mirror of
https://github.com/lwfinger/rtl8188eu.git
synced 2024-11-14 17:09:36 +00:00
rtl8188EUS: Initial addition of files in branch v5.2.2.4
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
parent
77471b4361
commit
6fa9ed423c
541 changed files with 393757 additions and 85553 deletions
2949
core/efuse/rtw_efuse.c
Normal file
2949
core/efuse/rtw_efuse.c
Normal file
File diff suppressed because it is too large
Load diff
3860
core/rtw_ap.c
3860
core/rtw_ap.c
File diff suppressed because it is too large
Load diff
3157
core/rtw_beamforming.c
Normal file
3157
core/rtw_beamforming.c
Normal file
File diff suppressed because it is too large
Load diff
1458
core/rtw_br_ext.c
1458
core/rtw_br_ext.c
File diff suppressed because it is too large
Load diff
1580
core/rtw_bt_mp.c
Normal file
1580
core/rtw_bt_mp.c
Normal file
File diff suppressed because it is too large
Load diff
1717
core/rtw_btcoex.c
Normal file
1717
core/rtw_btcoex.c
Normal file
File diff suppressed because it is too large
Load diff
42
core/rtw_btcoex_wifionly.c
Normal file
42
core/rtw_btcoex_wifionly.c
Normal file
|
@ -0,0 +1,42 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2013 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
#include <drv_types.h>
|
||||
#include <hal_btcoex_wifionly.h>
|
||||
#include <hal_data.h>
|
||||
|
||||
void rtw_btcoex_wifionly_switchband_notify(PADAPTER padapter)
|
||||
{
|
||||
hal_btcoex_wifionly_switchband_notify(padapter);
|
||||
}
|
||||
|
||||
void rtw_btcoex_wifionly_scan_notify(PADAPTER padapter)
|
||||
{
|
||||
hal_btcoex_wifionly_scan_notify(padapter);
|
||||
}
|
||||
|
||||
void rtw_btcoex_wifionly_hw_config(PADAPTER padapter)
|
||||
{
|
||||
hal_btcoex_wifionly_hw_config(padapter);
|
||||
}
|
||||
|
||||
void rtw_btcoex_wifionly_initialize(PADAPTER padapter)
|
||||
{
|
||||
hal_btcoex_wifionly_initlizevariables(padapter);
|
||||
}
|
4241
core/rtw_cmd.c
4241
core/rtw_cmd.c
File diff suppressed because it is too large
Load diff
5860
core/rtw_debug.c
5860
core/rtw_debug.c
File diff suppressed because it is too large
Load diff
374
core/rtw_eeprom.c
Normal file
374
core/rtw_eeprom.c
Normal file
|
@ -0,0 +1,374 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
#define _RTW_EEPROM_C_
|
||||
|
||||
#include <drv_conf.h>
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
|
||||
void up_clk(_adapter *padapter, u16 *x)
|
||||
{
|
||||
*x = *x | _EESK;
|
||||
rtw_write8(padapter, EE_9346CR, (u8)*x);
|
||||
rtw_udelay_os(CLOCK_RATE);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void down_clk(_adapter *padapter, u16 *x)
|
||||
{
|
||||
*x = *x & ~_EESK;
|
||||
rtw_write8(padapter, EE_9346CR, (u8)*x);
|
||||
rtw_udelay_os(CLOCK_RATE);
|
||||
}
|
||||
|
||||
void shift_out_bits(_adapter *padapter, u16 data, u16 count)
|
||||
{
|
||||
u16 x, mask;
|
||||
|
||||
if (rtw_is_surprise_removed(padapter)) {
|
||||
goto out;
|
||||
}
|
||||
mask = 0x01 << (count - 1);
|
||||
x = rtw_read8(padapter, EE_9346CR);
|
||||
|
||||
x &= ~(_EEDO | _EEDI);
|
||||
|
||||
do {
|
||||
x &= ~_EEDI;
|
||||
if (data & mask)
|
||||
x |= _EEDI;
|
||||
if (rtw_is_surprise_removed(padapter)) {
|
||||
goto out;
|
||||
}
|
||||
rtw_write8(padapter, EE_9346CR, (u8)x);
|
||||
rtw_udelay_os(CLOCK_RATE);
|
||||
up_clk(padapter, &x);
|
||||
down_clk(padapter, &x);
|
||||
mask = mask >> 1;
|
||||
} while (mask);
|
||||
if (rtw_is_surprise_removed(padapter)) {
|
||||
goto out;
|
||||
}
|
||||
x &= ~_EEDI;
|
||||
rtw_write8(padapter, EE_9346CR, (u8)x);
|
||||
out:
|
||||
return;
|
||||
}
|
||||
|
||||
u16 shift_in_bits(_adapter *padapter)
|
||||
{
|
||||
u16 x, d = 0, i;
|
||||
if (rtw_is_surprise_removed(padapter)) {
|
||||
goto out;
|
||||
}
|
||||
x = rtw_read8(padapter, EE_9346CR);
|
||||
|
||||
x &= ~(_EEDO | _EEDI);
|
||||
d = 0;
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
d = d << 1;
|
||||
up_clk(padapter, &x);
|
||||
if (rtw_is_surprise_removed(padapter)) {
|
||||
goto out;
|
||||
}
|
||||
x = rtw_read8(padapter, EE_9346CR);
|
||||
|
||||
x &= ~(_EEDI);
|
||||
if (x & _EEDO)
|
||||
d |= 1;
|
||||
|
||||
down_clk(padapter, &x);
|
||||
}
|
||||
out:
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
void standby(_adapter *padapter)
|
||||
{
|
||||
u8 x;
|
||||
x = rtw_read8(padapter, EE_9346CR);
|
||||
|
||||
x &= ~(_EECS | _EESK);
|
||||
rtw_write8(padapter, EE_9346CR, x);
|
||||
|
||||
rtw_udelay_os(CLOCK_RATE);
|
||||
x |= _EECS;
|
||||
rtw_write8(padapter, EE_9346CR, x);
|
||||
rtw_udelay_os(CLOCK_RATE);
|
||||
}
|
||||
|
||||
u16 wait_eeprom_cmd_done(_adapter *padapter)
|
||||
{
|
||||
u8 x;
|
||||
u16 i, res = _FALSE;
|
||||
standby(padapter);
|
||||
for (i = 0; i < 200; i++) {
|
||||
x = rtw_read8(padapter, EE_9346CR);
|
||||
if (x & _EEDO) {
|
||||
res = _TRUE;
|
||||
goto exit;
|
||||
}
|
||||
rtw_udelay_os(CLOCK_RATE);
|
||||
}
|
||||
exit:
|
||||
return res;
|
||||
}
|
||||
|
||||
void eeprom_clean(_adapter *padapter)
|
||||
{
|
||||
u16 x;
|
||||
if (rtw_is_surprise_removed(padapter)) {
|
||||
goto out;
|
||||
}
|
||||
x = rtw_read8(padapter, EE_9346CR);
|
||||
if (rtw_is_surprise_removed(padapter)) {
|
||||
goto out;
|
||||
}
|
||||
x &= ~(_EECS | _EEDI);
|
||||
rtw_write8(padapter, EE_9346CR, (u8)x);
|
||||
if (rtw_is_surprise_removed(padapter)) {
|
||||
goto out;
|
||||
}
|
||||
up_clk(padapter, &x);
|
||||
if (rtw_is_surprise_removed(padapter)) {
|
||||
goto out;
|
||||
}
|
||||
down_clk(padapter, &x);
|
||||
out:
|
||||
return;
|
||||
}
|
||||
|
||||
void eeprom_write16(_adapter *padapter, u16 reg, u16 data)
|
||||
{
|
||||
u8 x;
|
||||
#ifdef CONFIG_RTL8712
|
||||
u8 tmp8_ori, tmp8_new, tmp8_clk_ori, tmp8_clk_new;
|
||||
tmp8_ori = rtw_read8(padapter, 0x102502f1);
|
||||
tmp8_new = tmp8_ori & 0xf7;
|
||||
if (tmp8_ori != tmp8_new) {
|
||||
rtw_write8(padapter, 0x102502f1, tmp8_new);
|
||||
}
|
||||
tmp8_clk_ori = rtw_read8(padapter, 0x10250003);
|
||||
tmp8_clk_new = tmp8_clk_ori | 0x20;
|
||||
if (tmp8_clk_new != tmp8_clk_ori) {
|
||||
rtw_write8(padapter, 0x10250003, tmp8_clk_new);
|
||||
}
|
||||
#endif
|
||||
|
||||
x = rtw_read8(padapter, EE_9346CR);
|
||||
|
||||
x &= ~(_EEDI | _EEDO | _EESK | _EEM0);
|
||||
x |= _EEM1 | _EECS;
|
||||
rtw_write8(padapter, EE_9346CR, x);
|
||||
|
||||
shift_out_bits(padapter, EEPROM_EWEN_OPCODE, 5);
|
||||
|
||||
if (padapter->EepromAddressSize == 8) /* CF+ and SDIO */
|
||||
shift_out_bits(padapter, 0, 6);
|
||||
else /* USB */
|
||||
shift_out_bits(padapter, 0, 4);
|
||||
|
||||
standby(padapter);
|
||||
|
||||
/* Commented out by rcnjko, 2004.0
|
||||
* Erase this particular word. Write the erase opcode and register
|
||||
* number in that order. The opcode is 3bits in length; reg is 6 bits long. */
|
||||
/* shift_out_bits(Adapter, EEPROM_ERASE_OPCODE, 3);
|
||||
* shift_out_bits(Adapter, reg, Adapter->EepromAddressSize);
|
||||
*
|
||||
* if (wait_eeprom_cmd_done(Adapter ) == FALSE)
|
||||
* {
|
||||
* return;
|
||||
* } */
|
||||
|
||||
|
||||
standby(padapter);
|
||||
|
||||
/* write the new word to the EEPROM */
|
||||
|
||||
/* send the write opcode the EEPORM */
|
||||
shift_out_bits(padapter, EEPROM_WRITE_OPCODE, 3);
|
||||
|
||||
/* select which word in the EEPROM that we are writing to. */
|
||||
shift_out_bits(padapter, reg, padapter->EepromAddressSize);
|
||||
|
||||
/* write the data to the selected EEPROM word. */
|
||||
shift_out_bits(padapter, data, 16);
|
||||
|
||||
if (wait_eeprom_cmd_done(padapter) == _FALSE)
|
||||
|
||||
goto exit;
|
||||
|
||||
standby(padapter);
|
||||
|
||||
shift_out_bits(padapter, EEPROM_EWDS_OPCODE, 5);
|
||||
shift_out_bits(padapter, reg, 4);
|
||||
|
||||
eeprom_clean(padapter);
|
||||
exit:
|
||||
#ifdef CONFIG_RTL8712
|
||||
if (tmp8_clk_new != tmp8_clk_ori)
|
||||
rtw_write8(padapter, 0x10250003, tmp8_clk_ori);
|
||||
if (tmp8_new != tmp8_ori)
|
||||
rtw_write8(padapter, 0x102502f1, tmp8_ori);
|
||||
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
u16 eeprom_read16(_adapter *padapter, u16 reg) /* ReadEEprom */
|
||||
{
|
||||
|
||||
u16 x;
|
||||
u16 data = 0;
|
||||
#ifdef CONFIG_RTL8712
|
||||
u8 tmp8_ori, tmp8_new, tmp8_clk_ori, tmp8_clk_new;
|
||||
tmp8_ori = rtw_read8(padapter, 0x102502f1);
|
||||
tmp8_new = tmp8_ori & 0xf7;
|
||||
if (tmp8_ori != tmp8_new) {
|
||||
rtw_write8(padapter, 0x102502f1, tmp8_new);
|
||||
}
|
||||
tmp8_clk_ori = rtw_read8(padapter, 0x10250003);
|
||||
tmp8_clk_new = tmp8_clk_ori | 0x20;
|
||||
if (tmp8_clk_new != tmp8_clk_ori) {
|
||||
rtw_write8(padapter, 0x10250003, tmp8_clk_new);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (rtw_is_surprise_removed(padapter)) {
|
||||
goto out;
|
||||
}
|
||||
/* select EEPROM, reset bits, set _EECS */
|
||||
x = rtw_read8(padapter, EE_9346CR);
|
||||
|
||||
if (rtw_is_surprise_removed(padapter)) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
x &= ~(_EEDI | _EEDO | _EESK | _EEM0);
|
||||
x |= _EEM1 | _EECS;
|
||||
rtw_write8(padapter, EE_9346CR, (unsigned char)x);
|
||||
|
||||
/* write the read opcode and register number in that order */
|
||||
/* The opcode is 3bits in length, reg is 6 bits long */
|
||||
shift_out_bits(padapter, EEPROM_READ_OPCODE, 3);
|
||||
shift_out_bits(padapter, reg, padapter->EepromAddressSize);
|
||||
|
||||
/* Now read the data (16 bits) in from the selected EEPROM word */
|
||||
data = shift_in_bits(padapter);
|
||||
|
||||
eeprom_clean(padapter);
|
||||
out:
|
||||
#ifdef CONFIG_RTL8712
|
||||
if (tmp8_clk_new != tmp8_clk_ori)
|
||||
rtw_write8(padapter, 0x10250003, tmp8_clk_ori);
|
||||
if (tmp8_new != tmp8_ori)
|
||||
rtw_write8(padapter, 0x102502f1, tmp8_ori);
|
||||
|
||||
#endif
|
||||
return data;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* From even offset */
|
||||
void eeprom_read_sz(_adapter *padapter, u16 reg, u8 *data, u32 sz)
|
||||
{
|
||||
|
||||
u16 x, data16;
|
||||
u32 i;
|
||||
if (rtw_is_surprise_removed(padapter)) {
|
||||
goto out;
|
||||
}
|
||||
/* select EEPROM, reset bits, set _EECS */
|
||||
x = rtw_read8(padapter, EE_9346CR);
|
||||
|
||||
if (rtw_is_surprise_removed(padapter)) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
x &= ~(_EEDI | _EEDO | _EESK | _EEM0);
|
||||
x |= _EEM1 | _EECS;
|
||||
rtw_write8(padapter, EE_9346CR, (unsigned char)x);
|
||||
|
||||
/* write the read opcode and register number in that order */
|
||||
/* The opcode is 3bits in length, reg is 6 bits long */
|
||||
shift_out_bits(padapter, EEPROM_READ_OPCODE, 3);
|
||||
shift_out_bits(padapter, reg, padapter->EepromAddressSize);
|
||||
|
||||
|
||||
for (i = 0; i < sz; i += 2) {
|
||||
data16 = shift_in_bits(padapter);
|
||||
data[i] = data16 & 0xff;
|
||||
data[i + 1] = data16 >> 8;
|
||||
}
|
||||
|
||||
eeprom_clean(padapter);
|
||||
out:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* addr_off : address offset of the entry in eeprom (not the tuple number of eeprom (reg); that is addr_off !=reg) */
|
||||
u8 eeprom_read(_adapter *padapter, u32 addr_off, u8 sz, u8 *rbuf)
|
||||
{
|
||||
u8 quotient, remainder, addr_2align_odd;
|
||||
u16 reg, stmp , i = 0, idx = 0;
|
||||
reg = (u16)(addr_off >> 1);
|
||||
addr_2align_odd = (u8)(addr_off & 0x1);
|
||||
|
||||
if (addr_2align_odd) { /* read that start at high part: e.g 1,3,5,7,9,... */
|
||||
stmp = eeprom_read16(padapter, reg);
|
||||
rbuf[idx++] = (u8)((stmp >> 8) & 0xff); /* return hogh-part of the short */
|
||||
reg++;
|
||||
sz--;
|
||||
}
|
||||
|
||||
quotient = sz >> 1;
|
||||
remainder = sz & 0x1;
|
||||
|
||||
for (i = 0 ; i < quotient; i++) {
|
||||
stmp = eeprom_read16(padapter, reg + i);
|
||||
rbuf[idx++] = (u8)(stmp & 0xff);
|
||||
rbuf[idx++] = (u8)((stmp >> 8) & 0xff);
|
||||
}
|
||||
|
||||
reg = reg + i;
|
||||
if (remainder) { /* end of read at lower part of short : 0,2,4,6,... */
|
||||
stmp = eeprom_read16(padapter, reg);
|
||||
rbuf[idx] = (u8)(stmp & 0xff);
|
||||
}
|
||||
return _TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID read_eeprom_content(_adapter *padapter)
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
1196
core/rtw_efuse.c
1196
core/rtw_efuse.c
File diff suppressed because it is too large
Load diff
2159
core/rtw_ieee80211.c
2159
core/rtw_ieee80211.c
File diff suppressed because it is too large
Load diff
471
core/rtw_io.c
471
core/rtw_io.c
|
@ -27,10 +27,20 @@ b. provides the protocol engine
|
|||
|
||||
c. provides the software interface between caller and the hardware interface
|
||||
|
||||
|
||||
Compiler Flag Option:
|
||||
|
||||
1. CONFIG_SDIO_HCI:
|
||||
a. USE_SYNC_IRP: Only sync operations are provided.
|
||||
b. USE_ASYNC_IRP:Both sync/async operations are provided.
|
||||
|
||||
2. CONFIG_USB_HCI:
|
||||
a. USE_ASYNC_IRP: Both sync/async operations are provided.
|
||||
|
||||
3. CONFIG_CFIO_HCI:
|
||||
b. USE_SYNC_IRP: Only sync operations are provided.
|
||||
|
||||
|
||||
Only sync read/rtw_write_mem operations are provided.
|
||||
|
||||
jackson@realtek.com.tw
|
||||
|
@ -38,53 +48,70 @@ jackson@realtek.com.tw
|
|||
*/
|
||||
|
||||
#define _RTW_IO_C_
|
||||
#include <drv_conf.h>
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
#include <rtw_io.h>
|
||||
#include <osdep_intf.h>
|
||||
#include <usb_ops.h>
|
||||
|
||||
u8 _rtw_read8(struct adapter *adapter, u32 addr)
|
||||
#include <drv_types.h>
|
||||
#include <hal_data.h>
|
||||
|
||||
#if defined(PLATFORM_LINUX) && defined (PLATFORM_WINDOWS)
|
||||
#error "Shall be Linux or Windows, but not both!\n"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SDIO_HCI
|
||||
#define rtw_le16_to_cpu(val) val
|
||||
#define rtw_le32_to_cpu(val) val
|
||||
#define rtw_cpu_to_le16(val) val
|
||||
#define rtw_cpu_to_le32(val) val
|
||||
#else
|
||||
#define rtw_le16_to_cpu(val) le16_to_cpu(val)
|
||||
#define rtw_le32_to_cpu(val) le32_to_cpu(val)
|
||||
#define rtw_cpu_to_le16(val) cpu_to_le16(val)
|
||||
#define rtw_cpu_to_le32(val) cpu_to_le32(val)
|
||||
#endif
|
||||
|
||||
|
||||
u8 _rtw_read8(_adapter *adapter, u32 addr)
|
||||
{
|
||||
u8 r_val;
|
||||
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
|
||||
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
u8 (*_read8)(struct intf_hdl *pintfhdl, u32 addr);
|
||||
u8(*_read8)(struct intf_hdl *pintfhdl, u32 addr);
|
||||
_read8 = pintfhdl->io_ops._read8;
|
||||
|
||||
r_val = _read8(pintfhdl, addr);
|
||||
return r_val;
|
||||
}
|
||||
|
||||
u16 _rtw_read16(struct adapter *adapter, u32 addr)
|
||||
u16 _rtw_read16(_adapter *adapter, u32 addr)
|
||||
{
|
||||
u16 r_val;
|
||||
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
u16 (*_read16)(struct intf_hdl *pintfhdl, u32 addr);
|
||||
u16(*_read16)(struct intf_hdl *pintfhdl, u32 addr);
|
||||
_read16 = pintfhdl->io_ops._read16;
|
||||
|
||||
r_val = _read16(pintfhdl, addr);
|
||||
return r_val;
|
||||
return rtw_le16_to_cpu(r_val);
|
||||
}
|
||||
|
||||
u32 _rtw_read32(struct adapter *adapter, u32 addr)
|
||||
u32 _rtw_read32(_adapter *adapter, u32 addr)
|
||||
{
|
||||
u32 r_val;
|
||||
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
u32 (*_read32)(struct intf_hdl *pintfhdl, u32 addr);
|
||||
u32(*_read32)(struct intf_hdl *pintfhdl, u32 addr);
|
||||
_read32 = pintfhdl->io_ops._read32;
|
||||
|
||||
r_val = _read32(pintfhdl, addr);
|
||||
return r_val;
|
||||
return rtw_le32_to_cpu(r_val);
|
||||
|
||||
}
|
||||
|
||||
int _rtw_write8(struct adapter *adapter, u32 addr, u8 val)
|
||||
int _rtw_write8(_adapter *adapter, u32 addr, u8 val)
|
||||
{
|
||||
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
|
||||
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
int (*_write8)(struct intf_hdl *pintfhdl, u32 addr, u8 val);
|
||||
|
@ -95,39 +122,40 @@ int _rtw_write8(struct adapter *adapter, u32 addr, u8 val)
|
|||
|
||||
return RTW_STATUS_CODE(ret);
|
||||
}
|
||||
|
||||
int _rtw_write16(struct adapter *adapter, u32 addr, u16 val)
|
||||
int _rtw_write16(_adapter *adapter, u32 addr, u16 val)
|
||||
{
|
||||
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
int (*_write16)(struct intf_hdl *pintfhdl, u32 addr, u16 val);
|
||||
int ret;
|
||||
|
||||
_write16 = pintfhdl->io_ops._write16;
|
||||
|
||||
val = rtw_cpu_to_le16(val);
|
||||
ret = _write16(pintfhdl, addr, val);
|
||||
|
||||
return RTW_STATUS_CODE(ret);
|
||||
}
|
||||
int _rtw_write32(struct adapter *adapter, u32 addr, u32 val)
|
||||
int _rtw_write32(_adapter *adapter, u32 addr, u32 val)
|
||||
{
|
||||
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
|
||||
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
int (*_write32)(struct intf_hdl *pintfhdl, u32 addr, u32 val);
|
||||
int ret;
|
||||
_write32 = pintfhdl->io_ops._write32;
|
||||
|
||||
val = rtw_cpu_to_le32(val);
|
||||
ret = _write32(pintfhdl, addr, val);
|
||||
|
||||
return RTW_STATUS_CODE(ret);
|
||||
}
|
||||
|
||||
int _rtw_writeN(struct adapter *adapter, u32 addr , u32 length , u8 *pdata)
|
||||
int _rtw_writeN(_adapter *adapter, u32 addr , u32 length , u8 *pdata)
|
||||
{
|
||||
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
|
||||
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = (struct intf_hdl*)(&(pio_priv->intf));
|
||||
struct intf_hdl *pintfhdl = (struct intf_hdl *)(&(pio_priv->intf));
|
||||
int (*_writeN)(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata);
|
||||
int ret;
|
||||
_writeN = pintfhdl->io_ops._writeN;
|
||||
|
@ -137,8 +165,133 @@ int _rtw_writeN(struct adapter *adapter, u32 addr , u32 length , u8 *pdata)
|
|||
return RTW_STATUS_CODE(ret);
|
||||
}
|
||||
|
||||
int _rtw_write8_async(struct adapter *adapter, u32 addr, u8 val)
|
||||
#ifdef CONFIG_SDIO_HCI
|
||||
u8 _rtw_sd_f0_read8(_adapter *adapter, u32 addr)
|
||||
{
|
||||
u8 r_val = 0x00;
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
u8(*_sd_f0_read8)(struct intf_hdl *pintfhdl, u32 addr);
|
||||
|
||||
_sd_f0_read8 = pintfhdl->io_ops._sd_f0_read8;
|
||||
|
||||
if (_sd_f0_read8)
|
||||
r_val = _sd_f0_read8(pintfhdl, addr);
|
||||
else
|
||||
RTW_WARN(FUNC_ADPT_FMT" _sd_f0_read8 callback is NULL\n", FUNC_ADPT_ARG(adapter));
|
||||
|
||||
return r_val;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SDIO_INDIRECT_ACCESS
|
||||
u8 _rtw_sd_iread8(_adapter *adapter, u32 addr)
|
||||
{
|
||||
u8 r_val = 0x00;
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
u8(*_sd_iread8)(struct intf_hdl *pintfhdl, u32 addr);
|
||||
|
||||
_sd_iread8 = pintfhdl->io_ops._sd_iread8;
|
||||
|
||||
if (_sd_iread8)
|
||||
r_val = _sd_iread8(pintfhdl, addr);
|
||||
else
|
||||
RTW_ERR(FUNC_ADPT_FMT" _sd_iread8 callback is NULL\n", FUNC_ADPT_ARG(adapter));
|
||||
|
||||
return r_val;
|
||||
}
|
||||
|
||||
u16 _rtw_sd_iread16(_adapter *adapter, u32 addr)
|
||||
{
|
||||
u16 r_val = 0x00;
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
u16(*_sd_iread16)(struct intf_hdl *pintfhdl, u32 addr);
|
||||
|
||||
_sd_iread16 = pintfhdl->io_ops._sd_iread16;
|
||||
|
||||
if (_sd_iread16)
|
||||
r_val = _sd_iread16(pintfhdl, addr);
|
||||
else
|
||||
RTW_ERR(FUNC_ADPT_FMT" _sd_iread16 callback is NULL\n", FUNC_ADPT_ARG(adapter));
|
||||
|
||||
return r_val;
|
||||
}
|
||||
|
||||
u32 _rtw_sd_iread32(_adapter *adapter, u32 addr)
|
||||
{
|
||||
u32 r_val = 0x00;
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
u32(*_sd_iread32)(struct intf_hdl *pintfhdl, u32 addr);
|
||||
|
||||
_sd_iread32 = pintfhdl->io_ops._sd_iread32;
|
||||
|
||||
if (_sd_iread32)
|
||||
r_val = _sd_iread32(pintfhdl, addr);
|
||||
else
|
||||
RTW_ERR(FUNC_ADPT_FMT" _sd_iread32 callback is NULL\n", FUNC_ADPT_ARG(adapter));
|
||||
|
||||
return r_val;
|
||||
}
|
||||
|
||||
int _rtw_sd_iwrite8(_adapter *adapter, u32 addr, u8 val)
|
||||
{
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
int (*_sd_iwrite8)(struct intf_hdl *pintfhdl, u32 addr, u8 val);
|
||||
int ret = -1;
|
||||
|
||||
_sd_iwrite8 = pintfhdl->io_ops._sd_iwrite8;
|
||||
|
||||
if (_sd_iwrite8)
|
||||
ret = _sd_iwrite8(pintfhdl, addr, val);
|
||||
else
|
||||
RTW_ERR(FUNC_ADPT_FMT" _sd_iwrite8 callback is NULL\n", FUNC_ADPT_ARG(adapter));
|
||||
|
||||
return RTW_STATUS_CODE(ret);
|
||||
}
|
||||
|
||||
int _rtw_sd_iwrite16(_adapter *adapter, u32 addr, u16 val)
|
||||
{
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
int (*_sd_iwrite16)(struct intf_hdl *pintfhdl, u32 addr, u16 val);
|
||||
int ret = -1;
|
||||
|
||||
_sd_iwrite16 = pintfhdl->io_ops._sd_iwrite16;
|
||||
|
||||
if (_sd_iwrite16)
|
||||
ret = _sd_iwrite16(pintfhdl, addr, val);
|
||||
else
|
||||
RTW_ERR(FUNC_ADPT_FMT" _sd_iwrite16 callback is NULL\n", FUNC_ADPT_ARG(adapter));
|
||||
|
||||
return RTW_STATUS_CODE(ret);
|
||||
}
|
||||
int _rtw_sd_iwrite32(_adapter *adapter, u32 addr, u32 val)
|
||||
{
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
int (*_sd_iwrite32)(struct intf_hdl *pintfhdl, u32 addr, u32 val);
|
||||
int ret = -1;
|
||||
|
||||
_sd_iwrite32 = pintfhdl->io_ops._sd_iwrite32;
|
||||
|
||||
if (_sd_iwrite32)
|
||||
ret = _sd_iwrite32(pintfhdl, addr, val);
|
||||
else
|
||||
RTW_ERR(FUNC_ADPT_FMT" _sd_iwrite32 callback is NULL\n", FUNC_ADPT_ARG(adapter));
|
||||
|
||||
return RTW_STATUS_CODE(ret);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SDIO_INDIRECT_ACCESS */
|
||||
|
||||
#endif /* CONFIG_SDIO_HCI */
|
||||
|
||||
int _rtw_write8_async(_adapter *adapter, u32 addr, u8 val)
|
||||
{
|
||||
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
int (*_write8_async)(struct intf_hdl *pintfhdl, u32 addr, u8 val);
|
||||
|
@ -149,81 +302,87 @@ int _rtw_write8_async(struct adapter *adapter, u32 addr, u8 val)
|
|||
|
||||
return RTW_STATUS_CODE(ret);
|
||||
}
|
||||
|
||||
int _rtw_write16_async(struct adapter *adapter, u32 addr, u16 val)
|
||||
int _rtw_write16_async(_adapter *adapter, u32 addr, u16 val)
|
||||
{
|
||||
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
int (*_write16_async)(struct intf_hdl *pintfhdl, u32 addr, u16 val);
|
||||
int ret;
|
||||
|
||||
_write16_async = pintfhdl->io_ops._write16_async;
|
||||
val = rtw_cpu_to_le16(val);
|
||||
ret = _write16_async(pintfhdl, addr, val);
|
||||
|
||||
return RTW_STATUS_CODE(ret);
|
||||
}
|
||||
|
||||
int _rtw_write32_async(struct adapter *adapter, u32 addr, u32 val)
|
||||
int _rtw_write32_async(_adapter *adapter, u32 addr, u32 val)
|
||||
{
|
||||
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
int (*_write32_async)(struct intf_hdl *pintfhdl, u32 addr, u32 val);
|
||||
int ret;
|
||||
|
||||
_write32_async = pintfhdl->io_ops._write32_async;
|
||||
val = rtw_cpu_to_le32(val);
|
||||
ret = _write32_async(pintfhdl, addr, val);
|
||||
|
||||
return RTW_STATUS_CODE(ret);
|
||||
}
|
||||
|
||||
void _rtw_read_mem(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
|
||||
void _rtw_read_mem(_adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
|
||||
{
|
||||
void (*_read_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
|
||||
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
|
||||
if (adapter->bDriverStopped || adapter->bSurpriseRemoved) {
|
||||
RT_TRACE(_module_rtl871x_io_c_, _drv_info_,
|
||||
("rtw_read_mem:bDriverStopped(%d) OR bSurpriseRemoved(%d)",
|
||||
adapter->bDriverStopped, adapter->bSurpriseRemoved));
|
||||
|
||||
if (RTW_CANNOT_RUN(adapter)) {
|
||||
return;
|
||||
}
|
||||
|
||||
_read_mem = pintfhdl->io_ops._read_mem;
|
||||
|
||||
_read_mem(pintfhdl, addr, cnt, pmem);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void _rtw_write_mem(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
|
||||
void _rtw_write_mem(_adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
|
||||
{
|
||||
void (*_write_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
|
||||
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
|
||||
|
||||
_write_mem = pintfhdl->io_ops._write_mem;
|
||||
|
||||
_write_mem(pintfhdl, addr, cnt, pmem);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void _rtw_read_port(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
|
||||
void _rtw_read_port(_adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
|
||||
{
|
||||
u32 (*_read_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
|
||||
u32(*_read_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
|
||||
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
|
||||
if ( (adapter->bDriverStopped) || (adapter->bSurpriseRemoved)) {
|
||||
RT_TRACE(_module_rtl871x_io_c_, _drv_info_,
|
||||
("rtw_read_port:bDriverStopped(%d) OR bSurpriseRemoved(%d)",
|
||||
adapter->bDriverStopped, adapter->bSurpriseRemoved));
|
||||
|
||||
if (RTW_CANNOT_RUN(adapter)) {
|
||||
return;
|
||||
}
|
||||
|
||||
_read_port = pintfhdl->io_ops._read_port;
|
||||
|
||||
_read_port(pintfhdl, addr, cnt, pmem);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void _rtw_read_port_cancel(struct adapter *adapter)
|
||||
void _rtw_read_port_cancel(_adapter *adapter)
|
||||
{
|
||||
void (*_read_port_cancel)(struct intf_hdl *pintfhdl);
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
|
@ -231,23 +390,30 @@ void _rtw_read_port_cancel(struct adapter *adapter)
|
|||
|
||||
_read_port_cancel = pintfhdl->io_ops._read_port_cancel;
|
||||
|
||||
RTW_DISABLE_FUNC(adapter, DF_RX_BIT);
|
||||
|
||||
if (_read_port_cancel)
|
||||
_read_port_cancel(pintfhdl);
|
||||
|
||||
}
|
||||
|
||||
u32 _rtw_write_port(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
|
||||
u32 _rtw_write_port(_adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
|
||||
{
|
||||
u32 (*_write_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
|
||||
u32(*_write_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
|
||||
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
u32 ret = _SUCCESS;
|
||||
|
||||
|
||||
_write_port = pintfhdl->io_ops._write_port;
|
||||
|
||||
return _write_port(pintfhdl, addr, cnt, pmem);
|
||||
ret = _write_port(pintfhdl, addr, cnt, pmem);
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
u32 _rtw_write_port_and_wait(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem, int timeout_ms)
|
||||
u32 _rtw_write_port_and_wait(_adapter *adapter, u32 addr, u32 cnt, u8 *pmem, int timeout_ms)
|
||||
{
|
||||
int ret = _SUCCESS;
|
||||
struct xmit_buf *pxmitbuf = (struct xmit_buf *)pmem;
|
||||
|
@ -259,11 +425,12 @@ u32 _rtw_write_port_and_wait(struct adapter *adapter, u32 addr, u32 cnt, u8 *pme
|
|||
ret = _rtw_write_port(adapter, addr, cnt, pmem);
|
||||
|
||||
if (ret == _SUCCESS)
|
||||
ret = rtw_sctx_wait(&sctx);
|
||||
ret = rtw_sctx_wait(&sctx, __func__);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void _rtw_write_port_cancel(struct adapter *adapter)
|
||||
void _rtw_write_port_cancel(_adapter *adapter)
|
||||
{
|
||||
void (*_write_port_cancel)(struct intf_hdl *pintfhdl);
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
|
@ -271,12 +438,12 @@ void _rtw_write_port_cancel(struct adapter *adapter)
|
|||
|
||||
_write_port_cancel = pintfhdl->io_ops._write_port_cancel;
|
||||
|
||||
RTW_DISABLE_FUNC(adapter, DF_TX_BIT);
|
||||
|
||||
if (_write_port_cancel)
|
||||
_write_port_cancel(pintfhdl);
|
||||
|
||||
}
|
||||
|
||||
int rtw_init_io_priv(struct adapter *padapter, void (*set_intf_ops)(struct _io_ops *pops))
|
||||
int rtw_init_io_priv(_adapter *padapter, void (*set_intf_ops)(_adapter *padapter, struct _io_ops *pops))
|
||||
{
|
||||
struct io_priv *piopriv = &padapter->iopriv;
|
||||
struct intf_hdl *pintf = &piopriv->intf;
|
||||
|
@ -288,25 +455,27 @@ int rtw_init_io_priv(struct adapter *padapter, void (*set_intf_ops)(struct _io_o
|
|||
pintf->padapter = padapter;
|
||||
pintf->pintf_dev = adapter_to_dvobj(padapter);
|
||||
|
||||
set_intf_ops(&pintf->io_ops);
|
||||
set_intf_ops(padapter, &pintf->io_ops);
|
||||
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Increase and check if the continual_io_error of this @param dvobjprive is larger than MAX_CONTINUAL_IO_ERR
|
||||
* @return true:
|
||||
* @return false:
|
||||
* @return _TRUE:
|
||||
* @return _FALSE:
|
||||
*/
|
||||
int rtw_inc_and_chk_continual_io_error(struct dvobj_priv *dvobj)
|
||||
{
|
||||
int ret = false;
|
||||
int ret = _FALSE;
|
||||
int value;
|
||||
if ( (value =ATOMIC_INC_RETURN(&dvobj->continual_io_error)) > MAX_CONTINUAL_IO_ERR) {
|
||||
DBG_88E("[dvobj:%p][ERROR] continual_io_error:%d > %d\n", dvobj, value, MAX_CONTINUAL_IO_ERR);
|
||||
ret = true;
|
||||
|
||||
value = ATOMIC_INC_RETURN(&dvobj->continual_io_error);
|
||||
if (value > MAX_CONTINUAL_IO_ERR) {
|
||||
RTW_INFO("[dvobj:%p][ERROR] continual_io_error:%d > %d\n", dvobj, value, MAX_CONTINUAL_IO_ERR);
|
||||
ret = _TRUE;
|
||||
} else {
|
||||
/* DBG_88E("[dvobj:%p] continual_io_error:%d\n", dvobj, value); */
|
||||
/* RTW_INFO("[dvobj:%p] continual_io_error:%d\n", dvobj, value); */
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -321,96 +490,212 @@ void rtw_reset_continual_io_error(struct dvobj_priv *dvobj)
|
|||
|
||||
#ifdef DBG_IO
|
||||
|
||||
u16 read_sniff_ranges[][2] = {
|
||||
/* 0x550, 0x551}, */
|
||||
u32 read_sniff_ranges[][2] = {
|
||||
/* {0x520, 0x523}, */
|
||||
};
|
||||
|
||||
u16 write_sniff_ranges[][2] = {
|
||||
/* 0x550, 0x551}, */
|
||||
/* 0x4c, 0x4c}, */
|
||||
u32 write_sniff_ranges[][2] = {
|
||||
/* {0x520, 0x523}, */
|
||||
/* {0x4c, 0x4c}, */
|
||||
};
|
||||
|
||||
int read_sniff_num = sizeof(read_sniff_ranges)/sizeof(u16)/2;
|
||||
int write_sniff_num = sizeof(write_sniff_ranges)/sizeof(u16)/2;
|
||||
int read_sniff_num = sizeof(read_sniff_ranges) / sizeof(u32) / 2;
|
||||
int write_sniff_num = sizeof(write_sniff_ranges) / sizeof(u32) / 2;
|
||||
|
||||
bool match_read_sniff_ranges(u16 addr, u16 len)
|
||||
bool match_read_sniff_ranges(u32 addr, u16 len)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i<read_sniff_num; i++) {
|
||||
for (i = 0; i < read_sniff_num; i++) {
|
||||
if (addr + len > read_sniff_ranges[i][0] && addr <= read_sniff_ranges[i][1])
|
||||
return true;
|
||||
return _TRUE;
|
||||
}
|
||||
|
||||
return false;
|
||||
return _FALSE;
|
||||
}
|
||||
|
||||
bool match_write_sniff_ranges(u16 addr, u16 len)
|
||||
bool match_write_sniff_ranges(u32 addr, u16 len)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i<write_sniff_num; i++) {
|
||||
for (i = 0; i < write_sniff_num; i++) {
|
||||
if (addr + len > write_sniff_ranges[i][0] && addr <= write_sniff_ranges[i][1])
|
||||
return true;
|
||||
return _TRUE;
|
||||
}
|
||||
|
||||
return false;
|
||||
return _FALSE;
|
||||
}
|
||||
|
||||
u8 dbg_rtw_read8(struct adapter *adapter, u32 addr, const char *caller, const int line)
|
||||
struct rf_sniff_ent {
|
||||
u8 path;
|
||||
u16 reg;
|
||||
u32 mask;
|
||||
};
|
||||
|
||||
struct rf_sniff_ent rf_read_sniff_ranges[] = {
|
||||
/* example for all path addr 0x55 with all RF Reg mask */
|
||||
/* {MAX_RF_PATH, 0x55, bRFRegOffsetMask}, */
|
||||
};
|
||||
|
||||
struct rf_sniff_ent rf_write_sniff_ranges[] = {
|
||||
/* example for all path addr 0x55 with all RF Reg mask */
|
||||
/* {MAX_RF_PATH, 0x55, bRFRegOffsetMask}, */
|
||||
};
|
||||
|
||||
int rf_read_sniff_num = sizeof(rf_read_sniff_ranges) / sizeof(struct rf_sniff_ent);
|
||||
int rf_write_sniff_num = sizeof(rf_write_sniff_ranges) / sizeof(struct rf_sniff_ent);
|
||||
|
||||
bool match_rf_read_sniff_ranges(u8 path, u32 addr, u32 mask)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < rf_read_sniff_num; i++) {
|
||||
if (rf_read_sniff_ranges[i].path == MAX_RF_PATH || rf_read_sniff_ranges[i].path == path)
|
||||
if (addr == rf_read_sniff_ranges[i].reg && (mask & rf_read_sniff_ranges[i].mask))
|
||||
return _TRUE;
|
||||
}
|
||||
|
||||
return _FALSE;
|
||||
}
|
||||
|
||||
bool match_rf_write_sniff_ranges(u8 path, u32 addr, u32 mask)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < rf_write_sniff_num; i++) {
|
||||
if (rf_write_sniff_ranges[i].path == MAX_RF_PATH || rf_write_sniff_ranges[i].path == path)
|
||||
if (addr == rf_write_sniff_ranges[i].reg && (mask & rf_write_sniff_ranges[i].mask))
|
||||
return _TRUE;
|
||||
}
|
||||
|
||||
return _FALSE;
|
||||
}
|
||||
|
||||
u8 dbg_rtw_read8(_adapter *adapter, u32 addr, const char *caller, const int line)
|
||||
{
|
||||
u8 val = _rtw_read8(adapter, addr);
|
||||
|
||||
if (match_read_sniff_ranges(addr, 1))
|
||||
DBG_88E("DBG_IO %s:%d rtw_read8(0x%04x) return 0x%02x\n", caller, line, addr, val);
|
||||
RTW_INFO("DBG_IO %s:%d rtw_read8(0x%04x) return 0x%02x\n", caller, line, addr, val);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
u16 dbg_rtw_read16(struct adapter *adapter, u32 addr, const char *caller, const int line)
|
||||
u16 dbg_rtw_read16(_adapter *adapter, u32 addr, const char *caller, const int line)
|
||||
{
|
||||
u16 val = _rtw_read16(adapter, addr);
|
||||
|
||||
if (match_read_sniff_ranges(addr, 2))
|
||||
DBG_88E("DBG_IO %s:%d rtw_read16(0x%04x) return 0x%04x\n", caller, line, addr, val);
|
||||
RTW_INFO("DBG_IO %s:%d rtw_read16(0x%04x) return 0x%04x\n", caller, line, addr, val);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
u32 dbg_rtw_read32(struct adapter *adapter, u32 addr, const char *caller, const int line)
|
||||
u32 dbg_rtw_read32(_adapter *adapter, u32 addr, const char *caller, const int line)
|
||||
{
|
||||
u32 val = _rtw_read32(adapter, addr);
|
||||
|
||||
if (match_read_sniff_ranges(addr, 4))
|
||||
DBG_88E("DBG_IO %s:%d rtw_read32(0x%04x) return 0x%08x\n", caller, line, addr, val);
|
||||
RTW_INFO("DBG_IO %s:%d rtw_read32(0x%04x) return 0x%08x\n", caller, line, addr, val);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
int dbg_rtw_write8(struct adapter *adapter, u32 addr, u8 val, const char *caller, const int line)
|
||||
int dbg_rtw_write8(_adapter *adapter, u32 addr, u8 val, const char *caller, const int line)
|
||||
{
|
||||
if (match_write_sniff_ranges(addr, 1))
|
||||
DBG_88E("DBG_IO %s:%d rtw_write8(0x%04x, 0x%02x)\n", caller, line, addr, val);
|
||||
RTW_INFO("DBG_IO %s:%d rtw_write8(0x%04x, 0x%02x)\n", caller, line, addr, val);
|
||||
|
||||
return _rtw_write8(adapter, addr, val);
|
||||
}
|
||||
int dbg_rtw_write16(struct adapter *adapter, u32 addr, u16 val, const char *caller, const int line)
|
||||
int dbg_rtw_write16(_adapter *adapter, u32 addr, u16 val, const char *caller, const int line)
|
||||
{
|
||||
if (match_write_sniff_ranges(addr, 2))
|
||||
DBG_88E("DBG_IO %s:%d rtw_write16(0x%04x, 0x%04x)\n", caller, line, addr, val);
|
||||
RTW_INFO("DBG_IO %s:%d rtw_write16(0x%04x, 0x%04x)\n", caller, line, addr, val);
|
||||
|
||||
return _rtw_write16(adapter, addr, val);
|
||||
}
|
||||
int dbg_rtw_write32(struct adapter *adapter, u32 addr, u32 val, const char *caller, const int line)
|
||||
int dbg_rtw_write32(_adapter *adapter, u32 addr, u32 val, const char *caller, const int line)
|
||||
{
|
||||
if (match_write_sniff_ranges(addr, 4))
|
||||
DBG_88E("DBG_IO %s:%d rtw_write32(0x%04x, 0x%08x)\n", caller, line, addr, val);
|
||||
RTW_INFO("DBG_IO %s:%d rtw_write32(0x%04x, 0x%08x)\n", caller, line, addr, val);
|
||||
|
||||
return _rtw_write32(adapter, addr, val);
|
||||
}
|
||||
int dbg_rtw_writeN(struct adapter *adapter, u32 addr , u32 length , u8 *data, const char *caller, const int line)
|
||||
int dbg_rtw_writeN(_adapter *adapter, u32 addr , u32 length , u8 *data, const char *caller, const int line)
|
||||
{
|
||||
if (match_write_sniff_ranges(addr, length))
|
||||
DBG_88E("DBG_IO %s:%d rtw_writeN(0x%04x, %u)\n", caller, line, addr, length);
|
||||
RTW_INFO("DBG_IO %s:%d rtw_writeN(0x%04x, %u)\n", caller, line, addr, length);
|
||||
|
||||
return _rtw_writeN(adapter, addr, length, data);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SDIO_HCI
|
||||
u8 dbg_rtw_sd_f0_read8(_adapter *adapter, u32 addr, const char *caller, const int line)
|
||||
{
|
||||
u8 val = _rtw_sd_f0_read8(adapter, addr);
|
||||
|
||||
#if 0
|
||||
if (match_read_sniff_ranges(addr, 1))
|
||||
RTW_INFO("DBG_IO %s:%d rtw_sd_f0_read8(0x%04x) return 0x%02x\n", caller, line, addr, val);
|
||||
#endif
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SDIO_INDIRECT_ACCESS
|
||||
u8 dbg_rtw_sd_iread8(_adapter *adapter, u32 addr, const char *caller, const int line)
|
||||
{
|
||||
u8 val = rtw_sd_iread8(adapter, addr);
|
||||
|
||||
if (match_read_sniff_ranges(addr, 1))
|
||||
RTW_INFO("DBG_IO %s:%d rtw_sd_iread8(0x%04x) return 0x%02x\n", caller, line, addr, val);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
u16 dbg_rtw_sd_iread16(_adapter *adapter, u32 addr, const char *caller, const int line)
|
||||
{
|
||||
u16 val = _rtw_sd_iread16(adapter, addr);
|
||||
|
||||
if (match_read_sniff_ranges(addr, 2))
|
||||
RTW_INFO("DBG_IO %s:%d rtw_sd_iread16(0x%04x) return 0x%04x\n", caller, line, addr, val);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
u32 dbg_rtw_sd_iread32(_adapter *adapter, u32 addr, const char *caller, const int line)
|
||||
{
|
||||
u32 val = _rtw_sd_iread32(adapter, addr);
|
||||
|
||||
if (match_read_sniff_ranges(addr, 4))
|
||||
RTW_INFO("DBG_IO %s:%d rtw_sd_iread32(0x%04x) return 0x%08x\n", caller, line, addr, val);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
int dbg_rtw_sd_iwrite8(_adapter *adapter, u32 addr, u8 val, const char *caller, const int line)
|
||||
{
|
||||
if (match_write_sniff_ranges(addr, 1))
|
||||
RTW_INFO("DBG_IO %s:%d rtw_sd_iwrite8(0x%04x, 0x%02x)\n", caller, line, addr, val);
|
||||
|
||||
return _rtw_sd_iwrite8(adapter, addr, val);
|
||||
}
|
||||
int dbg_rtw_sd_iwrite16(_adapter *adapter, u32 addr, u16 val, const char *caller, const int line)
|
||||
{
|
||||
if (match_write_sniff_ranges(addr, 2))
|
||||
RTW_INFO("DBG_IO %s:%d rtw_sd_iwrite16(0x%04x, 0x%04x)\n", caller, line, addr, val);
|
||||
|
||||
return _rtw_sd_iwrite16(adapter, addr, val);
|
||||
}
|
||||
int dbg_rtw_sd_iwrite32(_adapter *adapter, u32 addr, u32 val, const char *caller, const int line)
|
||||
{
|
||||
if (match_write_sniff_ranges(addr, 4))
|
||||
RTW_INFO("DBG_IO %s:%d rtw_sd_iwrite32(0x%04x, 0x%08x)\n", caller, line, addr, val);
|
||||
|
||||
return _rtw_sd_iwrite32(adapter, addr, val);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SDIO_INDIRECT_ACCESS */
|
||||
|
||||
#endif /* CONFIG_SDIO_HCI */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -19,8 +19,153 @@
|
|||
******************************************************************************/
|
||||
#define _RTW_IOCTL_QUERY_C_
|
||||
|
||||
#include <drv_conf.h>
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
#include <rtw_ioctl_query.h>
|
||||
#include <wifi.h>
|
||||
|
||||
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
/*
|
||||
* Added for WPA2-PSK, by Annie, 2005-09-20.
|
||||
* */
|
||||
u8
|
||||
query_802_11_capability(
|
||||
_adapter *Adapter,
|
||||
u8 *pucBuf,
|
||||
u32 *pulOutLen
|
||||
)
|
||||
{
|
||||
static NDIS_802_11_AUTHENTICATION_ENCRYPTION szAuthEnc[] = {
|
||||
{Ndis802_11AuthModeOpen, Ndis802_11EncryptionDisabled},
|
||||
{Ndis802_11AuthModeOpen, Ndis802_11Encryption1Enabled},
|
||||
{Ndis802_11AuthModeShared, Ndis802_11EncryptionDisabled},
|
||||
{Ndis802_11AuthModeShared, Ndis802_11Encryption1Enabled},
|
||||
{Ndis802_11AuthModeWPA, Ndis802_11Encryption2Enabled},
|
||||
{Ndis802_11AuthModeWPA, Ndis802_11Encryption3Enabled},
|
||||
{Ndis802_11AuthModeWPAPSK, Ndis802_11Encryption2Enabled},
|
||||
{Ndis802_11AuthModeWPAPSK, Ndis802_11Encryption3Enabled},
|
||||
{Ndis802_11AuthModeWPANone, Ndis802_11Encryption2Enabled},
|
||||
{Ndis802_11AuthModeWPANone, Ndis802_11Encryption3Enabled},
|
||||
{Ndis802_11AuthModeWPA2, Ndis802_11Encryption2Enabled},
|
||||
{Ndis802_11AuthModeWPA2, Ndis802_11Encryption3Enabled},
|
||||
{Ndis802_11AuthModeWPA2PSK, Ndis802_11Encryption2Enabled},
|
||||
{Ndis802_11AuthModeWPA2PSK, Ndis802_11Encryption3Enabled}
|
||||
};
|
||||
static ULONG ulNumOfPairSupported = sizeof(szAuthEnc) / sizeof(NDIS_802_11_AUTHENTICATION_ENCRYPTION);
|
||||
NDIS_802_11_CAPABILITY *pCap = (NDIS_802_11_CAPABILITY *)pucBuf;
|
||||
u8 *pucAuthEncryptionSupported = (u8 *) pCap->AuthenticationEncryptionSupported;
|
||||
|
||||
|
||||
pCap->Length = sizeof(NDIS_802_11_CAPABILITY);
|
||||
if (ulNumOfPairSupported > 1)
|
||||
pCap->Length += (ulNumOfPairSupported - 1) * sizeof(NDIS_802_11_AUTHENTICATION_ENCRYPTION);
|
||||
|
||||
pCap->Version = 2;
|
||||
pCap->NoOfPMKIDs = NUM_PMKID_CACHE;
|
||||
pCap->NoOfAuthEncryptPairsSupported = ulNumOfPairSupported;
|
||||
|
||||
if (sizeof(szAuthEnc) <= 240) /* 240 = 256 - 4*4 */ { /* SecurityInfo.szCapability: only 256 bytes in size. */
|
||||
_rtw_memcpy(pucAuthEncryptionSupported, (u8 *)szAuthEnc, sizeof(szAuthEnc));
|
||||
*pulOutLen = pCap->Length;
|
||||
return _TRUE;
|
||||
} else {
|
||||
*pulOutLen = 0;
|
||||
return _FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
u8 query_802_11_association_information(_adapter *padapter, PNDIS_802_11_ASSOCIATION_INFORMATION pAssocInfo)
|
||||
{
|
||||
struct wlan_network *tgt_network;
|
||||
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
|
||||
struct security_priv *psecuritypriv = &(padapter->securitypriv);
|
||||
WLAN_BSSID_EX *psecnetwork = (WLAN_BSSID_EX *)&pmlmepriv->cur_network.network;
|
||||
u8 *pDest = (u8 *)pAssocInfo + sizeof(NDIS_802_11_ASSOCIATION_INFORMATION);
|
||||
unsigned char i, *auth_ie, *supp_ie;
|
||||
|
||||
/* NdisZeroMemory(pAssocInfo, sizeof(NDIS_802_11_ASSOCIATION_INFORMATION)); */
|
||||
_rtw_memset(pAssocInfo, 0, sizeof(NDIS_802_11_ASSOCIATION_INFORMATION));
|
||||
/* pAssocInfo->Length = sizeof(NDIS_802_11_ASSOCIATION_INFORMATION); */
|
||||
|
||||
/* ------------------------------------------------------ */
|
||||
/* Association Request related information */
|
||||
/* ------------------------------------------------------ */
|
||||
/* Req_1. AvailableRequestFixedIEs */
|
||||
if (psecnetwork != NULL) {
|
||||
|
||||
pAssocInfo->AvailableRequestFixedIEs |= NDIS_802_11_AI_REQFI_CAPABILITIES | NDIS_802_11_AI_REQFI_CURRENTAPADDRESS;
|
||||
pAssocInfo->RequestFixedIEs.Capabilities = (unsigned short) *&psecnetwork->IEs[10];
|
||||
_rtw_memcpy(pAssocInfo->RequestFixedIEs.CurrentAPAddress,
|
||||
&psecnetwork->MacAddress, 6);
|
||||
|
||||
pAssocInfo->OffsetRequestIEs = sizeof(NDIS_802_11_ASSOCIATION_INFORMATION);
|
||||
|
||||
if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING | _FW_LINKED) == _TRUE) {
|
||||
|
||||
if (psecuritypriv->ndisauthtype >= Ndis802_11AuthModeWPA2)
|
||||
pDest[0] = 48; /* RSN Information Element */
|
||||
else
|
||||
pDest[0] = 221; /* WPA(SSN) Information Element */
|
||||
|
||||
supp_ie = &psecuritypriv->supplicant_ie[0];
|
||||
|
||||
i = 13; /* 0~11 is fixed information element */
|
||||
while ((i < supp_ie[0]) && (i < 256)) {
|
||||
if ((unsigned char)supp_ie[i] == pDest[0]) {
|
||||
_rtw_memcpy((u8 *)(pDest),
|
||||
&supp_ie[i],
|
||||
supp_ie[1 + i] + 2);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
i = i + supp_ie[i + 1] + 2;
|
||||
if (supp_ie[1 + i] == 0)
|
||||
i = i + 1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
pAssocInfo->RequestIELength += (2 + supp_ie[1 + i]); /* (2 + psecnetwork->IEs[1+i]+4); */
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------ */
|
||||
/* Association Response related information */
|
||||
/* ------------------------------------------------------ */
|
||||
|
||||
if (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) {
|
||||
tgt_network = &(pmlmepriv->cur_network);
|
||||
if (tgt_network != NULL) {
|
||||
pAssocInfo->AvailableResponseFixedIEs =
|
||||
NDIS_802_11_AI_RESFI_CAPABILITIES
|
||||
| NDIS_802_11_AI_RESFI_ASSOCIATIONID
|
||||
;
|
||||
|
||||
pAssocInfo->ResponseFixedIEs.Capabilities = (unsigned short) *&tgt_network->network.IEs[10];
|
||||
pAssocInfo->ResponseFixedIEs.StatusCode = 0;
|
||||
pAssocInfo->ResponseFixedIEs.AssociationId = (unsigned short) tgt_network->aid;
|
||||
|
||||
pDest = (u8 *)pAssocInfo + sizeof(NDIS_802_11_ASSOCIATION_INFORMATION) + pAssocInfo->RequestIELength;
|
||||
auth_ie = &psecuritypriv->authenticator_ie[0];
|
||||
|
||||
|
||||
i = auth_ie[0] - 12;
|
||||
if (i > 0) {
|
||||
_rtw_memcpy((u8 *)&pDest[0], &auth_ie[1], i);
|
||||
pAssocInfo->ResponseIELength = i;
|
||||
}
|
||||
|
||||
|
||||
pAssocInfo->OffsetResponseIEs = sizeof(NDIS_802_11_ASSOCIATION_INFORMATION) + pAssocInfo->RequestIELength;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return _TRUE;
|
||||
}
|
||||
#endif
|
||||
|
|
904
core/rtw_ioctl_rtl.c
Normal file
904
core/rtw_ioctl_rtl.c
Normal file
|
@ -0,0 +1,904 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
#define _RTW_IOCTL_RTL_C_
|
||||
|
||||
#include <drv_types.h>
|
||||
|
||||
#ifdef CONFIG_MP_INCLUDED
|
||||
#include <rtw_mp_ioctl.h>
|
||||
#endif
|
||||
|
||||
struct oid_obj_priv oid_rtl_seg_01_01[] = {
|
||||
{1, &oid_null_function}, /* 0x80 */
|
||||
{1, &oid_null_function}, /* 0x81 */
|
||||
{1, &oid_null_function}, /* 0x82 */
|
||||
{1, &oid_null_function}, /* 0x83 */ /* OID_RT_SET_SNIFFER_MODE */
|
||||
{1, &oid_rt_get_signal_quality_hdl}, /* 0x84 */
|
||||
{1, &oid_rt_get_small_packet_crc_hdl}, /* 0x85 */
|
||||
{1, &oid_rt_get_middle_packet_crc_hdl}, /* 0x86 */
|
||||
{1, &oid_rt_get_large_packet_crc_hdl}, /* 0x87 */
|
||||
{1, &oid_rt_get_tx_retry_hdl}, /* 0x88 */
|
||||
{1, &oid_rt_get_rx_retry_hdl}, /* 0x89 */
|
||||
{1, &oid_rt_pro_set_fw_dig_state_hdl}, /* 0x8A */
|
||||
{1, &oid_rt_pro_set_fw_ra_state_hdl} , /* 0x8B */
|
||||
{1, &oid_null_function}, /* 0x8C */
|
||||
{1, &oid_null_function}, /* 0x8D */
|
||||
{1, &oid_null_function}, /* 0x8E */
|
||||
{1, &oid_null_function}, /* 0x8F */
|
||||
{1, &oid_rt_get_rx_total_packet_hdl}, /* 0x90 */
|
||||
{1, &oid_rt_get_tx_beacon_ok_hdl}, /* 0x91 */
|
||||
{1, &oid_rt_get_tx_beacon_err_hdl}, /* 0x92 */
|
||||
{1, &oid_rt_get_rx_icv_err_hdl}, /* 0x93 */
|
||||
{1, &oid_rt_set_encryption_algorithm_hdl}, /* 0x94 */
|
||||
{1, &oid_null_function}, /* 0x95 */
|
||||
{1, &oid_rt_get_preamble_mode_hdl}, /* 0x96 */
|
||||
{1, &oid_null_function}, /* 0x97 */
|
||||
{1, &oid_rt_get_ap_ip_hdl}, /* 0x98 */
|
||||
{1, &oid_rt_get_channelplan_hdl}, /* 0x99 */
|
||||
{1, &oid_rt_set_preamble_mode_hdl}, /* 0x9A */
|
||||
{1, &oid_rt_set_bcn_intvl_hdl}, /* 0x9B */
|
||||
{1, &oid_null_function}, /* 0x9C */
|
||||
{1, &oid_rt_dedicate_probe_hdl}, /* 0x9D */
|
||||
{1, &oid_null_function}, /* 0x9E */
|
||||
{1, &oid_null_function}, /* 0x9F */
|
||||
{1, &oid_null_function}, /* 0xA0 */
|
||||
{1, &oid_null_function}, /* 0xA1 */
|
||||
{1, &oid_null_function}, /* 0xA2 */
|
||||
{1, &oid_null_function}, /* 0xA3 */
|
||||
{1, &oid_null_function}, /* 0xA4 */
|
||||
{1, &oid_null_function}, /* 0xA5 */
|
||||
{1, &oid_null_function}, /* 0xA6 */
|
||||
{1, &oid_rt_get_total_tx_bytes_hdl}, /* 0xA7 */
|
||||
{1, &oid_rt_get_total_rx_bytes_hdl}, /* 0xA8 */
|
||||
{1, &oid_rt_current_tx_power_level_hdl}, /* 0xA9 */
|
||||
{1, &oid_rt_get_enc_key_mismatch_count_hdl}, /* 0xAA */
|
||||
{1, &oid_rt_get_enc_key_match_count_hdl}, /* 0xAB */
|
||||
{1, &oid_rt_get_channel_hdl}, /* 0xAC */
|
||||
{1, &oid_rt_set_channelplan_hdl}, /* 0xAD */
|
||||
{1, &oid_rt_get_hardware_radio_off_hdl}, /* 0xAE */
|
||||
{1, &oid_null_function}, /* 0xAF */
|
||||
{1, &oid_null_function}, /* 0xB0 */
|
||||
{1, &oid_null_function}, /* 0xB1 */
|
||||
{1, &oid_null_function}, /* 0xB2 */
|
||||
{1, &oid_null_function}, /* 0xB3 */
|
||||
{1, &oid_rt_get_key_mismatch_hdl}, /* 0xB4 */
|
||||
{1, &oid_null_function}, /* 0xB5 */
|
||||
{1, &oid_null_function}, /* 0xB6 */
|
||||
{1, &oid_null_function}, /* 0xB7 */
|
||||
{1, &oid_null_function}, /* 0xB8 */
|
||||
{1, &oid_null_function}, /* 0xB9 */
|
||||
{1, &oid_null_function}, /* 0xBA */
|
||||
{1, &oid_rt_supported_wireless_mode_hdl}, /* 0xBB */
|
||||
{1, &oid_rt_get_channel_list_hdl}, /* 0xBC */
|
||||
{1, &oid_rt_get_scan_in_progress_hdl}, /* 0xBD */
|
||||
{1, &oid_null_function}, /* 0xBE */
|
||||
{1, &oid_null_function}, /* 0xBF */
|
||||
{1, &oid_null_function}, /* 0xC0 */
|
||||
{1, &oid_rt_forced_data_rate_hdl}, /* 0xC1 */
|
||||
{1, &oid_rt_wireless_mode_for_scan_list_hdl}, /* 0xC2 */
|
||||
{1, &oid_rt_get_bss_wireless_mode_hdl}, /* 0xC3 */
|
||||
{1, &oid_rt_scan_with_magic_packet_hdl}, /* 0xC4 */
|
||||
{1, &oid_null_function}, /* 0xC5 */
|
||||
{1, &oid_null_function}, /* 0xC6 */
|
||||
{1, &oid_null_function}, /* 0xC7 */
|
||||
{1, &oid_null_function}, /* 0xC8 */
|
||||
{1, &oid_null_function}, /* 0xC9 */
|
||||
{1, &oid_null_function}, /* 0xCA */
|
||||
{1, &oid_null_function}, /* 0xCB */
|
||||
{1, &oid_null_function}, /* 0xCC */
|
||||
{1, &oid_null_function}, /* 0xCD */
|
||||
{1, &oid_null_function}, /* 0xCE */
|
||||
{1, &oid_null_function}, /* 0xCF */
|
||||
|
||||
};
|
||||
|
||||
struct oid_obj_priv oid_rtl_seg_01_03[] = {
|
||||
{1, &oid_rt_ap_get_associated_station_list_hdl}, /* 0x00 */
|
||||
{1, &oid_null_function}, /* 0x01 */
|
||||
{1, &oid_rt_ap_switch_into_ap_mode_hdl}, /* 0x02 */
|
||||
{1, &oid_null_function}, /* 0x03 */
|
||||
{1, &oid_rt_ap_supported_hdl}, /* 0x04 */
|
||||
{1, &oid_rt_ap_set_passphrase_hdl}, /* 0x05 */
|
||||
|
||||
};
|
||||
|
||||
struct oid_obj_priv oid_rtl_seg_01_11[] = {
|
||||
{1, &oid_null_function}, /* 0xC0 OID_RT_PRO_RX_FILTER */
|
||||
{1, &oid_null_function}, /* 0xC1 OID_CE_USB_WRITE_REGISTRY */
|
||||
{1, &oid_null_function}, /* 0xC2 OID_CE_USB_READ_REGISTRY */
|
||||
{1, &oid_null_function}, /* 0xC3 OID_RT_PRO_SET_INITIAL_GAIN */
|
||||
{1, &oid_null_function}, /* 0xC4 OID_RT_PRO_SET_BB_RF_STANDBY_MODE */
|
||||
{1, &oid_null_function}, /* 0xC5 OID_RT_PRO_SET_BB_RF_SHUTDOWN_MODE */
|
||||
{1, &oid_null_function}, /* 0xC6 OID_RT_PRO_SET_TX_CHARGE_PUMP */
|
||||
{1, &oid_null_function}, /* 0xC7 OID_RT_PRO_SET_RX_CHARGE_PUMP */
|
||||
{1, &oid_rt_pro_rf_write_registry_hdl}, /* 0xC8 */
|
||||
{1, &oid_rt_pro_rf_read_registry_hdl}, /* 0xC9 */
|
||||
{1, &oid_null_function} /* 0xCA OID_RT_PRO_QUERY_RF_TYPE */
|
||||
|
||||
};
|
||||
|
||||
struct oid_obj_priv oid_rtl_seg_03_00[] = {
|
||||
{1, &oid_null_function}, /* 0x00 */
|
||||
{1, &oid_rt_get_connect_state_hdl}, /* 0x01 */
|
||||
{1, &oid_null_function}, /* 0x02 */
|
||||
{1, &oid_null_function}, /* 0x03 */
|
||||
{1, &oid_rt_set_default_key_id_hdl}, /* 0x04 */
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
/* ************** oid_rtl_seg_01_01 section start ************** */
|
||||
|
||||
NDIS_STATUS oid_rt_pro_set_fw_dig_state_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
#if 0
|
||||
PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
_irqL oldirql;
|
||||
|
||||
|
||||
if (poid_par_priv->type_of_oid != SET_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
_irqlevel_changed_(&oldirql, LOWER);
|
||||
if (poid_par_priv->information_buf_len >= sizeof(struct setdig_parm)) {
|
||||
/* DEBUG_ERR(("===> oid_rt_pro_set_fw_dig_state_hdl. type:0x%02x.\n",*((unsigned char*)poid_par_priv->information_buf ))); */
|
||||
if (!rtw_setfwdig_cmd(Adapter, *((unsigned char *)poid_par_priv->information_buf)))
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
|
||||
} else
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
_irqlevel_changed_(&oldirql, RAISE);
|
||||
#endif
|
||||
return status;
|
||||
}
|
||||
/* ----------------------------------------------------------------------------- */
|
||||
NDIS_STATUS oid_rt_pro_set_fw_ra_state_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
#if 0
|
||||
PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
_irqL oldirql;
|
||||
|
||||
if (poid_par_priv->type_of_oid != SET_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
_irqlevel_changed_(&oldirql, LOWER);
|
||||
|
||||
if (poid_par_priv->information_buf_len >= sizeof(struct setra_parm)) {
|
||||
/* DEBUG_ERR(("===> oid_rt_pro_set_fw_ra_state_hdl. type:0x%02x.\n",*((unsigned char*)poid_par_priv->information_buf ))); */
|
||||
if (!rtw_setfwra_cmd(Adapter, *((unsigned char *)poid_par_priv->information_buf)))
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
|
||||
} else
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
_irqlevel_changed_(&oldirql, RAISE);
|
||||
#endif
|
||||
return status;
|
||||
}
|
||||
/* ----------------------------------------------------------------------------- */
|
||||
NDIS_STATUS oid_rt_get_signal_quality_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
/* DEBUG_ERR(("<**********************oid_rt_get_signal_quality_hdl\n")); */
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (pMgntInfo->mAssoc || pMgntInfo->mIbss) {
|
||||
ulInfo = pAdapter->RxStats.SignalQuality;
|
||||
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
|
||||
} else {
|
||||
ulInfo = 0xffffffff; /* It stands for -1 in 4-byte integer. */
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
|
||||
NDIS_STATUS oid_rt_get_small_packet_crc_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
if (poid_par_priv->information_buf_len >= sizeof(ULONG)) {
|
||||
*(ULONG *)poid_par_priv->information_buf = padapter->recvpriv.rx_smallpacket_crcerr;
|
||||
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
|
||||
} else
|
||||
status = NDIS_STATUS_INVALID_LENGTH;
|
||||
|
||||
return status;
|
||||
}
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
NDIS_STATUS oid_rt_get_middle_packet_crc_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
if (poid_par_priv->information_buf_len >= sizeof(ULONG)) {
|
||||
*(ULONG *)poid_par_priv->information_buf = padapter->recvpriv.rx_middlepacket_crcerr;
|
||||
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
|
||||
} else
|
||||
status = NDIS_STATUS_INVALID_LENGTH;
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
NDIS_STATUS oid_rt_get_large_packet_crc_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
if (poid_par_priv->information_buf_len >= sizeof(ULONG)) {
|
||||
*(ULONG *)poid_par_priv->information_buf = padapter->recvpriv.rx_largepacket_crcerr;
|
||||
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
|
||||
} else
|
||||
status = NDIS_STATUS_INVALID_LENGTH;
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
NDIS_STATUS oid_rt_get_tx_retry_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
NDIS_STATUS oid_rt_get_rx_retry_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
|
||||
return status;
|
||||
}
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
NDIS_STATUS oid_rt_get_rx_total_packet_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
if (poid_par_priv->information_buf_len >= sizeof(ULONG)) {
|
||||
*(u64 *)poid_par_priv->information_buf = padapter->recvpriv.rx_pkts + padapter->recvpriv.rx_drop;
|
||||
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
|
||||
} else
|
||||
status = NDIS_STATUS_INVALID_LENGTH;
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
NDIS_STATUS oid_rt_get_tx_beacon_ok_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
NDIS_STATUS oid_rt_get_tx_beacon_err_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
NDIS_STATUS oid_rt_get_rx_icv_err_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
if (poid_par_priv->information_buf_len >= sizeof(u32)) {
|
||||
/* _rtw_memcpy(*(uint *)poid_par_priv->information_buf,padapter->recvpriv.rx_icv_err,sizeof(u32)); */
|
||||
*(uint *)poid_par_priv->information_buf = padapter->recvpriv.rx_icv_err;
|
||||
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
|
||||
} else
|
||||
status = NDIS_STATUS_INVALID_LENGTH ;
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
NDIS_STATUS oid_rt_set_encryption_algorithm_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != SET_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
NDIS_STATUS oid_rt_get_preamble_mode_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
ULONG preamblemode = 0 ;
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
if (poid_par_priv->information_buf_len >= sizeof(ULONG)) {
|
||||
if (padapter->registrypriv.preamble == PREAMBLE_LONG)
|
||||
preamblemode = 0;
|
||||
else if (padapter->registrypriv.preamble == PREAMBLE_AUTO)
|
||||
preamblemode = 1;
|
||||
else if (padapter->registrypriv.preamble == PREAMBLE_SHORT)
|
||||
preamblemode = 2;
|
||||
|
||||
|
||||
*(ULONG *)poid_par_priv->information_buf = preamblemode ;
|
||||
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
|
||||
} else
|
||||
status = NDIS_STATUS_INVALID_LENGTH ;
|
||||
return status;
|
||||
}
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
NDIS_STATUS oid_rt_get_ap_ip_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
NDIS_STATUS oid_rt_get_channelplan_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
|
||||
*(u16 *)poid_par_priv->information_buf = padapter->mlmepriv.ChannelPlan ;
|
||||
|
||||
return status;
|
||||
}
|
||||
NDIS_STATUS oid_rt_set_channelplan_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != SET_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
padapter->mlmepriv.ChannelPlan = *(u16 *)poid_par_priv->information_buf ;
|
||||
|
||||
return status;
|
||||
}
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
NDIS_STATUS oid_rt_set_preamble_mode_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
ULONG preamblemode = 0;
|
||||
if (poid_par_priv->type_of_oid != SET_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
if (poid_par_priv->information_buf_len >= sizeof(ULONG)) {
|
||||
preamblemode = *(ULONG *)poid_par_priv->information_buf ;
|
||||
if (preamblemode == 0)
|
||||
padapter->registrypriv.preamble = PREAMBLE_LONG;
|
||||
else if (preamblemode == 1)
|
||||
padapter->registrypriv.preamble = PREAMBLE_AUTO;
|
||||
else if (preamblemode == 2)
|
||||
padapter->registrypriv.preamble = PREAMBLE_SHORT;
|
||||
|
||||
*(ULONG *)poid_par_priv->information_buf = preamblemode ;
|
||||
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
|
||||
} else
|
||||
status = NDIS_STATUS_INVALID_LENGTH ;
|
||||
|
||||
return status;
|
||||
}
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
NDIS_STATUS oid_rt_set_bcn_intvl_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != SET_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
NDIS_STATUS oid_rt_dedicate_probe_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
return status;
|
||||
}
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
NDIS_STATUS oid_rt_get_total_tx_bytes_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
if (poid_par_priv->information_buf_len >= sizeof(ULONG)) {
|
||||
*(u64 *)poid_par_priv->information_buf = padapter->xmitpriv.tx_bytes;
|
||||
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
|
||||
} else
|
||||
status = NDIS_STATUS_INVALID_LENGTH ;
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
NDIS_STATUS oid_rt_get_total_rx_bytes_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
if (poid_par_priv->information_buf_len >= sizeof(ULONG)) {
|
||||
/* _rtw_memcpy(*(uint *)poid_par_priv->information_buf,padapter->recvpriv.rx_icv_err,sizeof(u32)); */
|
||||
*(u64 *)poid_par_priv->information_buf = padapter->recvpriv.rx_bytes;
|
||||
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
|
||||
} else
|
||||
status = NDIS_STATUS_INVALID_LENGTH ;
|
||||
return status;
|
||||
}
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
NDIS_STATUS oid_rt_current_tx_power_level_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
return status;
|
||||
}
|
||||
NDIS_STATUS oid_rt_get_enc_key_mismatch_count_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
NDIS_STATUS oid_rt_get_enc_key_match_count_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
NDIS_STATUS oid_rt_get_channel_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
NDIS_802_11_CONFIGURATION *pnic_Config;
|
||||
|
||||
ULONG channelnum;
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
if ((check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) ||
|
||||
(check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == _TRUE))
|
||||
pnic_Config = &pmlmepriv->cur_network.network.Configuration;
|
||||
else
|
||||
pnic_Config = &padapter->registrypriv.dev_network.Configuration;
|
||||
|
||||
channelnum = pnic_Config->DSConfig;
|
||||
*(ULONG *)poid_par_priv->information_buf = channelnum;
|
||||
|
||||
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
|
||||
|
||||
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
NDIS_STATUS oid_rt_get_hardware_radio_off_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
NDIS_STATUS oid_rt_get_key_mismatch_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
NDIS_STATUS oid_rt_supported_wireless_mode_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
ULONG ulInfo = 0 ;
|
||||
/* DEBUG_ERR(("<**********************oid_rt_supported_wireless_mode_hdl\n")); */
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
if (poid_par_priv->information_buf_len >= sizeof(ULONG)) {
|
||||
ulInfo |= 0x0100; /* WIRELESS_MODE_B */
|
||||
ulInfo |= 0x0200; /* WIRELESS_MODE_G */
|
||||
ulInfo |= 0x0400; /* WIRELESS_MODE_A */
|
||||
|
||||
*(ULONG *) poid_par_priv->information_buf = ulInfo;
|
||||
/* DEBUG_ERR(("<===oid_rt_supported_wireless_mode %x\n",ulInfo)); */
|
||||
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
|
||||
} else
|
||||
status = NDIS_STATUS_INVALID_LENGTH;
|
||||
|
||||
return status;
|
||||
}
|
||||
NDIS_STATUS oid_rt_get_channel_list_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
NDIS_STATUS oid_rt_get_scan_in_progress_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
NDIS_STATUS oid_rt_forced_data_rate_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
return status;
|
||||
}
|
||||
NDIS_STATUS oid_rt_wireless_mode_for_scan_list_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
return status;
|
||||
}
|
||||
NDIS_STATUS oid_rt_get_bss_wireless_mode_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
NDIS_STATUS oid_rt_scan_with_magic_packet_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
return status;
|
||||
}
|
||||
/* ************** oid_rtl_seg_01_01 section end ************** */
|
||||
|
||||
/* ************** oid_rtl_seg_01_03 section start ************** */
|
||||
NDIS_STATUS oid_rt_ap_get_associated_station_list_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
NDIS_STATUS oid_rt_ap_switch_into_ap_mode_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
return status;
|
||||
}
|
||||
NDIS_STATUS oid_rt_ap_supported_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
return status;
|
||||
}
|
||||
NDIS_STATUS oid_rt_ap_set_passphrase_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != SET_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/* ************** oid_rtl_seg_01_03 section end ************** */
|
||||
|
||||
/* **************** oid_rtl_seg_01_11 section start **************** */
|
||||
NDIS_STATUS oid_rt_pro_rf_write_registry_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
_irqL oldirql;
|
||||
/* DEBUG_ERR(("<**********************oid_rt_pro_rf_write_registry_hdl\n")); */
|
||||
if (poid_par_priv->type_of_oid != SET_OID) { /* QUERY_OID */
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
_irqlevel_changed_(&oldirql, LOWER);
|
||||
if (poid_par_priv->information_buf_len == (sizeof(unsigned long) * 3)) {
|
||||
/* RegOffsetValue - The offset of RF register to write. */
|
||||
/* RegDataWidth - The data width of RF register to write. */
|
||||
/* RegDataValue - The value to write. */
|
||||
/* RegOffsetValue = *((unsigned long*)InformationBuffer); */
|
||||
/* RegDataWidth = *((unsigned long*)InformationBuffer+1); */
|
||||
/* RegDataValue = *((unsigned long*)InformationBuffer+2); */
|
||||
if (!rtw_setrfreg_cmd(Adapter,
|
||||
*(unsigned char *)poid_par_priv->information_buf,
|
||||
(unsigned long)(*((unsigned long *)poid_par_priv->information_buf + 2))))
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
|
||||
} else
|
||||
status = NDIS_STATUS_INVALID_LENGTH;
|
||||
_irqlevel_changed_(&oldirql, RAISE);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
NDIS_STATUS oid_rt_pro_rf_read_registry_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
#if 0
|
||||
PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
_irqL oldirql;
|
||||
|
||||
/* DEBUG_ERR(("<**********************oid_rt_pro_rf_read_registry_hdl\n")); */
|
||||
if (poid_par_priv->type_of_oid != SET_OID) { /* QUERY_OID */
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
_irqlevel_changed_(&oldirql, LOWER);
|
||||
if (poid_par_priv->information_buf_len == (sizeof(unsigned long) * 3)) {
|
||||
if (Adapter->mppriv.act_in_progress == _TRUE)
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
else {
|
||||
/* init workparam */
|
||||
Adapter->mppriv.act_in_progress = _TRUE;
|
||||
Adapter->mppriv.workparam.bcompleted = _FALSE;
|
||||
Adapter->mppriv.workparam.act_type = MPT_READ_RF;
|
||||
Adapter->mppriv.workparam.io_offset = *(unsigned long *)poid_par_priv->information_buf;
|
||||
Adapter->mppriv.workparam.io_value = 0xcccccccc;
|
||||
|
||||
/* RegOffsetValue - The offset of RF register to read. */
|
||||
/* RegDataWidth - The data width of RF register to read. */
|
||||
/* RegDataValue - The value to read. */
|
||||
/* RegOffsetValue = *((unsigned long*)InformationBuffer); */
|
||||
/* RegDataWidth = *((unsigned long*)InformationBuffer+1); */
|
||||
/* RegDataValue = *((unsigned long*)InformationBuffer+2); */
|
||||
if (!rtw_getrfreg_cmd(Adapter,
|
||||
*(unsigned char *)poid_par_priv->information_buf,
|
||||
(unsigned char *)&Adapter->mppriv.workparam.io_value))
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
}
|
||||
|
||||
|
||||
} else
|
||||
status = NDIS_STATUS_INVALID_LENGTH;
|
||||
_irqlevel_changed_(&oldirql, RAISE);
|
||||
#endif
|
||||
return status;
|
||||
}
|
||||
|
||||
/* **************** oid_rtl_seg_01_11 section end**************** */
|
||||
|
||||
|
||||
/* ************** oid_rtl_seg_03_00 section start ************** */
|
||||
enum _CONNECT_STATE_ {
|
||||
CHECKINGSTATUS,
|
||||
ASSOCIATED,
|
||||
ADHOCMODE,
|
||||
NOTASSOCIATED
|
||||
};
|
||||
|
||||
NDIS_STATUS oid_rt_get_connect_state_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
|
||||
|
||||
ULONG ulInfo;
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
/* nStatus==0 CheckingStatus */
|
||||
/* nStatus==1 Associated */
|
||||
/* nStatus==2 AdHocMode */
|
||||
/* nStatus==3 NotAssociated */
|
||||
|
||||
if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == _TRUE)
|
||||
ulInfo = CHECKINGSTATUS;
|
||||
else if (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE)
|
||||
ulInfo = ASSOCIATED;
|
||||
else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == _TRUE)
|
||||
ulInfo = ADHOCMODE;
|
||||
else
|
||||
ulInfo = NOTASSOCIATED ;
|
||||
|
||||
*(ULONG *)poid_par_priv->information_buf = ulInfo;
|
||||
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
|
||||
|
||||
#if 0
|
||||
/* Rearrange the order to let the UI still shows connection when scan is in progress */
|
||||
if (pMgntInfo->mAssoc)
|
||||
ulInfo = 1;
|
||||
else if (pMgntInfo->mIbss)
|
||||
ulInfo = 2;
|
||||
else if (pMgntInfo->bScanInProgress)
|
||||
ulInfo = 0;
|
||||
else
|
||||
ulInfo = 3;
|
||||
ulInfoLen = sizeof(ULONG);
|
||||
#endif
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
NDIS_STATUS oid_rt_set_default_key_id_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != SET_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
/* ************** oid_rtl_seg_03_00 section end ************** */
|
1265
core/rtw_ioctl_set.c
1265
core/rtw_ioctl_set.c
File diff suppressed because it is too large
Load diff
279
core/rtw_iol.c
279
core/rtw_iol.c
|
@ -18,24 +18,26 @@
|
|||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include<rtw_iol.h>
|
||||
#include <drv_types.h>
|
||||
|
||||
struct xmit_frame *rtw_IOL_accquire_xmit_frame(struct adapter *adapter)
|
||||
#ifdef CONFIG_IOL
|
||||
struct xmit_frame *rtw_IOL_accquire_xmit_frame(ADAPTER *adapter)
|
||||
{
|
||||
struct xmit_frame *xmit_frame;
|
||||
struct xmit_buf *xmitbuf;
|
||||
struct pkt_attrib *pattrib;
|
||||
struct xmit_priv *pxmitpriv = &(adapter->xmitpriv);
|
||||
|
||||
if ((xmit_frame = rtw_alloc_xmitframe(pxmitpriv)) == NULL)
|
||||
{
|
||||
DBG_88E("%s rtw_alloc_xmitframe return null\n", __FUNCTION__);
|
||||
#if 1
|
||||
xmit_frame = rtw_alloc_xmitframe(pxmitpriv);
|
||||
if (xmit_frame == NULL) {
|
||||
RTW_INFO("%s rtw_alloc_xmitframe return null\n", __FUNCTION__);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if ((xmitbuf = rtw_alloc_xmitbuf(pxmitpriv)) == NULL)
|
||||
{
|
||||
DBG_88E("%s rtw_alloc_xmitbuf return null\n", __FUNCTION__);
|
||||
xmitbuf = rtw_alloc_xmitbuf(pxmitpriv);
|
||||
if (xmitbuf == NULL) {
|
||||
RTW_INFO("%s rtw_alloc_xmitbuf return null\n", __FUNCTION__);
|
||||
rtw_free_xmitframe(pxmitpriv, xmit_frame);
|
||||
xmit_frame = NULL;
|
||||
goto exit;
|
||||
|
@ -48,14 +50,27 @@ struct xmit_frame *rtw_IOL_accquire_xmit_frame(struct adapter *adapter)
|
|||
|
||||
pattrib = &xmit_frame->attrib;
|
||||
update_mgntframe_attrib(adapter, pattrib);
|
||||
pattrib->qsel = 0x10;/* Beacon */
|
||||
pattrib->qsel = QSLT_BEACON;/* Beacon */
|
||||
pattrib->subtype = WIFI_BEACON;
|
||||
pattrib->pktlen = pattrib->last_txcmdsz = 0;
|
||||
|
||||
#else
|
||||
xmit_frame = alloc_mgtxmitframe(pxmitpriv);
|
||||
if (xmit_frame == NULL)
|
||||
RTW_INFO("%s alloc_mgtxmitframe return null\n", __FUNCTION__);
|
||||
else {
|
||||
pattrib = &xmit_frame->attrib;
|
||||
update_mgntframe_attrib(adapter, pattrib);
|
||||
pattrib->qsel = QSLT_BEACON;
|
||||
pattrib->pktlen = pattrib->last_txcmdsz = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
exit:
|
||||
return xmit_frame;
|
||||
}
|
||||
|
||||
|
||||
int rtw_IOL_append_cmds(struct xmit_frame *xmit_frame, u8 *IOL_cmds, u32 cmd_len)
|
||||
{
|
||||
struct pkt_attrib *pattrib = &xmit_frame->attrib;
|
||||
|
@ -63,38 +78,43 @@ int rtw_IOL_append_cmds(struct xmit_frame *xmit_frame, u8 *IOL_cmds, u32 cmd_len
|
|||
u32 ori_len;
|
||||
|
||||
buf_offset = TXDESC_OFFSET;
|
||||
ori_len = buf_offset+pattrib->pktlen;
|
||||
ori_len = buf_offset + pattrib->pktlen;
|
||||
|
||||
/* check if the io_buf can accommodate new cmds */
|
||||
if (ori_len + cmd_len + 8 > MAX_XMITBUF_SZ) {
|
||||
DBG_88E("%s %u is large than MAX_XMITBUF_SZ:%u, can't accommodate new cmds\n", __FUNCTION__
|
||||
, ori_len + cmd_len + 8, MAX_XMITBUF_SZ);
|
||||
RTW_INFO("%s %u is large than MAX_XMITBUF_SZ:%u, can't accommodate new cmds\n", __FUNCTION__
|
||||
, ori_len + cmd_len + 8, MAX_XMITBUF_SZ);
|
||||
return _FAIL;
|
||||
}
|
||||
|
||||
memcpy(xmit_frame->buf_addr + buf_offset + pattrib->pktlen, IOL_cmds, cmd_len);
|
||||
_rtw_memcpy(xmit_frame->buf_addr + buf_offset + pattrib->pktlen, IOL_cmds, cmd_len);
|
||||
pattrib->pktlen += cmd_len;
|
||||
pattrib->last_txcmdsz += cmd_len;
|
||||
|
||||
/* DBG_88E("%s ori:%u + cmd_len:%u = %u\n", __FUNCTION__, ori_len, cmd_len, buf_offset+pattrib->pktlen); */
|
||||
/* RTW_INFO("%s ori:%u + cmd_len:%u = %u\n", __FUNCTION__, ori_len, cmd_len, buf_offset+pattrib->pktlen); */
|
||||
|
||||
return _SUCCESS;
|
||||
}
|
||||
bool rtw_IOL_applied(struct adapter *adapter)
|
||||
|
||||
bool rtw_IOL_applied(ADAPTER *adapter)
|
||||
{
|
||||
if (1 == adapter->registrypriv.fw_iol)
|
||||
return true;
|
||||
return _TRUE;
|
||||
|
||||
if ((2 == adapter->registrypriv.fw_iol) && (!adapter_to_dvobj(adapter)->ishighspeed))
|
||||
return true;
|
||||
return false;
|
||||
#ifdef CONFIG_USB_HCI
|
||||
if ((2 == adapter->registrypriv.fw_iol) && (IS_FULL_SPEED_USB(adapter)))
|
||||
return _TRUE;
|
||||
#endif
|
||||
|
||||
return _FALSE;
|
||||
}
|
||||
|
||||
int rtw_IOL_exec_cmds_sync(struct adapter *adapter, struct xmit_frame *xmit_frame, u32 max_wating_ms, u32 bndy_cnt)
|
||||
int rtw_IOL_exec_cmds_sync(ADAPTER *adapter, struct xmit_frame *xmit_frame, u32 max_wating_ms, u32 bndy_cnt)
|
||||
{
|
||||
return rtw_hal_iol_cmd(adapter, xmit_frame, max_wating_ms, bndy_cnt);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_IOL_NEW_GENERATION
|
||||
int rtw_IOL_append_LLT_cmd(struct xmit_frame *xmit_frame, u8 page_boundary)
|
||||
{
|
||||
return _SUCCESS;
|
||||
|
@ -103,63 +123,60 @@ int _rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value, u8
|
|||
{
|
||||
struct ioreg_cfg cmd = {8, IOREG_CMD_WB_REG, 0x0, 0x0, 0x0};
|
||||
|
||||
/* RTW_PUT_LE16((u8*)&cmd.address, addr); */
|
||||
/* RTW_PUT_LE32((u8*)&cmd.value, (u32)value); */
|
||||
/* RTW_PUT_LE16((u8*)&cmd.address, addr); */
|
||||
/* RTW_PUT_LE32((u8*)&cmd.value, (u32)value); */
|
||||
cmd.address = cpu_to_le16(addr);
|
||||
cmd.data = cpu_to_le32(value);
|
||||
|
||||
if (mask!=0xFF)
|
||||
{
|
||||
if (mask != 0xFF) {
|
||||
cmd.length = 12;
|
||||
/* RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask); */
|
||||
/* RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask); */
|
||||
cmd.mask = cpu_to_le32(mask);
|
||||
}
|
||||
|
||||
/* DBG_88E("%s addr:0x%04x, value:0x%08x, mask:0x%08x\n", __FUNCTION__, addr, value, mask); */
|
||||
/* RTW_INFO("%s addr:0x%04x,value:0x%08x,mask:0x%08x\n", __FUNCTION__, addr,value,mask); */
|
||||
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, cmd.length);
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, cmd.length);
|
||||
|
||||
}
|
||||
int _rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value, u16 mask)
|
||||
{
|
||||
struct ioreg_cfg cmd = {8, IOREG_CMD_WW_REG, 0x0, 0x0, 0x0};
|
||||
|
||||
/* RTW_PUT_LE16((u8*)&cmd.address, addr); */
|
||||
/* RTW_PUT_LE32((u8*)&cmd.value, (u32)value); */
|
||||
/* RTW_PUT_LE16((u8*)&cmd.address, addr); */
|
||||
/* RTW_PUT_LE32((u8*)&cmd.value, (u32)value); */
|
||||
cmd.address = cpu_to_le16(addr);
|
||||
cmd.data = cpu_to_le32(value);
|
||||
|
||||
if (mask!=0xFFFF)
|
||||
{
|
||||
if (mask != 0xFFFF) {
|
||||
cmd.length = 12;
|
||||
/* RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask); */
|
||||
/* RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask); */
|
||||
cmd.mask = cpu_to_le32(mask);
|
||||
}
|
||||
|
||||
/* DBG_88E("%s addr:0x%04x, value:0x%08x, mask:0x%08x\n", __FUNCTION__, addr, value, mask); */
|
||||
/* RTW_INFO("%s addr:0x%04x,value:0x%08x,mask:0x%08x\n", __FUNCTION__, addr,value,mask); */
|
||||
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, cmd.length);
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, cmd.length);
|
||||
|
||||
}
|
||||
int _rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value, u32 mask)
|
||||
{
|
||||
struct ioreg_cfg cmd = {8, IOREG_CMD_WD_REG, 0x0, 0x0, 0x0};
|
||||
|
||||
/* RTW_PUT_LE16((u8*)&cmd.address, addr); */
|
||||
/* RTW_PUT_LE32((u8*)&cmd.value, (u32)value); */
|
||||
/* RTW_PUT_LE16((u8*)&cmd.address, addr); */
|
||||
/* RTW_PUT_LE32((u8*)&cmd.value, (u32)value); */
|
||||
cmd.address = cpu_to_le16(addr);
|
||||
cmd.data = cpu_to_le32(value);
|
||||
|
||||
if (mask!=0xFFFFFFFF)
|
||||
{
|
||||
if (mask != 0xFFFFFFFF) {
|
||||
cmd.length = 12;
|
||||
/* RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask); */
|
||||
/* RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask); */
|
||||
cmd.mask = cpu_to_le32(mask);
|
||||
}
|
||||
|
||||
/* DBG_88E("%s addr:0x%04x, value:0x%08x, mask:0x%08x\n", __FU2NCTION__, addr, value, mask); */
|
||||
/* RTW_INFO("%s addr:0x%04x,value:0x%08x,mask:0x%08x\n", __FU2NCTION__, addr,value,mask); */
|
||||
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, cmd.length);
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, cmd.length);
|
||||
|
||||
}
|
||||
|
||||
|
@ -167,78 +184,204 @@ int _rtw_IOL_append_WRF_cmd(struct xmit_frame *xmit_frame, u8 rf_path, u16 addr,
|
|||
{
|
||||
struct ioreg_cfg cmd = {8, IOREG_CMD_W_RF, 0x0, 0x0, 0x0};
|
||||
|
||||
/* RTW_PUT_LE16((u8*)&cmd.address, addr); */
|
||||
/* RTW_PUT_LE32((u8*)&cmd.value, (u32)value); */
|
||||
cmd.address = cpu_to_le16((rf_path<<8) |((addr) &0xFF));
|
||||
/* RTW_PUT_LE16((u8*)&cmd.address, addr); */
|
||||
/* RTW_PUT_LE32((u8*)&cmd.value, (u32)value); */
|
||||
cmd.address = (rf_path << 8) | ((addr) & 0xFF);
|
||||
cmd.data = cpu_to_le32(value);
|
||||
|
||||
if (mask!=0x000FFFFF)
|
||||
{
|
||||
if (mask != 0x000FFFFF) {
|
||||
cmd.length = 12;
|
||||
/* RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask); */
|
||||
/* RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask); */
|
||||
cmd.mask = cpu_to_le32(mask);
|
||||
}
|
||||
|
||||
/* DBG_88E("%s rf_path:0x%02x addr:0x%04x, value:0x%08x, mask:0x%08x\n", __FU2NCTION__, rf_path, addr, value, mask); */
|
||||
/* RTW_INFO("%s rf_path:0x%02x addr:0x%04x,value:0x%08x,mask:0x%08x\n", __FU2NCTION__,rf_path, addr,value,mask); */
|
||||
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, cmd.length);
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, cmd.length);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
int rtw_IOL_append_DELAY_US_cmd(struct xmit_frame *xmit_frame, u16 us)
|
||||
{
|
||||
struct ioreg_cfg cmd = {4, IOREG_CMD_DELAY_US, 0x0, 0x0, 0x0};
|
||||
/* RTW_PUT_LE16((u8*)&cmd.address, us); */
|
||||
/* RTW_PUT_LE16((u8*)&cmd.address, us); */
|
||||
cmd.address = cpu_to_le16(us);
|
||||
|
||||
/* DBG_88E("%s %u\n", __FUNCTION__, us); */
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, 4);
|
||||
/* RTW_INFO("%s %u\n", __FUNCTION__, us); */
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, 4);
|
||||
}
|
||||
|
||||
int rtw_IOL_append_DELAY_MS_cmd(struct xmit_frame *xmit_frame, u16 ms)
|
||||
{
|
||||
struct ioreg_cfg cmd = {4, IOREG_CMD_DELAY_US, 0x0, 0x0, 0x0};
|
||||
|
||||
/* RTW_PUT_LE16((u8*)&cmd.address, ms); */
|
||||
/* RTW_PUT_LE16((u8*)&cmd.address, ms); */
|
||||
cmd.address = cpu_to_le16(ms);
|
||||
|
||||
/* DBG_88E("%s %u\n", __FUNCTION__, ms); */
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, 4);
|
||||
/* RTW_INFO("%s %u\n", __FUNCTION__, ms); */
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, 4);
|
||||
}
|
||||
int rtw_IOL_append_END_cmd(struct xmit_frame *xmit_frame)
|
||||
{
|
||||
struct ioreg_cfg cmd = {4, IOREG_CMD_END, cpu_to_le16(0xFFFF),
|
||||
cpu_to_le32(0xFF), 0x0};
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, 4);
|
||||
struct ioreg_cfg cmd = {4, IOREG_CMD_END, 0xFFFF, 0xFF, 0x0};
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, 4);
|
||||
|
||||
}
|
||||
|
||||
u8 rtw_IOL_cmd_boundary_handle(struct xmit_frame *pxmit_frame)
|
||||
{
|
||||
u8 is_cmd_bndy = false;
|
||||
if (((pxmit_frame->attrib.pktlen+32)%256) + 8 >= 256) {
|
||||
u8 is_cmd_bndy = _FALSE;
|
||||
if (((pxmit_frame->attrib.pktlen + 32) % 256) + 8 >= 256) {
|
||||
rtw_IOL_append_END_cmd(pxmit_frame);
|
||||
pxmit_frame->attrib.pktlen = ((((pxmit_frame->attrib.pktlen+32)/256)+1)*256 );
|
||||
pxmit_frame->attrib.pktlen = ((((pxmit_frame->attrib.pktlen + 32) / 256) + 1) * 256);
|
||||
|
||||
/* printk("==> %s, pktlen(%d)\n", __FUNCTION__, pxmit_frame->attrib.pktlen); */
|
||||
/* printk("==> %s, pktlen(%d)\n",__FUNCTION__,pxmit_frame->attrib.pktlen); */
|
||||
pxmit_frame->attrib.last_txcmdsz = pxmit_frame->attrib.pktlen;
|
||||
is_cmd_bndy = true;
|
||||
is_cmd_bndy = _TRUE;
|
||||
}
|
||||
return is_cmd_bndy;
|
||||
}
|
||||
|
||||
void rtw_IOL_cmd_buf_dump(struct adapter *Adapter, int buf_len, u8 *pbuf)
|
||||
void rtw_IOL_cmd_buf_dump(ADAPTER *Adapter, int buf_len, u8 *pbuf)
|
||||
{
|
||||
int i;
|
||||
int j =1;
|
||||
int j = 1;
|
||||
|
||||
printk("###### %s ######\n", __FUNCTION__);
|
||||
for (i =0;i< buf_len;i++) {
|
||||
printk("%02x-",*(pbuf+i));
|
||||
if (j%32 == 0)
|
||||
for (i = 0; i < buf_len; i++) {
|
||||
printk("%02x-", *(pbuf + i));
|
||||
|
||||
if (j % 32 == 0)
|
||||
printk("\n");
|
||||
j++;
|
||||
}
|
||||
printk("\n");
|
||||
printk("============= ioreg_cmd len = %d ===============\n", buf_len);
|
||||
}
|
||||
|
||||
|
||||
#else /* CONFIG_IOL_NEW_GENERATION */
|
||||
int rtw_IOL_append_LLT_cmd(struct xmit_frame *xmit_frame, u8 page_boundary)
|
||||
{
|
||||
IOL_CMD cmd = {0x0, IOL_CMD_LLT, 0x0, 0x0};
|
||||
|
||||
RTW_PUT_BE32((u8 *)&cmd.value, (u32)page_boundary);
|
||||
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, 8);
|
||||
}
|
||||
|
||||
int _rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value)
|
||||
{
|
||||
IOL_CMD cmd = {0x0, IOL_CMD_WB_REG, 0x0, 0x0};
|
||||
|
||||
RTW_PUT_BE16((u8 *)&cmd.address, (u16)addr);
|
||||
RTW_PUT_BE32((u8 *)&cmd.value, (u32)value);
|
||||
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, 8);
|
||||
}
|
||||
|
||||
int _rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value)
|
||||
{
|
||||
IOL_CMD cmd = {0x0, IOL_CMD_WW_REG, 0x0, 0x0};
|
||||
|
||||
RTW_PUT_BE16((u8 *)&cmd.address, (u16)addr);
|
||||
RTW_PUT_BE32((u8 *)&cmd.value, (u32)value);
|
||||
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, 8);
|
||||
}
|
||||
|
||||
int _rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value)
|
||||
{
|
||||
IOL_CMD cmd = {0x0, IOL_CMD_WD_REG, 0x0, 0x0};
|
||||
u8 *pos = (u8 *)&cmd;
|
||||
|
||||
RTW_PUT_BE16((u8 *)&cmd.address, (u16)addr);
|
||||
RTW_PUT_BE32((u8 *)&cmd.value, (u32)value);
|
||||
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, 8);
|
||||
}
|
||||
|
||||
#ifdef DBG_IO
|
||||
int dbg_rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value, const char *caller, const int line)
|
||||
{
|
||||
if (match_write_sniff_ranges(addr, 1))
|
||||
RTW_INFO("DBG_IO %s:%d IOL_WB(0x%04x, 0x%02x)\n", caller, line, addr, value);
|
||||
|
||||
return _rtw_IOL_append_WB_cmd(xmit_frame, addr, value);
|
||||
}
|
||||
|
||||
int dbg_rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value, const char *caller, const int line)
|
||||
{
|
||||
if (match_write_sniff_ranges(addr, 2))
|
||||
RTW_INFO("DBG_IO %s:%d IOL_WW(0x%04x, 0x%04x)\n", caller, line, addr, value);
|
||||
|
||||
return _rtw_IOL_append_WW_cmd(xmit_frame, addr, value);
|
||||
}
|
||||
|
||||
int dbg_rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value, const char *caller, const int line)
|
||||
{
|
||||
if (match_write_sniff_ranges(addr, 4))
|
||||
RTW_INFO("DBG_IO %s:%d IOL_WD(0x%04x, 0x%08x)\n", caller, line, addr, value);
|
||||
|
||||
return _rtw_IOL_append_WD_cmd(xmit_frame, addr, value);
|
||||
}
|
||||
#endif
|
||||
|
||||
int rtw_IOL_append_DELAY_US_cmd(struct xmit_frame *xmit_frame, u16 us)
|
||||
{
|
||||
IOL_CMD cmd = {0x0, IOL_CMD_DELAY_US, 0x0, 0x0};
|
||||
|
||||
RTW_PUT_BE32((u8 *)&cmd.value, (u32)us);
|
||||
|
||||
/* RTW_INFO("%s %u\n", __FUNCTION__, us); */
|
||||
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, 8);
|
||||
}
|
||||
|
||||
int rtw_IOL_append_DELAY_MS_cmd(struct xmit_frame *xmit_frame, u16 ms)
|
||||
{
|
||||
IOL_CMD cmd = {0x0, IOL_CMD_DELAY_MS, 0x0, 0x0};
|
||||
|
||||
RTW_PUT_BE32((u8 *)&cmd.value, (u32)ms);
|
||||
|
||||
/* RTW_INFO("%s %u\n", __FUNCTION__, ms); */
|
||||
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, 8);
|
||||
}
|
||||
|
||||
int rtw_IOL_append_END_cmd(struct xmit_frame *xmit_frame)
|
||||
{
|
||||
IOL_CMD end_cmd = {0x0, IOL_CMD_END, 0x0, 0x0};
|
||||
|
||||
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&end_cmd, 8);
|
||||
|
||||
}
|
||||
|
||||
int rtw_IOL_exec_cmd_array_sync(PADAPTER adapter, u8 *IOL_cmds, u32 cmd_num, u32 max_wating_ms)
|
||||
{
|
||||
struct xmit_frame *xmit_frame;
|
||||
|
||||
xmit_frame = rtw_IOL_accquire_xmit_frame(adapter);
|
||||
if (xmit_frame == NULL)
|
||||
return _FAIL;
|
||||
|
||||
if (rtw_IOL_append_cmds(xmit_frame, IOL_cmds, cmd_num << 3) == _FAIL)
|
||||
return _FAIL;
|
||||
|
||||
return rtw_IOL_exec_cmds_sync(adapter, xmit_frame, max_wating_ms, 0);
|
||||
}
|
||||
|
||||
int rtw_IOL_exec_empty_cmds_sync(ADAPTER *adapter, u32 max_wating_ms)
|
||||
{
|
||||
IOL_CMD end_cmd = {0x0, IOL_CMD_END, 0x0, 0x0};
|
||||
return rtw_IOL_exec_cmd_array_sync(adapter, (u8 *)&end_cmd, 1, max_wating_ms);
|
||||
}
|
||||
#endif /* CONFIG_IOL_NEW_GENERATION */
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* CONFIG_IOL */
|
||||
|
|
2305
core/rtw_led.c
2305
core/rtw_led.c
File diff suppressed because it is too large
Load diff
114
core/rtw_mem.c
Normal file
114
core/rtw_mem.c
Normal file
|
@ -0,0 +1,114 @@
|
|||
|
||||
#include <drv_types.h>
|
||||
#include <rtw_mem.h>
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_DESCRIPTION("Realtek Wireless Lan Driver");
|
||||
MODULE_AUTHOR("Realtek Semiconductor Corp.");
|
||||
MODULE_VERSION("DRIVERVERSION");
|
||||
|
||||
struct sk_buff_head rtk_skb_mem_q;
|
||||
struct u8 *rtk_buf_mem[NR_RECVBUFF];
|
||||
|
||||
struct u8 *rtw_get_buf_premem(int index)
|
||||
{
|
||||
printk("%s, rtk_buf_mem index : %d\n", __func__, index);
|
||||
return rtk_buf_mem[index];
|
||||
}
|
||||
|
||||
u16 rtw_rtkm_get_buff_size(void)
|
||||
{
|
||||
return MAX_RTKM_RECVBUF_SZ;
|
||||
}
|
||||
EXPORT_SYMBOL(rtw_rtkm_get_buff_size);
|
||||
|
||||
u8 rtw_rtkm_get_nr_recv_skb(void)
|
||||
{
|
||||
return MAX_RTKM_NR_PREALLOC_RECV_SKB;
|
||||
}
|
||||
EXPORT_SYMBOL(rtw_rtkm_get_nr_recv_skb);
|
||||
|
||||
struct sk_buff *rtw_alloc_skb_premem(u16 in_size)
|
||||
{
|
||||
struct sk_buff *skb = NULL;
|
||||
|
||||
if (in_size > MAX_RTKM_RECVBUF_SZ) {
|
||||
pr_info("warning %s: driver buffer size(%d) > rtkm buffer size(%d)\n", __func__, in_size, MAX_RTKM_RECVBUF_SZ);
|
||||
WARN_ON(1);
|
||||
return skb;
|
||||
}
|
||||
|
||||
skb = skb_dequeue(&rtk_skb_mem_q);
|
||||
|
||||
printk("%s, rtk_skb_mem_q len : %d\n", __func__, skb_queue_len(&rtk_skb_mem_q));
|
||||
|
||||
return skb;
|
||||
}
|
||||
EXPORT_SYMBOL(rtw_alloc_skb_premem);
|
||||
|
||||
int rtw_free_skb_premem(struct sk_buff *pskb)
|
||||
{
|
||||
if (!pskb)
|
||||
return -1;
|
||||
|
||||
if (skb_queue_len(&rtk_skb_mem_q) >= MAX_RTKM_NR_PREALLOC_RECV_SKB)
|
||||
return -1;
|
||||
|
||||
skb_queue_tail(&rtk_skb_mem_q, pskb);
|
||||
|
||||
printk("%s, rtk_skb_mem_q len : %d\n", __func__, skb_queue_len(&rtk_skb_mem_q));
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(rtw_free_skb_premem);
|
||||
|
||||
static int __init rtw_mem_init(void)
|
||||
{
|
||||
int i;
|
||||
SIZE_PTR tmpaddr = 0;
|
||||
SIZE_PTR alignment = 0;
|
||||
struct sk_buff *pskb = NULL;
|
||||
|
||||
printk("%s\n", __func__);
|
||||
pr_info("MAX_RTKM_NR_PREALLOC_RECV_SKB: %d\n", MAX_RTKM_NR_PREALLOC_RECV_SKB);
|
||||
pr_info("MAX_RTKM_RECVBUF_SZ: %d\n", MAX_RTKM_RECVBUF_SZ);
|
||||
|
||||
#ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX
|
||||
for (i = 0; i < NR_RECVBUFF; i++)
|
||||
rtk_buf_mem[i] = usb_buffer_alloc(dev, size, (in_interrupt() ? GFP_ATOMIC : GFP_KERNEL), dma);
|
||||
#endif /* CONFIG_USE_USB_BUFFER_ALLOC_RX */
|
||||
|
||||
skb_queue_head_init(&rtk_skb_mem_q);
|
||||
|
||||
for (i = 0; i < MAX_RTKM_NR_PREALLOC_RECV_SKB; i++) {
|
||||
pskb = __dev_alloc_skb(MAX_RTKM_RECVBUF_SZ + RECVBUFF_ALIGN_SZ, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
|
||||
if (pskb) {
|
||||
tmpaddr = (SIZE_PTR)pskb->data;
|
||||
alignment = tmpaddr & (RECVBUFF_ALIGN_SZ - 1);
|
||||
skb_reserve(pskb, (RECVBUFF_ALIGN_SZ - alignment));
|
||||
|
||||
skb_queue_tail(&rtk_skb_mem_q, pskb);
|
||||
} else
|
||||
printk("%s, alloc skb memory fail!\n", __func__);
|
||||
|
||||
pskb = NULL;
|
||||
}
|
||||
|
||||
printk("%s, rtk_skb_mem_q len : %d\n", __func__, skb_queue_len(&rtk_skb_mem_q));
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
static void __exit rtw_mem_exit(void)
|
||||
{
|
||||
if (skb_queue_len(&rtk_skb_mem_q))
|
||||
printk("%s, rtk_skb_mem_q len : %d\n", __func__, skb_queue_len(&rtk_skb_mem_q));
|
||||
|
||||
skb_queue_purge(&rtk_skb_mem_q);
|
||||
|
||||
printk("%s\n", __func__);
|
||||
}
|
||||
|
||||
module_init(rtw_mem_init);
|
||||
module_exit(rtw_mem_exit);
|
1286
core/rtw_mi.c
Normal file
1286
core/rtw_mi.c
Normal file
File diff suppressed because it is too large
Load diff
4456
core/rtw_mlme.c
4456
core/rtw_mlme.c
File diff suppressed because it is too large
Load diff
15841
core/rtw_mlme_ext.c
Normal file → Executable file
15841
core/rtw_mlme_ext.c
Normal file → Executable file
File diff suppressed because it is too large
Load diff
3569
core/rtw_mp.c
Normal file
3569
core/rtw_mp.c
Normal file
File diff suppressed because it is too large
Load diff
2534
core/rtw_mp_ioctl.c
Normal file
2534
core/rtw_mp_ioctl.c
Normal file
File diff suppressed because it is too large
Load diff
571
core/rtw_odm.c
571
core/rtw_odm.c
|
@ -19,187 +19,428 @@
|
|||
******************************************************************************/
|
||||
|
||||
#include <rtw_odm.h>
|
||||
#include <rtl8188e_hal.h>
|
||||
#include <hal_data.h>
|
||||
|
||||
static const char *odm_comp_str[] = {
|
||||
"ODM_COMP_DIG",
|
||||
"ODM_COMP_RA_MASK",
|
||||
"ODM_COMP_DYNAMIC_TXPWR",
|
||||
"ODM_COMP_FA_CNT",
|
||||
"ODM_COMP_RSSI_MONITOR",
|
||||
"ODM_COMP_CCK_PD",
|
||||
"ODM_COMP_ANT_DIV",
|
||||
"ODM_COMP_PWR_SAVE",
|
||||
"ODM_COMP_PWR_TRAIN",
|
||||
"ODM_COMP_RATE_ADAPTIVE",
|
||||
"ODM_COMP_PATH_DIV",
|
||||
"ODM_COMP_PSD",
|
||||
"ODM_COMP_DYNAMIC_PRICCA",
|
||||
"ODM_COMP_RXHP",
|
||||
NULL,
|
||||
NULL,
|
||||
"ODM_COMP_EDCA_TURBO",
|
||||
"ODM_COMP_EARLY_MODE",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
"ODM_COMP_TX_PWR_TRACK",
|
||||
"ODM_COMP_RX_GAIN_TRACK",
|
||||
"ODM_COMP_CALIBRATION",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
"ODM_COMP_COMMON",
|
||||
"ODM_COMP_INIT",
|
||||
};
|
||||
|
||||
#define RTW_ODM_COMP_MAX 32
|
||||
|
||||
static const char *odm_ability_str[] = {
|
||||
"ODM_BB_DIG",
|
||||
"ODM_BB_RA_MASK",
|
||||
"ODM_BB_DYNAMIC_TXPWR",
|
||||
"ODM_BB_FA_CNT",
|
||||
"ODM_BB_RSSI_MONITOR",
|
||||
"ODM_BB_CCK_PD ",
|
||||
"ODM_BB_ANT_DIV",
|
||||
"ODM_BB_PWR_SAVE",
|
||||
"ODM_BB_PWR_TRAIN",
|
||||
"ODM_BB_RATE_ADAPTIVE",
|
||||
"ODM_BB_PATH_DIV",
|
||||
"ODM_BB_PSD",
|
||||
"ODM_BB_RXHP",
|
||||
"ODM_BB_ADAPTIVITY",
|
||||
"ODM_BB_DYNAMIC_ATC",
|
||||
NULL,
|
||||
"ODM_MAC_EDCA_TURBO",
|
||||
"ODM_MAC_EARLY_MODE",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
"ODM_RF_TX_PWR_TRACK",
|
||||
"ODM_RF_RX_GAIN_TRACK",
|
||||
"ODM_RF_CALIBRATION",
|
||||
};
|
||||
/* set ODM_CMNINFO_IC_TYPE based on chip_type */
|
||||
void rtw_odm_init_ic_type(_adapter *adapter)
|
||||
{
|
||||
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter);
|
||||
struct PHY_DM_STRUCT *odm = &hal_data->odmpriv;
|
||||
u4Byte ic_type = chip_type_to_odm_ic_type(rtw_get_chip_type(adapter));
|
||||
|
||||
#define RTW_ODM_ABILITY_MAX 27
|
||||
rtw_warn_on(!ic_type);
|
||||
|
||||
static const char *odm_dbg_level_str[] = {
|
||||
NULL,
|
||||
"ODM_DBG_OFF",
|
||||
"ODM_DBG_SERIOUS",
|
||||
"ODM_DBG_WARNING",
|
||||
"ODM_DBG_LOUD",
|
||||
"ODM_DBG_TRACE ",
|
||||
};
|
||||
odm_cmn_info_init(odm, ODM_CMNINFO_IC_TYPE, ic_type);
|
||||
}
|
||||
|
||||
#define RTW_ODM_DBG_LEVEL_NUM 6
|
||||
inline void rtw_odm_set_force_igi_lb(_adapter *adapter, u8 lb)
|
||||
{
|
||||
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter);
|
||||
|
||||
int _rtw_odm_dbg_comp_msg(struct adapter *adapter, char *buf, int len)
|
||||
hal_data->u1ForcedIgiLb = lb;
|
||||
}
|
||||
|
||||
inline u8 rtw_odm_get_force_igi_lb(_adapter *adapter)
|
||||
{
|
||||
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter);
|
||||
|
||||
return hal_data->u1ForcedIgiLb;
|
||||
}
|
||||
|
||||
void rtw_odm_adaptivity_ver_msg(void *sel, _adapter *adapter)
|
||||
{
|
||||
RTW_PRINT_SEL(sel, "ADAPTIVITY_VERSION "ADAPTIVITY_VERSION"\n");
|
||||
}
|
||||
|
||||
#define RTW_ADAPTIVITY_EN_DISABLE 0
|
||||
#define RTW_ADAPTIVITY_EN_ENABLE 1
|
||||
|
||||
void rtw_odm_adaptivity_en_msg(void *sel, _adapter *adapter)
|
||||
{
|
||||
struct registry_priv *regsty = &adapter->registrypriv;
|
||||
struct mlme_priv *mlme = &adapter->mlmepriv;
|
||||
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter);
|
||||
struct PHY_DM_STRUCT *odm = &hal_data->odmpriv;
|
||||
|
||||
RTW_PRINT_SEL(sel, "RTW_ADAPTIVITY_EN_");
|
||||
|
||||
if (regsty->adaptivity_en == RTW_ADAPTIVITY_EN_DISABLE)
|
||||
_RTW_PRINT_SEL(sel, "DISABLE\n");
|
||||
else if (regsty->adaptivity_en == RTW_ADAPTIVITY_EN_ENABLE)
|
||||
_RTW_PRINT_SEL(sel, "ENABLE\n");
|
||||
else
|
||||
_RTW_PRINT_SEL(sel, "INVALID\n");
|
||||
}
|
||||
|
||||
#define RTW_ADAPTIVITY_MODE_NORMAL 0
|
||||
#define RTW_ADAPTIVITY_MODE_CARRIER_SENSE 1
|
||||
|
||||
void rtw_odm_adaptivity_mode_msg(void *sel, _adapter *adapter)
|
||||
{
|
||||
struct registry_priv *regsty = &adapter->registrypriv;
|
||||
|
||||
RTW_PRINT_SEL(sel, "RTW_ADAPTIVITY_MODE_");
|
||||
|
||||
if (regsty->adaptivity_mode == RTW_ADAPTIVITY_MODE_NORMAL)
|
||||
_RTW_PRINT_SEL(sel, "NORMAL\n");
|
||||
else if (regsty->adaptivity_mode == RTW_ADAPTIVITY_MODE_CARRIER_SENSE)
|
||||
_RTW_PRINT_SEL(sel, "CARRIER_SENSE\n");
|
||||
else
|
||||
_RTW_PRINT_SEL(sel, "INVALID\n");
|
||||
}
|
||||
|
||||
#define RTW_ADAPTIVITY_DML_DISABLE 0
|
||||
#define RTW_ADAPTIVITY_DML_ENABLE 1
|
||||
|
||||
void rtw_odm_adaptivity_dml_msg(void *sel, _adapter *adapter)
|
||||
{
|
||||
struct registry_priv *regsty = &adapter->registrypriv;
|
||||
|
||||
RTW_PRINT_SEL(sel, "RTW_ADAPTIVITY_DML_");
|
||||
|
||||
if (regsty->adaptivity_dml == RTW_ADAPTIVITY_DML_DISABLE)
|
||||
_RTW_PRINT_SEL(sel, "DISABLE\n");
|
||||
else if (regsty->adaptivity_dml == RTW_ADAPTIVITY_DML_ENABLE)
|
||||
_RTW_PRINT_SEL(sel, "ENABLE\n");
|
||||
else
|
||||
_RTW_PRINT_SEL(sel, "INVALID\n");
|
||||
}
|
||||
|
||||
void rtw_odm_adaptivity_dc_backoff_msg(void *sel, _adapter *adapter)
|
||||
{
|
||||
struct registry_priv *regsty = &adapter->registrypriv;
|
||||
|
||||
RTW_PRINT_SEL(sel, "RTW_ADAPTIVITY_DC_BACKOFF:%u\n", regsty->adaptivity_dc_backoff);
|
||||
}
|
||||
|
||||
void rtw_odm_adaptivity_config_msg(void *sel, _adapter *adapter)
|
||||
{
|
||||
rtw_odm_adaptivity_ver_msg(sel, adapter);
|
||||
rtw_odm_adaptivity_en_msg(sel, adapter);
|
||||
rtw_odm_adaptivity_mode_msg(sel, adapter);
|
||||
rtw_odm_adaptivity_dml_msg(sel, adapter);
|
||||
rtw_odm_adaptivity_dc_backoff_msg(sel, adapter);
|
||||
}
|
||||
|
||||
bool rtw_odm_adaptivity_needed(_adapter *adapter)
|
||||
{
|
||||
struct registry_priv *regsty = &adapter->registrypriv;
|
||||
struct mlme_priv *mlme = &adapter->mlmepriv;
|
||||
bool ret = _FALSE;
|
||||
|
||||
if (regsty->adaptivity_en == RTW_ADAPTIVITY_EN_ENABLE)
|
||||
ret = _TRUE;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void rtw_odm_adaptivity_parm_msg(void *sel, _adapter *adapter)
|
||||
{
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(adapter);
|
||||
DM_ODM_T *odm = &pHalData->odmpriv;
|
||||
int cnt = 0;
|
||||
u64 dbg_comp;
|
||||
int i;
|
||||
struct PHY_DM_STRUCT *odm = &pHalData->odmpriv;
|
||||
|
||||
rtw_hal_get_def_var(adapter, HW_DEF_ODM_DBG_FLAG, &dbg_comp);
|
||||
cnt += snprintf(buf+cnt, len-cnt, "odm.DebugComponents = 0x%016llx\n", dbg_comp);
|
||||
for (i =0;i<RTW_ODM_COMP_MAX;i++) {
|
||||
if (odm_comp_str[i])
|
||||
cnt += snprintf(buf+cnt, len-cnt, "%cBIT%-2d %s\n",
|
||||
(BIT0 << i) & dbg_comp ? '+' : ' ', i, odm_comp_str[i]);
|
||||
}
|
||||
rtw_odm_adaptivity_config_msg(sel, adapter);
|
||||
|
||||
return cnt;
|
||||
}
|
||||
RTW_PRINT_SEL(sel, "%10s %16s %16s %22s %12s\n"
|
||||
, "th_l2h_ini", "th_edcca_hl_diff", "th_l2h_ini_mode2", "th_edcca_hl_diff_mode2", "edcca_enable");
|
||||
RTW_PRINT_SEL(sel, "0x%-8x %-16d 0x%-14x %-22d %-12d\n"
|
||||
, (u8)odm->th_l2h_ini
|
||||
, odm->th_edcca_hl_diff
|
||||
, (u8)odm->th_l2h_ini_mode2
|
||||
, odm->th_edcca_hl_diff_mode2
|
||||
, odm->edcca_enable
|
||||
);
|
||||
|
||||
void rtw_odm_dbg_comp_msg(struct adapter *adapter)
|
||||
{
|
||||
char buf[768] = {0};
|
||||
|
||||
_rtw_odm_dbg_comp_msg(adapter, buf, 768);
|
||||
DBG_88E_LEVEL(_drv_always_, "\n%s", buf);
|
||||
}
|
||||
|
||||
inline void rtw_odm_dbg_comp_set(struct adapter *adapter, u64 comps)
|
||||
{
|
||||
rtw_hal_set_def_var(adapter, HW_DEF_ODM_DBG_FLAG, &comps);
|
||||
}
|
||||
|
||||
int _rtw_odm_dbg_level_msg(struct adapter *adapter, char *buf, int len)
|
||||
{
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(adapter);
|
||||
DM_ODM_T *odm = &pHalData->odmpriv;
|
||||
int cnt = 0;
|
||||
u32 dbg_level;
|
||||
int i;
|
||||
|
||||
rtw_hal_get_def_var(adapter, HW_DEF_ODM_DBG_LEVEL, &dbg_level);
|
||||
cnt += snprintf(buf+cnt, len-cnt, "odm.DebugDebugLevel = %u\n", dbg_level);
|
||||
for (i =0;i<RTW_ODM_DBG_LEVEL_NUM;i++) {
|
||||
if (odm_dbg_level_str[i])
|
||||
cnt += snprintf(buf+cnt, len-cnt, "%u %s\n", i, odm_dbg_level_str[i]);
|
||||
}
|
||||
|
||||
return cnt;
|
||||
}
|
||||
|
||||
void rtw_odm_dbg_level_msg(struct adapter *adapter)
|
||||
{
|
||||
char buf[100] = {0};
|
||||
|
||||
_rtw_odm_dbg_comp_msg(adapter, buf, 100);
|
||||
DBG_88E_LEVEL(_drv_always_, "\n%s", buf);
|
||||
}
|
||||
|
||||
inline void rtw_odm_dbg_level_set(struct adapter *adapter, u32 level)
|
||||
{
|
||||
rtw_hal_set_def_var(adapter, HW_DEF_ODM_DBG_LEVEL, &level);
|
||||
}
|
||||
|
||||
int _rtw_odm_adaptivity_parm_msg(struct adapter *adapter, char *buf, int len)
|
||||
{
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(adapter);
|
||||
DM_ODM_T *odm = &pHalData->odmpriv;
|
||||
|
||||
return snprintf(buf, len,
|
||||
"%10s %16s %8s %10s %11s %14s\n"
|
||||
"0x%-8x %-16d 0x%-6x %-10d %-11u %-14u\n",
|
||||
"TH_L2H_ini", "TH_EDCCA_HL_diff", "IGI_Base", "ForceEDCCA", "AdapEn_RSSI", "IGI_LowerBound",
|
||||
(u8)odm->TH_L2H_ini,
|
||||
odm->TH_EDCCA_HL_diff,
|
||||
odm->IGI_Base,
|
||||
odm->ForceEDCCA,
|
||||
odm->AdapEn_RSSI,
|
||||
odm->IGI_LowerBound
|
||||
RTW_PRINT_SEL(sel, "%15s %9s\n", "AdapEnableState", "Adap_Flag");
|
||||
RTW_PRINT_SEL(sel, "%-15x %-9x\n"
|
||||
, odm->adaptivity_enable
|
||||
, odm->adaptivity_flag
|
||||
);
|
||||
}
|
||||
|
||||
void rtw_odm_adaptivity_parm_msg(struct adapter *adapter)
|
||||
{
|
||||
char buf[256] = {0};
|
||||
|
||||
_rtw_odm_dbg_comp_msg(adapter, buf, 256);
|
||||
DBG_88E_LEVEL(_drv_always_, "\n%s", buf);
|
||||
}
|
||||
|
||||
void rtw_odm_adaptivity_parm_set(struct adapter *adapter, s8 TH_L2H_ini, s8 TH_EDCCA_HL_diff,
|
||||
s8 IGI_Base, bool ForceEDCCA, u8 AdapEn_RSSI, u8 IGI_LowerBound)
|
||||
void rtw_odm_adaptivity_parm_set(_adapter *adapter, s8 th_l2h_ini, s8 th_edcca_hl_diff, s8 th_l2h_ini_mode2, s8 th_edcca_hl_diff_mode2, u8 edcca_enable)
|
||||
{
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(adapter);
|
||||
DM_ODM_T *odm = &pHalData->odmpriv;
|
||||
struct PHY_DM_STRUCT *odm = &pHalData->odmpriv;
|
||||
|
||||
odm->TH_L2H_ini = TH_L2H_ini;
|
||||
odm->TH_EDCCA_HL_diff = TH_EDCCA_HL_diff;
|
||||
odm->IGI_Base = IGI_Base;
|
||||
odm->ForceEDCCA = ForceEDCCA;
|
||||
odm->AdapEn_RSSI = AdapEn_RSSI;
|
||||
odm->IGI_LowerBound = IGI_LowerBound;
|
||||
odm->th_l2h_ini = th_l2h_ini;
|
||||
odm->th_edcca_hl_diff = th_edcca_hl_diff;
|
||||
odm->th_l2h_ini_mode2 = th_l2h_ini_mode2;
|
||||
odm->th_edcca_hl_diff_mode2 = th_edcca_hl_diff_mode2;
|
||||
odm->edcca_enable = edcca_enable;
|
||||
}
|
||||
|
||||
void rtw_odm_get_perpkt_rssi(void *sel, _adapter *adapter)
|
||||
{
|
||||
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter);
|
||||
struct PHY_DM_STRUCT *odm = &(hal_data->odmpriv);
|
||||
|
||||
RTW_PRINT_SEL(sel, "rx_rate = %s, RSSI_A = %d(%%), RSSI_B = %d(%%)\n",
|
||||
HDATA_RATE(odm->rx_rate), odm->RSSI_A, odm->RSSI_B);
|
||||
}
|
||||
|
||||
|
||||
void rtw_odm_acquirespinlock(_adapter *adapter, enum rt_spinlock_type type)
|
||||
{
|
||||
PHAL_DATA_TYPE pHalData = GET_HAL_DATA(adapter);
|
||||
_irqL irqL;
|
||||
|
||||
switch (type) {
|
||||
case RT_IQK_SPINLOCK:
|
||||
_enter_critical_bh(&pHalData->IQKSpinLock, &irqL);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void rtw_odm_releasespinlock(_adapter *adapter, enum rt_spinlock_type type)
|
||||
{
|
||||
PHAL_DATA_TYPE pHalData = GET_HAL_DATA(adapter);
|
||||
_irqL irqL;
|
||||
|
||||
switch (type) {
|
||||
case RT_IQK_SPINLOCK:
|
||||
_exit_critical_bh(&pHalData->IQKSpinLock, &irqL);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
inline u8 rtw_odm_get_dfs_domain(_adapter *adapter)
|
||||
{
|
||||
#ifdef CONFIG_DFS_MASTER
|
||||
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter);
|
||||
struct PHY_DM_STRUCT *pDM_Odm = &(hal_data->odmpriv);
|
||||
|
||||
return pDM_Odm->dfs_region_domain;
|
||||
#else
|
||||
return PHYDM_DFS_DOMAIN_UNKNOWN;
|
||||
#endif
|
||||
}
|
||||
|
||||
inline u8 rtw_odm_dfs_domain_unknown(_adapter *adapter)
|
||||
{
|
||||
#ifdef CONFIG_DFS_MASTER
|
||||
return rtw_odm_get_dfs_domain(adapter) == PHYDM_DFS_DOMAIN_UNKNOWN;
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DFS_MASTER
|
||||
inline VOID rtw_odm_radar_detect_reset(_adapter *adapter)
|
||||
{
|
||||
phydm_radar_detect_reset(GET_ODM(adapter));
|
||||
}
|
||||
|
||||
inline VOID rtw_odm_radar_detect_disable(_adapter *adapter)
|
||||
{
|
||||
phydm_radar_detect_disable(GET_ODM(adapter));
|
||||
}
|
||||
|
||||
/* called after ch, bw is set */
|
||||
inline VOID rtw_odm_radar_detect_enable(_adapter *adapter)
|
||||
{
|
||||
phydm_radar_detect_enable(GET_ODM(adapter));
|
||||
}
|
||||
|
||||
inline BOOLEAN rtw_odm_radar_detect(_adapter *adapter)
|
||||
{
|
||||
return phydm_radar_detect(GET_ODM(adapter));
|
||||
}
|
||||
#endif /* CONFIG_DFS_MASTER */
|
||||
|
||||
void rtw_odm_parse_rx_phy_status_chinfo(union recv_frame *rframe, u8 *phys)
|
||||
{
|
||||
#ifndef DBG_RX_PHYSTATUS_CHINFO
|
||||
#define DBG_RX_PHYSTATUS_CHINFO 0
|
||||
#endif
|
||||
|
||||
#if (ODM_PHY_STATUS_NEW_TYPE_SUPPORT == 1)
|
||||
_adapter *adapter = rframe->u.hdr.adapter;
|
||||
struct PHY_DM_STRUCT *phydm = GET_ODM(adapter);
|
||||
struct rx_pkt_attrib *attrib = &rframe->u.hdr.attrib;
|
||||
u8 *wlanhdr = get_recvframe_data(rframe);
|
||||
|
||||
if (phydm->support_ic_type & ODM_IC_PHY_STATUE_NEW_TYPE) {
|
||||
/*
|
||||
* 8723D:
|
||||
* type_0(CCK)
|
||||
* l_rxsc
|
||||
* is filled with primary channel SC, not real rxsc.
|
||||
* 0:LSC, 1:USC
|
||||
* type_1(OFDM)
|
||||
* rf_mode
|
||||
* RF bandwidth when RX
|
||||
* l_rxsc(legacy), ht_rxsc
|
||||
* see below RXSC N-series
|
||||
* type_2(Not used)
|
||||
*/
|
||||
/*
|
||||
* 8821C, 8822B:
|
||||
* type_0(CCK)
|
||||
* l_rxsc
|
||||
* is filled with primary channel SC, not real rxsc.
|
||||
* 0:LSC, 1:USC
|
||||
* type_1(OFDM)
|
||||
* rf_mode
|
||||
* RF bandwidth when RX
|
||||
* l_rxsc(legacy), ht_rxsc
|
||||
* see below RXSC AC-series
|
||||
* type_2(Not used)
|
||||
*/
|
||||
|
||||
if ((*phys & 0xf) == 0) {
|
||||
struct _phy_status_rpt_jaguar2_type0 *phys_t0 = (struct _phy_status_rpt_jaguar2_type0 *)phys;
|
||||
|
||||
if (DBG_RX_PHYSTATUS_CHINFO) {
|
||||
RTW_PRINT("phys_t%u ta="MAC_FMT" %s, %s(band:%u, ch:%u, l_rxsc:%u)\n"
|
||||
, *phys & 0xf
|
||||
, MAC_ARG(get_ta(wlanhdr))
|
||||
, is_broadcast_mac_addr(get_ra(wlanhdr)) ? "BC" : is_multicast_mac_addr(get_ra(wlanhdr)) ? "MC" : "UC"
|
||||
, HDATA_RATE(attrib->data_rate)
|
||||
, phys_t0->band, phys_t0->channel, phys_t0->rxsc
|
||||
);
|
||||
}
|
||||
|
||||
} else if ((*phys & 0xf) == 1) {
|
||||
struct _phy_status_rpt_jaguar2_type1 *phys_t1 = (struct _phy_status_rpt_jaguar2_type1 *)phys;
|
||||
u8 rxsc = (attrib->data_rate > DESC_RATE11M && attrib->data_rate < DESC_RATEMCS0) ? phys_t1->l_rxsc : phys_t1->ht_rxsc;
|
||||
u8 pkt_cch = 0;
|
||||
u8 pkt_bw = CHANNEL_WIDTH_20;
|
||||
|
||||
#if ODM_IC_11N_SERIES_SUPPORT
|
||||
if (phydm->support_ic_type & ODM_IC_11N_SERIES) {
|
||||
/* RXSC N-series */
|
||||
#define RXSC_DUP 0
|
||||
#define RXSC_LSC 1
|
||||
#define RXSC_USC 2
|
||||
#define RXSC_40M 3
|
||||
|
||||
static const s8 cch_offset_by_rxsc[4] = {0, -2, 2, 0};
|
||||
|
||||
if (phys_t1->rf_mode == 0) {
|
||||
pkt_cch = phys_t1->channel;
|
||||
pkt_bw = CHANNEL_WIDTH_20;
|
||||
} else if (phys_t1->rf_mode == 1) {
|
||||
if (rxsc == RXSC_LSC || rxsc == RXSC_USC) {
|
||||
pkt_cch = phys_t1->channel + cch_offset_by_rxsc[rxsc];
|
||||
pkt_bw = CHANNEL_WIDTH_20;
|
||||
} else if (rxsc == RXSC_40M) {
|
||||
pkt_cch = phys_t1->channel;
|
||||
pkt_bw = CHANNEL_WIDTH_40;
|
||||
}
|
||||
} else
|
||||
rtw_warn_on(1);
|
||||
|
||||
goto type1_end;
|
||||
}
|
||||
#endif /* ODM_IC_11N_SERIES_SUPPORT */
|
||||
|
||||
#if ODM_IC_11AC_SERIES_SUPPORT
|
||||
if (phydm->support_ic_type & ODM_IC_11AC_SERIES) {
|
||||
/* RXSC AC-series */
|
||||
#define RXSC_DUP 0 /* 0: RX from all SC of current rf_mode */
|
||||
|
||||
#define RXSC_LL20M_OF_160M 8 /* 1~8: RX from 20MHz SC */
|
||||
#define RXSC_L20M_OF_160M 6
|
||||
#define RXSC_L20M_OF_80M 4
|
||||
#define RXSC_L20M_OF_40M 2
|
||||
#define RXSC_U20M_OF_40M 1
|
||||
#define RXSC_U20M_OF_80M 3
|
||||
#define RXSC_U20M_OF_160M 5
|
||||
#define RXSC_UU20M_OF_160M 7
|
||||
|
||||
#define RXSC_L40M_OF_160M 12 /* 9~12: RX from 40MHz SC */
|
||||
#define RXSC_L40M_OF_80M 10
|
||||
#define RXSC_U40M_OF_80M 9
|
||||
#define RXSC_U40M_OF_160M 11
|
||||
|
||||
#define RXSC_L80M_OF_160M 14 /* 13~14: RX from 80MHz SC */
|
||||
#define RXSC_U80M_OF_160M 13
|
||||
|
||||
static const s8 cch_offset_by_rxsc[15] = {0, 2, -2, 6, -6, 10, -10, 14, -14, 4, -4, 12, -12, 8, -8};
|
||||
|
||||
if (phys_t1->rf_mode > 3) {
|
||||
/* invalid rf_mode */
|
||||
rtw_warn_on(1);
|
||||
goto type1_end;
|
||||
}
|
||||
|
||||
if (phys_t1->rf_mode == 0) {
|
||||
/* RF 20MHz */
|
||||
pkt_cch = phys_t1->channel;
|
||||
pkt_bw = CHANNEL_WIDTH_20;
|
||||
goto type1_end;
|
||||
}
|
||||
|
||||
if (rxsc == 0) {
|
||||
/* RF and RX with same BW */
|
||||
if (attrib->data_rate >= DESC_RATEMCS0) {
|
||||
pkt_cch = phys_t1->channel;
|
||||
pkt_bw = phys_t1->rf_mode;
|
||||
}
|
||||
goto type1_end;
|
||||
}
|
||||
|
||||
if ((phys_t1->rf_mode == 1 && rxsc >= 1 && rxsc <= 2) /* RF 40MHz, RX 20MHz */
|
||||
|| (phys_t1->rf_mode == 2 && rxsc >= 1 && rxsc <= 4) /* RF 80MHz, RX 20MHz */
|
||||
|| (phys_t1->rf_mode == 3 && rxsc >= 1 && rxsc <= 8) /* RF 160MHz, RX 20MHz */
|
||||
) {
|
||||
pkt_cch = phys_t1->channel + cch_offset_by_rxsc[rxsc];
|
||||
pkt_bw = CHANNEL_WIDTH_20;
|
||||
} else if ((phys_t1->rf_mode == 2 && rxsc >= 9 && rxsc <= 10) /* RF 80MHz, RX 40MHz */
|
||||
|| (phys_t1->rf_mode == 3 && rxsc >= 9 && rxsc <= 12) /* RF 160MHz, RX 40MHz */
|
||||
) {
|
||||
if (attrib->data_rate >= DESC_RATEMCS0) {
|
||||
pkt_cch = phys_t1->channel + cch_offset_by_rxsc[rxsc];
|
||||
pkt_bw = CHANNEL_WIDTH_40;
|
||||
}
|
||||
} else if ((phys_t1->rf_mode == 3 && rxsc >= 13 && rxsc <= 14) /* RF 160MHz, RX 80MHz */
|
||||
) {
|
||||
if (attrib->data_rate >= DESC_RATEMCS0) {
|
||||
pkt_cch = phys_t1->channel + cch_offset_by_rxsc[rxsc];
|
||||
pkt_bw = CHANNEL_WIDTH_80;
|
||||
}
|
||||
} else
|
||||
rtw_warn_on(1);
|
||||
|
||||
}
|
||||
#endif /* ODM_IC_11AC_SERIES_SUPPORT */
|
||||
|
||||
type1_end:
|
||||
if (DBG_RX_PHYSTATUS_CHINFO) {
|
||||
RTW_PRINT("phys_t%u ta="MAC_FMT" %s, %s(band:%u, ch:%u, rf_mode:%u, l_rxsc:%u, ht_rxsc:%u) => %u,%u\n"
|
||||
, *phys & 0xf
|
||||
, MAC_ARG(get_ta(wlanhdr))
|
||||
, is_broadcast_mac_addr(get_ra(wlanhdr)) ? "BC" : is_multicast_mac_addr(get_ra(wlanhdr)) ? "MC" : "UC"
|
||||
, HDATA_RATE(attrib->data_rate)
|
||||
, phys_t1->band, phys_t1->channel, phys_t1->rf_mode, phys_t1->l_rxsc, phys_t1->ht_rxsc
|
||||
, pkt_cch, pkt_bw
|
||||
);
|
||||
}
|
||||
|
||||
/* for now, only return cneter channel of 20MHz packet */
|
||||
if (pkt_cch && pkt_bw == CHANNEL_WIDTH_20)
|
||||
attrib->ch = pkt_cch;
|
||||
|
||||
} else {
|
||||
struct _phy_status_rpt_jaguar2_type2 *phys_t2 = (struct _phy_status_rpt_jaguar2_type2 *)phys;
|
||||
|
||||
if (DBG_RX_PHYSTATUS_CHINFO) {
|
||||
RTW_PRINT("phys_t%u ta="MAC_FMT" %s, %s(band:%u, ch:%u, l_rxsc:%u, ht_rxsc:%u)\n"
|
||||
, *phys & 0xf
|
||||
, MAC_ARG(get_ta(wlanhdr))
|
||||
, is_broadcast_mac_addr(get_ra(wlanhdr)) ? "BC" : is_multicast_mac_addr(get_ra(wlanhdr)) ? "MC" : "UC"
|
||||
, HDATA_RATE(attrib->data_rate)
|
||||
, phys_t2->band, phys_t2->channel, phys_t2->l_rxsc, phys_t2->ht_rxsc
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* (ODM_PHY_STATUS_NEW_TYPE_SUPPORT == 1) */
|
||||
|
||||
}
|
||||
|
||||
|
|
5640
core/rtw_p2p.c
5640
core/rtw_p2p.c
File diff suppressed because it is too large
Load diff
2549
core/rtw_pwrctrl.c
2549
core/rtw_pwrctrl.c
File diff suppressed because it is too large
Load diff
4531
core/rtw_recv.c
Normal file → Executable file
4531
core/rtw_recv.c
Normal file → Executable file
File diff suppressed because it is too large
Load diff
1179
core/rtw_rf.c
1179
core/rtw_rf.c
File diff suppressed because it is too large
Load diff
98
core/rtw_sdio.c
Normal file
98
core/rtw_sdio.c
Normal file
|
@ -0,0 +1,98 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2015 - 2016 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
******************************************************************************/
|
||||
#define _RTW_SDIO_C_
|
||||
|
||||
#include <drv_types.h> /* struct dvobj_priv and etc. */
|
||||
#include <drv_types_sdio.h> /* RTW_SDIO_ADDR_CMD52_GEN */
|
||||
|
||||
/*
|
||||
* Description:
|
||||
* Use SDIO cmd52 or cmd53 to read/write data
|
||||
*
|
||||
* Parameters:
|
||||
* d pointer of device object(struct dvobj_priv)
|
||||
* addr SDIO address, 17 bits
|
||||
* buf buffer for I/O
|
||||
* len length
|
||||
* write 0:read, 1:write
|
||||
* cmd52 0:cmd52, 1:cmd53
|
||||
*
|
||||
* Return:
|
||||
* _SUCCESS I/O ok.
|
||||
* _FAIL I/O fail.
|
||||
*/
|
||||
static u8 sdio_io(struct dvobj_priv *d, u32 addr, void *buf, size_t len, u8 write, u8 cmd52)
|
||||
{
|
||||
int err;
|
||||
|
||||
|
||||
if (cmd52)
|
||||
addr = RTW_SDIO_ADDR_CMD52_GEN(addr);
|
||||
|
||||
if (write)
|
||||
err = d->intf_ops->write(d, addr, buf, len, 0);
|
||||
else
|
||||
err = d->intf_ops->read(d, addr, buf, len, 0);
|
||||
if (err) {
|
||||
RTW_INFO("%s: [ERROR] %s FAIL! error(%d)\n",
|
||||
__FUNCTION__, write ? "write" : "read", err);
|
||||
return _FAIL;
|
||||
}
|
||||
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
u8 rtw_sdio_read_cmd52(struct dvobj_priv *d, u32 addr, void *buf, size_t len)
|
||||
{
|
||||
return sdio_io(d, addr, buf, len, 0, 1);
|
||||
}
|
||||
|
||||
u8 rtw_sdio_read_cmd53(struct dvobj_priv *d, u32 addr, void *buf, size_t len)
|
||||
{
|
||||
return sdio_io(d, addr, buf, len, 0, 0);
|
||||
}
|
||||
|
||||
u8 rtw_sdio_write_cmd52(struct dvobj_priv *d, u32 addr, void *buf, size_t len)
|
||||
{
|
||||
return sdio_io(d, addr, buf, len, 1, 1);
|
||||
}
|
||||
|
||||
u8 rtw_sdio_write_cmd53(struct dvobj_priv *d, u32 addr, void *buf, size_t len)
|
||||
{
|
||||
return sdio_io(d, addr, buf, len, 1, 0);
|
||||
}
|
||||
|
||||
u8 rtw_sdio_f0_read(struct dvobj_priv *d, u32 addr, void *buf, size_t len)
|
||||
{
|
||||
int err;
|
||||
u8 ret;
|
||||
|
||||
|
||||
ret = _SUCCESS;
|
||||
addr = RTW_SDIO_ADDR_F0_GEN(addr);
|
||||
|
||||
err = d->intf_ops->read(d, addr, buf, len, 0);
|
||||
if (err) {
|
||||
RTW_INFO("%s: [ERROR] Read f0 register FAIL!\n", __FUNCTION__);
|
||||
ret = _FAIL;
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
2343
core/rtw_security.c
2343
core/rtw_security.c
File diff suppressed because it is too large
Load diff
|
@ -18,90 +18,102 @@
|
|||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include<rtw_sreset.h>
|
||||
#include <drv_types.h>
|
||||
#include <hal_data.h>
|
||||
#include <rtw_sreset.h>
|
||||
|
||||
void sreset_init_value(struct adapter *padapter)
|
||||
void sreset_init_value(_adapter *padapter)
|
||||
{
|
||||
#if defined(DBG_CONFIG_ERROR_DETECT)
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
struct sreset_priv *psrtpriv = &pHalData->srestpriv;
|
||||
|
||||
_rtw_mutex_init(&psrtpriv->silentreset_mutex);
|
||||
psrtpriv->silent_reset_inprogress = false;
|
||||
psrtpriv->silent_reset_inprogress = _FALSE;
|
||||
psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS;
|
||||
psrtpriv->last_tx_time =0;
|
||||
psrtpriv->last_tx_complete_time =0;
|
||||
psrtpriv->last_tx_time = 0;
|
||||
psrtpriv->last_tx_complete_time = 0;
|
||||
#endif
|
||||
}
|
||||
void sreset_reset_value(struct adapter *padapter)
|
||||
void sreset_reset_value(_adapter *padapter)
|
||||
{
|
||||
#if defined(DBG_CONFIG_ERROR_DETECT)
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
struct sreset_priv *psrtpriv = &pHalData->srestpriv;
|
||||
|
||||
/* psrtpriv->silent_reset_inprogress = false; */
|
||||
psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS;
|
||||
psrtpriv->last_tx_time =0;
|
||||
psrtpriv->last_tx_complete_time =0;
|
||||
psrtpriv->last_tx_time = 0;
|
||||
psrtpriv->last_tx_complete_time = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
u8 sreset_get_wifi_status(struct adapter *padapter)
|
||||
u8 sreset_get_wifi_status(_adapter *padapter)
|
||||
{
|
||||
#if defined(DBG_CONFIG_ERROR_DETECT)
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
struct sreset_priv *psrtpriv = &pHalData->srestpriv;
|
||||
|
||||
u8 status = WIFI_STATUS_SUCCESS;
|
||||
u32 val32 = 0;
|
||||
unsigned long irqL;
|
||||
if (psrtpriv->silent_reset_inprogress == true)
|
||||
{
|
||||
_irqL irqL;
|
||||
if (psrtpriv->silent_reset_inprogress == _TRUE)
|
||||
return status;
|
||||
}
|
||||
val32 =rtw_read32(padapter, REG_TXDMA_STATUS);
|
||||
if (val32 == 0xeaeaeaea) {
|
||||
val32 = rtw_read32(padapter, REG_TXDMA_STATUS);
|
||||
if (val32 == 0xeaeaeaea)
|
||||
psrtpriv->Wifi_Error_Status = WIFI_IF_NOT_EXIST;
|
||||
}
|
||||
else if (val32!=0) {
|
||||
DBG_8192C("txdmastatu(%x)\n", val32);
|
||||
else if (val32 != 0) {
|
||||
RTW_INFO("txdmastatu(%x)\n", val32);
|
||||
psrtpriv->Wifi_Error_Status = WIFI_MAC_TXDMA_ERROR;
|
||||
}
|
||||
|
||||
if (WIFI_STATUS_SUCCESS !=psrtpriv->Wifi_Error_Status)
|
||||
{
|
||||
DBG_8192C("==>%s error_status(0x%x)\n", __FUNCTION__, psrtpriv->Wifi_Error_Status);
|
||||
status = (psrtpriv->Wifi_Error_Status &( ~(USB_READ_PORT_FAIL|USB_WRITE_PORT_FAIL)));
|
||||
if (WIFI_STATUS_SUCCESS != psrtpriv->Wifi_Error_Status) {
|
||||
RTW_INFO("==>%s error_status(0x%x)\n", __FUNCTION__, psrtpriv->Wifi_Error_Status);
|
||||
status = (psrtpriv->Wifi_Error_Status & (~(USB_READ_PORT_FAIL | USB_WRITE_PORT_FAIL)));
|
||||
}
|
||||
DBG_8192C("==> %s wifi_status(0x%x)\n", __FUNCTION__, status);
|
||||
RTW_INFO("==> %s wifi_status(0x%x)\n", __FUNCTION__, status);
|
||||
|
||||
/* status restore */
|
||||
psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS;
|
||||
|
||||
return status;
|
||||
#else
|
||||
return WIFI_STATUS_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
|
||||
void sreset_set_wifi_error_status(struct adapter *padapter, u32 status)
|
||||
void sreset_set_wifi_error_status(_adapter *padapter, u32 status)
|
||||
{
|
||||
#if defined(DBG_CONFIG_ERROR_DETECT)
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
pHalData->srestpriv.Wifi_Error_Status = status;
|
||||
#endif
|
||||
}
|
||||
|
||||
void sreset_set_trigger_point(struct adapter *padapter, s32 tgp)
|
||||
void sreset_set_trigger_point(_adapter *padapter, s32 tgp)
|
||||
{
|
||||
#if defined(DBG_CONFIG_ERROR_DETECT)
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
pHalData->srestpriv.dbg_trigger_point = tgp;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool sreset_inprogress(struct adapter *padapter)
|
||||
bool sreset_inprogress(_adapter *padapter)
|
||||
{
|
||||
#if defined(DBG_CONFIG_ERROR_RESET)
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
|
||||
return pHalData->srestpriv.silent_reset_inprogress;
|
||||
#else
|
||||
return _FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void sreset_restore_security_station(struct adapter *padapter)
|
||||
void sreset_restore_security_station(_adapter *padapter)
|
||||
{
|
||||
u8 EntryId = 0;
|
||||
struct mlme_priv *mlmepriv = &padapter->mlmepriv;
|
||||
struct sta_priv * pstapriv = &padapter->stapriv;
|
||||
struct sta_priv *pstapriv = &padapter->stapriv;
|
||||
struct sta_info *psta;
|
||||
struct security_priv* psecuritypriv =&(padapter->securitypriv);
|
||||
struct security_priv *psecuritypriv = &(padapter->securitypriv);
|
||||
struct mlme_ext_info *pmlmeinfo = &padapter->mlmeextpriv.mlmext_info;
|
||||
|
||||
{
|
||||
|
@ -109,43 +121,78 @@ static void sreset_restore_security_station(struct adapter *padapter)
|
|||
|
||||
if (pmlmeinfo->auth_algo == dot11AuthAlgrthm_8021X) {
|
||||
val8 = 0xcc;
|
||||
} else {
|
||||
#ifdef CONFIG_WAPI_SUPPORT
|
||||
} else if (padapter->wapiInfo.bWapiEnable && pmlmeinfo->auth_algo == dot11AuthAlgrthm_WAPI) {
|
||||
/* Disable TxUseDefaultKey, RxUseDefaultKey, RxBroadcastUseDefaultKey. */
|
||||
val8 = 0x4c;
|
||||
#endif
|
||||
} else
|
||||
val8 = 0xcf;
|
||||
}
|
||||
rtw_hal_set_hwreg(padapter, HW_VAR_SEC_CFG, (u8 *)(&val8));
|
||||
}
|
||||
|
||||
if ((padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) ||
|
||||
(padapter->securitypriv.dot11PrivacyAlgrthm == _AES_))
|
||||
{
|
||||
psta = rtw_get_stainfo(pstapriv, get_bssid(mlmepriv));
|
||||
if (psta == NULL) {
|
||||
/* DEBUG_ERR( ("Set wpa_set_encryption: Obtain Sta_info fail\n")); */
|
||||
#if 0
|
||||
if ((padapter->securitypriv.dot11PrivacyAlgrthm == _WEP40_) ||
|
||||
(padapter->securitypriv.dot11PrivacyAlgrthm == _WEP104_)) {
|
||||
|
||||
for (EntryId = 0; EntryId < 4; EntryId++) {
|
||||
if (EntryId == psecuritypriv->dot11PrivacyKeyIndex)
|
||||
rtw_set_key(padapter, &padapter->securitypriv, EntryId, 1, _FALSE);
|
||||
else
|
||||
rtw_set_key(padapter, &padapter->securitypriv, EntryId, 0, _FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* pairwise key */
|
||||
rtw_setstakey_cmd(padapter, (unsigned char *)psta, true, false);
|
||||
/* group key */
|
||||
rtw_set_key(padapter,&padapter->securitypriv, padapter->securitypriv.dot118021XGrpKeyid, 0, false);
|
||||
|
||||
} else
|
||||
#endif
|
||||
if ((padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) ||
|
||||
(padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)) {
|
||||
psta = rtw_get_stainfo(pstapriv, get_bssid(mlmepriv));
|
||||
if (psta == NULL) {
|
||||
/* DEBUG_ERR( ("Set wpa_set_encryption: Obtain Sta_info fail\n")); */
|
||||
} else {
|
||||
/* pairwise key */
|
||||
rtw_setstakey_cmd(padapter, psta, UNICAST_KEY, _FALSE);
|
||||
/* group key */
|
||||
rtw_set_key(padapter, &padapter->securitypriv, padapter->securitypriv.dot118021XGrpKeyid, 0, _FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void sreset_restore_network_station(struct adapter *padapter)
|
||||
void sreset_restore_network_station(_adapter *padapter)
|
||||
{
|
||||
struct mlme_priv *mlmepriv = &padapter->mlmepriv;
|
||||
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
||||
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
|
||||
u8 doiqk = _FALSE;
|
||||
|
||||
rtw_setopmode_cmd(padapter, Ndis802_11Infrastructure, false);
|
||||
#if 0
|
||||
{
|
||||
/* ======================================================= */
|
||||
/* reset related register of Beacon control */
|
||||
|
||||
/* set MSR to nolink */
|
||||
Set_MSR(padapter, _HW_STATE_NOLINK_);
|
||||
/* reject all data frame */
|
||||
rtw_write16(padapter, REG_RXFLTMAP2, 0x00);
|
||||
/* reset TSF */
|
||||
rtw_write8(padapter, REG_DUAL_TSF_RST, (BIT(0) | BIT(1)));
|
||||
|
||||
/* disable update TSF */
|
||||
SetBcnCtrlReg(padapter, BIT(4), 0);
|
||||
|
||||
/* ======================================================= */
|
||||
}
|
||||
#endif
|
||||
|
||||
rtw_setopmode_cmd(padapter, Ndis802_11Infrastructure, _FALSE);
|
||||
|
||||
{
|
||||
u8 threshold;
|
||||
/* TH =1 => means that invalidate usb rx aggregation */
|
||||
/* TH =0 => means that validate usb rx aggregation, use init value. */
|
||||
#ifdef CONFIG_USB_HCI
|
||||
/* 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)
|
||||
if (padapter->registrypriv.wifi_spec == 1)
|
||||
threshold = 1;
|
||||
else
|
||||
threshold = 0;
|
||||
|
@ -154,12 +201,18 @@ static void sreset_restore_network_station(struct adapter *padapter)
|
|||
threshold = 1;
|
||||
rtw_hal_set_hwreg(padapter, HW_VAR_RXDMA_AGG_PG_TH, (u8 *)(&threshold));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
doiqk = _TRUE;
|
||||
rtw_hal_set_hwreg(padapter, HW_VAR_DO_IQK , &doiqk);
|
||||
|
||||
set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
|
||||
|
||||
doiqk = _FALSE;
|
||||
rtw_hal_set_hwreg(padapter , HW_VAR_DO_IQK , &doiqk);
|
||||
/* disable dynamic functions, such as high power, DIG */
|
||||
/* Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, false); */
|
||||
/*rtw_phydm_func_disable_all(padapter);*/
|
||||
|
||||
rtw_hal_set_hwreg(padapter, HW_VAR_BSSID, pmlmeinfo->network.MacAddress);
|
||||
|
||||
|
@ -172,31 +225,31 @@ static void sreset_restore_network_station(struct adapter *padapter)
|
|||
|
||||
mlmeext_joinbss_event_callback(padapter, 1);
|
||||
/* restore Sequence No. */
|
||||
rtw_write8(padapter, 0x4dc, padapter->xmitpriv.nqos_ssn);
|
||||
rtw_hal_set_hwreg(padapter, HW_VAR_RESTORE_HW_SEQ, 0);
|
||||
|
||||
sreset_restore_security_station(padapter);
|
||||
}
|
||||
|
||||
static void sreset_restore_network_status(struct adapter *padapter)
|
||||
|
||||
void sreset_restore_network_status(_adapter *padapter)
|
||||
{
|
||||
struct mlme_priv *mlmepriv = &padapter->mlmepriv;
|
||||
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
||||
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
|
||||
|
||||
if (check_fwstate(mlmepriv, WIFI_STATION_STATE)) {
|
||||
DBG_88E(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_STATION_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(mlmepriv));
|
||||
RTW_INFO(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_STATION_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(mlmepriv));
|
||||
sreset_restore_network_station(padapter);
|
||||
} else if (check_fwstate(mlmepriv, WIFI_AP_STATE)) {
|
||||
DBG_88E(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_AP_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(mlmepriv));
|
||||
RTW_INFO(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_AP_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(mlmepriv));
|
||||
rtw_ap_restore_network(padapter);
|
||||
} else if (check_fwstate(mlmepriv, WIFI_ADHOC_STATE)) {
|
||||
DBG_88E(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_ADHOC_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(mlmepriv));
|
||||
} else {
|
||||
DBG_88E(FUNC_ADPT_FMT" fwstate:0x%08x - ???\n", FUNC_ADPT_ARG(padapter), get_fwstate(mlmepriv));
|
||||
}
|
||||
} else if (check_fwstate(mlmepriv, WIFI_ADHOC_STATE))
|
||||
RTW_INFO(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_ADHOC_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(mlmepriv));
|
||||
else
|
||||
RTW_INFO(FUNC_ADPT_FMT" fwstate:0x%08x - ???\n", FUNC_ADPT_ARG(padapter), get_fwstate(mlmepriv));
|
||||
}
|
||||
|
||||
static void sreset_stop_adapter(struct adapter *padapter)
|
||||
void sreset_stop_adapter(_adapter *padapter)
|
||||
{
|
||||
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
|
||||
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
|
||||
|
@ -204,28 +257,28 @@ static void sreset_stop_adapter(struct adapter *padapter)
|
|||
if (padapter == NULL)
|
||||
return;
|
||||
|
||||
DBG_88E(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter));
|
||||
RTW_INFO(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter));
|
||||
|
||||
if (!rtw_netif_queue_stopped(padapter->pnetdev))
|
||||
rtw_netif_stop_queue(padapter->pnetdev);
|
||||
rtw_netif_stop_queue(padapter->pnetdev);
|
||||
|
||||
rtw_cancel_all_timer(padapter);
|
||||
|
||||
/* TODO: OS and HCI independent */
|
||||
#if defined(PLATFORM_LINUX) && defined(CONFIG_USB_HCI)
|
||||
tasklet_kill(&pxmitpriv->xmit_tasklet);
|
||||
#endif
|
||||
|
||||
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY))
|
||||
rtw_scan_abort(padapter);
|
||||
|
||||
if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING))
|
||||
{
|
||||
rtw_set_roaming(padapter, 0);
|
||||
if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) {
|
||||
rtw_set_to_roam(padapter, 0);
|
||||
_rtw_join_timeout_handler(padapter);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void sreset_start_adapter(struct adapter *padapter)
|
||||
void sreset_start_adapter(_adapter *padapter)
|
||||
{
|
||||
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
|
||||
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
|
||||
|
@ -233,51 +286,61 @@ static void sreset_start_adapter(struct adapter *padapter)
|
|||
if (padapter == NULL)
|
||||
return;
|
||||
|
||||
DBG_88E(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter));
|
||||
RTW_INFO(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter));
|
||||
|
||||
if (check_fwstate(pmlmepriv, _FW_LINKED)) {
|
||||
if (check_fwstate(pmlmepriv, _FW_LINKED))
|
||||
sreset_restore_network_status(padapter);
|
||||
}
|
||||
|
||||
/* TODO: OS and HCI independent */
|
||||
#if defined(PLATFORM_LINUX) && defined(CONFIG_USB_HCI)
|
||||
tasklet_hi_schedule(&pxmitpriv->xmit_tasklet);
|
||||
#endif
|
||||
|
||||
_set_timer(&padapter->mlmepriv.dynamic_chk_timer, 2000);
|
||||
|
||||
if (rtw_netif_queue_stopped(padapter->pnetdev))
|
||||
rtw_netif_wake_queue(padapter->pnetdev);
|
||||
if (is_primary_adapter(padapter))
|
||||
_set_timer(&adapter_to_dvobj(padapter)->dynamic_chk_timer, 2000);
|
||||
|
||||
rtw_netif_wake_queue(padapter->pnetdev);
|
||||
}
|
||||
|
||||
void sreset_reset(struct adapter *padapter)
|
||||
void sreset_reset(_adapter *padapter)
|
||||
{
|
||||
#ifdef DBG_CONFIG_ERROR_RESET
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
struct sreset_priv *psrtpriv = &pHalData->srestpriv;
|
||||
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
|
||||
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
|
||||
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
|
||||
unsigned long irqL;
|
||||
u32 start = jiffies;
|
||||
_irqL irqL;
|
||||
u32 start = rtw_get_current_time();
|
||||
struct dvobj_priv *psdpriv = padapter->dvobj;
|
||||
struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
|
||||
|
||||
DBG_88E("%s\n", __FUNCTION__);
|
||||
RTW_INFO("%s\n", __FUNCTION__);
|
||||
|
||||
psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS;
|
||||
|
||||
|
||||
#ifdef CONFIG_LPS
|
||||
rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, "SRESET");
|
||||
#endif/* #ifdef CONFIG_LPS */
|
||||
|
||||
_enter_pwrlock(&pwrpriv->lock);
|
||||
|
||||
psrtpriv->silent_reset_inprogress = true;
|
||||
psrtpriv->silent_reset_inprogress = _TRUE;
|
||||
pwrpriv->change_rfpwrstate = rf_off;
|
||||
|
||||
sreset_stop_adapter(padapter);
|
||||
|
||||
rtw_mi_sreset_adapter_hdl(padapter, _FALSE);/*sreset_stop_adapter*/
|
||||
#ifdef CONFIG_IPS
|
||||
_ips_enter(padapter);
|
||||
_ips_leave(padapter);
|
||||
#endif
|
||||
rtw_mi_sreset_adapter_hdl(padapter, _TRUE);/*sreset_start_adapter*/
|
||||
|
||||
sreset_start_adapter(padapter);
|
||||
|
||||
psrtpriv->silent_reset_inprogress = false;
|
||||
psrtpriv->silent_reset_inprogress = _FALSE;
|
||||
|
||||
_exit_pwrlock(&pwrpriv->lock);
|
||||
|
||||
DBG_88E("%s done in %d ms\n", __FUNCTION__, rtw_get_passing_time_ms(start));
|
||||
RTW_INFO("%s done in %d ms\n", __FUNCTION__, rtw_get_passing_time_ms(start));
|
||||
pdbgpriv->dbg_sreset_cnt++;
|
||||
#endif
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
3332
core/rtw_tdls.c
Normal file
3332
core/rtw_tdls.c
Normal file
File diff suppressed because it is too large
Load diff
803
core/rtw_vht.c
Normal file
803
core/rtw_vht.c
Normal file
|
@ -0,0 +1,803 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
#define _RTW_VHT_C
|
||||
|
||||
#include <drv_types.h>
|
||||
#include <hal_data.h>
|
||||
|
||||
#ifdef CONFIG_80211AC_VHT
|
||||
/* 20/40/80, ShortGI, MCS Rate */
|
||||
const u16 VHT_MCS_DATA_RATE[3][2][30] = {
|
||||
{ {
|
||||
13, 26, 39, 52, 78, 104, 117, 130, 156, 156,
|
||||
26, 52, 78, 104, 156, 208, 234, 260, 312, 312,
|
||||
39, 78, 117, 156, 234, 312, 351, 390, 468, 520
|
||||
}, /* Long GI, 20MHz */
|
||||
{
|
||||
14, 29, 43, 58, 87, 116, 130, 144, 173, 173,
|
||||
29, 58, 87, 116, 173, 231, 260, 289, 347, 347,
|
||||
43, 87, 130, 173, 260, 347, 390, 433, 520, 578
|
||||
}
|
||||
}, /* Short GI, 20MHz */
|
||||
{ {
|
||||
27, 54, 81, 108, 162, 216, 243, 270, 324, 360,
|
||||
54, 108, 162, 216, 324, 432, 486, 540, 648, 720,
|
||||
81, 162, 243, 324, 486, 648, 729, 810, 972, 1080
|
||||
}, /* Long GI, 40MHz */
|
||||
{
|
||||
30, 60, 90, 120, 180, 240, 270, 300, 360, 400,
|
||||
60, 120, 180, 240, 360, 480, 540, 600, 720, 800,
|
||||
90, 180, 270, 360, 540, 720, 810, 900, 1080, 1200
|
||||
}
|
||||
}, /* Short GI, 40MHz */
|
||||
{ {
|
||||
59, 117, 176, 234, 351, 468, 527, 585, 702, 780,
|
||||
117, 234, 351, 468, 702, 936, 1053, 1170, 1404, 1560,
|
||||
176, 351, 527, 702, 1053, 1404, 1580, 1755, 2106, 2340
|
||||
}, /* Long GI, 80MHz */
|
||||
{
|
||||
65, 130, 195, 260, 390, 520, 585, 650, 780, 867,
|
||||
130, 260, 390, 520, 780, 1040, 1170, 1300, 1560, 1734,
|
||||
195, 390, 585, 780, 1170, 1560, 1755, 1950, 2340, 2600
|
||||
}
|
||||
} /* Short GI, 80MHz */
|
||||
};
|
||||
|
||||
u8 rtw_get_vht_highest_rate(u8 *pvht_mcs_map)
|
||||
{
|
||||
u8 i, j;
|
||||
u8 bit_map;
|
||||
u8 vht_mcs_rate = 0;
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
if (pvht_mcs_map[i] != 0xff) {
|
||||
for (j = 0; j < 8; j += 2) {
|
||||
bit_map = (pvht_mcs_map[i] >> j) & 3;
|
||||
|
||||
if (bit_map != 3)
|
||||
vht_mcs_rate = MGN_VHT1SS_MCS7 + 10 * j / 2 + i * 40 + bit_map; /* VHT rate indications begin from 0x90 */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* RTW_INFO("HighestVHTMCSRate is %x\n", vht_mcs_rate); */
|
||||
return vht_mcs_rate;
|
||||
}
|
||||
|
||||
u8 rtw_vht_mcsmap_to_nss(u8 *pvht_mcs_map)
|
||||
{
|
||||
u8 i, j;
|
||||
u8 bit_map;
|
||||
u8 nss = 0;
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
if (pvht_mcs_map[i] != 0xff) {
|
||||
for (j = 0; j < 8; j += 2) {
|
||||
bit_map = (pvht_mcs_map[i] >> j) & 3;
|
||||
|
||||
if (bit_map != 3)
|
||||
nss++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* RTW_INFO("%s : %dSS\n", __FUNCTION__, nss); */
|
||||
return nss;
|
||||
}
|
||||
|
||||
void rtw_vht_nss_to_mcsmap(u8 nss, u8 *target_mcs_map, u8 *cur_mcs_map)
|
||||
{
|
||||
u8 i, j;
|
||||
u8 cur_rate, target_rate;
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
target_mcs_map[i] = 0;
|
||||
for (j = 0; j < 8; j += 2) {
|
||||
cur_rate = (cur_mcs_map[i] >> j) & 3;
|
||||
if (cur_rate == 3) /* 0x3 indicates not supported that num of SS */
|
||||
target_rate = 3;
|
||||
else if (nss <= ((j / 2) + i * 4))
|
||||
target_rate = 3;
|
||||
else
|
||||
target_rate = cur_rate;
|
||||
|
||||
target_mcs_map[i] |= (target_rate << j);
|
||||
}
|
||||
}
|
||||
|
||||
/* RTW_INFO("%s : %dSS\n", __FUNCTION__, nss); */
|
||||
}
|
||||
|
||||
u16 rtw_vht_mcs_to_data_rate(u8 bw, u8 short_GI, u8 vht_mcs_rate)
|
||||
{
|
||||
if (vht_mcs_rate > MGN_VHT3SS_MCS9)
|
||||
vht_mcs_rate = MGN_VHT3SS_MCS9;
|
||||
/* RTW_INFO("bw=%d, short_GI=%d, ((vht_mcs_rate - MGN_VHT1SS_MCS0)&0x3f)=%d\n", bw, short_GI, ((vht_mcs_rate - MGN_VHT1SS_MCS0)&0x3f)); */
|
||||
return VHT_MCS_DATA_RATE[bw][short_GI][((vht_mcs_rate - MGN_VHT1SS_MCS0) & 0x3f)];
|
||||
}
|
||||
|
||||
void rtw_vht_use_default_setting(_adapter *padapter)
|
||||
{
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
struct vht_priv *pvhtpriv = &pmlmepriv->vhtpriv;
|
||||
struct registry_priv *pregistrypriv = &padapter->registrypriv;
|
||||
BOOLEAN bHwLDPCSupport = _FALSE, bHwSTBCSupport = _FALSE;
|
||||
#ifdef CONFIG_BEAMFORMING
|
||||
BOOLEAN bHwSupportBeamformer = _FALSE, bHwSupportBeamformee = _FALSE;
|
||||
u8 mu_bfer, mu_bfee;
|
||||
#endif /* CONFIG_BEAMFORMING */
|
||||
u8 rf_type = 0;
|
||||
u8 tx_nss, rx_nss;
|
||||
struct hal_spec_t *hal_spec = GET_HAL_SPEC(padapter);
|
||||
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
|
||||
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
|
||||
pvhtpriv->sgi_80m = TEST_FLAG(pregistrypriv->short_gi, BIT2) ? _TRUE : _FALSE;
|
||||
|
||||
/* LDPC support */
|
||||
rtw_hal_get_def_var(padapter, HAL_DEF_RX_LDPC, (u8 *)&bHwLDPCSupport);
|
||||
CLEAR_FLAGS(pvhtpriv->ldpc_cap);
|
||||
if (bHwLDPCSupport) {
|
||||
if (TEST_FLAG(pregistrypriv->ldpc_cap, BIT0))
|
||||
SET_FLAG(pvhtpriv->ldpc_cap, LDPC_VHT_ENABLE_RX);
|
||||
}
|
||||
rtw_hal_get_def_var(padapter, HAL_DEF_TX_LDPC, (u8 *)&bHwLDPCSupport);
|
||||
if (bHwLDPCSupport) {
|
||||
if (TEST_FLAG(pregistrypriv->ldpc_cap, BIT1))
|
||||
SET_FLAG(pvhtpriv->ldpc_cap, LDPC_VHT_ENABLE_TX);
|
||||
}
|
||||
if (pvhtpriv->ldpc_cap)
|
||||
RTW_INFO("[VHT] Support LDPC = 0x%02X\n", pvhtpriv->ldpc_cap);
|
||||
|
||||
/* STBC */
|
||||
rtw_hal_get_def_var(padapter, HAL_DEF_TX_STBC, (u8 *)&bHwSTBCSupport);
|
||||
CLEAR_FLAGS(pvhtpriv->stbc_cap);
|
||||
if (bHwSTBCSupport) {
|
||||
if (TEST_FLAG(pregistrypriv->stbc_cap, BIT1))
|
||||
SET_FLAG(pvhtpriv->stbc_cap, STBC_VHT_ENABLE_TX);
|
||||
}
|
||||
rtw_hal_get_def_var(padapter, HAL_DEF_RX_STBC, (u8 *)&bHwSTBCSupport);
|
||||
if (bHwSTBCSupport) {
|
||||
if (TEST_FLAG(pregistrypriv->stbc_cap, BIT0))
|
||||
SET_FLAG(pvhtpriv->stbc_cap, STBC_VHT_ENABLE_RX);
|
||||
}
|
||||
if (pvhtpriv->stbc_cap)
|
||||
RTW_INFO("[VHT] Support STBC = 0x%02X\n", pvhtpriv->stbc_cap);
|
||||
|
||||
/* Beamforming setting */
|
||||
CLEAR_FLAGS(pvhtpriv->beamform_cap);
|
||||
#ifdef CONFIG_BEAMFORMING
|
||||
rtw_hal_get_def_var(padapter, HAL_DEF_EXPLICIT_BEAMFORMER, (u8 *)&bHwSupportBeamformer);
|
||||
rtw_hal_get_def_var(padapter, HAL_DEF_EXPLICIT_BEAMFORMEE, (u8 *)&bHwSupportBeamformee);
|
||||
mu_bfer = _FALSE;
|
||||
mu_bfee = _FALSE;
|
||||
rtw_hal_get_def_var(padapter, HAL_DEF_VHT_MU_BEAMFORMER, &mu_bfer);
|
||||
rtw_hal_get_def_var(padapter, HAL_DEF_VHT_MU_BEAMFORMEE, &mu_bfee);
|
||||
if (TEST_FLAG(pregistrypriv->beamform_cap, BIT0) && bHwSupportBeamformer) {
|
||||
#ifdef CONFIG_CONCURRENT_MODE
|
||||
if ((pmlmeinfo->state & 0x03) == WIFI_FW_AP_STATE) {
|
||||
SET_FLAG(pvhtpriv->beamform_cap, BEAMFORMING_VHT_BEAMFORMER_ENABLE);
|
||||
RTW_INFO("[VHT] CONCURRENT AP Support Beamformer\n");
|
||||
if (TEST_FLAG(pregistrypriv->beamform_cap, BIT(2))
|
||||
&& (_TRUE == mu_bfer)) {
|
||||
SET_FLAG(pvhtpriv->beamform_cap, BEAMFORMING_VHT_MU_MIMO_AP_ENABLE);
|
||||
RTW_INFO("[VHT] Support MU-MIMO AP\n");
|
||||
}
|
||||
} else
|
||||
RTW_INFO("[VHT] CONCURRENT not AP ;not allow Support Beamformer\n");
|
||||
#else
|
||||
SET_FLAG(pvhtpriv->beamform_cap, BEAMFORMING_VHT_BEAMFORMER_ENABLE);
|
||||
RTW_INFO("[VHT] Support Beamformer\n");
|
||||
if (TEST_FLAG(pregistrypriv->beamform_cap, BIT(2))
|
||||
&& (_TRUE == mu_bfer)
|
||||
&& ((pmlmeinfo->state & 0x03) == WIFI_FW_AP_STATE)) {
|
||||
SET_FLAG(pvhtpriv->beamform_cap, BEAMFORMING_VHT_MU_MIMO_AP_ENABLE);
|
||||
RTW_INFO("[VHT] Support MU-MIMO AP\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (TEST_FLAG(pregistrypriv->beamform_cap, BIT1) && bHwSupportBeamformee) {
|
||||
SET_FLAG(pvhtpriv->beamform_cap, BEAMFORMING_VHT_BEAMFORMEE_ENABLE);
|
||||
RTW_INFO("[VHT] Support Beamformee\n");
|
||||
if (TEST_FLAG(pregistrypriv->beamform_cap, BIT(3))
|
||||
&& (_TRUE == mu_bfee)
|
||||
&& ((pmlmeinfo->state & 0x03) != WIFI_FW_AP_STATE)) {
|
||||
SET_FLAG(pvhtpriv->beamform_cap, BEAMFORMING_VHT_MU_MIMO_STA_ENABLE);
|
||||
RTW_INFO("[VHT] Support MU-MIMO STA\n");
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_BEAMFORMING */
|
||||
|
||||
pvhtpriv->ampdu_len = pregistrypriv->ampdu_factor;
|
||||
|
||||
rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type));
|
||||
tx_nss = rtw_min(rf_type_to_rf_tx_cnt(rf_type), hal_spec->tx_nss_num);
|
||||
rx_nss = rtw_min(rf_type_to_rf_rx_cnt(rf_type), hal_spec->rx_nss_num);
|
||||
|
||||
/* for now, vhtpriv.vht_mcs_map comes from RX NSS */
|
||||
rtw_vht_nss_to_mcsmap(rx_nss, pvhtpriv->vht_mcs_map, pregistrypriv->vht_rx_mcs_map);
|
||||
pvhtpriv->vht_highest_rate = rtw_get_vht_highest_rate(pvhtpriv->vht_mcs_map);
|
||||
}
|
||||
|
||||
u64 rtw_vht_mcs_map_to_bitmap(u8 *mcs_map, u8 nss)
|
||||
{
|
||||
u8 i, j, tmp;
|
||||
u64 bitmap = 0;
|
||||
u8 bits_nss = nss * 2;
|
||||
|
||||
for (i = j = 0; i < bits_nss; i += 2, j += 10) {
|
||||
/* every two bits means single sptial stream */
|
||||
tmp = (mcs_map[i / 8] >> i) & 3;
|
||||
|
||||
switch (tmp) {
|
||||
case 2:
|
||||
bitmap = bitmap | (0x03ff << j);
|
||||
break;
|
||||
case 1:
|
||||
bitmap = bitmap | (0x01ff << j);
|
||||
break;
|
||||
case 0:
|
||||
bitmap = bitmap | (0x00ff << j);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
RTW_INFO("vht_mcs_map=%02x %02x, nss=%u => bitmap=%016llx\n"
|
||||
, mcs_map[0], mcs_map[1], nss, bitmap);
|
||||
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
void update_sta_vht_info_apmode(_adapter *padapter, PVOID sta)
|
||||
{
|
||||
struct sta_info *psta = (struct sta_info *)sta;
|
||||
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
|
||||
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
||||
struct vht_priv *pvhtpriv_ap = &pmlmepriv->vhtpriv;
|
||||
struct vht_priv *pvhtpriv_sta = &psta->vhtpriv;
|
||||
struct ht_priv *phtpriv_sta = &psta->htpriv;
|
||||
u8 cur_ldpc_cap = 0, cur_stbc_cap = 0, bw_mode = 0;
|
||||
u16 cur_beamform_cap = 0;
|
||||
u8 *pcap_mcs;
|
||||
|
||||
if (pvhtpriv_sta->vht_option == _FALSE)
|
||||
return;
|
||||
|
||||
bw_mode = GET_VHT_OPERATING_MODE_FIELD_CHNL_WIDTH(&pvhtpriv_sta->vht_op_mode_notify);
|
||||
|
||||
/* if (bw_mode > psta->bw_mode) */
|
||||
psta->bw_mode = bw_mode;
|
||||
|
||||
/* B4 Rx LDPC */
|
||||
if (TEST_FLAG(pvhtpriv_ap->ldpc_cap, LDPC_VHT_ENABLE_TX) &&
|
||||
GET_VHT_CAPABILITY_ELE_RX_LDPC(pvhtpriv_sta->vht_cap)) {
|
||||
SET_FLAG(cur_ldpc_cap, (LDPC_VHT_ENABLE_TX | LDPC_VHT_CAP_TX));
|
||||
RTW_INFO("Current STA(%d) VHT LDPC = %02X\n", psta->aid, cur_ldpc_cap);
|
||||
}
|
||||
pvhtpriv_sta->ldpc_cap = cur_ldpc_cap;
|
||||
|
||||
if (psta->bw_mode > pmlmeext->cur_bwmode)
|
||||
psta->bw_mode = pmlmeext->cur_bwmode;
|
||||
|
||||
if (psta->bw_mode == CHANNEL_WIDTH_80) {
|
||||
/* B5 Short GI for 80 MHz */
|
||||
pvhtpriv_sta->sgi_80m = (GET_VHT_CAPABILITY_ELE_SHORT_GI80M(pvhtpriv_sta->vht_cap) & pvhtpriv_ap->sgi_80m) ? _TRUE : _FALSE;
|
||||
/* RTW_INFO("Current STA ShortGI80MHz = %d\n", pvhtpriv_sta->sgi_80m); */
|
||||
} else if (psta->bw_mode >= CHANNEL_WIDTH_160) {
|
||||
/* B5 Short GI for 80 MHz */
|
||||
pvhtpriv_sta->sgi_80m = (GET_VHT_CAPABILITY_ELE_SHORT_GI160M(pvhtpriv_sta->vht_cap) & pvhtpriv_ap->sgi_80m) ? _TRUE : _FALSE;
|
||||
/* RTW_INFO("Current STA ShortGI160MHz = %d\n", pvhtpriv_sta->sgi_80m); */
|
||||
}
|
||||
|
||||
/* B8 B9 B10 Rx STBC */
|
||||
if (TEST_FLAG(pvhtpriv_ap->stbc_cap, STBC_VHT_ENABLE_TX) &&
|
||||
GET_VHT_CAPABILITY_ELE_RX_STBC(pvhtpriv_sta->vht_cap)) {
|
||||
SET_FLAG(cur_stbc_cap, (STBC_VHT_ENABLE_TX | STBC_VHT_CAP_TX));
|
||||
RTW_INFO("Current STA(%d) VHT STBC = %02X\n", psta->aid, cur_stbc_cap);
|
||||
}
|
||||
pvhtpriv_sta->stbc_cap = cur_stbc_cap;
|
||||
|
||||
#ifdef CONFIG_BEAMFORMING
|
||||
/* B11 SU Beamformer Capable, the target supports Beamformer and we are Beamformee */
|
||||
if (TEST_FLAG(pvhtpriv_ap->beamform_cap, BEAMFORMING_VHT_BEAMFORMER_ENABLE) &&
|
||||
GET_VHT_CAPABILITY_ELE_SU_BFEE(pvhtpriv_sta->vht_cap)) {
|
||||
SET_FLAG(cur_beamform_cap, BEAMFORMING_VHT_BEAMFORMEE_ENABLE);
|
||||
/*Shift to BEAMFORMING_VHT_BEAMFORMER_STS_CAP*/
|
||||
SET_FLAG(cur_beamform_cap, GET_VHT_CAPABILITY_ELE_SU_BFEE_STS_CAP(pvhtpriv_sta->vht_cap) << 8);
|
||||
}
|
||||
|
||||
/* B12 SU Beamformee Capable, the target supports Beamformee and we are Beamformer */
|
||||
if (TEST_FLAG(pvhtpriv_ap->beamform_cap, BEAMFORMING_VHT_BEAMFORMEE_ENABLE) &&
|
||||
GET_VHT_CAPABILITY_ELE_SU_BFER(pvhtpriv_sta->vht_cap)) {
|
||||
SET_FLAG(cur_beamform_cap, BEAMFORMING_VHT_BEAMFORMER_ENABLE);
|
||||
/*Shit to BEAMFORMING_VHT_BEAMFORMEE_SOUND_DIM*/
|
||||
SET_FLAG(cur_beamform_cap, GET_VHT_CAPABILITY_ELE_SU_BFER_SOUND_DIM_NUM(pvhtpriv_sta->vht_cap) << 12);
|
||||
}
|
||||
pvhtpriv_sta->beamform_cap = cur_beamform_cap;
|
||||
if (cur_beamform_cap)
|
||||
RTW_INFO("Current STA(%d) VHT Beamforming Setting = %02X\n", psta->aid, cur_beamform_cap);
|
||||
#endif
|
||||
|
||||
/* B23 B24 B25 Maximum A-MPDU Length Exponent */
|
||||
pvhtpriv_sta->ampdu_len = GET_VHT_CAPABILITY_ELE_MAX_RXAMPDU_FACTOR(pvhtpriv_sta->vht_cap);
|
||||
|
||||
pcap_mcs = GET_VHT_CAPABILITY_ELE_RX_MCS(pvhtpriv_sta->vht_cap);
|
||||
_rtw_memcpy(pvhtpriv_sta->vht_mcs_map, pcap_mcs, 2);
|
||||
pvhtpriv_sta->vht_highest_rate = rtw_get_vht_highest_rate(pvhtpriv_sta->vht_mcs_map);
|
||||
}
|
||||
|
||||
void update_hw_vht_param(_adapter *padapter)
|
||||
{
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
struct vht_priv *pvhtpriv = &pmlmepriv->vhtpriv;
|
||||
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
||||
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
|
||||
u8 ht_AMPDU_len;
|
||||
|
||||
ht_AMPDU_len = pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x03;
|
||||
|
||||
if (pvhtpriv->ampdu_len > ht_AMPDU_len)
|
||||
rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_FACTOR, (u8 *)(&pvhtpriv->ampdu_len));
|
||||
}
|
||||
|
||||
void VHT_caps_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE)
|
||||
{
|
||||
struct hal_spec_t *hal_spec = GET_HAL_SPEC(padapter);
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
struct vht_priv *pvhtpriv = &pmlmepriv->vhtpriv;
|
||||
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
||||
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
|
||||
u8 cur_ldpc_cap = 0, cur_stbc_cap = 0, rf_type = RF_1T1R, tx_nss = 0;
|
||||
u16 cur_beamform_cap = 0;
|
||||
u8 *pcap_mcs;
|
||||
|
||||
if (pIE == NULL)
|
||||
return;
|
||||
|
||||
if (pvhtpriv->vht_option == _FALSE)
|
||||
return;
|
||||
|
||||
pmlmeinfo->VHT_enable = 1;
|
||||
|
||||
/* B4 Rx LDPC */
|
||||
if (TEST_FLAG(pvhtpriv->ldpc_cap, LDPC_VHT_ENABLE_TX) &&
|
||||
GET_VHT_CAPABILITY_ELE_RX_LDPC(pIE->data)) {
|
||||
SET_FLAG(cur_ldpc_cap, (LDPC_VHT_ENABLE_TX | LDPC_VHT_CAP_TX));
|
||||
RTW_INFO("Current VHT LDPC Setting = %02X\n", cur_ldpc_cap);
|
||||
}
|
||||
pvhtpriv->ldpc_cap = cur_ldpc_cap;
|
||||
|
||||
/* B5 Short GI for 80 MHz */
|
||||
pvhtpriv->sgi_80m = (GET_VHT_CAPABILITY_ELE_SHORT_GI80M(pIE->data) & pvhtpriv->sgi_80m) ? _TRUE : _FALSE;
|
||||
/* RTW_INFO("Current ShortGI80MHz = %d\n", pvhtpriv->sgi_80m); */
|
||||
|
||||
/* B8 B9 B10 Rx STBC */
|
||||
if (TEST_FLAG(pvhtpriv->stbc_cap, STBC_VHT_ENABLE_TX) &&
|
||||
GET_VHT_CAPABILITY_ELE_RX_STBC(pIE->data)) {
|
||||
SET_FLAG(cur_stbc_cap, (STBC_VHT_ENABLE_TX | STBC_VHT_CAP_TX));
|
||||
RTW_INFO("Current VHT STBC Setting = %02X\n", cur_stbc_cap);
|
||||
}
|
||||
pvhtpriv->stbc_cap = cur_stbc_cap;
|
||||
#ifdef CONFIG_BEAMFORMING
|
||||
#ifdef RTW_BEAMFORMING_VERSION_2
|
||||
/*
|
||||
* B11 SU Beamformer Capable,
|
||||
* the target supports Beamformer and we are Beamformee
|
||||
*/
|
||||
if (TEST_FLAG(pvhtpriv->beamform_cap, BEAMFORMING_VHT_BEAMFORMEE_ENABLE)
|
||||
&& GET_VHT_CAPABILITY_ELE_SU_BFER(pIE->data)) {
|
||||
SET_FLAG(cur_beamform_cap, BEAMFORMING_VHT_BEAMFORMEE_ENABLE);
|
||||
|
||||
/* Shift to BEAMFORMING_VHT_BEAMFORMEE_STS_CAP */
|
||||
SET_FLAG(cur_beamform_cap, GET_VHT_CAPABILITY_ELE_SU_BFEE_STS_CAP(pIE->data) << 8);
|
||||
|
||||
/*
|
||||
* B19 MU Beamformer Capable,
|
||||
* the target supports Beamformer and we are Beamformee
|
||||
*/
|
||||
if (TEST_FLAG(pvhtpriv->beamform_cap, BEAMFORMING_VHT_MU_MIMO_STA_ENABLE)
|
||||
&& GET_VHT_CAPABILITY_ELE_MU_BFER(pIE->data))
|
||||
SET_FLAG(cur_beamform_cap, BEAMFORMING_VHT_MU_MIMO_STA_ENABLE);
|
||||
}
|
||||
|
||||
/*
|
||||
* B12 SU Beamformee Capable,
|
||||
* the target supports Beamformee and we are Beamformer
|
||||
*/
|
||||
if (TEST_FLAG(pvhtpriv->beamform_cap, BEAMFORMING_VHT_BEAMFORMER_ENABLE)
|
||||
&& GET_VHT_CAPABILITY_ELE_SU_BFEE(pIE->data)) {
|
||||
SET_FLAG(cur_beamform_cap, BEAMFORMING_VHT_BEAMFORMER_ENABLE);
|
||||
|
||||
/* Shit to BEAMFORMING_VHT_BEAMFORMER_SOUND_DIM */
|
||||
SET_FLAG(cur_beamform_cap, GET_VHT_CAPABILITY_ELE_SU_BFER_SOUND_DIM_NUM(pIE->data) << 12);
|
||||
|
||||
/*
|
||||
* B20 MU Beamformee Capable,
|
||||
* the target supports Beamformee and we are Beamformer
|
||||
*/
|
||||
if (TEST_FLAG(pvhtpriv->beamform_cap, BEAMFORMING_VHT_MU_MIMO_AP_ENABLE)
|
||||
&& GET_VHT_CAPABILITY_ELE_MU_BFEE(pIE->data))
|
||||
SET_FLAG(cur_beamform_cap, BEAMFORMING_VHT_MU_MIMO_AP_ENABLE);
|
||||
}
|
||||
|
||||
pvhtpriv->beamform_cap = cur_beamform_cap;
|
||||
RTW_INFO("Current VHT Beamforming Setting=0x%04X\n", cur_beamform_cap);
|
||||
#else /* !RTW_BEAMFORMING_VERSION_2 */
|
||||
/* B11 SU Beamformer Capable, the target supports Beamformer and we are Beamformee */
|
||||
if (TEST_FLAG(pvhtpriv->beamform_cap, BEAMFORMING_VHT_BEAMFORMER_ENABLE) &&
|
||||
GET_VHT_CAPABILITY_ELE_SU_BFEE(pIE->data)) {
|
||||
SET_FLAG(cur_beamform_cap, BEAMFORMING_VHT_BEAMFORMEE_ENABLE);
|
||||
/*Shift to BEAMFORMING_VHT_BEAMFORMER_STS_CAP*/
|
||||
SET_FLAG(cur_beamform_cap, GET_VHT_CAPABILITY_ELE_SU_BFEE_STS_CAP(pIE->data) << 8);
|
||||
}
|
||||
|
||||
/* B12 SU Beamformee Capable, the target supports Beamformee and we are Beamformer */
|
||||
if (TEST_FLAG(pvhtpriv->beamform_cap, BEAMFORMING_VHT_BEAMFORMEE_ENABLE) &&
|
||||
GET_VHT_CAPABILITY_ELE_SU_BFER(pIE->data)) {
|
||||
SET_FLAG(cur_beamform_cap, BEAMFORMING_VHT_BEAMFORMER_ENABLE);
|
||||
/*Shit to BEAMFORMING_VHT_BEAMFORMEE_SOUND_DIM*/
|
||||
SET_FLAG(cur_beamform_cap, GET_VHT_CAPABILITY_ELE_SU_BFER_SOUND_DIM_NUM(pIE->data) << 12);
|
||||
|
||||
}
|
||||
pvhtpriv->beamform_cap = cur_beamform_cap;
|
||||
if (cur_beamform_cap)
|
||||
RTW_INFO("Current VHT Beamforming Setting = %02X\n", cur_beamform_cap);
|
||||
#endif /* !RTW_BEAMFORMING_VERSION_2 */
|
||||
#endif /* CONFIG_BEAMFORMING */
|
||||
/* B23 B24 B25 Maximum A-MPDU Length Exponent */
|
||||
pvhtpriv->ampdu_len = GET_VHT_CAPABILITY_ELE_MAX_RXAMPDU_FACTOR(pIE->data);
|
||||
|
||||
pcap_mcs = GET_VHT_CAPABILITY_ELE_RX_MCS(pIE->data);
|
||||
rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type));
|
||||
tx_nss = rtw_min(rf_type_to_rf_tx_cnt(rf_type), hal_spec->tx_nss_num);
|
||||
rtw_vht_nss_to_mcsmap(tx_nss, pvhtpriv->vht_mcs_map, pcap_mcs);
|
||||
pvhtpriv->vht_highest_rate = rtw_get_vht_highest_rate(pvhtpriv->vht_mcs_map);
|
||||
}
|
||||
|
||||
void VHT_operation_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE)
|
||||
{
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
struct vht_priv *pvhtpriv = &pmlmepriv->vhtpriv;
|
||||
|
||||
if (pIE == NULL)
|
||||
return;
|
||||
|
||||
if (pvhtpriv->vht_option == _FALSE)
|
||||
return;
|
||||
}
|
||||
|
||||
void rtw_process_vht_op_mode_notify(_adapter *padapter, u8 *pframe, PVOID sta)
|
||||
{
|
||||
struct sta_info *psta = (struct sta_info *)sta;
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
struct vht_priv *pvhtpriv = &pmlmepriv->vhtpriv;
|
||||
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
||||
struct registry_priv *regsty = adapter_to_regsty(padapter);
|
||||
u8 target_bw;
|
||||
u8 target_rxss, current_rxss;
|
||||
u8 update_ra = _FALSE;
|
||||
|
||||
if (pvhtpriv->vht_option == _FALSE)
|
||||
return;
|
||||
|
||||
target_bw = GET_VHT_OPERATING_MODE_FIELD_CHNL_WIDTH(pframe);
|
||||
target_rxss = (GET_VHT_OPERATING_MODE_FIELD_RX_NSS(pframe) + 1);
|
||||
|
||||
if (target_bw != psta->bw_mode) {
|
||||
if (hal_is_bw_support(padapter, target_bw)
|
||||
&& REGSTY_IS_BW_5G_SUPPORT(regsty, target_bw)
|
||||
) {
|
||||
update_ra = _TRUE;
|
||||
psta->bw_mode = target_bw;
|
||||
}
|
||||
}
|
||||
|
||||
current_rxss = rtw_vht_mcsmap_to_nss(psta->vhtpriv.vht_mcs_map);
|
||||
if (target_rxss != current_rxss) {
|
||||
u8 vht_mcs_map[2] = {};
|
||||
|
||||
update_ra = _TRUE;
|
||||
|
||||
rtw_vht_nss_to_mcsmap(target_rxss, vht_mcs_map, psta->vhtpriv.vht_mcs_map);
|
||||
_rtw_memcpy(psta->vhtpriv.vht_mcs_map, vht_mcs_map, 2);
|
||||
|
||||
rtw_hal_update_sta_rate_mask(padapter, psta);
|
||||
}
|
||||
|
||||
if (update_ra)
|
||||
rtw_dm_ra_mask_wk_cmd(padapter, (u8 *)psta);
|
||||
}
|
||||
|
||||
u32 rtw_build_vht_operation_ie(_adapter *padapter, u8 *pbuf, u8 channel)
|
||||
{
|
||||
struct registry_priv *pregistrypriv = &padapter->registrypriv;
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
struct vht_priv *pvhtpriv = &pmlmepriv->vhtpriv;
|
||||
/* struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; */
|
||||
u8 ChnlWidth, center_freq, bw_mode;
|
||||
u32 len = 0;
|
||||
u8 operation[5];
|
||||
|
||||
_rtw_memset(operation, 0, 5);
|
||||
|
||||
bw_mode = REGSTY_BW_5G(pregistrypriv); /* TODO: control op bw with other info */
|
||||
|
||||
if (hal_chk_bw_cap(padapter, BW_CAP_80M | BW_CAP_160M)
|
||||
&& REGSTY_BW_5G(pregistrypriv) >= CHANNEL_WIDTH_80
|
||||
) {
|
||||
center_freq = rtw_get_center_ch(channel, bw_mode, HAL_PRIME_CHNL_OFFSET_LOWER);
|
||||
ChnlWidth = 1;
|
||||
} else {
|
||||
center_freq = 0;
|
||||
ChnlWidth = 0;
|
||||
}
|
||||
|
||||
|
||||
SET_VHT_OPERATION_ELE_CHL_WIDTH(operation, ChnlWidth);
|
||||
/* center frequency */
|
||||
SET_VHT_OPERATION_ELE_CHL_CENTER_FREQ1(operation, center_freq);/* Todo: need to set correct center channel */
|
||||
SET_VHT_OPERATION_ELE_CHL_CENTER_FREQ2(operation, 0);
|
||||
|
||||
_rtw_memcpy(operation + 3, pvhtpriv->vht_mcs_map, 2);
|
||||
|
||||
rtw_set_ie(pbuf, EID_VHTOperation, 5, operation, &len);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
u32 rtw_build_vht_op_mode_notify_ie(_adapter *padapter, u8 *pbuf, u8 bw)
|
||||
{
|
||||
/* struct registry_priv *pregistrypriv = &padapter->registrypriv; */
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
struct vht_priv *pvhtpriv = &pmlmepriv->vhtpriv;
|
||||
u32 len = 0;
|
||||
u8 opmode = 0;
|
||||
u8 chnl_width, rx_nss;
|
||||
|
||||
chnl_width = bw;
|
||||
rx_nss = rtw_vht_mcsmap_to_nss(pvhtpriv->vht_mcs_map);
|
||||
|
||||
SET_VHT_OPERATING_MODE_FIELD_CHNL_WIDTH(&opmode, chnl_width);
|
||||
SET_VHT_OPERATING_MODE_FIELD_RX_NSS(&opmode, (rx_nss - 1));
|
||||
SET_VHT_OPERATING_MODE_FIELD_RX_NSS_TYPE(&opmode, 0); /* Todo */
|
||||
|
||||
pvhtpriv->vht_op_mode_notify = opmode;
|
||||
|
||||
pbuf = rtw_set_ie(pbuf, EID_OpModeNotification, 1, &opmode, &len);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
u32 rtw_build_vht_cap_ie(_adapter *padapter, u8 *pbuf)
|
||||
{
|
||||
u8 bw, rf_type, rf_num, rx_stbc_nss = 0;
|
||||
u16 HighestRate;
|
||||
u8 *pcap, *pcap_mcs;
|
||||
u32 len = 0;
|
||||
u32 rx_packet_offset, max_recvbuf_sz;
|
||||
struct registry_priv *pregistrypriv = &padapter->registrypriv;
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
struct vht_priv *pvhtpriv = &pmlmepriv->vhtpriv;
|
||||
|
||||
pcap = pvhtpriv->vht_cap;
|
||||
_rtw_memset(pcap, 0, 32);
|
||||
|
||||
/* B0 B1 Maximum MPDU Length */
|
||||
rtw_hal_get_def_var(padapter, HAL_DEF_RX_PACKET_OFFSET, &rx_packet_offset);
|
||||
rtw_hal_get_def_var(padapter, HAL_DEF_MAX_RECVBUF_SZ, &max_recvbuf_sz);
|
||||
|
||||
RTW_DBG("%s, line%d, Available RX buf size = %d bytes\n.", __FUNCTION__, __LINE__, max_recvbuf_sz - rx_packet_offset);
|
||||
|
||||
if ((max_recvbuf_sz - rx_packet_offset) >= 11454) {
|
||||
SET_VHT_CAPABILITY_ELE_MAX_MPDU_LENGTH(pcap, 2);
|
||||
RTW_INFO("%s, line%d, Set MAX MPDU len = 11454 bytes\n.", __FUNCTION__, __LINE__);
|
||||
} else if ((max_recvbuf_sz - rx_packet_offset) >= 7991) {
|
||||
SET_VHT_CAPABILITY_ELE_MAX_MPDU_LENGTH(pcap, 1);
|
||||
RTW_INFO("%s, line%d, Set MAX MPDU len = 7991 bytes\n.", __FUNCTION__, __LINE__);
|
||||
} else if ((max_recvbuf_sz - rx_packet_offset) >= 3895) {
|
||||
SET_VHT_CAPABILITY_ELE_MAX_MPDU_LENGTH(pcap, 0);
|
||||
RTW_INFO("%s, line%d, Set MAX MPDU len = 3895 bytes\n.", __FUNCTION__, __LINE__);
|
||||
} else
|
||||
RTW_ERR("%s, line%d, Error!! Available RX buf size < 3895 bytes\n.", __FUNCTION__, __LINE__);
|
||||
|
||||
/* B2 B3 Supported Channel Width Set */
|
||||
if (hal_chk_bw_cap(padapter, BW_CAP_160M) && REGSTY_IS_BW_5G_SUPPORT(pregistrypriv, CHANNEL_WIDTH_160)) {
|
||||
if (hal_chk_bw_cap(padapter, BW_CAP_80_80M) && REGSTY_IS_BW_5G_SUPPORT(pregistrypriv, CHANNEL_WIDTH_80_80))
|
||||
SET_VHT_CAPABILITY_ELE_CHL_WIDTH(pcap, 2);
|
||||
else
|
||||
SET_VHT_CAPABILITY_ELE_CHL_WIDTH(pcap, 1);
|
||||
} else
|
||||
SET_VHT_CAPABILITY_ELE_CHL_WIDTH(pcap, 0);
|
||||
|
||||
/* B4 Rx LDPC */
|
||||
if (TEST_FLAG(pvhtpriv->ldpc_cap, LDPC_VHT_ENABLE_RX)) {
|
||||
SET_VHT_CAPABILITY_ELE_RX_LDPC(pcap, 1);
|
||||
RTW_INFO("[VHT] Declare supporting RX LDPC\n");
|
||||
}
|
||||
|
||||
/* B5 ShortGI for 80MHz */
|
||||
SET_VHT_CAPABILITY_ELE_SHORT_GI80M(pcap, pvhtpriv->sgi_80m ? 1 : 0); /* We can receive Short GI of 80M */
|
||||
if (pvhtpriv->sgi_80m)
|
||||
RTW_INFO("[VHT] Declare supporting SGI 80MHz\n");
|
||||
|
||||
/* B6 ShortGI for 160MHz */
|
||||
/* SET_VHT_CAPABILITY_ELE_SHORT_GI160M(pcap, pvhtpriv->sgi_80m? 1 : 0); */
|
||||
|
||||
/* B7 Tx STBC */
|
||||
if (TEST_FLAG(pvhtpriv->stbc_cap, STBC_VHT_ENABLE_TX)) {
|
||||
SET_VHT_CAPABILITY_ELE_TX_STBC(pcap, 1);
|
||||
RTW_INFO("[VHT] Declare supporting TX STBC\n");
|
||||
}
|
||||
|
||||
/* B8 B9 B10 Rx STBC */
|
||||
if (TEST_FLAG(pvhtpriv->stbc_cap, STBC_VHT_ENABLE_RX)) {
|
||||
rtw_hal_get_def_var(padapter, HAL_DEF_RX_STBC, (u8 *)(&rx_stbc_nss));
|
||||
|
||||
SET_VHT_CAPABILITY_ELE_RX_STBC(pcap, rx_stbc_nss);
|
||||
RTW_INFO("[VHT] Declare supporting RX STBC = %d\n", rx_stbc_nss);
|
||||
}
|
||||
|
||||
/* B11 SU Beamformer Capable */
|
||||
if (TEST_FLAG(pvhtpriv->beamform_cap, BEAMFORMING_VHT_BEAMFORMER_ENABLE)) {
|
||||
SET_VHT_CAPABILITY_ELE_SU_BFER(pcap, 1);
|
||||
RTW_INFO("[VHT] Declare supporting SU Bfer\n");
|
||||
/* B16 17 18 Number of Sounding Dimensions */
|
||||
rtw_hal_get_def_var(padapter, HAL_DEF_BEAMFORMER_CAP, (u8 *)&rf_num);
|
||||
SET_VHT_CAPABILITY_ELE_SOUNDING_DIMENSIONS(pcap, rf_num);
|
||||
/* B19 MU Beamformer Capable */
|
||||
if (TEST_FLAG(pvhtpriv->beamform_cap, BEAMFORMING_VHT_MU_MIMO_AP_ENABLE)) {
|
||||
SET_VHT_CAPABILITY_ELE_MU_BFER(pcap, 1);
|
||||
RTW_INFO("[VHT] Declare supporting MU Bfer\n");
|
||||
}
|
||||
}
|
||||
|
||||
/* B12 SU Beamformee Capable */
|
||||
if (TEST_FLAG(pvhtpriv->beamform_cap, BEAMFORMING_VHT_BEAMFORMEE_ENABLE)) {
|
||||
SET_VHT_CAPABILITY_ELE_SU_BFEE(pcap, 1);
|
||||
RTW_INFO("[VHT] Declare supporting SU Bfee\n");
|
||||
/* B13 14 15 Compressed Steering Number of Beamformer Antennas Supported */
|
||||
rtw_hal_get_def_var(padapter, HAL_DEF_BEAMFORMEE_CAP, (u8 *)&rf_num);
|
||||
SET_VHT_CAPABILITY_ELE_BFER_ANT_SUPP(pcap, rf_num);
|
||||
/* B20 SU Beamformee Capable */
|
||||
if (TEST_FLAG(pvhtpriv->beamform_cap, BEAMFORMING_VHT_MU_MIMO_STA_ENABLE)) {
|
||||
SET_VHT_CAPABILITY_ELE_MU_BFEE(pcap, 1);
|
||||
RTW_INFO("[VHT] Declare supporting MU Bfee\n");
|
||||
}
|
||||
}
|
||||
|
||||
/* B21 VHT TXOP PS */
|
||||
SET_VHT_CAPABILITY_ELE_TXOP_PS(pcap, 0);
|
||||
/* B22 +HTC-VHT Capable */
|
||||
SET_VHT_CAPABILITY_ELE_HTC_VHT(pcap, 1);
|
||||
/* B23 24 25 Maximum A-MPDU Length Exponent */
|
||||
if (pregistrypriv->ampdu_factor != 0xFE)
|
||||
SET_VHT_CAPABILITY_ELE_MAX_RXAMPDU_FACTOR(pcap, pregistrypriv->ampdu_factor);
|
||||
else
|
||||
SET_VHT_CAPABILITY_ELE_MAX_RXAMPDU_FACTOR(pcap, 7);
|
||||
/* B26 27 VHT Link Adaptation Capable */
|
||||
SET_VHT_CAPABILITY_ELE_LINK_ADAPTION(pcap, 0);
|
||||
|
||||
pcap_mcs = GET_VHT_CAPABILITY_ELE_RX_MCS(pcap);
|
||||
_rtw_memcpy(pcap_mcs, pvhtpriv->vht_mcs_map, 2);
|
||||
|
||||
pcap_mcs = GET_VHT_CAPABILITY_ELE_TX_MCS(pcap);
|
||||
_rtw_memcpy(pcap_mcs, pvhtpriv->vht_mcs_map, 2);
|
||||
|
||||
/* find the largest bw supported by both registry and hal */
|
||||
bw = hal_largest_bw(padapter, REGSTY_BW_5G(pregistrypriv));
|
||||
|
||||
HighestRate = VHT_MCS_DATA_RATE[bw][pvhtpriv->sgi_80m][((pvhtpriv->vht_highest_rate - MGN_VHT1SS_MCS0) & 0x3f)];
|
||||
HighestRate = (HighestRate + 1) >> 1;
|
||||
|
||||
SET_VHT_CAPABILITY_ELE_MCS_RX_HIGHEST_RATE(pcap, HighestRate); /* indicate we support highest rx rate is 600Mbps. */
|
||||
SET_VHT_CAPABILITY_ELE_MCS_TX_HIGHEST_RATE(pcap, HighestRate); /* indicate we support highest tx rate is 600Mbps. */
|
||||
|
||||
pbuf = rtw_set_ie(pbuf, EID_VHTCapability, 12, pcap, &len);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
u32 rtw_restructure_vht_ie(_adapter *padapter, u8 *in_ie, u8 *out_ie, uint in_len, uint *pout_len)
|
||||
{
|
||||
u32 ielen = 0, out_len = 0;
|
||||
u8 cap_len = 0, notify_len = 0, notify_bw = 0, operation_bw = 0, supported_chnl_width = 0;
|
||||
u8 *p, *pframe;
|
||||
struct registry_priv *pregistrypriv = &padapter->registrypriv;
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
struct vht_priv *pvhtpriv = &pmlmepriv->vhtpriv;
|
||||
|
||||
rtw_vht_use_default_setting(padapter);
|
||||
|
||||
p = rtw_get_ie(in_ie + 12, EID_VHTCapability, &ielen, in_len - 12);
|
||||
if (p && ielen > 0) {
|
||||
supported_chnl_width = GET_VHT_CAPABILITY_ELE_CHL_WIDTH(p + 2);
|
||||
|
||||
/* VHT Capabilities element */
|
||||
cap_len = rtw_build_vht_cap_ie(padapter, out_ie + *pout_len);
|
||||
*pout_len += cap_len;
|
||||
|
||||
/* Get HT BW */
|
||||
p = rtw_get_ie(in_ie + 12, _HT_EXTRA_INFO_IE_, &ielen, in_len - 12);
|
||||
if (p && ielen > 0) {
|
||||
struct HT_info_element *pht_info = (struct HT_info_element *)(p + 2);
|
||||
if (pht_info->infos[0] & BIT(2))
|
||||
operation_bw = CHANNEL_WIDTH_40;
|
||||
else
|
||||
operation_bw = CHANNEL_WIDTH_20;
|
||||
}
|
||||
|
||||
/* VHT Operation element */
|
||||
p = rtw_get_ie(in_ie + 12, EID_VHTOperation, &ielen, in_len - 12);
|
||||
if (p && ielen > 0) {
|
||||
out_len = *pout_len;
|
||||
if (GET_VHT_OPERATION_ELE_CHL_WIDTH(p + 2) >= 1) {
|
||||
if (supported_chnl_width == 2)
|
||||
operation_bw = CHANNEL_WIDTH_80_80;
|
||||
else if (supported_chnl_width == 1)
|
||||
operation_bw = CHANNEL_WIDTH_160;
|
||||
else
|
||||
operation_bw = CHANNEL_WIDTH_80;
|
||||
}
|
||||
pframe = rtw_set_ie(out_ie + out_len, EID_VHTOperation, ielen, p + 2 , pout_len);
|
||||
}
|
||||
|
||||
/* find the largest bw supported by both registry and hal */
|
||||
notify_bw = hal_largest_bw(padapter, REGSTY_BW_5G(pregistrypriv));
|
||||
|
||||
if (notify_bw > operation_bw)
|
||||
notify_bw = operation_bw;
|
||||
|
||||
/* Operating Mode Notification element */
|
||||
notify_len = rtw_build_vht_op_mode_notify_ie(padapter, out_ie + *pout_len, notify_bw);
|
||||
*pout_len += notify_len;
|
||||
|
||||
pvhtpriv->vht_option = _TRUE;
|
||||
}
|
||||
|
||||
return pvhtpriv->vht_option;
|
||||
|
||||
}
|
||||
|
||||
void VHTOnAssocRsp(_adapter *padapter)
|
||||
{
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
struct vht_priv *pvhtpriv = &pmlmepriv->vhtpriv;
|
||||
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
||||
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
|
||||
u8 ht_AMPDU_len;
|
||||
|
||||
RTW_INFO("%s\n", __FUNCTION__);
|
||||
|
||||
if (!pmlmeinfo->HT_enable)
|
||||
return;
|
||||
|
||||
if (!pmlmeinfo->VHT_enable)
|
||||
return;
|
||||
|
||||
ht_AMPDU_len = pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x03;
|
||||
|
||||
if (pvhtpriv->ampdu_len > ht_AMPDU_len)
|
||||
rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_FACTOR, (u8 *)(&pvhtpriv->ampdu_len));
|
||||
|
||||
rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_MAX_TIME, (u8 *)(&pvhtpriv->vht_highest_rate));
|
||||
}
|
||||
|
||||
#endif /* CONFIG_80211AC_VHT */
|
1240
core/rtw_wapi.c
Normal file
1240
core/rtw_wapi.c
Normal file
File diff suppressed because it is too large
Load diff
908
core/rtw_wapi_sms4.c
Normal file
908
core/rtw_wapi_sms4.c
Normal file
|
@ -0,0 +1,908 @@
|
|||
#ifdef CONFIG_WAPI_SUPPORT
|
||||
|
||||
#include <linux/unistd.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <drv_types.h>
|
||||
#include <rtw_wapi.h>
|
||||
|
||||
|
||||
#ifdef CONFIG_WAPI_SW_SMS4
|
||||
|
||||
#define WAPI_LITTLE_ENDIAN
|
||||
/* #define BIG_ENDIAN */
|
||||
#define ENCRYPT 0
|
||||
#define DECRYPT 1
|
||||
|
||||
|
||||
/**********************************************************
|
||||
**********************************************************/
|
||||
const u8 Sbox[256] = {
|
||||
0xd6, 0x90, 0xe9, 0xfe, 0xcc, 0xe1, 0x3d, 0xb7, 0x16, 0xb6, 0x14, 0xc2, 0x28, 0xfb, 0x2c, 0x05,
|
||||
0x2b, 0x67, 0x9a, 0x76, 0x2a, 0xbe, 0x04, 0xc3, 0xaa, 0x44, 0x13, 0x26, 0x49, 0x86, 0x06, 0x99,
|
||||
0x9c, 0x42, 0x50, 0xf4, 0x91, 0xef, 0x98, 0x7a, 0x33, 0x54, 0x0b, 0x43, 0xed, 0xcf, 0xac, 0x62,
|
||||
0xe4, 0xb3, 0x1c, 0xa9, 0xc9, 0x08, 0xe8, 0x95, 0x80, 0xdf, 0x94, 0xfa, 0x75, 0x8f, 0x3f, 0xa6,
|
||||
0x47, 0x07, 0xa7, 0xfc, 0xf3, 0x73, 0x17, 0xba, 0x83, 0x59, 0x3c, 0x19, 0xe6, 0x85, 0x4f, 0xa8,
|
||||
0x68, 0x6b, 0x81, 0xb2, 0x71, 0x64, 0xda, 0x8b, 0xf8, 0xeb, 0x0f, 0x4b, 0x70, 0x56, 0x9d, 0x35,
|
||||
0x1e, 0x24, 0x0e, 0x5e, 0x63, 0x58, 0xd1, 0xa2, 0x25, 0x22, 0x7c, 0x3b, 0x01, 0x21, 0x78, 0x87,
|
||||
0xd4, 0x00, 0x46, 0x57, 0x9f, 0xd3, 0x27, 0x52, 0x4c, 0x36, 0x02, 0xe7, 0xa0, 0xc4, 0xc8, 0x9e,
|
||||
0xea, 0xbf, 0x8a, 0xd2, 0x40, 0xc7, 0x38, 0xb5, 0xa3, 0xf7, 0xf2, 0xce, 0xf9, 0x61, 0x15, 0xa1,
|
||||
0xe0, 0xae, 0x5d, 0xa4, 0x9b, 0x34, 0x1a, 0x55, 0xad, 0x93, 0x32, 0x30, 0xf5, 0x8c, 0xb1, 0xe3,
|
||||
0x1d, 0xf6, 0xe2, 0x2e, 0x82, 0x66, 0xca, 0x60, 0xc0, 0x29, 0x23, 0xab, 0x0d, 0x53, 0x4e, 0x6f,
|
||||
0xd5, 0xdb, 0x37, 0x45, 0xde, 0xfd, 0x8e, 0x2f, 0x03, 0xff, 0x6a, 0x72, 0x6d, 0x6c, 0x5b, 0x51,
|
||||
0x8d, 0x1b, 0xaf, 0x92, 0xbb, 0xdd, 0xbc, 0x7f, 0x11, 0xd9, 0x5c, 0x41, 0x1f, 0x10, 0x5a, 0xd8,
|
||||
0x0a, 0xc1, 0x31, 0x88, 0xa5, 0xcd, 0x7b, 0xbd, 0x2d, 0x74, 0xd0, 0x12, 0xb8, 0xe5, 0xb4, 0xb0,
|
||||
0x89, 0x69, 0x97, 0x4a, 0x0c, 0x96, 0x77, 0x7e, 0x65, 0xb9, 0xf1, 0x09, 0xc5, 0x6e, 0xc6, 0x84,
|
||||
0x18, 0xf0, 0x7d, 0xec, 0x3a, 0xdc, 0x4d, 0x20, 0x79, 0xee, 0x5f, 0x3e, 0xd7, 0xcb, 0x39, 0x48
|
||||
};
|
||||
|
||||
const u32 CK[32] = {
|
||||
0x00070e15, 0x1c232a31, 0x383f464d, 0x545b6269,
|
||||
0x70777e85, 0x8c939aa1, 0xa8afb6bd, 0xc4cbd2d9,
|
||||
0xe0e7eef5, 0xfc030a11, 0x181f262d, 0x343b4249,
|
||||
0x50575e65, 0x6c737a81, 0x888f969d, 0xa4abb2b9,
|
||||
0xc0c7ced5, 0xdce3eaf1, 0xf8ff060d, 0x141b2229,
|
||||
0x30373e45, 0x4c535a61, 0x686f767d, 0x848b9299,
|
||||
0xa0a7aeb5, 0xbcc3cad1, 0xd8dfe6ed, 0xf4fb0209,
|
||||
0x10171e25, 0x2c333a41, 0x484f565d, 0x646b7279
|
||||
};
|
||||
|
||||
#define Rotl(_x, _y) (((_x) << (_y)) | ((_x) >> (32 - (_y))))
|
||||
|
||||
#define ByteSub(_A) (Sbox[(_A) >> 24 & 0xFF] << 24 | \
|
||||
Sbox[(_A) >> 16 & 0xFF] << 16 | \
|
||||
Sbox[(_A) >> 8 & 0xFF] << 8 | \
|
||||
Sbox[(_A) & 0xFF])
|
||||
|
||||
#define L1(_B) ((_B) ^ Rotl(_B, 2) ^ Rotl(_B, 10) ^ Rotl(_B, 18) ^ Rotl(_B, 24))
|
||||
#define L2(_B) ((_B) ^ Rotl(_B, 13) ^ Rotl(_B, 23))
|
||||
|
||||
static void
|
||||
xor_block(void *dst, void *src1, void *src2)
|
||||
/* 128-bit xor: *dst = *src1 xor *src2. Pointers must be 32-bit aligned */
|
||||
{
|
||||
((u32 *)dst)[0] = ((u32 *)src1)[0] ^ ((u32 *)src2)[0];
|
||||
((u32 *)dst)[1] = ((u32 *)src1)[1] ^ ((u32 *)src2)[1];
|
||||
((u32 *)dst)[2] = ((u32 *)src1)[2] ^ ((u32 *)src2)[2];
|
||||
((u32 *)dst)[3] = ((u32 *)src1)[3] ^ ((u32 *)src2)[3];
|
||||
}
|
||||
|
||||
|
||||
void SMS4Crypt(u8 *Input, u8 *Output, u32 *rk)
|
||||
{
|
||||
u32 r, mid, x0, x1, x2, x3, *p;
|
||||
p = (u32 *)Input;
|
||||
x0 = p[0];
|
||||
x1 = p[1];
|
||||
x2 = p[2];
|
||||
x3 = p[3];
|
||||
#ifdef WAPI_LITTLE_ENDIAN
|
||||
x0 = Rotl(x0, 16);
|
||||
x0 = ((x0 & 0x00FF00FF) << 8) | ((x0 & 0xFF00FF00) >> 8);
|
||||
x1 = Rotl(x1, 16);
|
||||
x1 = ((x1 & 0x00FF00FF) << 8) | ((x1 & 0xFF00FF00) >> 8);
|
||||
x2 = Rotl(x2, 16);
|
||||
x2 = ((x2 & 0x00FF00FF) << 8) | ((x2 & 0xFF00FF00) >> 8);
|
||||
x3 = Rotl(x3, 16);
|
||||
x3 = ((x3 & 0x00FF00FF) << 8) | ((x3 & 0xFF00FF00) >> 8);
|
||||
#endif
|
||||
for (r = 0; r < 32; r += 4) {
|
||||
mid = x1 ^ x2 ^ x3 ^ rk[r + 0];
|
||||
mid = ByteSub(mid);
|
||||
x0 ^= L1(mid);
|
||||
mid = x2 ^ x3 ^ x0 ^ rk[r + 1];
|
||||
mid = ByteSub(mid);
|
||||
x1 ^= L1(mid);
|
||||
mid = x3 ^ x0 ^ x1 ^ rk[r + 2];
|
||||
mid = ByteSub(mid);
|
||||
x2 ^= L1(mid);
|
||||
mid = x0 ^ x1 ^ x2 ^ rk[r + 3];
|
||||
mid = ByteSub(mid);
|
||||
x3 ^= L1(mid);
|
||||
}
|
||||
#ifdef WAPI_LITTLE_ENDIAN
|
||||
x0 = Rotl(x0, 16);
|
||||
x0 = ((x0 & 0x00FF00FF) << 8) | ((x0 & 0xFF00FF00) >> 8);
|
||||
x1 = Rotl(x1, 16);
|
||||
x1 = ((x1 & 0x00FF00FF) << 8) | ((x1 & 0xFF00FF00) >> 8);
|
||||
x2 = Rotl(x2, 16);
|
||||
x2 = ((x2 & 0x00FF00FF) << 8) | ((x2 & 0xFF00FF00) >> 8);
|
||||
x3 = Rotl(x3, 16);
|
||||
x3 = ((x3 & 0x00FF00FF) << 8) | ((x3 & 0xFF00FF00) >> 8);
|
||||
#endif
|
||||
p = (u32 *)Output;
|
||||
p[0] = x3;
|
||||
p[1] = x2;
|
||||
p[2] = x1;
|
||||
p[3] = x0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SMS4KeyExt(u8 *Key, u32 *rk, u32 CryptFlag)
|
||||
{
|
||||
u32 r, mid, x0, x1, x2, x3, *p;
|
||||
|
||||
p = (u32 *)Key;
|
||||
x0 = p[0];
|
||||
x1 = p[1];
|
||||
x2 = p[2];
|
||||
x3 = p[3];
|
||||
#ifdef WAPI_LITTLE_ENDIAN
|
||||
x0 = Rotl(x0, 16);
|
||||
x0 = ((x0 & 0xFF00FF) << 8) | ((x0 & 0xFF00FF00) >> 8);
|
||||
x1 = Rotl(x1, 16);
|
||||
x1 = ((x1 & 0xFF00FF) << 8) | ((x1 & 0xFF00FF00) >> 8);
|
||||
x2 = Rotl(x2, 16);
|
||||
x2 = ((x2 & 0xFF00FF) << 8) | ((x2 & 0xFF00FF00) >> 8);
|
||||
x3 = Rotl(x3, 16);
|
||||
x3 = ((x3 & 0xFF00FF) << 8) | ((x3 & 0xFF00FF00) >> 8);
|
||||
#endif
|
||||
|
||||
x0 ^= 0xa3b1bac6;
|
||||
x1 ^= 0x56aa3350;
|
||||
x2 ^= 0x677d9197;
|
||||
x3 ^= 0xb27022dc;
|
||||
for (r = 0; r < 32; r += 4) {
|
||||
mid = x1 ^ x2 ^ x3 ^ CK[r + 0];
|
||||
mid = ByteSub(mid);
|
||||
rk[r + 0] = x0 ^= L2(mid);
|
||||
mid = x2 ^ x3 ^ x0 ^ CK[r + 1];
|
||||
mid = ByteSub(mid);
|
||||
rk[r + 1] = x1 ^= L2(mid);
|
||||
mid = x3 ^ x0 ^ x1 ^ CK[r + 2];
|
||||
mid = ByteSub(mid);
|
||||
rk[r + 2] = x2 ^= L2(mid);
|
||||
mid = x0 ^ x1 ^ x2 ^ CK[r + 3];
|
||||
mid = ByteSub(mid);
|
||||
rk[r + 3] = x3 ^= L2(mid);
|
||||
}
|
||||
if (CryptFlag == DECRYPT) {
|
||||
for (r = 0; r < 16; r++)
|
||||
mid = rk[r], rk[r] = rk[31 - r], rk[31 - r] = mid;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void WapiSMS4Cryption(u8 *Key, u8 *IV, u8 *Input, u16 InputLength,
|
||||
u8 *Output, u16 *OutputLength, u32 CryptFlag)
|
||||
{
|
||||
u32 blockNum, i, j, rk[32];
|
||||
u16 remainder;
|
||||
u8 blockIn[16], blockOut[16], tempIV[16], k;
|
||||
|
||||
*OutputLength = 0;
|
||||
remainder = InputLength & 0x0F;
|
||||
blockNum = InputLength >> 4;
|
||||
if (remainder != 0)
|
||||
blockNum++;
|
||||
else
|
||||
remainder = 16;
|
||||
|
||||
for (k = 0; k < 16; k++)
|
||||
tempIV[k] = IV[15 - k];
|
||||
|
||||
memcpy(blockIn, tempIV, 16);
|
||||
|
||||
SMS4KeyExt((u8 *)Key, rk, CryptFlag);
|
||||
|
||||
for (i = 0; i < blockNum - 1; i++) {
|
||||
SMS4Crypt((u8 *)blockIn, blockOut, rk);
|
||||
xor_block(&Output[i * 16], &Input[i * 16], blockOut);
|
||||
memcpy(blockIn, blockOut, 16);
|
||||
}
|
||||
|
||||
*OutputLength = i * 16;
|
||||
|
||||
SMS4Crypt((u8 *)blockIn, blockOut, rk);
|
||||
|
||||
for (j = 0; j < remainder; j++)
|
||||
Output[i * 16 + j] = Input[i * 16 + j] ^ blockOut[j];
|
||||
*OutputLength += remainder;
|
||||
|
||||
}
|
||||
|
||||
void WapiSMS4Encryption(u8 *Key, u8 *IV, u8 *Input, u16 InputLength,
|
||||
u8 *Output, u16 *OutputLength)
|
||||
{
|
||||
|
||||
WapiSMS4Cryption(Key, IV, Input, InputLength, Output, OutputLength, ENCRYPT);
|
||||
}
|
||||
|
||||
void WapiSMS4Decryption(u8 *Key, u8 *IV, u8 *Input, u16 InputLength,
|
||||
u8 *Output, u16 *OutputLength)
|
||||
{
|
||||
/* OFB mode: is also ENCRYPT flag */
|
||||
WapiSMS4Cryption(Key, IV, Input, InputLength, Output, OutputLength, ENCRYPT);
|
||||
}
|
||||
|
||||
void WapiSMS4CalculateMic(u8 *Key, u8 *IV, u8 *Input1, u8 Input1Length,
|
||||
u8 *Input2, u16 Input2Length, u8 *Output, u8 *OutputLength)
|
||||
{
|
||||
u32 blockNum, i, remainder, rk[32];
|
||||
u8 BlockIn[16], BlockOut[16], TempBlock[16], tempIV[16], k;
|
||||
|
||||
*OutputLength = 0;
|
||||
remainder = Input1Length & 0x0F;
|
||||
blockNum = Input1Length >> 4;
|
||||
|
||||
for (k = 0; k < 16; k++)
|
||||
tempIV[k] = IV[15 - k];
|
||||
|
||||
memcpy(BlockIn, tempIV, 16);
|
||||
|
||||
SMS4KeyExt((u8 *)Key, rk, ENCRYPT);
|
||||
|
||||
SMS4Crypt((u8 *)BlockIn, BlockOut, rk);
|
||||
|
||||
for (i = 0; i < blockNum; i++) {
|
||||
xor_block(BlockIn, (Input1 + i * 16), BlockOut);
|
||||
SMS4Crypt((u8 *)BlockIn, BlockOut, rk);
|
||||
}
|
||||
|
||||
if (remainder != 0) {
|
||||
memset(TempBlock, 0, 16);
|
||||
memcpy(TempBlock, (Input1 + blockNum * 16), remainder);
|
||||
|
||||
xor_block(BlockIn, TempBlock, BlockOut);
|
||||
SMS4Crypt((u8 *)BlockIn, BlockOut, rk);
|
||||
}
|
||||
|
||||
remainder = Input2Length & 0x0F;
|
||||
blockNum = Input2Length >> 4;
|
||||
|
||||
for (i = 0; i < blockNum; i++) {
|
||||
xor_block(BlockIn, (Input2 + i * 16), BlockOut);
|
||||
SMS4Crypt((u8 *)BlockIn, BlockOut, rk);
|
||||
}
|
||||
|
||||
if (remainder != 0) {
|
||||
memset(TempBlock, 0, 16);
|
||||
memcpy(TempBlock, (Input2 + blockNum * 16), remainder);
|
||||
|
||||
xor_block(BlockIn, TempBlock, BlockOut);
|
||||
SMS4Crypt((u8 *)BlockIn, BlockOut, rk);
|
||||
}
|
||||
|
||||
memcpy(Output, BlockOut, 16);
|
||||
*OutputLength = 16;
|
||||
}
|
||||
|
||||
void SecCalculateMicSMS4(
|
||||
u8 KeyIdx,
|
||||
u8 *MicKey,
|
||||
u8 *pHeader,
|
||||
u8 *pData,
|
||||
u16 DataLen,
|
||||
u8 *MicBuffer
|
||||
)
|
||||
{
|
||||
#if 0
|
||||
struct ieee80211_hdr_3addr_qos *header;
|
||||
u8 TempBuf[34], TempLen = 32, MicLen, QosOffset, *IV;
|
||||
u16 *pTemp, fc;
|
||||
|
||||
WAPI_TRACE(WAPI_TX | WAPI_RX, "=========>%s\n", __FUNCTION__);
|
||||
|
||||
header = (struct ieee80211_hdr_3addr_qos *)pHeader;
|
||||
memset(TempBuf, 0, 34);
|
||||
memcpy(TempBuf, pHeader, 2); /* FrameCtrl */
|
||||
pTemp = (u16 *)TempBuf;
|
||||
*pTemp &= 0xc78f; /* bit4,5,6,11,12,13 */
|
||||
|
||||
memcpy((TempBuf + 2), (pHeader + 4), 12); /* Addr1, Addr2 */
|
||||
memcpy((TempBuf + 14), (pHeader + 22), 2); /* SeqCtrl */
|
||||
pTemp = (u16 *)(TempBuf + 14);
|
||||
*pTemp &= 0x000f;
|
||||
|
||||
memcpy((TempBuf + 16), (pHeader + 16), 6); /* Addr3 */
|
||||
|
||||
fc = le16_to_cpu(header->frame_ctl);
|
||||
|
||||
|
||||
|
||||
if (GetFrDs((u16 *)&fc) && GetToDs((u16 *)&fc)) {
|
||||
memcpy((TempBuf + 22), (pHeader + 24), 6);
|
||||
QosOffset = 30;
|
||||
} else {
|
||||
memset((TempBuf + 22), 0, 6);
|
||||
QosOffset = 24;
|
||||
}
|
||||
|
||||
if ((fc & 0x0088) == 0x0088) {
|
||||
memcpy((TempBuf + 28), (pHeader + QosOffset), 2);
|
||||
TempLen += 2;
|
||||
/* IV = pHeader + QosOffset + 2 + SNAP_SIZE + sizeof(u16) + 2; */
|
||||
IV = pHeader + QosOffset + 2 + 2;
|
||||
} else {
|
||||
IV = pHeader + QosOffset + 2;
|
||||
/* IV = pHeader + QosOffset + SNAP_SIZE + sizeof(u16) + 2; */
|
||||
}
|
||||
|
||||
TempBuf[TempLen - 1] = (u8)(DataLen & 0xff);
|
||||
TempBuf[TempLen - 2] = (u8)((DataLen & 0xff00) >> 8);
|
||||
TempBuf[TempLen - 4] = KeyIdx;
|
||||
|
||||
WAPI_DATA(WAPI_TX, "CalculateMic - KEY", MicKey, 16);
|
||||
WAPI_DATA(WAPI_TX, "CalculateMic - IV", IV, 16);
|
||||
WAPI_DATA(WAPI_TX, "CalculateMic - TempBuf", TempBuf, TempLen);
|
||||
WAPI_DATA(WAPI_TX, "CalculateMic - pData", pData, DataLen);
|
||||
|
||||
WapiSMS4CalculateMic(MicKey, IV, TempBuf, TempLen,
|
||||
pData, DataLen, MicBuffer, &MicLen);
|
||||
|
||||
if (MicLen != 16)
|
||||
WAPI_TRACE(WAPI_ERR, "%s: MIC Length Error!!\n", __FUNCTION__);
|
||||
|
||||
WAPI_TRACE(WAPI_TX | WAPI_RX, "<=========%s\n", __FUNCTION__);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* AddCount: 1 or 2.
|
||||
* If overflow, return 1,
|
||||
* else return 0.
|
||||
*/
|
||||
u8 WapiIncreasePN(u8 *PN, u8 AddCount)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
if (NULL == PN)
|
||||
return 1;
|
||||
/* YJ,test,091102 */
|
||||
/*
|
||||
if(AddCount == 2){
|
||||
RTW_INFO("############################%s(): PN[0]=0x%x\n", __FUNCTION__, PN[0]);
|
||||
if(PN[0] == 0x48){
|
||||
PN[0] += AddCount;
|
||||
return 1;
|
||||
}else{
|
||||
PN[0] += AddCount;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
*/
|
||||
/* YJ,test,091102,end */
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
if (PN[i] + AddCount <= 0xff) {
|
||||
PN[i] += AddCount;
|
||||
return 0;
|
||||
} else {
|
||||
PN[i] += AddCount;
|
||||
AddCount = 1;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void WapiGetLastRxUnicastPNForQoSData(
|
||||
u8 UserPriority,
|
||||
PRT_WAPI_STA_INFO pWapiStaInfo,
|
||||
u8 *PNOut
|
||||
)
|
||||
{
|
||||
WAPI_TRACE(WAPI_RX, "===========> %s\n", __FUNCTION__);
|
||||
switch (UserPriority) {
|
||||
case 0:
|
||||
case 3:
|
||||
memcpy(PNOut, pWapiStaInfo->lastRxUnicastPNBEQueue, 16);
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
memcpy(PNOut, pWapiStaInfo->lastRxUnicastPNBKQueue, 16);
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
memcpy(PNOut, pWapiStaInfo->lastRxUnicastPNVIQueue, 16);
|
||||
break;
|
||||
case 6:
|
||||
case 7:
|
||||
memcpy(PNOut, pWapiStaInfo->lastRxUnicastPNVOQueue, 16);
|
||||
break;
|
||||
default:
|
||||
WAPI_TRACE(WAPI_ERR, "%s: Unknown TID\n", __FUNCTION__);
|
||||
break;
|
||||
}
|
||||
WAPI_TRACE(WAPI_RX, "<=========== %s\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
void WapiSetLastRxUnicastPNForQoSData(
|
||||
u8 UserPriority,
|
||||
u8 *PNIn,
|
||||
PRT_WAPI_STA_INFO pWapiStaInfo
|
||||
)
|
||||
{
|
||||
WAPI_TRACE(WAPI_RX, "===========> %s\n", __FUNCTION__);
|
||||
switch (UserPriority) {
|
||||
case 0:
|
||||
case 3:
|
||||
memcpy(pWapiStaInfo->lastRxUnicastPNBEQueue, PNIn, 16);
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
memcpy(pWapiStaInfo->lastRxUnicastPNBKQueue, PNIn, 16);
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
memcpy(pWapiStaInfo->lastRxUnicastPNVIQueue, PNIn, 16);
|
||||
break;
|
||||
case 6:
|
||||
case 7:
|
||||
memcpy(pWapiStaInfo->lastRxUnicastPNVOQueue, PNIn, 16);
|
||||
break;
|
||||
default:
|
||||
WAPI_TRACE(WAPI_ERR, "%s: Unknown TID\n", __FUNCTION__);
|
||||
break;
|
||||
}
|
||||
WAPI_TRACE(WAPI_RX, "<=========== %s\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
FALSE not RX-Reorder
|
||||
TRUE do RX Reorder
|
||||
add to support WAPI to N-mode
|
||||
*****************************************************************************/
|
||||
u8 WapiCheckPnInSwDecrypt(
|
||||
_adapter *padapter,
|
||||
struct sk_buff *pskb
|
||||
)
|
||||
{
|
||||
u8 ret = false;
|
||||
|
||||
#if 0
|
||||
struct ieee80211_hdr_3addr_qos *header;
|
||||
u16 fc;
|
||||
u8 *pDaddr, *pTaddr, *pRaddr;
|
||||
|
||||
header = (struct ieee80211_hdr_3addr_qos *)pskb->data;
|
||||
pTaddr = header->addr2;
|
||||
pRaddr = header->addr1;
|
||||
fc = le16_to_cpu(header->frame_ctl);
|
||||
|
||||
if (GetToDs(&fc))
|
||||
pDaddr = header->addr3;
|
||||
else
|
||||
pDaddr = header->addr1;
|
||||
|
||||
if ((_rtw_memcmp(pRaddr, padapter->pnetdev->dev_addr, ETH_ALEN) == 0)
|
||||
&& !(pDaddr)
|
||||
&& (GetFrameType(&fc) == WIFI_QOS_DATA_TYPE))
|
||||
/* && ieee->pHTInfo->bCurrentHTSupport && */
|
||||
/* ieee->pHTInfo->bCurRxReorderEnable) */
|
||||
ret = false;
|
||||
else
|
||||
ret = true;
|
||||
#endif
|
||||
WAPI_TRACE(WAPI_RX, "%s: return %d\n", __FUNCTION__, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int SecSMS4HeaderFillIV(_adapter *padapter, u8 *pxmitframe)
|
||||
{
|
||||
struct pkt_attrib *pattrib = &((struct xmit_frame *)pxmitframe)->attrib;
|
||||
u8 *frame = ((struct xmit_frame *)pxmitframe)->buf_addr + TXDESC_OFFSET;
|
||||
u8 *pSecHeader = NULL, *pos = NULL, *pRA = NULL;
|
||||
u8 bPNOverflow = false, bFindMatchPeer = false, hdr_len = 0;
|
||||
PWLAN_HEADER_WAPI_EXTENSION pWapiExt = NULL;
|
||||
PRT_WAPI_T pWapiInfo = &padapter->wapiInfo;
|
||||
PRT_WAPI_STA_INFO pWapiSta = NULL;
|
||||
int ret = 0;
|
||||
|
||||
WAPI_TRACE(WAPI_TX, "=========>%s\n", __FUNCTION__);
|
||||
|
||||
return ret;
|
||||
#if 0
|
||||
hdr_len = sMacHdrLng;
|
||||
if (GetFrameType(pskb->data) == WIFI_QOS_DATA_TYPE)
|
||||
hdr_len += 2;
|
||||
/* hdr_len += SNAP_SIZE + sizeof(u16); */
|
||||
|
||||
pos = skb_push(pskb, padapter->wapiInfo.extra_prefix_len);
|
||||
memmove(pos, pos + padapter->wapiInfo.extra_prefix_len, hdr_len);
|
||||
|
||||
pSecHeader = pskb->data + hdr_len;
|
||||
pWapiExt = (PWLAN_HEADER_WAPI_EXTENSION)pSecHeader;
|
||||
pRA = pskb->data + 4;
|
||||
|
||||
WAPI_DATA(WAPI_TX, "FillIV - Before Fill IV", pskb->data, pskb->len);
|
||||
|
||||
/* Address 1 is always receiver's address */
|
||||
if (IS_MCAST(pRA)) {
|
||||
if (!pWapiInfo->wapiTxMsk.bTxEnable) {
|
||||
WAPI_TRACE(WAPI_ERR, "%s: bTxEnable = 0!!\n", __FUNCTION__);
|
||||
return -2;
|
||||
}
|
||||
if (pWapiInfo->wapiTxMsk.keyId <= 1) {
|
||||
pWapiExt->KeyIdx = pWapiInfo->wapiTxMsk.keyId;
|
||||
pWapiExt->Reserved = 0;
|
||||
bPNOverflow = WapiIncreasePN(pWapiInfo->lastTxMulticastPN, 1);
|
||||
memcpy(pWapiExt->PN, pWapiInfo->lastTxMulticastPN, 16);
|
||||
if (bPNOverflow) {
|
||||
/* Update MSK Notification. */
|
||||
WAPI_TRACE(WAPI_ERR, "===============>%s():multicast PN overflow\n", __FUNCTION__);
|
||||
rtw_wapi_app_event_handler(padapter, NULL, 0, pRA, false, false, true, 0, false);
|
||||
}
|
||||
} else {
|
||||
WAPI_TRACE(WAPI_ERR, "%s: Invalid Wapi Multicast KeyIdx!!\n", __FUNCTION__);
|
||||
ret = -3;
|
||||
}
|
||||
} else {
|
||||
list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list) {
|
||||
if (!memcmp(pWapiSta->PeerMacAddr, pRA, 6)) {
|
||||
bFindMatchPeer = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (bFindMatchPeer) {
|
||||
if ((!pWapiSta->wapiUskUpdate.bTxEnable) && (!pWapiSta->wapiUsk.bTxEnable)) {
|
||||
WAPI_TRACE(WAPI_ERR, "%s: bTxEnable = 0!!\n", __FUNCTION__);
|
||||
return -4;
|
||||
}
|
||||
if (pWapiSta->wapiUsk.keyId <= 1) {
|
||||
if (pWapiSta->wapiUskUpdate.bTxEnable)
|
||||
pWapiExt->KeyIdx = pWapiSta->wapiUskUpdate.keyId;
|
||||
else
|
||||
pWapiExt->KeyIdx = pWapiSta->wapiUsk.keyId;
|
||||
|
||||
pWapiExt->Reserved = 0;
|
||||
bPNOverflow = WapiIncreasePN(pWapiSta->lastTxUnicastPN, 2);
|
||||
memcpy(pWapiExt->PN, pWapiSta->lastTxUnicastPN, 16);
|
||||
if (bPNOverflow) {
|
||||
/* Update USK Notification. */
|
||||
WAPI_TRACE(WAPI_ERR, "===============>%s():unicast PN overflow\n", __FUNCTION__);
|
||||
rtw_wapi_app_event_handler(padapter, NULL, 0, pWapiSta->PeerMacAddr, false, true, false, 0, false);
|
||||
}
|
||||
} else {
|
||||
WAPI_TRACE(WAPI_ERR, "%s: Invalid Wapi Unicast KeyIdx!!\n", __FUNCTION__);
|
||||
ret = -5;
|
||||
}
|
||||
} else {
|
||||
WAPI_TRACE(WAPI_ERR, "%s: Can not find Peer Sta "MAC_FMT"!!\n", __FUNCTION__, MAC_ARG(pRA));
|
||||
ret = -6;
|
||||
}
|
||||
}
|
||||
|
||||
WAPI_DATA(WAPI_TX, "FillIV - After Fill IV", pskb->data, pskb->len);
|
||||
WAPI_TRACE(WAPI_TX, "<=========%s\n", __FUNCTION__);
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* WAPI SW Enc: must have done Coalesce! */
|
||||
void SecSWSMS4Encryption(
|
||||
_adapter *padapter,
|
||||
u8 *pxmitframe
|
||||
)
|
||||
{
|
||||
PRT_WAPI_T pWapiInfo = &padapter->wapiInfo;
|
||||
PRT_WAPI_STA_INFO pWapiSta = NULL;
|
||||
u8 *pframe = ((struct xmit_frame *)pxmitframe)->buf_addr + TXDESC_SIZE;
|
||||
struct pkt_attrib *pattrib = &((struct xmit_frame *)pxmitframe)->attrib;
|
||||
|
||||
u8 *SecPtr = NULL, *pRA, *pMicKey = NULL, *pDataKey = NULL, *pIV = NULL;
|
||||
u8 IVOffset, DataOffset, bFindMatchPeer = false, KeyIdx = 0, MicBuffer[16];
|
||||
u16 OutputLength;
|
||||
|
||||
WAPI_TRACE(WAPI_TX, "=========>%s\n", __FUNCTION__);
|
||||
|
||||
WAPI_TRACE(WAPI_TX, "hdrlen: %d\n", pattrib->hdrlen);
|
||||
|
||||
return;
|
||||
|
||||
DataOffset = pattrib->hdrlen + pattrib->iv_len;
|
||||
|
||||
pRA = pframe + 4;
|
||||
|
||||
|
||||
if (IS_MCAST(pRA)) {
|
||||
KeyIdx = pWapiInfo->wapiTxMsk.keyId;
|
||||
pIV = pWapiInfo->lastTxMulticastPN;
|
||||
pMicKey = pWapiInfo->wapiTxMsk.micKey;
|
||||
pDataKey = pWapiInfo->wapiTxMsk.dataKey;
|
||||
} else {
|
||||
if (!list_empty(&(pWapiInfo->wapiSTAUsedList))) {
|
||||
list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list) {
|
||||
if (0 == memcmp(pWapiSta->PeerMacAddr, pRA, 6)) {
|
||||
bFindMatchPeer = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (bFindMatchPeer) {
|
||||
if (pWapiSta->wapiUskUpdate.bTxEnable) {
|
||||
KeyIdx = pWapiSta->wapiUskUpdate.keyId;
|
||||
WAPI_TRACE(WAPI_TX, "%s(): Use update USK!! KeyIdx=%d\n", __FUNCTION__, KeyIdx);
|
||||
pIV = pWapiSta->lastTxUnicastPN;
|
||||
pMicKey = pWapiSta->wapiUskUpdate.micKey;
|
||||
pDataKey = pWapiSta->wapiUskUpdate.dataKey;
|
||||
} else {
|
||||
KeyIdx = pWapiSta->wapiUsk.keyId;
|
||||
WAPI_TRACE(WAPI_TX, "%s(): Use USK!! KeyIdx=%d\n", __FUNCTION__, KeyIdx);
|
||||
pIV = pWapiSta->lastTxUnicastPN;
|
||||
pMicKey = pWapiSta->wapiUsk.micKey;
|
||||
pDataKey = pWapiSta->wapiUsk.dataKey;
|
||||
}
|
||||
} else {
|
||||
WAPI_TRACE(WAPI_ERR, "%s: Can not find Peer Sta!!\n", __FUNCTION__);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
WAPI_TRACE(WAPI_ERR, "%s: wapiSTAUsedList is empty!!\n", __FUNCTION__);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
SecPtr = pframe;
|
||||
SecCalculateMicSMS4(KeyIdx, pMicKey, SecPtr, (SecPtr + DataOffset), pattrib->pktlen, MicBuffer);
|
||||
|
||||
WAPI_DATA(WAPI_TX, "Encryption - MIC", MicBuffer, padapter->wapiInfo.extra_postfix_len);
|
||||
|
||||
memcpy(pframe + pattrib->hdrlen + pattrib->iv_len + pattrib->pktlen - pattrib->icv_len,
|
||||
(u8 *)MicBuffer,
|
||||
padapter->wapiInfo.extra_postfix_len
|
||||
);
|
||||
|
||||
|
||||
WapiSMS4Encryption(pDataKey, pIV, (SecPtr + DataOffset), pattrib->pktlen + pattrib->icv_len, (SecPtr + DataOffset), &OutputLength);
|
||||
|
||||
WAPI_DATA(WAPI_TX, "Encryption - After SMS4 encryption", pframe, pattrib->hdrlen + pattrib->iv_len + pattrib->pktlen);
|
||||
|
||||
WAPI_TRACE(WAPI_TX, "<=========%s\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
u8 SecSWSMS4Decryption(
|
||||
_adapter *padapter,
|
||||
u8 *precv_frame,
|
||||
struct recv_priv *precv_priv
|
||||
)
|
||||
{
|
||||
PRT_WAPI_T pWapiInfo = &padapter->wapiInfo;
|
||||
struct recv_frame_hdr *precv_hdr;
|
||||
PRT_WAPI_STA_INFO pWapiSta = NULL;
|
||||
u8 IVOffset, DataOffset, bFindMatchPeer = false, bUseUpdatedKey = false;
|
||||
u8 KeyIdx, MicBuffer[16], lastRxPNforQoS[16];
|
||||
u8 *pRA, *pTA, *pMicKey, *pDataKey, *pLastRxPN, *pRecvPN, *pSecData, *pRecvMic, *pos;
|
||||
u8 TID = 0;
|
||||
u16 OutputLength, DataLen;
|
||||
u8 bQosData;
|
||||
struct sk_buff *pskb;
|
||||
|
||||
WAPI_TRACE(WAPI_RX, "=========>%s\n", __FUNCTION__);
|
||||
|
||||
return 0;
|
||||
|
||||
precv_hdr = &((union recv_frame *)precv_frame)->u.hdr;
|
||||
pskb = (struct sk_buff *)(precv_hdr->rx_data);
|
||||
precv_hdr->bWapiCheckPNInDecrypt = WapiCheckPnInSwDecrypt(padapter, pskb);
|
||||
WAPI_TRACE(WAPI_RX, "=========>%s: check PN %d\n", __FUNCTION__, precv_hdr->bWapiCheckPNInDecrypt);
|
||||
WAPI_DATA(WAPI_RX, "Decryption - Before decryption", pskb->data, pskb->len);
|
||||
|
||||
IVOffset = sMacHdrLng;
|
||||
bQosData = GetFrameType(pskb->data) == WIFI_QOS_DATA_TYPE;
|
||||
if (bQosData)
|
||||
IVOffset += 2;
|
||||
|
||||
/* if(GetHTC()) */
|
||||
/* IVOffset += 4; */
|
||||
|
||||
/* IVOffset += SNAP_SIZE + sizeof(u16); */
|
||||
|
||||
DataOffset = IVOffset + padapter->wapiInfo.extra_prefix_len;
|
||||
|
||||
pRA = pskb->data + 4;
|
||||
pTA = pskb->data + 10;
|
||||
KeyIdx = *(pskb->data + IVOffset);
|
||||
pRecvPN = pskb->data + IVOffset + 2;
|
||||
pSecData = pskb->data + DataOffset;
|
||||
DataLen = pskb->len - DataOffset;
|
||||
pRecvMic = pskb->data + pskb->len - padapter->wapiInfo.extra_postfix_len;
|
||||
TID = GetTid(pskb->data);
|
||||
|
||||
if (!list_empty(&(pWapiInfo->wapiSTAUsedList))) {
|
||||
list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list) {
|
||||
if (0 == memcmp(pWapiSta->PeerMacAddr, pTA, 6)) {
|
||||
bFindMatchPeer = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!bFindMatchPeer) {
|
||||
WAPI_TRACE(WAPI_ERR, "%s: Can not find Peer Sta "MAC_FMT" for Key Info!!!\n", __FUNCTION__, MAC_ARG(pTA));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IS_MCAST(pRA)) {
|
||||
WAPI_TRACE(WAPI_RX, "%s: Multicast decryption !!!\n", __FUNCTION__);
|
||||
if (pWapiSta->wapiMsk.keyId == KeyIdx && pWapiSta->wapiMsk.bSet) {
|
||||
pLastRxPN = pWapiSta->lastRxMulticastPN;
|
||||
if (!WapiComparePN(pRecvPN, pLastRxPN)) {
|
||||
WAPI_TRACE(WAPI_ERR, "%s: MSK PN is not larger than last, Dropped!!!\n", __FUNCTION__);
|
||||
WAPI_DATA(WAPI_ERR, "pRecvPN:", pRecvPN, 16);
|
||||
WAPI_DATA(WAPI_ERR, "pLastRxPN:", pLastRxPN, 16);
|
||||
return false;
|
||||
}
|
||||
|
||||
memcpy(pLastRxPN, pRecvPN, 16);
|
||||
pMicKey = pWapiSta->wapiMsk.micKey;
|
||||
pDataKey = pWapiSta->wapiMsk.dataKey;
|
||||
} else if (pWapiSta->wapiMskUpdate.keyId == KeyIdx && pWapiSta->wapiMskUpdate.bSet) {
|
||||
WAPI_TRACE(WAPI_RX, "%s: Use Updated MSK for Decryption !!!\n", __FUNCTION__);
|
||||
bUseUpdatedKey = true;
|
||||
memcpy(pWapiSta->lastRxMulticastPN, pRecvPN, 16);
|
||||
pMicKey = pWapiSta->wapiMskUpdate.micKey;
|
||||
pDataKey = pWapiSta->wapiMskUpdate.dataKey;
|
||||
} else {
|
||||
WAPI_TRACE(WAPI_ERR, "%s: Can not find MSK with matched KeyIdx(%d), Dropped !!!\n", __FUNCTION__, KeyIdx);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
WAPI_TRACE(WAPI_RX, "%s: Unicast decryption !!!\n", __FUNCTION__);
|
||||
if (pWapiSta->wapiUsk.keyId == KeyIdx && pWapiSta->wapiUsk.bSet) {
|
||||
WAPI_TRACE(WAPI_RX, "%s: Use USK for Decryption!!!\n", __FUNCTION__);
|
||||
if (precv_hdr->bWapiCheckPNInDecrypt) {
|
||||
if (GetFrameType(pskb->data) == WIFI_QOS_DATA_TYPE) {
|
||||
WapiGetLastRxUnicastPNForQoSData(TID, pWapiSta, lastRxPNforQoS);
|
||||
pLastRxPN = lastRxPNforQoS;
|
||||
} else
|
||||
pLastRxPN = pWapiSta->lastRxUnicastPN;
|
||||
if (!WapiComparePN(pRecvPN, pLastRxPN))
|
||||
return false;
|
||||
if (bQosData)
|
||||
WapiSetLastRxUnicastPNForQoSData(TID, pRecvPN, pWapiSta);
|
||||
else
|
||||
memcpy(pWapiSta->lastRxUnicastPN, pRecvPN, 16);
|
||||
} else
|
||||
memcpy(precv_hdr->WapiTempPN, pRecvPN, 16);
|
||||
|
||||
if (check_fwstate(&padapter->mlmepriv, WIFI_STATION_STATE)) {
|
||||
if ((pRecvPN[0] & 0x1) == 0) {
|
||||
WAPI_TRACE(WAPI_ERR, "%s: Rx USK PN is not odd when Infra STA mode, Dropped !!!\n", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
pMicKey = pWapiSta->wapiUsk.micKey;
|
||||
pDataKey = pWapiSta->wapiUsk.dataKey;
|
||||
} else if (pWapiSta->wapiUskUpdate.keyId == KeyIdx && pWapiSta->wapiUskUpdate.bSet) {
|
||||
WAPI_TRACE(WAPI_RX, "%s: Use Updated USK for Decryption!!!\n", __FUNCTION__);
|
||||
if (pWapiSta->bAuthenticatorInUpdata)
|
||||
bUseUpdatedKey = true;
|
||||
else
|
||||
bUseUpdatedKey = false;
|
||||
|
||||
if (bQosData)
|
||||
WapiSetLastRxUnicastPNForQoSData(TID, pRecvPN, pWapiSta);
|
||||
else
|
||||
memcpy(pWapiSta->lastRxUnicastPN, pRecvPN, 16);
|
||||
pMicKey = pWapiSta->wapiUskUpdate.micKey;
|
||||
pDataKey = pWapiSta->wapiUskUpdate.dataKey;
|
||||
} else {
|
||||
WAPI_TRACE(WAPI_ERR, "%s: No valid USK!!!KeyIdx=%d pWapiSta->wapiUsk.keyId=%d pWapiSta->wapiUskUpdate.keyId=%d\n", __FUNCTION__, KeyIdx, pWapiSta->wapiUsk.keyId,
|
||||
pWapiSta->wapiUskUpdate.keyId);
|
||||
/* dump_buf(pskb->data,pskb->len); */
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
WAPI_DATA(WAPI_RX, "Decryption - DataKey", pDataKey, 16);
|
||||
WAPI_DATA(WAPI_RX, "Decryption - IV", pRecvPN, 16);
|
||||
WapiSMS4Decryption(pDataKey, pRecvPN, pSecData, DataLen, pSecData, &OutputLength);
|
||||
|
||||
if (OutputLength != DataLen)
|
||||
WAPI_TRACE(WAPI_ERR, "%s: Output Length Error!!!!\n", __FUNCTION__);
|
||||
|
||||
WAPI_DATA(WAPI_RX, "Decryption - After decryption", pskb->data, pskb->len);
|
||||
|
||||
DataLen -= padapter->wapiInfo.extra_postfix_len;
|
||||
|
||||
SecCalculateMicSMS4(KeyIdx, pMicKey, pskb->data, pSecData, DataLen, MicBuffer);
|
||||
|
||||
WAPI_DATA(WAPI_RX, "Decryption - MIC received", pRecvMic, SMS4_MIC_LEN);
|
||||
WAPI_DATA(WAPI_RX, "Decryption - MIC calculated", MicBuffer, SMS4_MIC_LEN);
|
||||
|
||||
if (0 == memcmp(MicBuffer, pRecvMic, padapter->wapiInfo.extra_postfix_len)) {
|
||||
WAPI_TRACE(WAPI_RX, "%s: Check MIC OK!!\n", __FUNCTION__);
|
||||
if (bUseUpdatedKey) {
|
||||
/* delete the old key */
|
||||
if (IS_MCAST(pRA)) {
|
||||
WAPI_TRACE(WAPI_API, "%s(): AE use new update MSK!!\n", __FUNCTION__);
|
||||
pWapiSta->wapiMsk.keyId = pWapiSta->wapiMskUpdate.keyId;
|
||||
memcpy(pWapiSta->wapiMsk.dataKey, pWapiSta->wapiMskUpdate.dataKey, 16);
|
||||
memcpy(pWapiSta->wapiMsk.micKey, pWapiSta->wapiMskUpdate.micKey, 16);
|
||||
pWapiSta->wapiMskUpdate.bTxEnable = pWapiSta->wapiMskUpdate.bSet = false;
|
||||
} else {
|
||||
WAPI_TRACE(WAPI_API, "%s(): AE use new update USK!!\n", __FUNCTION__);
|
||||
pWapiSta->wapiUsk.keyId = pWapiSta->wapiUskUpdate.keyId;
|
||||
memcpy(pWapiSta->wapiUsk.dataKey, pWapiSta->wapiUskUpdate.dataKey, 16);
|
||||
memcpy(pWapiSta->wapiUsk.micKey, pWapiSta->wapiUskUpdate.micKey, 16);
|
||||
pWapiSta->wapiUskUpdate.bTxEnable = pWapiSta->wapiUskUpdate.bSet = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
WAPI_TRACE(WAPI_ERR, "%s: Check MIC Error, Dropped !!!!\n", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
|
||||
pos = pskb->data;
|
||||
memmove(pos + padapter->wapiInfo.extra_prefix_len, pos, IVOffset);
|
||||
skb_pull(pskb, padapter->wapiInfo.extra_prefix_len);
|
||||
|
||||
WAPI_TRACE(WAPI_RX, "<=========%s\n", __FUNCTION__);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
u32 rtw_sms4_encrypt(_adapter *padapter, u8 *pxmitframe)
|
||||
{
|
||||
|
||||
u8 *pframe;
|
||||
u32 res = _SUCCESS;
|
||||
|
||||
WAPI_TRACE(WAPI_TX, "=========>%s\n", __FUNCTION__);
|
||||
|
||||
if ((!padapter->WapiSupport) || (!padapter->wapiInfo.bWapiEnable)) {
|
||||
WAPI_TRACE(WAPI_TX, "<========== %s, WAPI not supported or enabled!\n", __FUNCTION__);
|
||||
return _FAIL;
|
||||
}
|
||||
|
||||
if (((struct xmit_frame *)pxmitframe)->buf_addr == NULL)
|
||||
return _FAIL;
|
||||
|
||||
pframe = ((struct xmit_frame *)pxmitframe)->buf_addr + TXDESC_OFFSET;
|
||||
|
||||
SecSWSMS4Encryption(padapter, pxmitframe);
|
||||
|
||||
WAPI_TRACE(WAPI_TX, "<=========%s\n", __FUNCTION__);
|
||||
return res;
|
||||
}
|
||||
|
||||
u32 rtw_sms4_decrypt(_adapter *padapter, u8 *precvframe)
|
||||
{
|
||||
u8 *pframe;
|
||||
u32 res = _SUCCESS;
|
||||
|
||||
WAPI_TRACE(WAPI_RX, "=========>%s\n", __FUNCTION__);
|
||||
|
||||
if ((!padapter->WapiSupport) || (!padapter->wapiInfo.bWapiEnable)) {
|
||||
WAPI_TRACE(WAPI_RX, "<========== %s, WAPI not supported or enabled!\n", __FUNCTION__);
|
||||
return _FAIL;
|
||||
}
|
||||
|
||||
|
||||
/* drop packet when hw decrypt fail
|
||||
* return tempraily */
|
||||
return _FAIL;
|
||||
|
||||
/* pframe=(unsigned char *)((union recv_frame*)precvframe)->u.hdr.rx_data; */
|
||||
|
||||
if (false == SecSWSMS4Decryption(padapter, precvframe, &padapter->recvpriv)) {
|
||||
WAPI_TRACE(WAPI_ERR, "%s():SMS4 decrypt frame error\n", __FUNCTION__);
|
||||
return _FAIL;
|
||||
}
|
||||
|
||||
WAPI_TRACE(WAPI_RX, "<=========%s\n", __FUNCTION__);
|
||||
return res;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
u32 rtw_sms4_encrypt(_adapter *padapter, u8 *pxmitframe)
|
||||
{
|
||||
WAPI_TRACE(WAPI_TX, "=========>Dummy %s\n", __FUNCTION__);
|
||||
WAPI_TRACE(WAPI_TX, "<=========Dummy %s\n", __FUNCTION__);
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
u32 rtw_sms4_decrypt(_adapter *padapter, u8 *precvframe)
|
||||
{
|
||||
WAPI_TRACE(WAPI_RX, "=========>Dummy %s\n", __FUNCTION__);
|
||||
WAPI_TRACE(WAPI_RX, "<=========Dummy %s\n", __FUNCTION__);
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
4943
core/rtw_wlan_util.c
4943
core/rtw_wlan_util.c
File diff suppressed because it is too large
Load diff
4999
core/rtw_xmit.c
4999
core/rtw_xmit.c
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,106 +0,0 @@
|
|||
#ifndef __INC_RA_H
|
||||
#define __INC_RA_H
|
||||
/*++
|
||||
Copyright (c) Realtek Semiconductor Corp. All rights reserved.
|
||||
|
||||
Module Name:
|
||||
RateAdaptive.h
|
||||
|
||||
Abstract:
|
||||
Prototype of RA and related data structure.
|
||||
|
||||
Major Change History:
|
||||
When Who What
|
||||
---------- --------------- -------------------------------
|
||||
2011-08-12 Page Create.
|
||||
--*/
|
||||
|
||||
/* Rate adaptive define */
|
||||
#define PERENTRY 23
|
||||
#define RETRYSIZE 5
|
||||
#define RATESIZE 28
|
||||
#define TX_RPT2_ITEM_SIZE 8
|
||||
|
||||
/* */
|
||||
/* TX report 2 format in Rx desc */
|
||||
/* */
|
||||
#define GET_TX_RPT2_DESC_PKT_LEN_88E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 0, 9)
|
||||
#define GET_TX_RPT2_DESC_MACID_VALID_1_88E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+16, 0, 32)
|
||||
#define GET_TX_RPT2_DESC_MACID_VALID_2_88E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+20, 0, 32)
|
||||
|
||||
#define GET_TX_REPORT_TYPE1_RERTY_0(__pAddr) LE_BITS_TO_4BYTE( __pAddr, 0, 16)
|
||||
#define GET_TX_REPORT_TYPE1_RERTY_1(__pAddr) LE_BITS_TO_1BYTE( __pAddr+2, 0, 8)
|
||||
#define GET_TX_REPORT_TYPE1_RERTY_2(__pAddr) LE_BITS_TO_1BYTE( __pAddr+3, 0, 8)
|
||||
#define GET_TX_REPORT_TYPE1_RERTY_3(__pAddr) LE_BITS_TO_1BYTE( __pAddr+4, 0, 8)
|
||||
#define GET_TX_REPORT_TYPE1_RERTY_4(__pAddr) LE_BITS_TO_1BYTE( __pAddr+4+1, 0, 8)
|
||||
#define GET_TX_REPORT_TYPE1_DROP_0(__pAddr) LE_BITS_TO_1BYTE( __pAddr+4+2, 0, 8)
|
||||
#define GET_TX_REPORT_TYPE1_DROP_1(__pAddr) LE_BITS_TO_1BYTE( __pAddr+4+3, 0, 8)
|
||||
|
||||
/* End rate adaptive define */
|
||||
|
||||
void
|
||||
ODM_RASupport_Init(
|
||||
PDM_ODM_T pDM_Odm
|
||||
);
|
||||
|
||||
int
|
||||
ODM_RAInfo_Init_all(
|
||||
PDM_ODM_T pDM_Odm
|
||||
);
|
||||
|
||||
int
|
||||
ODM_RAInfo_Init(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u8 MacID
|
||||
);
|
||||
|
||||
u8
|
||||
ODM_RA_GetShortGI_8188E(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u8 MacID
|
||||
);
|
||||
|
||||
u8
|
||||
ODM_RA_GetDecisionRate_8188E(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u8 MacID
|
||||
);
|
||||
|
||||
u8
|
||||
ODM_RA_GetHwPwrStatus_8188E(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u8 MacID
|
||||
);
|
||||
void
|
||||
ODM_RA_UpdateRateInfo_8188E(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u8 MacID,
|
||||
u8 RateID,
|
||||
u32 RateMask,
|
||||
u8 SGIEnable
|
||||
);
|
||||
|
||||
void
|
||||
ODM_RA_SetRSSI_8188E(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u8 MacID,
|
||||
u8 Rssi
|
||||
);
|
||||
|
||||
void
|
||||
ODM_RA_TxRPT2Handle_8188E(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u8 * TxRPT_Buf,
|
||||
u16 TxRPT_Len,
|
||||
u32 MacIDValidEntry0,
|
||||
u32 MacIDValidEntry1
|
||||
);
|
||||
|
||||
|
||||
void
|
||||
ODM_RA_Set_TxRPT_Time(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u16 minRptTime
|
||||
);
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load diff
|
@ -1,373 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include "odm_precomp.h"
|
||||
|
||||
static bool
|
||||
CheckCondition(
|
||||
const u32 Condition,
|
||||
const u32 Hex
|
||||
)
|
||||
{
|
||||
u32 _board = (Hex & 0x000000FF);
|
||||
u32 _interface = (Hex & 0x0000FF00) >> 8;
|
||||
u32 _platform = (Hex & 0x00FF0000) >> 16;
|
||||
u32 cond = Condition;
|
||||
|
||||
if ( Condition == 0xCDCDCDCD )
|
||||
return true;
|
||||
|
||||
cond = Condition & 0x000000FF;
|
||||
if ( (_board != cond) && (cond != 0xFF) )
|
||||
return false;
|
||||
|
||||
cond = Condition & 0x0000FF00;
|
||||
cond = cond >> 8;
|
||||
if ( ((_interface & cond) == 0) && (cond != 0x07) )
|
||||
return false;
|
||||
|
||||
cond = Condition & 0x00FF0000;
|
||||
cond = cond >> 16;
|
||||
if ( ((_platform & cond) == 0) && (cond != 0x0F) )
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* MAC_REG.TXT
|
||||
******************************************************************************/
|
||||
|
||||
static u32 Array_MAC_REG_8188E[] = {
|
||||
0x026, 0x00000041,
|
||||
0x027, 0x00000035,
|
||||
0xFF0F0718, 0xABCD,
|
||||
0x040, 0x0000000C,
|
||||
0xCDCDCDCD, 0xCDCD,
|
||||
0x040, 0x00000000,
|
||||
0xFF0F0718, 0xDEAD,
|
||||
0x428, 0x0000000A,
|
||||
0x429, 0x00000010,
|
||||
0x430, 0x00000000,
|
||||
0x431, 0x00000001,
|
||||
0x432, 0x00000002,
|
||||
0x433, 0x00000004,
|
||||
0x434, 0x00000005,
|
||||
0x435, 0x00000006,
|
||||
0x436, 0x00000007,
|
||||
0x437, 0x00000008,
|
||||
0x438, 0x00000000,
|
||||
0x439, 0x00000000,
|
||||
0x43A, 0x00000001,
|
||||
0x43B, 0x00000002,
|
||||
0x43C, 0x00000004,
|
||||
0x43D, 0x00000005,
|
||||
0x43E, 0x00000006,
|
||||
0x43F, 0x00000007,
|
||||
0x440, 0x0000005D,
|
||||
0x441, 0x00000001,
|
||||
0x442, 0x00000000,
|
||||
0x444, 0x00000015,
|
||||
0x445, 0x000000F0,
|
||||
0x446, 0x0000000F,
|
||||
0x447, 0x00000000,
|
||||
0x458, 0x00000041,
|
||||
0x459, 0x000000A8,
|
||||
0x45A, 0x00000072,
|
||||
0x45B, 0x000000B9,
|
||||
0x460, 0x00000066,
|
||||
0x461, 0x00000066,
|
||||
0x480, 0x00000008,
|
||||
0x4C8, 0x000000FF,
|
||||
0x4C9, 0x00000008,
|
||||
0x4CC, 0x000000FF,
|
||||
0x4CD, 0x000000FF,
|
||||
0x4CE, 0x00000001,
|
||||
0x4D3, 0x00000001,
|
||||
0x500, 0x00000026,
|
||||
0x501, 0x000000A2,
|
||||
0x502, 0x0000002F,
|
||||
0x503, 0x00000000,
|
||||
0x504, 0x00000028,
|
||||
0x505, 0x000000A3,
|
||||
0x506, 0x0000005E,
|
||||
0x507, 0x00000000,
|
||||
0x508, 0x0000002B,
|
||||
0x509, 0x000000A4,
|
||||
0x50A, 0x0000005E,
|
||||
0x50B, 0x00000000,
|
||||
0x50C, 0x0000004F,
|
||||
0x50D, 0x000000A4,
|
||||
0x50E, 0x00000000,
|
||||
0x50F, 0x00000000,
|
||||
0x512, 0x0000001C,
|
||||
0x514, 0x0000000A,
|
||||
0x516, 0x0000000A,
|
||||
0x525, 0x0000004F,
|
||||
0x550, 0x00000010,
|
||||
0x551, 0x00000010,
|
||||
0x559, 0x00000002,
|
||||
0x55D, 0x000000FF,
|
||||
0x605, 0x00000030,
|
||||
0x608, 0x0000000E,
|
||||
0x609, 0x0000002A,
|
||||
0x620, 0x000000FF,
|
||||
0x621, 0x000000FF,
|
||||
0x622, 0x000000FF,
|
||||
0x623, 0x000000FF,
|
||||
0x624, 0x000000FF,
|
||||
0x625, 0x000000FF,
|
||||
0x626, 0x000000FF,
|
||||
0x627, 0x000000FF,
|
||||
0x652, 0x00000020,
|
||||
0x63C, 0x0000000A,
|
||||
0x63D, 0x0000000A,
|
||||
0x63E, 0x0000000E,
|
||||
0x63F, 0x0000000E,
|
||||
0x640, 0x00000040,
|
||||
0x66E, 0x00000005,
|
||||
0x700, 0x00000021,
|
||||
0x701, 0x00000043,
|
||||
0x702, 0x00000065,
|
||||
0x703, 0x00000087,
|
||||
0x708, 0x00000021,
|
||||
0x709, 0x00000043,
|
||||
0x70A, 0x00000065,
|
||||
0x70B, 0x00000087,
|
||||
};
|
||||
|
||||
HAL_STATUS
|
||||
ODM_ReadAndConfig_MAC_REG_8188E(
|
||||
PDM_ODM_T pDM_Odm
|
||||
)
|
||||
{
|
||||
#define READ_NEXT_PAIR(v1, v2, i) do { i += 2; v1 = Array[i]; v2 = Array[i+1]; } while (0)
|
||||
|
||||
u32 hex = 0;
|
||||
u32 i = 0;
|
||||
u16 count = 0;
|
||||
u32 * ptr_array = NULL;
|
||||
u8 platform = pDM_Odm->SupportPlatform;
|
||||
u8 interfaceValue = pDM_Odm->SupportInterface;
|
||||
u8 board = pDM_Odm->BoardType;
|
||||
u32 ArrayLen = sizeof(Array_MAC_REG_8188E)/sizeof(u32);
|
||||
u32 * Array = Array_MAC_REG_8188E;
|
||||
bool biol = false;
|
||||
HAL_STATUS rst =HAL_STATUS_SUCCESS;
|
||||
hex += board;
|
||||
hex += interfaceValue << 8;
|
||||
hex += platform << 16;
|
||||
hex += 0xFF000000;
|
||||
|
||||
for (i = 0; i < ArrayLen; i += 2 ) {
|
||||
u32 v1 = Array[i];
|
||||
u32 v2 = Array[i+1];
|
||||
|
||||
/* This (offset, data) pair meets the condition. */
|
||||
if ( v1 < 0xCDCDCDCD )
|
||||
{
|
||||
odm_ConfigMAC_8188E(pDM_Odm, v1, (u8)v2);
|
||||
continue;
|
||||
} else { /* This line is the start line of branch. */
|
||||
if ( !CheckCondition(Array[i], hex) )
|
||||
{ /* Discard the following (offset, data) pairs. */
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
while ( v2 != 0xDEAD &&
|
||||
v2 != 0xCDEF &&
|
||||
v2 != 0xCDCD && i < ArrayLen -2)
|
||||
{
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
i -= 2; /* prevent from for-loop += 2 */
|
||||
}
|
||||
else /* Configure matched pairs and skip to end of if-else. */
|
||||
{
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
while (v2 != 0xDEAD &&
|
||||
v2 != 0xCDEF &&
|
||||
v2 != 0xCDCD && i < ArrayLen -2) {
|
||||
odm_ConfigMAC_8188E(pDM_Odm, v1, (u8)v2);
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
while (v2 != 0xDEAD && i < ArrayLen -2)
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rst;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* MAC_REG_ICUT.TXT
|
||||
******************************************************************************/
|
||||
|
||||
static u32 Array_MP_8188E_MAC_REG_ICUT[] = {
|
||||
0x026, 0x00000041,
|
||||
0x027, 0x00000035,
|
||||
0x428, 0x0000000A,
|
||||
0x429, 0x00000010,
|
||||
0x430, 0x00000000,
|
||||
0x431, 0x00000001,
|
||||
0x432, 0x00000002,
|
||||
0x433, 0x00000004,
|
||||
0x434, 0x00000005,
|
||||
0x435, 0x00000006,
|
||||
0x436, 0x00000007,
|
||||
0x437, 0x00000008,
|
||||
0x438, 0x00000000,
|
||||
0x439, 0x00000000,
|
||||
0x43A, 0x00000001,
|
||||
0x43B, 0x00000002,
|
||||
0x43C, 0x00000004,
|
||||
0x43D, 0x00000005,
|
||||
0x43E, 0x00000006,
|
||||
0x43F, 0x00000007,
|
||||
0x440, 0x0000005D,
|
||||
0x441, 0x00000001,
|
||||
0x442, 0x00000000,
|
||||
0x444, 0x00000015,
|
||||
0x445, 0x000000F0,
|
||||
0x446, 0x0000000F,
|
||||
0x447, 0x00000000,
|
||||
0x458, 0x00000041,
|
||||
0x459, 0x000000A8,
|
||||
0x45A, 0x00000072,
|
||||
0x45B, 0x000000B9,
|
||||
0x460, 0x00000066,
|
||||
0x461, 0x00000066,
|
||||
0x480, 0x00000008,
|
||||
0x4C8, 0x000000FF,
|
||||
0x4C9, 0x00000008,
|
||||
0x4CC, 0x000000FF,
|
||||
0x4CD, 0x000000FF,
|
||||
0x4CE, 0x00000001,
|
||||
0x4D3, 0x00000001,
|
||||
0x500, 0x00000026,
|
||||
0x501, 0x000000A2,
|
||||
0x502, 0x0000002F,
|
||||
0x503, 0x00000000,
|
||||
0x504, 0x00000028,
|
||||
0x505, 0x000000A3,
|
||||
0x506, 0x0000005E,
|
||||
0x507, 0x00000000,
|
||||
0x508, 0x0000002B,
|
||||
0x509, 0x000000A4,
|
||||
0x50A, 0x0000005E,
|
||||
0x50B, 0x00000000,
|
||||
0x50C, 0x0000004F,
|
||||
0x50D, 0x000000A4,
|
||||
0x50E, 0x00000000,
|
||||
0x50F, 0x00000000,
|
||||
0x512, 0x0000001C,
|
||||
0x514, 0x0000000A,
|
||||
0x516, 0x0000000A,
|
||||
0x525, 0x0000004F,
|
||||
0x550, 0x00000010,
|
||||
0x551, 0x00000010,
|
||||
0x559, 0x00000002,
|
||||
0x55D, 0x000000FF,
|
||||
0x605, 0x00000030,
|
||||
0x608, 0x0000000E,
|
||||
0x609, 0x0000002A,
|
||||
0x620, 0x000000FF,
|
||||
0x621, 0x000000FF,
|
||||
0x622, 0x000000FF,
|
||||
0x623, 0x000000FF,
|
||||
0x624, 0x000000FF,
|
||||
0x625, 0x000000FF,
|
||||
0x626, 0x000000FF,
|
||||
0x627, 0x000000FF,
|
||||
0x652, 0x00000020,
|
||||
0x63C, 0x0000000A,
|
||||
0x63D, 0x0000000A,
|
||||
0x63E, 0x0000000E,
|
||||
0x63F, 0x0000000E,
|
||||
0x640, 0x00000040,
|
||||
0x66E, 0x00000005,
|
||||
0x700, 0x00000021,
|
||||
0x701, 0x00000043,
|
||||
0x702, 0x00000065,
|
||||
0x703, 0x00000087,
|
||||
0x708, 0x00000021,
|
||||
0x709, 0x00000043,
|
||||
0x70A, 0x00000065,
|
||||
0x70B, 0x00000087,
|
||||
|
||||
};
|
||||
|
||||
void
|
||||
ODM_ReadAndConfig_MAC_REG_ICUT_8188E(
|
||||
PDM_ODM_T pDM_Odm
|
||||
)
|
||||
{
|
||||
#define READ_NEXT_PAIR(v1, v2, i) do { i += 2; v1 = Array[i]; v2 = Array[i+1]; } while (0)
|
||||
|
||||
u32 hex = 0;
|
||||
u32 i = 0;
|
||||
u16 count = 0;
|
||||
u32 * ptr_array = NULL;
|
||||
u8 platform = pDM_Odm->SupportPlatform;
|
||||
u8 _interface = pDM_Odm->SupportInterface;
|
||||
u8 board = pDM_Odm->BoardType;
|
||||
u32 ArrayLen = sizeof(Array_MP_8188E_MAC_REG_ICUT)/sizeof(u32);
|
||||
u32 * Array = Array_MP_8188E_MAC_REG_ICUT;
|
||||
|
||||
|
||||
hex += board;
|
||||
hex += _interface << 8;
|
||||
hex += platform << 16;
|
||||
hex += 0xFF000000;
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8188E_MAC_REG_ICUT, hex = 0x%X\n", hex));
|
||||
|
||||
for (i = 0; i < ArrayLen; i += 2 ) {
|
||||
u32 v1 = Array[i];
|
||||
u32 v2 = Array[i+1];
|
||||
|
||||
/* This (offset, data) pair meets the condition. */
|
||||
if ( v1 < 0xCDCDCDCD ) {
|
||||
odm_ConfigMAC_8188E(pDM_Odm, v1, (u8)v2);
|
||||
continue;
|
||||
} else
|
||||
{ /* This line is the start line of branch. */
|
||||
if ( !CheckCondition(Array[i], hex) )
|
||||
{ /* Discard the following (offset, data) pairs. */
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
while (v2 != 0xDEAD &&
|
||||
v2 != 0xCDEF &&
|
||||
v2 != 0xCDCD && i < ArrayLen -2)
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
i -= 2; /* prevent from for-loop += 2 */
|
||||
} else /* Configure matched pairs and skip to end of if-else. */
|
||||
{
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
while (v2 != 0xDEAD &&
|
||||
v2 != 0xCDEF &&
|
||||
v2 != 0xCDCD && i < ArrayLen -2) {
|
||||
odm_ConfigMAC_8188E(pDM_Odm, v1, (u8)v2);
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
|
||||
while (v2 != 0xDEAD && i < ArrayLen -2)
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __INC_MAC_8188E_HW_IMG_H
|
||||
#define __INC_MAC_8188E_HW_IMG_H
|
||||
|
||||
/* static bool CheckCondition(const u32 Condition, const u32 Hex); */
|
||||
|
||||
/******************************************************************************
|
||||
* MAC_REG.TXT
|
||||
******************************************************************************/
|
||||
|
||||
HAL_STATUS
|
||||
ODM_ReadAndConfig_MAC_REG_8188E(
|
||||
PDM_ODM_T pDM_Odm
|
||||
);
|
||||
|
||||
/******************************************************************************
|
||||
* MAC_REG_ICUT.TXT
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
ODM_ReadAndConfig_MAC_REG_ICUT_8188E( /* TC: Test Chip, MP: MP Chip */
|
||||
PDM_ODM_T pDM_Odm
|
||||
);
|
||||
|
||||
#endif
|
|
@ -1,414 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include "odm_precomp.h"
|
||||
|
||||
static bool
|
||||
CheckCondition(
|
||||
const u32 Condition,
|
||||
const u32 Hex
|
||||
)
|
||||
{
|
||||
u32 _board = (Hex & 0x000000FF);
|
||||
u32 _interface = (Hex & 0x0000FF00) >> 8;
|
||||
u32 _platform = (Hex & 0x00FF0000) >> 16;
|
||||
u32 cond = Condition;
|
||||
|
||||
if ( Condition == 0xCDCDCDCD )
|
||||
return true;
|
||||
|
||||
cond = Condition & 0x000000FF;
|
||||
if ( (_board != cond) && (cond != 0xFF) )
|
||||
return false;
|
||||
|
||||
cond = Condition & 0x0000FF00;
|
||||
cond = cond >> 8;
|
||||
if ( ((_interface & cond) == 0) && (cond != 0x07) )
|
||||
return false;
|
||||
|
||||
cond = Condition & 0x00FF0000;
|
||||
cond = cond >> 16;
|
||||
if ( ((_platform & cond) == 0) && (cond != 0x0F) )
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* RadioA_1T.TXT
|
||||
******************************************************************************/
|
||||
|
||||
static u32 Array_RadioA_1T_8188E[] = {
|
||||
0x000, 0x00030000,
|
||||
0x008, 0x00084000,
|
||||
0x018, 0x00000407,
|
||||
0x019, 0x00000012,
|
||||
0x01E, 0x00080009,
|
||||
0x01F, 0x00000880,
|
||||
0x02F, 0x0001A060,
|
||||
0x03F, 0x00000000,
|
||||
0x042, 0x000060C0,
|
||||
0x057, 0x000D0000,
|
||||
0x058, 0x000BE180,
|
||||
0x067, 0x00001552,
|
||||
0x083, 0x00000000,
|
||||
0x0B0, 0x000FF8FC,
|
||||
0x0B1, 0x00054400,
|
||||
0x0B2, 0x000CCC19,
|
||||
0x0B4, 0x00043003,
|
||||
0x0B6, 0x0004953E,
|
||||
0x0B7, 0x0001C718,
|
||||
0x0B8, 0x000060FF,
|
||||
0x0B9, 0x00080001,
|
||||
0x0BA, 0x00040000,
|
||||
0x0BB, 0x00000400,
|
||||
0x0BF, 0x000C0000,
|
||||
0x0C2, 0x00002400,
|
||||
0x0C3, 0x00000009,
|
||||
0x0C4, 0x00040C91,
|
||||
0x0C5, 0x00099999,
|
||||
0x0C6, 0x000000A3,
|
||||
0x0C7, 0x00088820,
|
||||
0x0C8, 0x00076C06,
|
||||
0x0C9, 0x00000000,
|
||||
0x0CA, 0x00080000,
|
||||
0x0DF, 0x00000180,
|
||||
0x0EF, 0x000001A0,
|
||||
0x051, 0x0006B27D,
|
||||
0xFF0F0400, 0xABCD,
|
||||
0x052, 0x0007E4DD,
|
||||
0xCDCDCDCD, 0xCDCD,
|
||||
0x052, 0x0007E49D,
|
||||
0xFF0F0400, 0xDEAD,
|
||||
0x053, 0x00000073,
|
||||
0x056, 0x00051FF3,
|
||||
0x035, 0x00000086,
|
||||
0x035, 0x00000186,
|
||||
0x035, 0x00000286,
|
||||
0x036, 0x00001C25,
|
||||
0x036, 0x00009C25,
|
||||
0x036, 0x00011C25,
|
||||
0x036, 0x00019C25,
|
||||
0x0B6, 0x00048538,
|
||||
0x018, 0x00000C07,
|
||||
0x05A, 0x0004BD00,
|
||||
0x019, 0x000739D0,
|
||||
0xFF0F0718, 0xABCD,
|
||||
0x034, 0x0000A093,
|
||||
0x034, 0x0000908F,
|
||||
0x034, 0x0000808C,
|
||||
0x034, 0x0000704F,
|
||||
0x034, 0x0000604C,
|
||||
0x034, 0x00005049,
|
||||
0x034, 0x0000400C,
|
||||
0x034, 0x00003009,
|
||||
0x034, 0x00002006,
|
||||
0x034, 0x00001003,
|
||||
0x034, 0x00000000,
|
||||
0xCDCDCDCD, 0xCDCD,
|
||||
0x034, 0x0000ADF3,
|
||||
0x034, 0x00009DF0,
|
||||
0x034, 0x00008DED,
|
||||
0x034, 0x00007DEA,
|
||||
0x034, 0x00006DE7,
|
||||
0x034, 0x000054EE,
|
||||
0x034, 0x000044EB,
|
||||
0x034, 0x000034E8,
|
||||
0x034, 0x0000246B,
|
||||
0x034, 0x00001468,
|
||||
0x034, 0x0000006D,
|
||||
0xFF0F0718, 0xDEAD,
|
||||
0x000, 0x00030159,
|
||||
0x084, 0x00068200,
|
||||
0x086, 0x000000CE,
|
||||
0x087, 0x00048A00,
|
||||
0x08E, 0x00065540,
|
||||
0x08F, 0x00088000,
|
||||
0x0EF, 0x000020A0,
|
||||
0x03B, 0x000F02B0,
|
||||
0x03B, 0x000EF7B0,
|
||||
0x03B, 0x000D4FB0,
|
||||
0x03B, 0x000CF060,
|
||||
0x03B, 0x000B0090,
|
||||
0x03B, 0x000A0080,
|
||||
0x03B, 0x00090080,
|
||||
0x03B, 0x0008F780,
|
||||
0x03B, 0x000722B0,
|
||||
0x03B, 0x0006F7B0,
|
||||
0x03B, 0x00054FB0,
|
||||
0x03B, 0x0004F060,
|
||||
0x03B, 0x00030090,
|
||||
0x03B, 0x00020080,
|
||||
0x03B, 0x00010080,
|
||||
0x03B, 0x0000F780,
|
||||
0x0EF, 0x000000A0,
|
||||
0x000, 0x00010159,
|
||||
0x018, 0x0000F407,
|
||||
0xFFE, 0x00000000,
|
||||
0xFFE, 0x00000000,
|
||||
0x01F, 0x00080003,
|
||||
0xFFE, 0x00000000,
|
||||
0xFFE, 0x00000000,
|
||||
0x01E, 0x00000001,
|
||||
0x01F, 0x00080000,
|
||||
0x000, 0x00033E60,
|
||||
|
||||
};
|
||||
|
||||
HAL_STATUS
|
||||
ODM_ReadAndConfig_RadioA_1T_8188E(
|
||||
PDM_ODM_T pDM_Odm
|
||||
)
|
||||
{
|
||||
#define READ_NEXT_PAIR(v1, v2, i) do { i += 2; v1 = Array[i]; v2 = Array[i+1]; } while (0)
|
||||
|
||||
u32 hex = 0;
|
||||
u32 i = 0;
|
||||
u16 count = 0;
|
||||
u32 * ptr_array = NULL;
|
||||
u8 platform = pDM_Odm->SupportPlatform;
|
||||
u8 interfaceValue = pDM_Odm->SupportInterface;
|
||||
u8 board = pDM_Odm->BoardType;
|
||||
u32 ArrayLen = sizeof(Array_RadioA_1T_8188E)/sizeof(u32);
|
||||
u32 * Array = Array_RadioA_1T_8188E;
|
||||
bool biol = false;
|
||||
HAL_STATUS rst =HAL_STATUS_SUCCESS;
|
||||
|
||||
hex += board;
|
||||
hex += interfaceValue << 8;
|
||||
hex += platform << 16;
|
||||
hex += 0xFF000000;
|
||||
for (i = 0; i < ArrayLen; i += 2 ) {
|
||||
u32 v1 = Array[i];
|
||||
u32 v2 = Array[i+1];
|
||||
|
||||
/* This (offset, data) pair meets the condition. */
|
||||
if ( v1 < 0xCDCDCDCD ) {
|
||||
odm_ConfigRF_RadioA_8188E(pDM_Odm, v1, v2);
|
||||
continue;
|
||||
} else { /* This line is the start line of branch. */
|
||||
if ( !CheckCondition(Array[i], hex) )
|
||||
{ /* Discard the following (offset, data) pairs. */
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
while (v2 != 0xDEAD &&
|
||||
v2 != 0xCDEF &&
|
||||
v2 != 0xCDCD && i < ArrayLen -2)
|
||||
{
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
i -= 2; /* prevent from for-loop += 2 */
|
||||
}
|
||||
else /* Configure matched pairs and skip to end of if-else. */
|
||||
{
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
while (v2 != 0xDEAD &&
|
||||
v2 != 0xCDEF &&
|
||||
v2 != 0xCDCD && i < ArrayLen -2)
|
||||
{
|
||||
odm_ConfigRF_RadioA_8188E(pDM_Odm, v1, v2);
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
|
||||
while (v2 != 0xDEAD && i < ArrayLen -2)
|
||||
{
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return rst;
|
||||
}
|
||||
/******************************************************************************
|
||||
* RadioA_1T_ICUT.TXT
|
||||
******************************************************************************/
|
||||
|
||||
static u32 Array_MP_8188E_RadioA_1T_ICUT[] = {
|
||||
0x000, 0x00030000,
|
||||
0x008, 0x00084000,
|
||||
0x018, 0x00000407,
|
||||
0x019, 0x00000012,
|
||||
0x01E, 0x00080009,
|
||||
0x01F, 0x00000880,
|
||||
0x02F, 0x0001A060,
|
||||
0x03F, 0x00000000,
|
||||
0x042, 0x000060C0,
|
||||
0x057, 0x000D0000,
|
||||
0x058, 0x000BE180,
|
||||
0x067, 0x00001552,
|
||||
0x083, 0x00000000,
|
||||
0x0B0, 0x000FF8FC,
|
||||
0x0B1, 0x00054400,
|
||||
0x0B2, 0x000CCC19,
|
||||
0x0B4, 0x00043003,
|
||||
0x0B6, 0x0004953E,
|
||||
0x0B7, 0x0001C718,
|
||||
0x0B8, 0x000060FF,
|
||||
0x0B9, 0x00080001,
|
||||
0x0BA, 0x00040000,
|
||||
0x0BB, 0x00000400,
|
||||
0x0BF, 0x000C0000,
|
||||
0x0C2, 0x00002400,
|
||||
0x0C3, 0x00000009,
|
||||
0x0C4, 0x00040C91,
|
||||
0x0C5, 0x00099999,
|
||||
0x0C6, 0x000000A3,
|
||||
0x0C7, 0x00088820,
|
||||
0x0C8, 0x00076C06,
|
||||
0x0C9, 0x00000000,
|
||||
0x0CA, 0x00080000,
|
||||
0x0DF, 0x00000180,
|
||||
0x0EF, 0x000001A0,
|
||||
0x051, 0x0006B27D,
|
||||
0xFF0F0400, 0xABCD,
|
||||
0x052, 0x0007E4DD,
|
||||
0xCDCDCDCD, 0xCDCD,
|
||||
0x052, 0x0007E49D,
|
||||
0xFF0F0400, 0xDEAD,
|
||||
0x053, 0x00000073,
|
||||
0x056, 0x00051FF3,
|
||||
0x035, 0x00000086,
|
||||
0x035, 0x00000186,
|
||||
0x035, 0x00000286,
|
||||
0x036, 0x00001C25,
|
||||
0x036, 0x00009C25,
|
||||
0x036, 0x00011C25,
|
||||
0x036, 0x00019C25,
|
||||
0x0B6, 0x00048538,
|
||||
0x018, 0x00000C07,
|
||||
0x05A, 0x0004BD00,
|
||||
0x019, 0x000739D0,
|
||||
0x034, 0x0000ADF3,
|
||||
0x034, 0x00009DF0,
|
||||
0x034, 0x00008DED,
|
||||
0x034, 0x00007DEA,
|
||||
0x034, 0x00006DE7,
|
||||
0x034, 0x000054EE,
|
||||
0x034, 0x000044EB,
|
||||
0x034, 0x000034E8,
|
||||
0x034, 0x0000246B,
|
||||
0x034, 0x00001468,
|
||||
0x034, 0x0000006D,
|
||||
0x000, 0x00030159,
|
||||
0x084, 0x00068200,
|
||||
0x086, 0x000000CE,
|
||||
0x087, 0x00048A00,
|
||||
0x08E, 0x00065540,
|
||||
0x08F, 0x00088000,
|
||||
0x0EF, 0x000020A0,
|
||||
0x03B, 0x000F02B0,
|
||||
0x03B, 0x000EF7B0,
|
||||
0x03B, 0x000D4FB0,
|
||||
0x03B, 0x000CF060,
|
||||
0x03B, 0x000B0090,
|
||||
0x03B, 0x000A0080,
|
||||
0x03B, 0x00090080,
|
||||
0x03B, 0x0008F780,
|
||||
0x03B, 0x000722B0,
|
||||
0x03B, 0x0006F7B0,
|
||||
0x03B, 0x00054FB0,
|
||||
0x03B, 0x0004F060,
|
||||
0x03B, 0x00030090,
|
||||
0x03B, 0x00020080,
|
||||
0x03B, 0x00010080,
|
||||
0x03B, 0x0000F780,
|
||||
0x0EF, 0x000000A0,
|
||||
0x000, 0x00010159,
|
||||
0x018, 0x0000F407,
|
||||
0xFFE, 0x00000000,
|
||||
0xFFE, 0x00000000,
|
||||
0x01F, 0x00080003,
|
||||
0xFFE, 0x00000000,
|
||||
0xFFE, 0x00000000,
|
||||
0x01E, 0x00000001,
|
||||
0x01F, 0x00080000,
|
||||
0x000, 0x00033E60,
|
||||
|
||||
};
|
||||
|
||||
void
|
||||
ODM_ReadAndConfig_RadioA_1T_ICUT_8188E(
|
||||
PDM_ODM_T pDM_Odm
|
||||
)
|
||||
{
|
||||
#define READ_NEXT_PAIR(v1, v2, i) do { i += 2; v1 = Array[i]; v2 = Array[i+1]; } while (0)
|
||||
|
||||
u32 hex = 0;
|
||||
u32 i = 0;
|
||||
u16 count = 0;
|
||||
u32 * ptr_array = NULL;
|
||||
u8 platform = pDM_Odm->SupportPlatform;
|
||||
u8 _interface = pDM_Odm->SupportInterface;
|
||||
u8 board = pDM_Odm->BoardType;
|
||||
u32 ArrayLen = sizeof(Array_MP_8188E_RadioA_1T_ICUT)/sizeof(u32);
|
||||
u32 * Array = Array_MP_8188E_RadioA_1T_ICUT;
|
||||
|
||||
|
||||
hex += board;
|
||||
hex += _interface << 8;
|
||||
hex += platform << 16;
|
||||
hex += 0xFF000000;
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8188E_RadioA_1T_ICUT, hex = 0x%X\n", hex));
|
||||
|
||||
for (i = 0; i < ArrayLen; i += 2 )
|
||||
{
|
||||
u32 v1 = Array[i];
|
||||
u32 v2 = Array[i+1];
|
||||
|
||||
/* This (offset, data) pair meets the condition. */
|
||||
if ( v1 < 0xCDCDCDCD )
|
||||
{
|
||||
odm_ConfigRF_RadioA_8188E(pDM_Odm, v1, v2);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{ /* This line is the start line of branch. */
|
||||
if ( !CheckCondition(Array[i], hex) )
|
||||
{ /* Discard the following (offset, data) pairs. */
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
while (v2 != 0xDEAD &&
|
||||
v2 != 0xCDEF &&
|
||||
v2 != 0xCDCD && i < ArrayLen -2)
|
||||
{
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
i -= 2; /* prevent from for-loop += 2 */
|
||||
}
|
||||
else /* Configure matched pairs and skip to end of if-else. */
|
||||
{
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
while (v2 != 0xDEAD &&
|
||||
v2 != 0xCDEF &&
|
||||
v2 != 0xCDCD && i < ArrayLen -2)
|
||||
{
|
||||
odm_ConfigRF_RadioA_8188E(pDM_Odm, v1, v2);
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
|
||||
while (v2 != 0xDEAD && i < ArrayLen -2)
|
||||
{
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __INC_RF_8188E_HW_IMG_H
|
||||
#define __INC_RF_8188E_HW_IMG_H
|
||||
|
||||
/* static bool CheckCondition(const u32 Condition, const u32 Hex); */
|
||||
|
||||
/******************************************************************************
|
||||
* RadioA_1T.TXT
|
||||
******************************************************************************/
|
||||
|
||||
HAL_STATUS
|
||||
ODM_ReadAndConfig_RadioA_1T_8188E(
|
||||
PDM_ODM_T pDM_Odm
|
||||
);
|
||||
/******************************************************************************
|
||||
* RadioA_1T_ICUT.TXT
|
||||
******************************************************************************/
|
||||
|
||||
void
|
||||
ODM_ReadAndConfig_RadioA_1T_ICUT_8188E( /* TC: Test Chip, MP: MP Chip */
|
||||
PDM_ODM_T pDM_Odm
|
||||
);
|
||||
|
||||
#endif
|
|
@ -1,78 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include "odm_precomp.h"
|
||||
|
||||
/* 3============================================================ */
|
||||
/* 3 IQ Calibration */
|
||||
/* 3============================================================ */
|
||||
|
||||
void
|
||||
ODM_ResetIQKResult(
|
||||
PDM_ODM_T pDM_Odm
|
||||
)
|
||||
{
|
||||
u8 i;
|
||||
struct adapter *Adapter = pDM_Odm->Adapter;
|
||||
|
||||
if (!IS_HARDWARE_TYPE_8192D(Adapter))
|
||||
return;
|
||||
ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD,("PHY_ResetIQKResult:: settings regs %d default regs %d\n", (u32)(sizeof(pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting)/sizeof(IQK_MATRIX_REGS_SETTING)), IQK_Matrix_Settings_NUM));
|
||||
/* 0xe94, 0xe9c, 0xea4, 0xeac, 0xeb4, 0xebc, 0xec4, 0xecc */
|
||||
|
||||
for (i = 0; i < IQK_Matrix_Settings_NUM; i++)
|
||||
{
|
||||
{
|
||||
pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[i].Value[0][0] =
|
||||
pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[i].Value[0][2] =
|
||||
pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[i].Value[0][4] =
|
||||
pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[i].Value[0][6] = 0x100;
|
||||
|
||||
pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[i].Value[0][1] =
|
||||
pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[i].Value[0][3] =
|
||||
pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[i].Value[0][5] =
|
||||
pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[i].Value[0][7] = 0x0;
|
||||
|
||||
pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[i].bIQKDone = false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
u8 ODM_GetRightChnlPlaceforIQK(u8 chnl)
|
||||
{
|
||||
u8 channel_all[ODM_TARGET_CHNL_NUM_2G_5G] =
|
||||
{1,2,3,4,5,6,7,8,9,10,11,12,13,14,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,149,151,153,155,157,159,161,163,165};
|
||||
u8 place = chnl;
|
||||
|
||||
|
||||
if (chnl > 14)
|
||||
{
|
||||
for (place = 14; place<sizeof(channel_all); place++)
|
||||
{
|
||||
if (channel_all[place] == chnl)
|
||||
{
|
||||
return place-13;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
2221
hal/HalPhyRf_8188e.c
2221
hal/HalPhyRf_8188e.c
File diff suppressed because it is too large
Load diff
|
@ -1,110 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __HAL_PHY_RF_8188E_H__
|
||||
#define __HAL_PHY_RF_8188E_H__
|
||||
|
||||
|
||||
/*--------------------------Define Parameters-------------------------------*/
|
||||
#define IQK_DELAY_TIME_88E 10 /* ms */
|
||||
#define index_mapping_NUM_88E 15
|
||||
#define AVG_THERMAL_NUM_88E 4
|
||||
|
||||
typedef enum _PWRTRACK_CONTROL_METHOD {
|
||||
BBSWING,
|
||||
TXAGC
|
||||
} PWRTRACK_METHOD;
|
||||
|
||||
|
||||
void
|
||||
ODM_TxPwrTrackAdjust88E(
|
||||
PDM_ODM_T pDM_Odm,
|
||||
u8 Type, /* 0 = OFDM, 1 = CCK */
|
||||
u8 * pDirection, /* 1 = +(increase) 2 = -(decrease) */
|
||||
u32 * pOutWriteVal /* Tx tracking CCK/OFDM BB swing index adjust */
|
||||
);
|
||||
|
||||
|
||||
void
|
||||
odm_TXPowerTrackingCallback_ThermalMeter_8188E(
|
||||
struct adapter * Adapter
|
||||
);
|
||||
|
||||
|
||||
/* 1 7. IQK */
|
||||
|
||||
void
|
||||
PHY_IQCalibrate_8188E(
|
||||
struct adapter * Adapter,
|
||||
bool bReCovery);
|
||||
|
||||
|
||||
/* */
|
||||
/* LC calibrate */
|
||||
/* */
|
||||
void
|
||||
PHY_LCCalibrate_8188E(
|
||||
struct adapter * pAdapter
|
||||
);
|
||||
|
||||
/* */
|
||||
/* AP calibrate */
|
||||
/* */
|
||||
void
|
||||
PHY_APCalibrate_8188E(
|
||||
struct adapter * pAdapter,
|
||||
s8 delta);
|
||||
|
||||
void
|
||||
PHY_DigitalPredistortion_8188E(struct adapter * pAdapter);
|
||||
|
||||
|
||||
void
|
||||
_PHY_SaveADDARegisters(
|
||||
struct adapter * pAdapter,
|
||||
u32 * ADDAReg,
|
||||
u32 * ADDABackup,
|
||||
u32 RegisterNum
|
||||
);
|
||||
|
||||
void
|
||||
_PHY_PathADDAOn(
|
||||
struct adapter * pAdapter,
|
||||
u32 * ADDAReg,
|
||||
bool isPathAOn,
|
||||
bool is2T
|
||||
);
|
||||
|
||||
void
|
||||
_PHY_MACSettingCalibration(
|
||||
struct adapter * pAdapter,
|
||||
u32 * MACReg,
|
||||
u32 * MACBackup
|
||||
);
|
||||
|
||||
|
||||
void
|
||||
_PHY_PathAStandBy(
|
||||
struct adapter * pAdapter
|
||||
);
|
||||
|
||||
|
||||
#endif /* #ifndef __HAL_PHY_RF_8188E_H__ */
|
||||
|
|
@ -35,112 +35,127 @@ Major Change History:
|
|||
--*/
|
||||
#include <HalPwrSeqCmd.h>
|
||||
|
||||
/* */
|
||||
/* Description: */
|
||||
/* This routine deal with the Power Configuration CMDs parsing for RTL8723/RTL8188E Series IC. */
|
||||
/* */
|
||||
/* Assumption: */
|
||||
/* We should follow specific format which was released from HW SD. */
|
||||
/* */
|
||||
/* 2011.07.07, added by Roger. */
|
||||
/* */
|
||||
|
||||
/*
|
||||
* Description:
|
||||
* This routine deal with the Power Configuration CMDs parsing for RTL8723/RTL8188E Series IC.
|
||||
*
|
||||
* Assumption:
|
||||
* We should follow specific format which was released from HW SD.
|
||||
*
|
||||
* 2011.07.07, added by Roger.
|
||||
* */
|
||||
u8 HalPwrSeqCmdParsing(
|
||||
struct adapter * padapter,
|
||||
PADAPTER padapter,
|
||||
u8 CutVersion,
|
||||
u8 FabVersion,
|
||||
u8 InterfaceType,
|
||||
struct wl_pwr_cfg PwrSeqCmd[])
|
||||
WLAN_PWR_CFG PwrSeqCmd[])
|
||||
{
|
||||
struct wl_pwr_cfg PwrCfgCmd = {0};
|
||||
u8 bPollingBit = false;
|
||||
WLAN_PWR_CFG PwrCfgCmd = {0};
|
||||
u8 bPollingBit = _FALSE;
|
||||
u32 AryIdx = 0;
|
||||
u8 value = 0;
|
||||
u32 offset = 0;
|
||||
u32 pollingCount = 0; /* polling autoload done. */
|
||||
u32 pollingCount = 0; /* polling autoload done. */
|
||||
u32 maxPollingCnt = 5000;
|
||||
|
||||
do {
|
||||
PwrCfgCmd = PwrSeqCmd[AryIdx];
|
||||
|
||||
RT_TRACE(_module_hal_init_c_ , _drv_info_,
|
||||
("HalPwrSeqCmdParsing: offset(%#x) cut_msk(%#x) fab_msk(%#x) interface_msk(%#x) base(%#x) cmd(%#x) msk(%#x) value(%#x)\n",
|
||||
GET_PWR_CFG_OFFSET(PwrCfgCmd),
|
||||
GET_PWR_CFG_CUT_MASK(PwrCfgCmd),
|
||||
GET_PWR_CFG_FAB_MASK(PwrCfgCmd),
|
||||
GET_PWR_CFG_INTF_MASK(PwrCfgCmd),
|
||||
GET_PWR_CFG_BASE(PwrCfgCmd),
|
||||
GET_PWR_CFG_CMD(PwrCfgCmd),
|
||||
GET_PWR_CFG_MASK(PwrCfgCmd),
|
||||
GET_PWR_CFG_VALUE(PwrCfgCmd)));
|
||||
|
||||
/* 2 Only Handle the command whose FAB, CUT, and Interface are matched */
|
||||
if ((GET_PWR_CFG_FAB_MASK(PwrCfgCmd) & FabVersion) &&
|
||||
(GET_PWR_CFG_CUT_MASK(PwrCfgCmd) & CutVersion) &&
|
||||
(GET_PWR_CFG_INTF_MASK(PwrCfgCmd) & InterfaceType))
|
||||
{
|
||||
switch (GET_PWR_CFG_CMD(PwrCfgCmd))
|
||||
{
|
||||
case PWR_CMD_READ:
|
||||
RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_READ\n"));
|
||||
break;
|
||||
(GET_PWR_CFG_CUT_MASK(PwrCfgCmd) & CutVersion) &&
|
||||
(GET_PWR_CFG_INTF_MASK(PwrCfgCmd) & InterfaceType)) {
|
||||
switch (GET_PWR_CFG_CMD(PwrCfgCmd)) {
|
||||
case PWR_CMD_READ:
|
||||
break;
|
||||
|
||||
case PWR_CMD_WRITE:
|
||||
RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_WRITE\n"));
|
||||
offset = GET_PWR_CFG_OFFSET(PwrCfgCmd);
|
||||
case PWR_CMD_WRITE:
|
||||
offset = GET_PWR_CFG_OFFSET(PwrCfgCmd);
|
||||
|
||||
/* Read the value from system register */
|
||||
value = rtw_read8(padapter, offset);
|
||||
#ifdef CONFIG_SDIO_HCI
|
||||
/* */
|
||||
/* <Roger_Notes> We should deal with interface specific address mapping for some interfaces, e.g., SDIO interface */
|
||||
/* 2011.07.07. */
|
||||
/* */
|
||||
if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO) {
|
||||
/* Read Back SDIO Local value */
|
||||
value = SdioLocalCmd52Read1Byte(padapter, offset);
|
||||
|
||||
value &= ~(GET_PWR_CFG_MASK(PwrCfgCmd));
|
||||
value |= (GET_PWR_CFG_VALUE(PwrCfgCmd) & GET_PWR_CFG_MASK(PwrCfgCmd));
|
||||
|
||||
/* Write the value back to sytem register */
|
||||
rtw_write8(padapter, offset, value);
|
||||
break;
|
||||
case PWR_CMD_POLLING:
|
||||
RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_POLLING\n"));
|
||||
/* Write Back SDIO Local value */
|
||||
SdioLocalCmd52Write1Byte(padapter, offset, value);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
#ifdef CONFIG_GSPI_HCI
|
||||
if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO)
|
||||
offset = SPI_LOCAL_OFFSET | offset;
|
||||
#endif
|
||||
/* Read the value from system register */
|
||||
value = rtw_read8(padapter, offset);
|
||||
|
||||
bPollingBit = false;
|
||||
offset = GET_PWR_CFG_OFFSET(PwrCfgCmd);
|
||||
do {
|
||||
value = value & (~(GET_PWR_CFG_MASK(PwrCfgCmd)));
|
||||
value = value | (GET_PWR_CFG_VALUE(PwrCfgCmd) & GET_PWR_CFG_MASK(PwrCfgCmd));
|
||||
|
||||
/* Write the value back to sytem register */
|
||||
rtw_write8(padapter, offset, value);
|
||||
}
|
||||
break;
|
||||
|
||||
case PWR_CMD_POLLING:
|
||||
|
||||
bPollingBit = _FALSE;
|
||||
offset = GET_PWR_CFG_OFFSET(PwrCfgCmd);
|
||||
#ifdef CONFIG_GSPI_HCI
|
||||
if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO)
|
||||
offset = SPI_LOCAL_OFFSET | offset;
|
||||
#endif
|
||||
do {
|
||||
#ifdef CONFIG_SDIO_HCI
|
||||
if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO)
|
||||
value = SdioLocalCmd52Read1Byte(padapter, offset);
|
||||
else
|
||||
#endif
|
||||
value = rtw_read8(padapter, offset);
|
||||
|
||||
value &= GET_PWR_CFG_MASK(PwrCfgCmd);
|
||||
if (value == (GET_PWR_CFG_VALUE(PwrCfgCmd) & GET_PWR_CFG_MASK(PwrCfgCmd)))
|
||||
bPollingBit = true;
|
||||
else
|
||||
rtw_udelay_os(10);
|
||||
|
||||
if (pollingCount++ > maxPollingCnt) {
|
||||
DBG_88E("Fail to polling Offset[%#x]\n", offset);
|
||||
return false;
|
||||
}
|
||||
} while (!bPollingBit);
|
||||
|
||||
break;
|
||||
|
||||
case PWR_CMD_DELAY:
|
||||
RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_DELAY\n"));
|
||||
if (GET_PWR_CFG_VALUE(PwrCfgCmd) == PWRSEQ_DELAY_US)
|
||||
rtw_udelay_os(GET_PWR_CFG_OFFSET(PwrCfgCmd));
|
||||
value = value & GET_PWR_CFG_MASK(PwrCfgCmd);
|
||||
if (value == (GET_PWR_CFG_VALUE(PwrCfgCmd) & GET_PWR_CFG_MASK(PwrCfgCmd)))
|
||||
bPollingBit = _TRUE;
|
||||
else
|
||||
rtw_udelay_os(GET_PWR_CFG_OFFSET(PwrCfgCmd)*1000);
|
||||
break;
|
||||
rtw_udelay_os(10);
|
||||
|
||||
case PWR_CMD_END:
|
||||
/* When this command is parsed, end the process */
|
||||
RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_END\n"));
|
||||
return true;
|
||||
break;
|
||||
if (pollingCount++ > maxPollingCnt) {
|
||||
RTW_ERR("HalPwrSeqCmdParsing: Fail to polling Offset[%#x]=%02x\n", offset, value);
|
||||
return _FALSE;
|
||||
}
|
||||
} while (!bPollingBit);
|
||||
|
||||
default:
|
||||
RT_TRACE(_module_hal_init_c_ , _drv_err_, ("HalPwrSeqCmdParsing: Unknown CMD!!\n"));
|
||||
break;
|
||||
break;
|
||||
|
||||
case PWR_CMD_DELAY:
|
||||
if (GET_PWR_CFG_VALUE(PwrCfgCmd) == PWRSEQ_DELAY_US)
|
||||
rtw_udelay_os(GET_PWR_CFG_OFFSET(PwrCfgCmd));
|
||||
else
|
||||
rtw_udelay_os(GET_PWR_CFG_OFFSET(PwrCfgCmd) * 1000);
|
||||
break;
|
||||
|
||||
case PWR_CMD_END:
|
||||
/* When this command is parsed, end the process */
|
||||
return _TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
AryIdx++;/* Add Array Index */
|
||||
}while (1);
|
||||
} while (1);
|
||||
|
||||
return true;
|
||||
return _TRUE;
|
||||
}
|
||||
|
|
3417
hal/btc/halbtc8192e1ant.c
Normal file
3417
hal/btc/halbtc8192e1ant.c
Normal file
File diff suppressed because it is too large
Load diff
226
hal/btc/halbtc8192e1ant.h
Normal file
226
hal/btc/halbtc8192e1ant.h
Normal file
|
@ -0,0 +1,226 @@
|
|||
|
||||
#if (BT_SUPPORT == 1 && COEX_SUPPORT == 1)
|
||||
|
||||
#if (RTL8192E_SUPPORT == 1)
|
||||
|
||||
/* *******************************************
|
||||
* The following is for 8192E 1ANT BT Co-exist definition
|
||||
* ******************************************* */
|
||||
#define BT_AUTO_REPORT_ONLY_8192E_1ANT 1
|
||||
|
||||
#define BT_INFO_8192E_1ANT_B_FTP BIT(7)
|
||||
#define BT_INFO_8192E_1ANT_B_A2DP BIT(6)
|
||||
#define BT_INFO_8192E_1ANT_B_HID BIT(5)
|
||||
#define BT_INFO_8192E_1ANT_B_SCO_BUSY BIT(4)
|
||||
#define BT_INFO_8192E_1ANT_B_ACL_BUSY BIT(3)
|
||||
#define BT_INFO_8192E_1ANT_B_INQ_PAGE BIT(2)
|
||||
#define BT_INFO_8192E_1ANT_B_SCO_ESCO BIT(1)
|
||||
#define BT_INFO_8192E_1ANT_B_CONNECTION BIT(0)
|
||||
|
||||
#define BT_INFO_8192E_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_) \
|
||||
(((_BT_INFO_EXT_&BIT(0))) ? true : false)
|
||||
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8192E_1ANT 2
|
||||
|
||||
#define BT_8192E_1ANT_WIFI_NOISY_THRESH 30 /* max: 255 */
|
||||
|
||||
enum bt_info_src_8192e_1ant {
|
||||
BT_INFO_SRC_8192E_1ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8192E_1ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8192E_1ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8192E_1ANT_MAX
|
||||
};
|
||||
|
||||
enum bt_8192e_1ant_bt_status {
|
||||
BT_8192E_1ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8192E_1ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8192E_1ANT_BT_STATUS_INQ_PAGE = 0x2,
|
||||
BT_8192E_1ANT_BT_STATUS_ACL_BUSY = 0x3,
|
||||
BT_8192E_1ANT_BT_STATUS_SCO_BUSY = 0x4,
|
||||
BT_8192E_1ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
|
||||
BT_8192E_1ANT_BT_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8192e_1ant_wifi_status {
|
||||
BT_8192E_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8192E_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN = 0x1,
|
||||
BT_8192E_1ANT_WIFI_STATUS_CONNECTED_SCAN = 0x2,
|
||||
BT_8192E_1ANT_WIFI_STATUS_CONNECTED_SPECIFIC_PKT = 0x3,
|
||||
BT_8192E_1ANT_WIFI_STATUS_CONNECTED_IDLE = 0x4,
|
||||
BT_8192E_1ANT_WIFI_STATUS_CONNECTED_BUSY = 0x5,
|
||||
BT_8192E_1ANT_WIFI_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8192e_1ant_coex_algo {
|
||||
BT_8192E_1ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8192E_1ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8192E_1ANT_COEX_ALGO_HID = 0x2,
|
||||
BT_8192E_1ANT_COEX_ALGO_A2DP = 0x3,
|
||||
BT_8192E_1ANT_COEX_ALGO_A2DP_PANHS = 0x4,
|
||||
BT_8192E_1ANT_COEX_ALGO_PANEDR = 0x5,
|
||||
BT_8192E_1ANT_COEX_ALGO_PANHS = 0x6,
|
||||
BT_8192E_1ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
|
||||
BT_8192E_1ANT_COEX_ALGO_PANEDR_HID = 0x8,
|
||||
BT_8192E_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
|
||||
BT_8192E_1ANT_COEX_ALGO_HID_A2DP = 0xa,
|
||||
BT_8192E_1ANT_COEX_ALGO_MAX = 0xb,
|
||||
};
|
||||
|
||||
struct coex_dm_8192e_1ant {
|
||||
/* fw mechanism */
|
||||
boolean cur_ignore_wlan_act;
|
||||
boolean pre_ignore_wlan_act;
|
||||
u8 pre_ps_tdma;
|
||||
u8 cur_ps_tdma;
|
||||
u8 ps_tdma_para[5];
|
||||
u8 ps_tdma_du_adj_type;
|
||||
boolean auto_tdma_adjust;
|
||||
boolean pre_ps_tdma_on;
|
||||
boolean cur_ps_tdma_on;
|
||||
boolean pre_bt_auto_report;
|
||||
boolean cur_bt_auto_report;
|
||||
u8 pre_lps;
|
||||
u8 cur_lps;
|
||||
u8 pre_rpwm;
|
||||
u8 cur_rpwm;
|
||||
|
||||
/* sw mechanism */
|
||||
boolean pre_low_penalty_ra;
|
||||
boolean cur_low_penalty_ra;
|
||||
u32 pre_val0x6c0;
|
||||
u32 cur_val0x6c0;
|
||||
u32 pre_val0x6c4;
|
||||
u32 cur_val0x6c4;
|
||||
u32 pre_val0x6c8;
|
||||
u32 cur_val0x6c8;
|
||||
u8 pre_val0x6cc;
|
||||
u8 cur_val0x6cc;
|
||||
boolean limited_dig;
|
||||
|
||||
u32 backup_arfr_cnt1; /* Auto Rate Fallback Retry cnt */
|
||||
u32 backup_arfr_cnt2; /* Auto Rate Fallback Retry cnt */
|
||||
u16 backup_retry_limit;
|
||||
u8 backup_ampdu_max_time;
|
||||
|
||||
/* algorithm related */
|
||||
u8 pre_algorithm;
|
||||
u8 cur_algorithm;
|
||||
u8 bt_status;
|
||||
u8 wifi_chnl_info[3];
|
||||
|
||||
u32 pre_ra_mask;
|
||||
u32 cur_ra_mask;
|
||||
u8 pre_arfr_type;
|
||||
u8 cur_arfr_type;
|
||||
u8 pre_retry_limit_type;
|
||||
u8 cur_retry_limit_type;
|
||||
u8 pre_ampdu_time_type;
|
||||
u8 cur_ampdu_time_type;
|
||||
u32 arp_cnt;
|
||||
|
||||
u8 error_condition;
|
||||
};
|
||||
|
||||
struct coex_sta_8192e_1ant {
|
||||
boolean bt_disabled;
|
||||
boolean bt_link_exist;
|
||||
boolean sco_exist;
|
||||
boolean a2dp_exist;
|
||||
boolean hid_exist;
|
||||
boolean pan_exist;
|
||||
|
||||
boolean under_lps;
|
||||
boolean under_ips;
|
||||
u32 specific_pkt_period_cnt;
|
||||
u32 high_priority_tx;
|
||||
u32 high_priority_rx;
|
||||
u32 low_priority_tx;
|
||||
u32 low_priority_rx;
|
||||
s8 bt_rssi;
|
||||
boolean bt_tx_rx_mask;
|
||||
u8 pre_bt_rssi_state;
|
||||
u8 pre_wifi_rssi_state[4];
|
||||
boolean c2h_bt_info_req_sent;
|
||||
u8 bt_info_c2h[BT_INFO_SRC_8192E_1ANT_MAX][10];
|
||||
u32 bt_info_c2h_cnt[BT_INFO_SRC_8192E_1ANT_MAX];
|
||||
boolean c2h_bt_inquiry_page;
|
||||
boolean c2h_bt_page; /* Add for win8.1 page out issue */
|
||||
boolean wifi_is_high_pri_task; /* Add for win8.1 page out issue */
|
||||
u8 bt_retry_cnt;
|
||||
u8 bt_info_ext;
|
||||
u32 pop_event_cnt;
|
||||
u8 scan_ap_num;
|
||||
|
||||
u32 crc_ok_cck;
|
||||
u32 crc_ok_11g;
|
||||
u32 crc_ok_11n;
|
||||
u32 crc_ok_11n_agg;
|
||||
|
||||
u32 crc_err_cck;
|
||||
u32 crc_err_11g;
|
||||
u32 crc_err_11n;
|
||||
u32 crc_err_11n_agg;
|
||||
|
||||
boolean cck_lock;
|
||||
boolean pre_ccklock;
|
||||
u8 coex_table_type;
|
||||
|
||||
boolean force_lps_on;
|
||||
};
|
||||
|
||||
/* *******************************************
|
||||
* The following is interface which will notify coex module.
|
||||
* ******************************************* */
|
||||
void ex_halbtc8192e1ant_power_on_setting(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8192e1ant_pre_load_firmware(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8192e1ant_init_hw_config(IN struct btc_coexist *btcoexist,
|
||||
IN boolean wifi_only);
|
||||
void ex_halbtc8192e1ant_init_coex_dm(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8192e1ant_ips_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8192e1ant_lps_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8192e1ant_scan_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8192e1ant_connect_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8192e1ant_media_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8192e1ant_specific_packet_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8192e1ant_bt_info_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 *tmp_buf, IN u8 length);
|
||||
void ex_halbtc8192e1ant_rf_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8192e1ant_halt_notify(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8192e1ant_pnp_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 pnp_state);
|
||||
void ex_halbtc8192e1ant_coex_dm_reset(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8192e1ant_periodical(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8192e1ant_display_coex_info(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8192e1ant_dbg_control(IN struct btc_coexist *btcoexist,
|
||||
IN u8 op_code, IN u8 op_len, IN u8 *pdata);
|
||||
|
||||
#else /* #if (RTL8192E_SUPPORT == 1) */
|
||||
#define ex_halbtc8192e1ant_power_on_setting(btcoexist)
|
||||
#define ex_halbtc8192e1ant_pre_load_firmware(btcoexist)
|
||||
#define ex_halbtc8192e1ant_init_hw_config(btcoexist, wifi_only)
|
||||
#define ex_halbtc8192e1ant_init_coex_dm(btcoexist)
|
||||
#define ex_halbtc8192e1ant_ips_notify(btcoexist, type)
|
||||
#define ex_halbtc8192e1ant_lps_notify(btcoexist, type)
|
||||
#define ex_halbtc8192e1ant_scan_notify(btcoexist, type)
|
||||
#define ex_halbtc8192e1ant_connect_notify(btcoexist, type)
|
||||
#define ex_halbtc8192e1ant_media_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8192e1ant_specific_packet_notify(btcoexist, type)
|
||||
#define ex_halbtc8192e1ant_bt_info_notify(btcoexist, tmp_buf, length)
|
||||
#define ex_halbtc8192e1ant_rf_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8192e1ant_halt_notify(btcoexist)
|
||||
#define ex_halbtc8192e1ant_pnp_notify(btcoexist, pnp_state)
|
||||
#define ex_halbtc8192e1ant_coex_dm_reset(btcoexist)
|
||||
#define ex_halbtc8192e1ant_periodical(btcoexist)
|
||||
#define ex_halbtc8192e1ant_display_coex_info(btcoexist)
|
||||
#define ex_halbtc8192e1ant_dbg_control(btcoexist, op_code, op_len, pdata)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
4377
hal/btc/halbtc8192e2ant.c
Normal file
4377
hal/btc/halbtc8192e2ant.c
Normal file
File diff suppressed because it is too large
Load diff
211
hal/btc/halbtc8192e2ant.h
Normal file
211
hal/btc/halbtc8192e2ant.h
Normal file
|
@ -0,0 +1,211 @@
|
|||
|
||||
#if (BT_SUPPORT == 1 && COEX_SUPPORT == 1)
|
||||
|
||||
#if (RTL8192E_SUPPORT == 1)
|
||||
/* *******************************************
|
||||
* The following is for 8192E 2Ant BT Co-exist definition
|
||||
* ******************************************* */
|
||||
#define BT_AUTO_REPORT_ONLY_8192E_2ANT 0
|
||||
|
||||
#define BT_INFO_8192E_2ANT_B_FTP BIT(7)
|
||||
#define BT_INFO_8192E_2ANT_B_A2DP BIT(6)
|
||||
#define BT_INFO_8192E_2ANT_B_HID BIT(5)
|
||||
#define BT_INFO_8192E_2ANT_B_SCO_BUSY BIT(4)
|
||||
#define BT_INFO_8192E_2ANT_B_ACL_BUSY BIT(3)
|
||||
#define BT_INFO_8192E_2ANT_B_INQ_PAGE BIT(2)
|
||||
#define BT_INFO_8192E_2ANT_B_SCO_ESCO BIT(1)
|
||||
#define BT_INFO_8192E_2ANT_B_CONNECTION BIT(0)
|
||||
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8192E_2ANT 2
|
||||
#define NOISY_AP_NUM_THRESH_8192E 10
|
||||
|
||||
enum bt_info_src_8192e_2ant {
|
||||
BT_INFO_SRC_8192E_2ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8192E_2ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8192E_2ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8192E_2ANT_MAX
|
||||
};
|
||||
|
||||
enum bt_8192e_2ant_bt_status {
|
||||
BT_8192E_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8192E_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8192E_2ANT_BT_STATUS_INQ_PAGE = 0x2,
|
||||
BT_8192E_2ANT_BT_STATUS_ACL_BUSY = 0x3,
|
||||
BT_8192E_2ANT_BT_STATUS_SCO_BUSY = 0x4,
|
||||
BT_8192E_2ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
|
||||
BT_8192E_2ANT_BT_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8192e_2ant_coex_algo {
|
||||
BT_8192E_2ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8192E_2ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8192E_2ANT_COEX_ALGO_SCO_PAN = 0x2,
|
||||
BT_8192E_2ANT_COEX_ALGO_HID = 0x3,
|
||||
BT_8192E_2ANT_COEX_ALGO_A2DP = 0x4,
|
||||
BT_8192E_2ANT_COEX_ALGO_A2DP_PANHS = 0x5,
|
||||
BT_8192E_2ANT_COEX_ALGO_PANEDR = 0x6,
|
||||
BT_8192E_2ANT_COEX_ALGO_PANHS = 0x7,
|
||||
BT_8192E_2ANT_COEX_ALGO_PANEDR_A2DP = 0x8,
|
||||
BT_8192E_2ANT_COEX_ALGO_PANEDR_HID = 0x9,
|
||||
BT_8192E_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0xa,
|
||||
BT_8192E_2ANT_COEX_ALGO_HID_A2DP = 0xb,
|
||||
BT_8192E_2ANT_COEX_ALGO_MAX = 0xc
|
||||
};
|
||||
|
||||
struct coex_dm_8192e_2ant {
|
||||
/* fw mechanism */
|
||||
u8 pre_bt_dec_pwr_lvl;
|
||||
u8 cur_bt_dec_pwr_lvl;
|
||||
u8 pre_fw_dac_swing_lvl;
|
||||
u8 cur_fw_dac_swing_lvl;
|
||||
boolean cur_ignore_wlan_act;
|
||||
boolean pre_ignore_wlan_act;
|
||||
u8 pre_ps_tdma;
|
||||
u8 cur_ps_tdma;
|
||||
u8 ps_tdma_para[5];
|
||||
u8 ps_tdma_du_adj_type;
|
||||
boolean reset_tdma_adjust;
|
||||
boolean auto_tdma_adjust;
|
||||
boolean auto_tdma_adjust_low_rssi;
|
||||
boolean pre_ps_tdma_on;
|
||||
boolean cur_ps_tdma_on;
|
||||
boolean pre_bt_auto_report;
|
||||
boolean cur_bt_auto_report;
|
||||
|
||||
/* sw mechanism */
|
||||
boolean pre_rf_rx_lpf_shrink;
|
||||
boolean cur_rf_rx_lpf_shrink;
|
||||
u32 bt_rf_0x1e_backup;
|
||||
boolean pre_low_penalty_ra;
|
||||
boolean cur_low_penalty_ra;
|
||||
boolean pre_dac_swing_on;
|
||||
u32 pre_dac_swing_lvl;
|
||||
boolean cur_dac_swing_on;
|
||||
u32 cur_dac_swing_lvl;
|
||||
boolean pre_adc_back_off;
|
||||
boolean cur_adc_back_off;
|
||||
boolean pre_agc_table_en;
|
||||
boolean cur_agc_table_en;
|
||||
u32 pre_val0x6c0;
|
||||
u32 cur_val0x6c0;
|
||||
u32 pre_val0x6c4;
|
||||
u32 cur_val0x6c4;
|
||||
u32 pre_val0x6c8;
|
||||
u32 cur_val0x6c8;
|
||||
u8 pre_val0x6cc;
|
||||
u8 cur_val0x6cc;
|
||||
boolean limited_dig;
|
||||
|
||||
u32 backup_arfr_cnt1; /* Auto Rate Fallback Retry cnt */
|
||||
u32 backup_arfr_cnt2; /* Auto Rate Fallback Retry cnt */
|
||||
u16 backup_retry_limit;
|
||||
u8 backup_ampdu_max_time;
|
||||
|
||||
/* algorithm related */
|
||||
u8 pre_algorithm;
|
||||
u8 cur_algorithm;
|
||||
u8 bt_status;
|
||||
u8 wifi_chnl_info[3];
|
||||
|
||||
u8 pre_ss_type;
|
||||
u8 cur_ss_type;
|
||||
|
||||
u8 pre_lps;
|
||||
u8 cur_lps;
|
||||
u8 pre_rpwm;
|
||||
u8 cur_rpwm;
|
||||
|
||||
|
||||
u32 pre_ra_mask;
|
||||
u32 cur_ra_mask;
|
||||
u8 cur_ra_mask_type;
|
||||
u8 pre_arfr_type;
|
||||
u8 cur_arfr_type;
|
||||
u8 pre_retry_limit_type;
|
||||
u8 cur_retry_limit_type;
|
||||
u8 pre_ampdu_time_type;
|
||||
u8 cur_ampdu_time_type;
|
||||
};
|
||||
|
||||
struct coex_sta_8192e_2ant {
|
||||
boolean bt_disabled;
|
||||
boolean bt_link_exist;
|
||||
boolean sco_exist;
|
||||
boolean a2dp_exist;
|
||||
boolean hid_exist;
|
||||
boolean pan_exist;
|
||||
|
||||
boolean under_lps;
|
||||
boolean under_ips;
|
||||
u32 high_priority_tx;
|
||||
u32 high_priority_rx;
|
||||
u32 low_priority_tx;
|
||||
u32 low_priority_rx;
|
||||
u8 bt_rssi;
|
||||
u8 pre_bt_rssi_state;
|
||||
u8 pre_wifi_rssi_state[4];
|
||||
boolean c2h_bt_info_req_sent;
|
||||
u8 bt_info_c2h[BT_INFO_SRC_8192E_2ANT_MAX][10];
|
||||
u32 bt_info_c2h_cnt[BT_INFO_SRC_8192E_2ANT_MAX];
|
||||
boolean c2h_bt_inquiry_page;
|
||||
u8 bt_retry_cnt;
|
||||
u8 bt_info_ext;
|
||||
u8 scan_ap_num;
|
||||
u32 bt_coex_supported_version;
|
||||
|
||||
u32 crc_ok_cck;
|
||||
u32 crc_ok_11g;
|
||||
u32 crc_ok_11n;
|
||||
u32 crc_ok_11n_vht;
|
||||
|
||||
u32 crc_err_cck;
|
||||
u32 crc_err_11g;
|
||||
u32 crc_err_11n;
|
||||
u32 crc_err_11n_vht;
|
||||
};
|
||||
|
||||
/* *******************************************
|
||||
* The following is interface which will notify coex module.
|
||||
* ******************************************* */
|
||||
void ex_halbtc8192e2ant_power_on_setting(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8192e2ant_init_hw_config(IN struct btc_coexist *btcoexist,
|
||||
IN boolean wifi_only);
|
||||
void ex_halbtc8192e2ant_init_coex_dm(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8192e2ant_ips_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8192e2ant_lps_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8192e2ant_scan_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8192e2ant_connect_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8192e2ant_media_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8192e2ant_specific_packet_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8192e2ant_bt_info_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 *tmp_buf, IN u8 length);
|
||||
void ex_halbtc8192e2ant_halt_notify(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8192e2ant_periodical(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8192e2ant_display_coex_info(IN struct btc_coexist *btcoexist);
|
||||
|
||||
#else /* #if (RTL8192E_SUPPORT == 1) */
|
||||
#define ex_halbtc8192e2ant_power_on_setting(btcoexist)
|
||||
#define ex_halbtc8192e2ant_init_hw_config(btcoexist, wifi_only)
|
||||
#define ex_halbtc8192e2ant_init_coex_dm(btcoexist)
|
||||
#define ex_halbtc8192e2ant_ips_notify(btcoexist, type)
|
||||
#define ex_halbtc8192e2ant_lps_notify(btcoexist, type)
|
||||
#define ex_halbtc8192e2ant_scan_notify(btcoexist, type)
|
||||
#define ex_halbtc8192e2ant_connect_notify(btcoexist, type)
|
||||
#define ex_halbtc8192e2ant_media_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8192e2ant_specific_packet_notify(btcoexist, type)
|
||||
#define ex_halbtc8192e2ant_bt_info_notify(btcoexist, tmp_buf, length)
|
||||
#define ex_halbtc8192e2ant_halt_notify(btcoexist)
|
||||
#define ex_halbtc8192e2ant_periodical(btcoexist)
|
||||
#define ex_halbtc8192e2ant_display_coex_info(btcoexist)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
4293
hal/btc/halbtc8703b1ant.c
Normal file
4293
hal/btc/halbtc8703b1ant.c
Normal file
File diff suppressed because it is too large
Load diff
404
hal/btc/halbtc8703b1ant.h
Normal file
404
hal/btc/halbtc8703b1ant.h
Normal file
|
@ -0,0 +1,404 @@
|
|||
|
||||
#if (BT_SUPPORT == 1 && COEX_SUPPORT == 1)
|
||||
|
||||
#if (RTL8703B_SUPPORT == 1)
|
||||
/* *******************************************
|
||||
* The following is for 8703B 1ANT BT Co-exist definition
|
||||
* ******************************************* */
|
||||
#define BT_AUTO_REPORT_ONLY_8703B_1ANT 1
|
||||
#define BT_8703B_1ANT_ENABLE_GNTBT_TO_GPIO14 0
|
||||
|
||||
#define BT_INFO_8703B_1ANT_B_FTP BIT(7)
|
||||
#define BT_INFO_8703B_1ANT_B_A2DP BIT(6)
|
||||
#define BT_INFO_8703B_1ANT_B_HID BIT(5)
|
||||
#define BT_INFO_8703B_1ANT_B_SCO_BUSY BIT(4)
|
||||
#define BT_INFO_8703B_1ANT_B_ACL_BUSY BIT(3)
|
||||
#define BT_INFO_8703B_1ANT_B_INQ_PAGE BIT(2)
|
||||
#define BT_INFO_8703B_1ANT_B_SCO_ESCO BIT(1)
|
||||
#define BT_INFO_8703B_1ANT_B_CONNECTION BIT(0)
|
||||
|
||||
#define BT_INFO_8703B_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_) \
|
||||
(((_BT_INFO_EXT_&BIT(0))) ? true : false)
|
||||
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8703B_1ANT 2
|
||||
|
||||
#define BT_8703B_1ANT_WIFI_NOISY_THRESH 50 /* max: 255 */
|
||||
|
||||
/* for Antenna detection */
|
||||
#define BT_8703B_1ANT_ANTDET_PSDTHRES_BACKGROUND 50
|
||||
#define BT_8703B_1ANT_ANTDET_PSDTHRES_2ANT_BADISOLATION 70
|
||||
#define BT_8703B_1ANT_ANTDET_PSDTHRES_2ANT_GOODISOLATION 55
|
||||
#define BT_8703B_1ANT_ANTDET_PSDTHRES_1ANT 35
|
||||
#define BT_8703B_1ANT_ANTDET_RETRY_INTERVAL 10 /* retry timer if ant det is fail, unit: second */
|
||||
#define BT_8703B_1ANT_ANTDET_SWEEPPOINT_DELAY 40000
|
||||
#define BT_8703B_1ANT_ANTDET_ENABLE 0
|
||||
#define BT_8703B_1ANT_ANTDET_COEXMECHANISMSWITCH_ENABLE 0
|
||||
|
||||
#define BT_8703B_1ANT_LTECOEX_INDIRECTREG_ACCESS_TIMEOUT 30000
|
||||
|
||||
enum bt_8703b_1ant_signal_state {
|
||||
BT_8703B_1ANT_SIG_STA_SET_TO_LOW = 0x0,
|
||||
BT_8703B_1ANT_SIG_STA_SET_BY_HW = 0x0,
|
||||
BT_8703B_1ANT_SIG_STA_SET_TO_HIGH = 0x1,
|
||||
BT_8703B_1ANT_SIG_STA_MAX
|
||||
};
|
||||
|
||||
enum bt_8703b_1ant_path_ctrl_owner {
|
||||
BT_8703B_1ANT_PCO_BTSIDE = 0x0,
|
||||
BT_8703B_1ANT_PCO_WLSIDE = 0x1,
|
||||
BT_8703B_1ANT_PCO_MAX
|
||||
};
|
||||
|
||||
enum bt_8703b_1ant_gnt_ctrl_type {
|
||||
BT_8703B_1ANT_GNT_TYPE_CTRL_BY_PTA = 0x0,
|
||||
BT_8703B_1ANT_GNT_TYPE_CTRL_BY_SW = 0x1,
|
||||
BT_8703B_1ANT_GNT_TYPE_MAX
|
||||
};
|
||||
|
||||
enum bt_8703b_1ant_gnt_ctrl_block {
|
||||
BT_8703B_1ANT_GNT_BLOCK_RFC_BB = 0x0,
|
||||
BT_8703B_1ANT_GNT_BLOCK_RFC = 0x1,
|
||||
BT_8703B_1ANT_GNT_BLOCK_BB = 0x2,
|
||||
BT_8703B_1ANT_GNT_BLOCK_MAX
|
||||
};
|
||||
|
||||
enum bt_8703b_1ant_lte_coex_table_type {
|
||||
BT_8703B_1ANT_CTT_WL_VS_LTE = 0x0,
|
||||
BT_8703B_1ANT_CTT_BT_VS_LTE = 0x1,
|
||||
BT_8703B_1ANT_CTT_MAX
|
||||
};
|
||||
|
||||
enum bt_8703b_1ant_lte_break_table_type {
|
||||
BT_8703B_1ANT_LBTT_WL_BREAK_LTE = 0x0,
|
||||
BT_8703B_1ANT_LBTT_BT_BREAK_LTE = 0x1,
|
||||
BT_8703B_1ANT_LBTT_LTE_BREAK_WL = 0x2,
|
||||
BT_8703B_1ANT_LBTT_LTE_BREAK_BT = 0x3,
|
||||
BT_8703B_1ANT_LBTT_MAX
|
||||
};
|
||||
|
||||
enum bt_info_src_8703b_1ant {
|
||||
BT_INFO_SRC_8703B_1ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8703B_1ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8703B_1ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8703B_1ANT_MAX
|
||||
};
|
||||
|
||||
enum bt_8703b_1ant_bt_status {
|
||||
BT_8703B_1ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8703B_1ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8703B_1ANT_BT_STATUS_INQ_PAGE = 0x2,
|
||||
BT_8703B_1ANT_BT_STATUS_ACL_BUSY = 0x3,
|
||||
BT_8703B_1ANT_BT_STATUS_SCO_BUSY = 0x4,
|
||||
BT_8703B_1ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
|
||||
BT_8703B_1ANT_BT_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8703b_1ant_wifi_status {
|
||||
BT_8703B_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8703B_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN = 0x1,
|
||||
BT_8703B_1ANT_WIFI_STATUS_CONNECTED_SCAN = 0x2,
|
||||
BT_8703B_1ANT_WIFI_STATUS_CONNECTED_SPECIFIC_PKT = 0x3,
|
||||
BT_8703B_1ANT_WIFI_STATUS_CONNECTED_IDLE = 0x4,
|
||||
BT_8703B_1ANT_WIFI_STATUS_CONNECTED_BUSY = 0x5,
|
||||
BT_8703B_1ANT_WIFI_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8703b_1ant_coex_algo {
|
||||
BT_8703B_1ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8703B_1ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8703B_1ANT_COEX_ALGO_HID = 0x2,
|
||||
BT_8703B_1ANT_COEX_ALGO_A2DP = 0x3,
|
||||
BT_8703B_1ANT_COEX_ALGO_A2DP_PANHS = 0x4,
|
||||
BT_8703B_1ANT_COEX_ALGO_PANEDR = 0x5,
|
||||
BT_8703B_1ANT_COEX_ALGO_PANHS = 0x6,
|
||||
BT_8703B_1ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
|
||||
BT_8703B_1ANT_COEX_ALGO_PANEDR_HID = 0x8,
|
||||
BT_8703B_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
|
||||
BT_8703B_1ANT_COEX_ALGO_HID_A2DP = 0xa,
|
||||
BT_8703B_1ANT_COEX_ALGO_MAX = 0xb,
|
||||
};
|
||||
|
||||
enum bt_8703b_1ant_phase {
|
||||
BT_8703B_1ANT_PHASE_COEX_INIT = 0x0,
|
||||
BT_8703B_1ANT_PHASE_WLANONLY_INIT = 0x1,
|
||||
BT_8703B_1ANT_PHASE_WLAN_OFF = 0x2,
|
||||
BT_8703B_1ANT_PHASE_2G_RUNTIME = 0x3,
|
||||
BT_8703B_1ANT_PHASE_5G_RUNTIME = 0x4,
|
||||
BT_8703B_1ANT_PHASE_BTMPMODE = 0x5,
|
||||
BT_8703B_1ANT_PHASE_ANTENNA_DET = 0x6,
|
||||
BT_8703B_1ANT_PHASE_MAX
|
||||
};
|
||||
|
||||
enum bt_8703b_1ant_Scoreboard {
|
||||
BT_8703B_1ANT_SCOREBOARD_ACTIVE = BIT(0),
|
||||
BT_8703B_1ANT_SCOREBOARD_ONOFF = BIT(1),
|
||||
BT_8703B_1ANT_SCOREBOARD_SCAN = BIT(2),
|
||||
BT_8703B_1ANT_SCOREBOARD_UNDERTEST = BIT(3),
|
||||
BT_8703B_1ANT_SCOREBOARD_WLBUSY = BIT(6)
|
||||
};
|
||||
|
||||
|
||||
struct coex_dm_8703b_1ant {
|
||||
/* hw setting */
|
||||
u8 pre_ant_pos_type;
|
||||
u8 cur_ant_pos_type;
|
||||
/* fw mechanism */
|
||||
boolean cur_ignore_wlan_act;
|
||||
boolean pre_ignore_wlan_act;
|
||||
u8 pre_ps_tdma;
|
||||
u8 cur_ps_tdma;
|
||||
u8 ps_tdma_para[5];
|
||||
u8 ps_tdma_du_adj_type;
|
||||
boolean auto_tdma_adjust;
|
||||
boolean pre_ps_tdma_on;
|
||||
boolean cur_ps_tdma_on;
|
||||
boolean pre_bt_auto_report;
|
||||
boolean cur_bt_auto_report;
|
||||
u8 pre_lps;
|
||||
u8 cur_lps;
|
||||
u8 pre_rpwm;
|
||||
u8 cur_rpwm;
|
||||
|
||||
/* sw mechanism */
|
||||
boolean pre_low_penalty_ra;
|
||||
boolean cur_low_penalty_ra;
|
||||
u32 pre_val0x6c0;
|
||||
u32 cur_val0x6c0;
|
||||
u32 pre_val0x6c4;
|
||||
u32 cur_val0x6c4;
|
||||
u32 pre_val0x6c8;
|
||||
u32 cur_val0x6c8;
|
||||
u8 pre_val0x6cc;
|
||||
u8 cur_val0x6cc;
|
||||
boolean limited_dig;
|
||||
|
||||
u32 backup_arfr_cnt1; /* Auto Rate Fallback Retry cnt */
|
||||
u32 backup_arfr_cnt2; /* Auto Rate Fallback Retry cnt */
|
||||
u16 backup_retry_limit;
|
||||
u8 backup_ampdu_max_time;
|
||||
|
||||
/* algorithm related */
|
||||
u8 pre_algorithm;
|
||||
u8 cur_algorithm;
|
||||
u8 bt_status;
|
||||
u8 wifi_chnl_info[3];
|
||||
|
||||
u32 pre_ra_mask;
|
||||
u32 cur_ra_mask;
|
||||
u8 pre_arfr_type;
|
||||
u8 cur_arfr_type;
|
||||
u8 pre_retry_limit_type;
|
||||
u8 cur_retry_limit_type;
|
||||
u8 pre_ampdu_time_type;
|
||||
u8 cur_ampdu_time_type;
|
||||
u32 arp_cnt;
|
||||
|
||||
u8 error_condition;
|
||||
};
|
||||
|
||||
struct coex_sta_8703b_1ant {
|
||||
boolean bt_disabled;
|
||||
boolean bt_link_exist;
|
||||
boolean sco_exist;
|
||||
boolean a2dp_exist;
|
||||
boolean hid_exist;
|
||||
boolean pan_exist;
|
||||
boolean bt_hi_pri_link_exist;
|
||||
u8 num_of_profile;
|
||||
|
||||
boolean under_lps;
|
||||
boolean under_ips;
|
||||
u32 specific_pkt_period_cnt;
|
||||
u32 high_priority_tx;
|
||||
u32 high_priority_rx;
|
||||
u32 low_priority_tx;
|
||||
u32 low_priority_rx;
|
||||
boolean is_hiPri_rx_overhead;
|
||||
s8 bt_rssi;
|
||||
boolean bt_tx_rx_mask;
|
||||
u8 pre_bt_rssi_state;
|
||||
u8 pre_wifi_rssi_state[4];
|
||||
u8 bt_info_c2h[BT_INFO_SRC_8703B_1ANT_MAX][10];
|
||||
u32 bt_info_c2h_cnt[BT_INFO_SRC_8703B_1ANT_MAX];
|
||||
boolean bt_whck_test;
|
||||
boolean c2h_bt_inquiry_page;
|
||||
boolean c2h_bt_remote_name_req;
|
||||
boolean c2h_bt_page; /* Add for win8.1 page out issue */
|
||||
boolean wifi_is_high_pri_task; /* Add for win8.1 page out issue */
|
||||
u8 bt_retry_cnt;
|
||||
u8 bt_info_ext;
|
||||
u8 bt_info_ext2;
|
||||
u32 pop_event_cnt;
|
||||
u8 scan_ap_num;
|
||||
|
||||
u32 crc_ok_cck;
|
||||
u32 crc_ok_11g;
|
||||
u32 crc_ok_11n;
|
||||
u32 crc_ok_11n_vht;
|
||||
|
||||
u32 crc_err_cck;
|
||||
u32 crc_err_11g;
|
||||
u32 crc_err_11n;
|
||||
u32 crc_err_11n_vht;
|
||||
|
||||
boolean cck_lock;
|
||||
boolean pre_ccklock;
|
||||
boolean cck_ever_lock;
|
||||
u8 coex_table_type;
|
||||
|
||||
boolean force_lps_on;
|
||||
|
||||
boolean concurrent_rx_mode_on;
|
||||
|
||||
u16 score_board;
|
||||
u8 isolation_btween_wb; /* 0~ 50 */
|
||||
|
||||
u8 a2dp_bit_pool;
|
||||
u8 cut_version;
|
||||
boolean acl_busy;
|
||||
boolean bt_create_connection;
|
||||
|
||||
u32 bt_coex_supported_feature;
|
||||
u32 bt_coex_supported_version;
|
||||
|
||||
u8 bt_ble_scan_type;
|
||||
u32 bt_ble_scan_para[3];
|
||||
|
||||
boolean run_time_state;
|
||||
boolean freeze_coexrun_by_btinfo;
|
||||
|
||||
boolean is_A2DP_3M;
|
||||
boolean voice_over_HOGP;
|
||||
u8 bt_info;
|
||||
boolean is_autoslot;
|
||||
u8 forbidden_slot;
|
||||
u8 hid_busy_num;
|
||||
u8 hid_pair_cnt;
|
||||
|
||||
u32 cnt_RemoteNameReq;
|
||||
u32 cnt_setupLink;
|
||||
u32 cnt_ReInit;
|
||||
u32 cnt_IgnWlanAct;
|
||||
u32 cnt_Page;
|
||||
|
||||
u16 bt_reg_vendor_ac;
|
||||
u16 bt_reg_vendor_ae;
|
||||
|
||||
boolean is_setupLink;
|
||||
u8 wl_noisy_level;
|
||||
u32 gnt_error_cnt;
|
||||
|
||||
u8 bt_afh_map[10];
|
||||
u8 bt_relink_downcount;
|
||||
boolean is_tdma_btautoslot;
|
||||
boolean is_tdma_btautoslot_hang;
|
||||
};
|
||||
|
||||
#define BT_8703B_1ANT_ANTDET_PSD_POINTS 256 /* MAX:1024 */
|
||||
#define BT_8703B_1ANT_ANTDET_PSD_AVGNUM 1 /* MAX:3 */
|
||||
#define BT_8703B_1ANT_ANTDET_BUF_LEN 16
|
||||
|
||||
struct psdscan_sta_8703b_1ant {
|
||||
|
||||
u32 ant_det_bt_le_channel; /* BT LE Channel ex:2412 */
|
||||
u32 ant_det_bt_tx_time;
|
||||
u32 ant_det_pre_psdscan_peak_val;
|
||||
boolean ant_det_is_ant_det_available;
|
||||
u32 ant_det_psd_scan_peak_val;
|
||||
boolean ant_det_is_btreply_available;
|
||||
u32 ant_det_psd_scan_peak_freq;
|
||||
|
||||
u8 ant_det_result;
|
||||
u8 ant_det_peak_val[BT_8703B_1ANT_ANTDET_BUF_LEN];
|
||||
u8 ant_det_peak_freq[BT_8703B_1ANT_ANTDET_BUF_LEN];
|
||||
u32 ant_det_try_count;
|
||||
u32 ant_det_fail_count;
|
||||
u32 ant_det_inteval_count;
|
||||
u32 ant_det_thres_offset;
|
||||
|
||||
u32 real_cent_freq;
|
||||
s32 real_offset;
|
||||
u32 real_span;
|
||||
|
||||
u32 psd_band_width; /* unit: Hz */
|
||||
u32 psd_point; /* 128/256/512/1024 */
|
||||
u32 psd_report[1024]; /* unit:dB (20logx), 0~255 */
|
||||
u32 psd_report_max_hold[1024]; /* unit:dB (20logx), 0~255 */
|
||||
u32 psd_start_point;
|
||||
u32 psd_stop_point;
|
||||
u32 psd_max_value_point;
|
||||
u32 psd_max_value;
|
||||
u32 psd_start_base;
|
||||
u32 psd_avg_num; /* 1/8/16/32 */
|
||||
u32 psd_gen_count;
|
||||
boolean is_psd_running;
|
||||
boolean is_psd_show_max_only;
|
||||
};
|
||||
|
||||
/* *******************************************
|
||||
* The following is interface which will notify coex module.
|
||||
* ******************************************* */
|
||||
void ex_halbtc8703b1ant_power_on_setting(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8703b1ant_pre_load_firmware(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8703b1ant_init_hw_config(IN struct btc_coexist *btcoexist,
|
||||
IN boolean wifi_only);
|
||||
void ex_halbtc8703b1ant_init_coex_dm(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8703b1ant_ips_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8703b1ant_lps_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8703b1ant_scan_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8703b1ant_connect_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8703b1ant_media_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8703b1ant_specific_packet_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8703b1ant_bt_info_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 *tmp_buf, IN u8 length);
|
||||
void ex_halbtc8703b1ant_rf_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8703b1ant_halt_notify(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8703b1ant_pnp_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 pnp_state);
|
||||
void ex_halbtc8703b1ant_coex_dm_reset(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8703b1ant_periodical(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8703b1ant_display_coex_info(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8703b1ant_antenna_detection(IN struct btc_coexist *btcoexist,
|
||||
IN u32 cent_freq, IN u32 offset, IN u32 span, IN u32 seconds);
|
||||
void ex_halbtc8703b1ant_antenna_isolation(IN struct btc_coexist *btcoexist,
|
||||
IN u32 cent_freq, IN u32 offset, IN u32 span, IN u32 seconds);
|
||||
|
||||
void ex_halbtc8703b1ant_psd_scan(IN struct btc_coexist *btcoexist,
|
||||
IN u32 cent_freq, IN u32 offset, IN u32 span, IN u32 seconds);
|
||||
void ex_halbtc8703b1ant_display_ant_detection(IN struct btc_coexist *btcoexist);
|
||||
|
||||
#else
|
||||
#define ex_halbtc8703b1ant_power_on_setting(btcoexist)
|
||||
#define ex_halbtc8703b1ant_pre_load_firmware(btcoexist)
|
||||
#define ex_halbtc8703b1ant_init_hw_config(btcoexist, wifi_only)
|
||||
#define ex_halbtc8703b1ant_init_coex_dm(btcoexist)
|
||||
#define ex_halbtc8703b1ant_ips_notify(btcoexist, type)
|
||||
#define ex_halbtc8703b1ant_lps_notify(btcoexist, type)
|
||||
#define ex_halbtc8703b1ant_scan_notify(btcoexist, type)
|
||||
#define ex_halbtc8703b1ant_connect_notify(btcoexist, type)
|
||||
#define ex_halbtc8703b1ant_media_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8703b1ant_specific_packet_notify(btcoexist, type)
|
||||
#define ex_halbtc8703b1ant_bt_info_notify(btcoexist, tmp_buf, length)
|
||||
#define ex_halbtc8703b1ant_rf_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8703b1ant_halt_notify(btcoexist)
|
||||
#define ex_halbtc8703b1ant_pnp_notify(btcoexist, pnp_state)
|
||||
#define ex_halbtc8703b1ant_coex_dm_reset(btcoexist)
|
||||
#define ex_halbtc8703b1ant_periodical(btcoexist)
|
||||
#define ex_halbtc8703b1ant_display_coex_info(btcoexist)
|
||||
#define ex_halbtc8703b1ant_antenna_detection(btcoexist, cent_freq, offset, span, seconds)
|
||||
#define ex_halbtc8703b1ant_antenna_isolation(btcoexist, cent_freq, offset, span, seconds)
|
||||
#define ex_halbtc8703b1ant_psd_scan(btcoexist, cent_freq, offset, span, seconds)
|
||||
#define ex_halbtc8703b1ant_display_ant_detection(btcoexist)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
5113
hal/btc/halbtc8723b1ant.c
Normal file
5113
hal/btc/halbtc8723b1ant.c
Normal file
File diff suppressed because it is too large
Load diff
293
hal/btc/halbtc8723b1ant.h
Normal file
293
hal/btc/halbtc8723b1ant.h
Normal file
|
@ -0,0 +1,293 @@
|
|||
|
||||
#if (BT_SUPPORT == 1 && COEX_SUPPORT == 1)
|
||||
|
||||
#if (RTL8723B_SUPPORT == 1)
|
||||
/* *******************************************
|
||||
* The following is for 8723B 1ANT BT Co-exist definition
|
||||
* ******************************************* */
|
||||
#define BT_AUTO_REPORT_ONLY_8723B_1ANT 1
|
||||
|
||||
#define BT_INFO_8723B_1ANT_B_FTP BIT(7)
|
||||
#define BT_INFO_8723B_1ANT_B_A2DP BIT(6)
|
||||
#define BT_INFO_8723B_1ANT_B_HID BIT(5)
|
||||
#define BT_INFO_8723B_1ANT_B_SCO_BUSY BIT(4)
|
||||
#define BT_INFO_8723B_1ANT_B_ACL_BUSY BIT(3)
|
||||
#define BT_INFO_8723B_1ANT_B_INQ_PAGE BIT(2)
|
||||
#define BT_INFO_8723B_1ANT_B_SCO_ESCO BIT(1)
|
||||
#define BT_INFO_8723B_1ANT_B_CONNECTION BIT(0)
|
||||
|
||||
#define BT_INFO_8723B_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_) \
|
||||
(((_BT_INFO_EXT_&BIT(0))) ? true : false)
|
||||
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8723B_1ANT 2
|
||||
|
||||
#define BT_8723B_1ANT_WIFI_NOISY_THRESH 50 /* 30 /max: 255 */
|
||||
|
||||
/* for Antenna detection */
|
||||
#define BT_8723B_1ANT_ANTDET_PSDTHRES_BACKGROUND 50
|
||||
#define BT_8723B_1ANT_ANTDET_PSDTHRES_2ANT_BADISOLATION 70
|
||||
#define BT_8723B_1ANT_ANTDET_PSDTHRES_2ANT_GOODISOLATION 48
|
||||
#define BT_8723B_1ANT_ANTDET_PSDTHRES_1ANT 32
|
||||
#define BT_8723B_1ANT_ANTDET_RETRY_INTERVAL 10 /* retry timer if ant det is fail, unit: second */
|
||||
#define BT_8723B_1ANT_ANTDET_SWEEPPOINT_DELAY 40000
|
||||
#define BT_8723B_1ANT_ANTDET_ENABLE 1
|
||||
#define BT_8723B_1ANT_ANTDET_COEXMECHANISMSWITCH_ENABLE 1
|
||||
#define BT_8723B_1ANT_ANTDET_BTTXTIME 100
|
||||
#define BT_8723B_1ANT_ANTDET_BTTXCHANNEL 39
|
||||
|
||||
enum bt_info_src_8723b_1ant {
|
||||
BT_INFO_SRC_8723B_1ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8723B_1ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8723B_1ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8723B_1ANT_MAX
|
||||
};
|
||||
|
||||
enum bt_8723b_1ant_bt_status {
|
||||
BT_8723B_1ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8723B_1ANT_BT_STATUS_INQ_PAGE = 0x2,
|
||||
BT_8723B_1ANT_BT_STATUS_ACL_BUSY = 0x3,
|
||||
BT_8723B_1ANT_BT_STATUS_SCO_BUSY = 0x4,
|
||||
BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
|
||||
BT_8723B_1ANT_BT_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8723b_1ant_wifi_status {
|
||||
BT_8723B_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8723B_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN = 0x1,
|
||||
BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SCAN = 0x2,
|
||||
BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SPECIFIC_PKT = 0x3,
|
||||
BT_8723B_1ANT_WIFI_STATUS_CONNECTED_IDLE = 0x4,
|
||||
BT_8723B_1ANT_WIFI_STATUS_CONNECTED_BUSY = 0x5,
|
||||
BT_8723B_1ANT_WIFI_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8723b_1ant_coex_algo {
|
||||
BT_8723B_1ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8723B_1ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8723B_1ANT_COEX_ALGO_HID = 0x2,
|
||||
BT_8723B_1ANT_COEX_ALGO_A2DP = 0x3,
|
||||
BT_8723B_1ANT_COEX_ALGO_A2DP_PANHS = 0x4,
|
||||
BT_8723B_1ANT_COEX_ALGO_PANEDR = 0x5,
|
||||
BT_8723B_1ANT_COEX_ALGO_PANHS = 0x6,
|
||||
BT_8723B_1ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
|
||||
BT_8723B_1ANT_COEX_ALGO_PANEDR_HID = 0x8,
|
||||
BT_8723B_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
|
||||
BT_8723B_1ANT_COEX_ALGO_HID_A2DP = 0xa,
|
||||
BT_8723B_1ANT_COEX_ALGO_MAX = 0xb,
|
||||
};
|
||||
|
||||
struct coex_dm_8723b_1ant {
|
||||
/* hw setting */
|
||||
u8 pre_ant_pos_type;
|
||||
u8 cur_ant_pos_type;
|
||||
/* fw mechanism */
|
||||
boolean cur_ignore_wlan_act;
|
||||
boolean pre_ignore_wlan_act;
|
||||
u8 pre_ps_tdma;
|
||||
u8 cur_ps_tdma;
|
||||
u8 ps_tdma_para[5];
|
||||
u8 ps_tdma_du_adj_type;
|
||||
boolean auto_tdma_adjust;
|
||||
boolean pre_ps_tdma_on;
|
||||
boolean cur_ps_tdma_on;
|
||||
boolean pre_bt_auto_report;
|
||||
boolean cur_bt_auto_report;
|
||||
u8 pre_lps;
|
||||
u8 cur_lps;
|
||||
u8 pre_rpwm;
|
||||
u8 cur_rpwm;
|
||||
|
||||
/* sw mechanism */
|
||||
boolean pre_low_penalty_ra;
|
||||
boolean cur_low_penalty_ra;
|
||||
u32 pre_val0x6c0;
|
||||
u32 cur_val0x6c0;
|
||||
u32 pre_val0x6c4;
|
||||
u32 cur_val0x6c4;
|
||||
u32 pre_val0x6c8;
|
||||
u32 cur_val0x6c8;
|
||||
u8 pre_val0x6cc;
|
||||
u8 cur_val0x6cc;
|
||||
|
||||
u32 backup_arfr_cnt1; /* Auto Rate Fallback Retry cnt */
|
||||
u32 backup_arfr_cnt2; /* Auto Rate Fallback Retry cnt */
|
||||
u16 backup_retry_limit;
|
||||
u8 backup_ampdu_max_time;
|
||||
|
||||
/* algorithm related */
|
||||
u8 bt_status;
|
||||
u8 wifi_chnl_info[3];
|
||||
|
||||
u32 pre_ra_mask;
|
||||
u32 cur_ra_mask;
|
||||
u8 pre_arfr_type;
|
||||
u8 cur_arfr_type;
|
||||
u8 pre_retry_limit_type;
|
||||
u8 cur_retry_limit_type;
|
||||
u8 pre_ampdu_time_type;
|
||||
u8 cur_ampdu_time_type;
|
||||
u32 arp_cnt;
|
||||
|
||||
u8 error_condition;
|
||||
};
|
||||
|
||||
struct coex_sta_8723b_1ant {
|
||||
boolean bt_disabled;
|
||||
boolean bt_enable_disable_change;
|
||||
boolean bt_link_exist;
|
||||
boolean sco_exist;
|
||||
boolean a2dp_exist;
|
||||
boolean hid_exist;
|
||||
boolean pan_exist;
|
||||
boolean bt_hi_pri_link_exist;
|
||||
u8 num_of_profile;
|
||||
boolean bt_abnormal_scan;
|
||||
|
||||
boolean under_lps;
|
||||
boolean under_ips;
|
||||
u32 specific_pkt_period_cnt;
|
||||
u32 high_priority_tx;
|
||||
u32 high_priority_rx;
|
||||
u32 low_priority_tx;
|
||||
u32 low_priority_rx;
|
||||
s8 bt_rssi;
|
||||
boolean bt_tx_rx_mask;
|
||||
boolean c2h_bt_info_req_sent;
|
||||
u8 bt_info_c2h[BT_INFO_SRC_8723B_1ANT_MAX][10];
|
||||
u32 bt_info_c2h_cnt[BT_INFO_SRC_8723B_1ANT_MAX];
|
||||
boolean bt_whck_test;
|
||||
boolean c2h_bt_inquiry_page;
|
||||
boolean c2h_bt_remote_name_req;
|
||||
boolean wifi_is_high_pri_task; /* Add for win8.1 page out issue */
|
||||
u8 bt_retry_cnt;
|
||||
u8 bt_info_ext;
|
||||
u32 pop_event_cnt;
|
||||
u8 scan_ap_num;
|
||||
|
||||
u32 crc_ok_cck;
|
||||
u32 crc_ok_11g;
|
||||
u32 crc_ok_11n;
|
||||
u32 crc_ok_11n_vht;
|
||||
|
||||
u32 crc_err_cck;
|
||||
u32 crc_err_11g;
|
||||
u32 crc_err_11n;
|
||||
u32 crc_err_11n_vht;
|
||||
|
||||
boolean cck_lock;
|
||||
boolean pre_ccklock;
|
||||
boolean cck_ever_lock;
|
||||
u8 coex_table_type;
|
||||
|
||||
boolean force_lps_on;
|
||||
u32 wrong_profile_notification;
|
||||
u32 bt_coex_supported_version;
|
||||
u8 a2dp_bit_pool;
|
||||
u8 cut_version;
|
||||
};
|
||||
|
||||
#define BT_8723B_1ANT_ANTDET_PSD_POINTS 256 /* MAX:1024 */
|
||||
#define BT_8723B_1ANT_ANTDET_PSD_AVGNUM 1 /* MAX:3 */
|
||||
#define BT_8723B_1ANT_ANTDET_BUF_LEN 16
|
||||
|
||||
struct psdscan_sta_8723b_1ant {
|
||||
|
||||
u32 ant_det_bt_le_channel; /* BT LE Channel ex:2412 */
|
||||
u32 ant_det_bt_tx_time;
|
||||
u32 ant_det_pre_psdscan_peak_val;
|
||||
boolean ant_det_is_ant_det_available;
|
||||
u32 ant_det_psd_scan_peak_val;
|
||||
boolean ant_det_is_btreply_available;
|
||||
u32 ant_det_psd_scan_peak_freq;
|
||||
|
||||
u8 ant_det_result;
|
||||
u8 ant_det_peak_val[BT_8723B_1ANT_ANTDET_BUF_LEN];
|
||||
u8 ant_det_peak_freq[BT_8723B_1ANT_ANTDET_BUF_LEN];
|
||||
u32 ant_det_try_count;
|
||||
u32 ant_det_fail_count;
|
||||
u32 ant_det_inteval_count;
|
||||
u32 ant_det_thres_offset;
|
||||
|
||||
u32 real_cent_freq;
|
||||
s32 real_offset;
|
||||
u32 real_span;
|
||||
|
||||
u32 psd_band_width; /* unit: Hz */
|
||||
u32 psd_point; /* 128/256/512/1024 */
|
||||
u32 psd_report[1024]; /* unit:dB (20logx), 0~255 */
|
||||
u32 psd_report_max_hold[1024]; /* unit:dB (20logx), 0~255 */
|
||||
u32 psd_start_point;
|
||||
u32 psd_stop_point;
|
||||
u32 psd_max_value_point;
|
||||
u32 psd_max_value;
|
||||
u32 psd_start_base;
|
||||
u32 psd_avg_num; /* 1/8/16/32 */
|
||||
u32 psd_gen_count;
|
||||
boolean is_psd_running;
|
||||
boolean is_psd_show_max_only;
|
||||
};
|
||||
|
||||
/* *******************************************
|
||||
* The following is interface which will notify coex module.
|
||||
* ******************************************* */
|
||||
void ex_halbtc8723b1ant_power_on_setting(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723b1ant_pre_load_firmware(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723b1ant_init_hw_config(IN struct btc_coexist *btcoexist,
|
||||
IN boolean wifi_only);
|
||||
void ex_halbtc8723b1ant_init_coex_dm(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723b1ant_ips_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723b1ant_lps_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723b1ant_scan_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723b1ant_set_antenna_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723b1ant_connect_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723b1ant_media_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723b1ant_specific_packet_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723b1ant_bt_info_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 *tmp_buf, IN u8 length);
|
||||
void ex_halbtc8723b1ant_rf_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723b1ant_halt_notify(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723b1ant_pnp_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 pnp_state);
|
||||
void ex_halbtc8723b1ant_coex_dm_reset(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723b1ant_periodical(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723b1ant_display_coex_info(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723b1ant_antenna_detection(IN struct btc_coexist *btcoexist,
|
||||
IN u32 cent_freq, IN u32 offset, IN u32 span, IN u32 seconds);
|
||||
|
||||
void ex_halbtc8723b1ant_display_ant_detection(IN struct btc_coexist *btcoexist);
|
||||
|
||||
#else
|
||||
#define ex_halbtc8723b1ant_power_on_setting(btcoexist)
|
||||
#define ex_halbtc8723b1ant_pre_load_firmware(btcoexist)
|
||||
#define ex_halbtc8723b1ant_init_hw_config(btcoexist, wifi_only)
|
||||
#define ex_halbtc8723b1ant_init_coex_dm(btcoexist)
|
||||
#define ex_halbtc8723b1ant_ips_notify(btcoexist, type)
|
||||
#define ex_halbtc8723b1ant_lps_notify(btcoexist, type)
|
||||
#define ex_halbtc8723b1ant_scan_notify(btcoexist, type)
|
||||
#define ex_halbtc8723b1ant_set_antenna_notify(btcoexist, type)
|
||||
#define ex_halbtc8723b1ant_connect_notify(btcoexist, type)
|
||||
#define ex_halbtc8723b1ant_media_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8723b1ant_specific_packet_notify(btcoexist, type)
|
||||
#define ex_halbtc8723b1ant_bt_info_notify(btcoexist, tmp_buf, length)
|
||||
#define ex_halbtc8723b1ant_rf_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8723b1ant_halt_notify(btcoexist)
|
||||
#define ex_halbtc8723b1ant_pnp_notify(btcoexist, pnp_state)
|
||||
#define ex_halbtc8723b1ant_coex_dm_reset(btcoexist)
|
||||
#define ex_halbtc8723b1ant_periodical(btcoexist)
|
||||
#define ex_halbtc8723b1ant_display_coex_info(btcoexist)
|
||||
#define ex_halbtc8723b1ant_antenna_detection(btcoexist, cent_freq, offset, span, seconds)
|
||||
#define ex_halbtc8723b1ant_display_ant_detection(btcoexist)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
4958
hal/btc/halbtc8723b2ant.c
Normal file
4958
hal/btc/halbtc8723b2ant.c
Normal file
File diff suppressed because it is too large
Load diff
217
hal/btc/halbtc8723b2ant.h
Normal file
217
hal/btc/halbtc8723b2ant.h
Normal file
|
@ -0,0 +1,217 @@
|
|||
|
||||
#if (BT_SUPPORT == 1 && COEX_SUPPORT == 1)
|
||||
|
||||
#if (RTL8723B_SUPPORT == 1)
|
||||
/* *******************************************
|
||||
* The following is for 8723B 2Ant BT Co-exist definition
|
||||
* ******************************************* */
|
||||
#define BT_AUTO_REPORT_ONLY_8723B_2ANT 1
|
||||
|
||||
|
||||
#define BT_INFO_8723B_2ANT_B_FTP BIT(7)
|
||||
#define BT_INFO_8723B_2ANT_B_A2DP BIT(6)
|
||||
#define BT_INFO_8723B_2ANT_B_HID BIT(5)
|
||||
#define BT_INFO_8723B_2ANT_B_SCO_BUSY BIT(4)
|
||||
#define BT_INFO_8723B_2ANT_B_ACL_BUSY BIT(3)
|
||||
#define BT_INFO_8723B_2ANT_B_INQ_PAGE BIT(2)
|
||||
#define BT_INFO_8723B_2ANT_B_SCO_ESCO BIT(1)
|
||||
#define BT_INFO_8723B_2ANT_B_CONNECTION BIT(0)
|
||||
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8723B_2ANT 2
|
||||
|
||||
|
||||
#define BT_8723B_2ANT_WIFI_RSSI_COEXSWITCH_THRES 42 /* WiFi RSSI Threshold for 2-Ant TDMA/1-Ant PS-TDMA translation */
|
||||
#define BT_8723B_2ANT_BT_RSSI_COEXSWITCH_THRES 46 /* BT RSSI Threshold for 2-Ant TDMA/1-Ant PS-TDMA translation */
|
||||
|
||||
enum bt_info_src_8723b_2ant {
|
||||
BT_INFO_SRC_8723B_2ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8723B_2ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8723B_2ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8723B_2ANT_MAX
|
||||
};
|
||||
|
||||
enum bt_8723b_2ant_bt_status {
|
||||
BT_8723B_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8723B_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8723B_2ANT_BT_STATUS_INQ_PAGE = 0x2,
|
||||
BT_8723B_2ANT_BT_STATUS_ACL_BUSY = 0x3,
|
||||
BT_8723B_2ANT_BT_STATUS_SCO_BUSY = 0x4,
|
||||
BT_8723B_2ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
|
||||
BT_8723B_2ANT_BT_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8723b_2ant_coex_algo {
|
||||
BT_8723B_2ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8723B_2ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8723B_2ANT_COEX_ALGO_HID = 0x2,
|
||||
BT_8723B_2ANT_COEX_ALGO_A2DP = 0x3,
|
||||
BT_8723B_2ANT_COEX_ALGO_A2DP_PANHS = 0x4,
|
||||
BT_8723B_2ANT_COEX_ALGO_PANEDR = 0x5,
|
||||
BT_8723B_2ANT_COEX_ALGO_PANHS = 0x6,
|
||||
BT_8723B_2ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
|
||||
BT_8723B_2ANT_COEX_ALGO_PANEDR_HID = 0x8,
|
||||
BT_8723B_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
|
||||
BT_8723B_2ANT_COEX_ALGO_HID_A2DP = 0xa,
|
||||
BT_8723B_2ANT_COEX_ALGO_MAX = 0xb,
|
||||
};
|
||||
|
||||
struct coex_dm_8723b_2ant {
|
||||
/* fw mechanism */
|
||||
u8 pre_bt_dec_pwr_lvl;
|
||||
u8 cur_bt_dec_pwr_lvl;
|
||||
u8 pre_fw_dac_swing_lvl;
|
||||
u8 cur_fw_dac_swing_lvl;
|
||||
boolean cur_ignore_wlan_act;
|
||||
boolean pre_ignore_wlan_act;
|
||||
u8 pre_ps_tdma;
|
||||
u8 cur_ps_tdma;
|
||||
u8 ps_tdma_para[5];
|
||||
u8 ps_tdma_du_adj_type;
|
||||
boolean reset_tdma_adjust;
|
||||
boolean auto_tdma_adjust;
|
||||
boolean pre_ps_tdma_on;
|
||||
boolean cur_ps_tdma_on;
|
||||
boolean pre_bt_auto_report;
|
||||
boolean cur_bt_auto_report;
|
||||
|
||||
/* sw mechanism */
|
||||
boolean pre_rf_rx_lpf_shrink;
|
||||
boolean cur_rf_rx_lpf_shrink;
|
||||
u32 bt_rf_0x1e_backup;
|
||||
boolean pre_low_penalty_ra;
|
||||
boolean cur_low_penalty_ra;
|
||||
boolean pre_dac_swing_on;
|
||||
u32 pre_dac_swing_lvl;
|
||||
boolean cur_dac_swing_on;
|
||||
u32 cur_dac_swing_lvl;
|
||||
boolean pre_adc_back_off;
|
||||
boolean cur_adc_back_off;
|
||||
boolean pre_agc_table_en;
|
||||
boolean cur_agc_table_en;
|
||||
u32 pre_val0x6c0;
|
||||
u32 cur_val0x6c0;
|
||||
u32 pre_val0x6c4;
|
||||
u32 cur_val0x6c4;
|
||||
u32 pre_val0x6c8;
|
||||
u32 cur_val0x6c8;
|
||||
u8 pre_val0x6cc;
|
||||
u8 cur_val0x6cc;
|
||||
boolean limited_dig;
|
||||
|
||||
/* algorithm related */
|
||||
u8 pre_algorithm;
|
||||
u8 cur_algorithm;
|
||||
u8 bt_status;
|
||||
u8 wifi_chnl_info[3];
|
||||
|
||||
boolean need_recover0x948;
|
||||
u32 backup0x948;
|
||||
|
||||
u8 pre_lps;
|
||||
u8 cur_lps;
|
||||
u8 pre_rpwm;
|
||||
u8 cur_rpwm;
|
||||
|
||||
boolean is_switch_to_1dot5_ant;
|
||||
u8 switch_thres_offset;
|
||||
};
|
||||
|
||||
struct coex_sta_8723b_2ant {
|
||||
boolean bt_disabled;
|
||||
boolean bt_link_exist;
|
||||
boolean sco_exist;
|
||||
boolean a2dp_exist;
|
||||
boolean hid_exist;
|
||||
boolean pan_exist;
|
||||
boolean bt_abnormal_scan;
|
||||
boolean under_lps;
|
||||
boolean under_ips;
|
||||
u32 high_priority_tx;
|
||||
u32 high_priority_rx;
|
||||
u32 low_priority_tx;
|
||||
u32 low_priority_rx;
|
||||
u8 bt_rssi;
|
||||
boolean bt_tx_rx_mask;
|
||||
u8 pre_bt_rssi_state;
|
||||
u8 pre_wifi_rssi_state[4];
|
||||
boolean c2h_bt_info_req_sent;
|
||||
u8 bt_info_c2h[BT_INFO_SRC_8723B_2ANT_MAX][10];
|
||||
u32 bt_info_c2h_cnt[BT_INFO_SRC_8723B_2ANT_MAX];
|
||||
boolean bt_whck_test;
|
||||
boolean c2h_bt_inquiry_page;
|
||||
boolean c2h_bt_remote_name_req;
|
||||
u8 bt_retry_cnt;
|
||||
u8 bt_info_ext;
|
||||
u32 pop_event_cnt;
|
||||
u8 scan_ap_num;
|
||||
|
||||
u32 crc_ok_cck;
|
||||
u32 crc_ok_11g;
|
||||
u32 crc_ok_11n;
|
||||
u32 crc_ok_11n_vht;
|
||||
|
||||
u32 crc_err_cck;
|
||||
u32 crc_err_11g;
|
||||
u32 crc_err_11n;
|
||||
u32 crc_err_11n_vht;
|
||||
|
||||
u32 bt_coex_supported_version;
|
||||
|
||||
u8 coex_table_type;
|
||||
boolean force_lps_on;
|
||||
|
||||
u8 dis_ver_info_cnt;
|
||||
|
||||
u8 a2dp_bit_pool;
|
||||
u8 cut_version;
|
||||
};
|
||||
|
||||
/* *******************************************
|
||||
* The following is interface which will notify coex module.
|
||||
* ******************************************* */
|
||||
void ex_halbtc8723b2ant_power_on_setting(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723b2ant_pre_load_firmware(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723b2ant_init_hw_config(IN struct btc_coexist *btcoexist,
|
||||
IN boolean wifi_only);
|
||||
void ex_halbtc8723b2ant_init_coex_dm(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723b2ant_ips_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723b2ant_lps_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723b2ant_scan_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723b2ant_connect_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723b2ant_media_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723b2ant_specific_packet_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723b2ant_bt_info_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 *tmp_buf, IN u8 length);
|
||||
void ex_halbtc8723b2ant_halt_notify(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723b2ant_pnp_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 pnp_state);
|
||||
void ex_halbtc8723b2ant_periodical(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723b2ant_display_coex_info(IN struct btc_coexist *btcoexist);
|
||||
|
||||
#else
|
||||
#define ex_halbtc8723b2ant_power_on_setting(btcoexist)
|
||||
#define ex_halbtc8723b2ant_pre_load_firmware(btcoexist)
|
||||
#define ex_halbtc8723b2ant_init_hw_config(btcoexist, wifi_only)
|
||||
#define ex_halbtc8723b2ant_init_coex_dm(btcoexist)
|
||||
#define ex_halbtc8723b2ant_ips_notify(btcoexist, type)
|
||||
#define ex_halbtc8723b2ant_lps_notify(btcoexist, type)
|
||||
#define ex_halbtc8723b2ant_scan_notify(btcoexist, type)
|
||||
#define ex_halbtc8723b2ant_connect_notify(btcoexist, type)
|
||||
#define ex_halbtc8723b2ant_media_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8723b2ant_specific_packet_notify(btcoexist, type)
|
||||
#define ex_halbtc8723b2ant_bt_info_notify(btcoexist, tmp_buf, length)
|
||||
#define ex_halbtc8723b2ant_halt_notify(btcoexist)
|
||||
#define ex_halbtc8723b2ant_pnp_notify(btcoexist, pnp_state)
|
||||
#define ex_halbtc8723b2ant_periodical(btcoexist)
|
||||
#define ex_halbtc8723b2ant_display_coex_info(btcoexist)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
68
hal/btc/halbtc8723bwifionly.c
Normal file
68
hal/btc/halbtc8723bwifionly.c
Normal file
|
@ -0,0 +1,68 @@
|
|||
#include "mp_precomp.h"
|
||||
|
||||
|
||||
VOID
|
||||
ex_hal8723b_wifi_only_hw_config(
|
||||
IN struct wifi_only_cfg *pwifionlycfg
|
||||
)
|
||||
{
|
||||
struct wifi_only_haldata *pwifionly_haldata = &pwifionlycfg->haldata_info;
|
||||
|
||||
|
||||
halwifionly_write1byte(pwifionlycfg, 0x778, 0x3); /* Set pta for wifi first priority, 0x1 need to reference pta table to determine wifi and bt priority */
|
||||
halwifionly_bitmaskwrite1byte(pwifionlycfg, 0x40, 0x20, 0x1);
|
||||
|
||||
/* Set Antenna path to Wifi */
|
||||
halwifionly_write2byte(pwifionlycfg, 0x0765, 0x8); /* Set pta for wifi first priority, 0x0 need to reference pta table to determine wifi and bt priority */
|
||||
halwifionly_write2byte(pwifionlycfg, 0x076e, 0xc);
|
||||
|
||||
halwifionly_write4byte(pwifionlycfg, 0x000006c0, 0xaaaaaaaa); /* pta table, 0xaaaaaaaa means wifi is higher priority than bt */
|
||||
halwifionly_write4byte(pwifionlycfg, 0x000006c4, 0xaaaaaaaa);
|
||||
|
||||
halwifionly_bitmaskwrite1byte(pwifionlycfg, 0x67, 0x20, 0x1); /* BT select s0/s1 is controlled by WiFi */
|
||||
|
||||
/* 0x948 setting */
|
||||
if (pwifionlycfg->chip_interface == WIFIONLY_INTF_PCI) {
|
||||
/* HP Foxconn NGFF at S0
|
||||
not sure HP pg correct or not(EEPROMBluetoothSingleAntPath), so here we just write
|
||||
0x948=0x280 for HP HW id NIC. */
|
||||
if (pwifionly_haldata->customer_id == CUSTOMER_HP_1) {
|
||||
halwifionly_write4byte(pwifionlycfg, 0x948, 0x280);
|
||||
halwifionly_phy_set_rf_reg(pwifionlycfg, 0, 0x1, 0xfffff, 0x0); /* WiFi TRx Mask off */
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (pwifionly_haldata->efuse_pg_antnum == 2) {
|
||||
halwifionly_write4byte(pwifionlycfg, 0x948, 0x0);
|
||||
} else {
|
||||
/* 3Attention !!! For 8723BU !!!!
|
||||
For 8723BU single ant case: jira [USB-1237]
|
||||
Because of 8723BU S1 has HW problem, we only can use S0 instead.
|
||||
Whether Efuse 0xc3 [6] is 0 or 1, we should always use S0 and write 0x948 to 80/280
|
||||
|
||||
--------------------------------------------------
|
||||
BT Team :
|
||||
When in Single Ant case, Reg[0x948] has two case : 0x80 or 0x200
|
||||
When in Two Ant case, Reg[0x948] has two case : 0x280 or 0x0
|
||||
Efuse 0xc3 [6] Antenna Path
|
||||
0xc3 [6] = 0 ==> S1 ==> 0x948 = 0/40/200
|
||||
0xc3 [6] = 1 ==> S0 ==> 0x948 = 80/240/280 */
|
||||
|
||||
if (pwifionlycfg->chip_interface == WIFIONLY_INTF_USB)
|
||||
halwifionly_write4byte(pwifionlycfg, 0x948, 0x80);
|
||||
else {
|
||||
if (pwifionly_haldata->efuse_pg_antpath == 0)
|
||||
halwifionly_write4byte(pwifionlycfg, 0x948, 0x0);
|
||||
else
|
||||
halwifionly_write4byte(pwifionlycfg, 0x948, 0x280);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* after 8723B F-cut, TRx Mask should be set when 0x948=0x0 or 0x280
|
||||
PHY_SetRFReg(Adapter, 0, 0x1, 0xfffff, 0x780); WiFi TRx Mask on */
|
||||
halwifionly_phy_set_rf_reg(pwifionlycfg, 0, 0x1, 0xfffff, 0x0); /*WiFi TRx Mask off */
|
||||
|
||||
}
|
8
hal/btc/halbtc8723bwifionly.h
Normal file
8
hal/btc/halbtc8723bwifionly.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
#ifndef __INC_HAL8723BWIFIONLYHWCFG_H
|
||||
#define __INC_HAL8723BWIFIONLYHWCFG_H
|
||||
|
||||
VOID
|
||||
ex_hal8723b_wifi_only_hw_config(
|
||||
IN struct wifi_only_cfg *pwifionlycfg
|
||||
);
|
||||
#endif
|
6225
hal/btc/halbtc8723d1ant.c
Normal file
6225
hal/btc/halbtc8723d1ant.c
Normal file
File diff suppressed because it is too large
Load diff
413
hal/btc/halbtc8723d1ant.h
Normal file
413
hal/btc/halbtc8723d1ant.h
Normal file
|
@ -0,0 +1,413 @@
|
|||
|
||||
#if (BT_SUPPORT == 1 && COEX_SUPPORT == 1)
|
||||
|
||||
#if (RTL8723D_SUPPORT == 1)
|
||||
|
||||
/* *******************************************
|
||||
* The following is for 8723D 1ANT BT Co-exist definition
|
||||
* ******************************************* */
|
||||
#define BT_8723D_1ANT_COEX_DBG 0
|
||||
#define BT_AUTO_REPORT_ONLY_8723D_1ANT 1
|
||||
|
||||
#define BT_INFO_8723D_1ANT_B_FTP BIT(7)
|
||||
#define BT_INFO_8723D_1ANT_B_A2DP BIT(6)
|
||||
#define BT_INFO_8723D_1ANT_B_HID BIT(5)
|
||||
#define BT_INFO_8723D_1ANT_B_SCO_BUSY BIT(4)
|
||||
#define BT_INFO_8723D_1ANT_B_ACL_BUSY BIT(3)
|
||||
#define BT_INFO_8723D_1ANT_B_INQ_PAGE BIT(2)
|
||||
#define BT_INFO_8723D_1ANT_B_SCO_ESCO BIT(1)
|
||||
#define BT_INFO_8723D_1ANT_B_CONNECTION BIT(0)
|
||||
|
||||
#define BT_INFO_8723D_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_) \
|
||||
(((_BT_INFO_EXT_&BIT(0))) ? true : false)
|
||||
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8723D_1ANT 2
|
||||
|
||||
#define BT_8723D_1ANT_WIFI_NOISY_THRESH 30 /* max: 255 */
|
||||
#define BT_8723D_1ANT_DEFAULT_ISOLATION 15 /* unit: dB */
|
||||
|
||||
|
||||
/* for Antenna detection */
|
||||
#define BT_8723D_1ANT_ANTDET_PSDTHRES_BACKGROUND 50
|
||||
#define BT_8723D_1ANT_ANTDET_PSDTHRES_2ANT_BADISOLATION 70
|
||||
#define BT_8723D_1ANT_ANTDET_PSDTHRES_2ANT_GOODISOLATION 55
|
||||
#define BT_8723D_1ANT_ANTDET_PSDTHRES_1ANT 35
|
||||
#define BT_8723D_1ANT_ANTDET_RETRY_INTERVAL 10 /* retry timer if ant det is fail, unit: second */
|
||||
#define BT_8723D_1ANT_ANTDET_SWEEPPOINT_DELAY 60000
|
||||
#define BT_8723D_1ANT_ANTDET_ENABLE 1
|
||||
#define BT_8723D_1ANT_ANTDET_BTTXTIME 100
|
||||
#define BT_8723D_1ANT_ANTDET_BTTXCHANNEL 39
|
||||
#define BT_8723D_1ANT_ANTDET_PSD_SWWEEPCOUNT 50
|
||||
|
||||
#define BT_8723D_1ANT_LTECOEX_INDIRECTREG_ACCESS_TIMEOUT 30000
|
||||
|
||||
enum bt_8723d_1ant_signal_state {
|
||||
BT_8723D_1ANT_SIG_STA_SET_TO_LOW = 0x0,
|
||||
BT_8723D_1ANT_SIG_STA_SET_BY_HW = 0x0,
|
||||
BT_8723D_1ANT_SIG_STA_SET_TO_HIGH = 0x1,
|
||||
BT_8723D_1ANT_SIG_STA_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_1ant_path_ctrl_owner {
|
||||
BT_8723D_1ANT_PCO_BTSIDE = 0x0,
|
||||
BT_8723D_1ANT_PCO_WLSIDE = 0x1,
|
||||
BT_8723D_1ANT_PCO_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_1ant_gnt_ctrl_type {
|
||||
BT_8723D_1ANT_GNT_TYPE_CTRL_BY_PTA = 0x0,
|
||||
BT_8723D_1ANT_GNT_TYPE_CTRL_BY_SW = 0x1,
|
||||
BT_8723D_1ANT_GNT_TYPE_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_1ant_gnt_ctrl_block {
|
||||
BT_8723D_1ANT_GNT_BLOCK_RFC_BB = 0x0,
|
||||
BT_8723D_1ANT_GNT_BLOCK_RFC = 0x1,
|
||||
BT_8723D_1ANT_GNT_BLOCK_BB = 0x2,
|
||||
BT_8723D_1ANT_GNT_BLOCK_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_1ant_lte_coex_table_type {
|
||||
BT_8723D_1ANT_CTT_WL_VS_LTE = 0x0,
|
||||
BT_8723D_1ANT_CTT_BT_VS_LTE = 0x1,
|
||||
BT_8723D_1ANT_CTT_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_1ant_lte_break_table_type {
|
||||
BT_8723D_1ANT_LBTT_WL_BREAK_LTE = 0x0,
|
||||
BT_8723D_1ANT_LBTT_BT_BREAK_LTE = 0x1,
|
||||
BT_8723D_1ANT_LBTT_LTE_BREAK_WL = 0x2,
|
||||
BT_8723D_1ANT_LBTT_LTE_BREAK_BT = 0x3,
|
||||
BT_8723D_1ANT_LBTT_MAX
|
||||
};
|
||||
|
||||
enum bt_info_src_8723d_1ant {
|
||||
BT_INFO_SRC_8723D_1ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8723D_1ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8723D_1ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8723D_1ANT_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_1ant_bt_status {
|
||||
BT_8723D_1ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8723D_1ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8723D_1ANT_BT_STATUS_INQ_PAGE = 0x2,
|
||||
BT_8723D_1ANT_BT_STATUS_ACL_BUSY = 0x3,
|
||||
BT_8723D_1ANT_BT_STATUS_SCO_BUSY = 0x4,
|
||||
BT_8723D_1ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
|
||||
BT_8723D_1ANT_BT_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_1ant_wifi_status {
|
||||
BT_8723D_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8723D_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN = 0x1,
|
||||
BT_8723D_1ANT_WIFI_STATUS_CONNECTED_SCAN = 0x2,
|
||||
BT_8723D_1ANT_WIFI_STATUS_CONNECTED_SPECIFIC_PKT = 0x3,
|
||||
BT_8723D_1ANT_WIFI_STATUS_CONNECTED_IDLE = 0x4,
|
||||
BT_8723D_1ANT_WIFI_STATUS_CONNECTED_BUSY = 0x5,
|
||||
BT_8723D_1ANT_WIFI_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_1ant_coex_algo {
|
||||
BT_8723D_1ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8723D_1ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8723D_1ANT_COEX_ALGO_HID = 0x2,
|
||||
BT_8723D_1ANT_COEX_ALGO_A2DP = 0x3,
|
||||
BT_8723D_1ANT_COEX_ALGO_A2DP_PANHS = 0x4,
|
||||
BT_8723D_1ANT_COEX_ALGO_PANEDR = 0x5,
|
||||
BT_8723D_1ANT_COEX_ALGO_PANHS = 0x6,
|
||||
BT_8723D_1ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
|
||||
BT_8723D_1ANT_COEX_ALGO_PANEDR_HID = 0x8,
|
||||
BT_8723D_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
|
||||
BT_8723D_1ANT_COEX_ALGO_HID_A2DP = 0xa,
|
||||
BT_8723D_1ANT_COEX_ALGO_MAX = 0xb,
|
||||
};
|
||||
|
||||
enum bt_8723d_1ant_phase {
|
||||
BT_8723D_1ANT_PHASE_COEX_INIT = 0x0,
|
||||
BT_8723D_1ANT_PHASE_WLANONLY_INIT = 0x1,
|
||||
BT_8723D_1ANT_PHASE_WLAN_OFF = 0x2,
|
||||
BT_8723D_1ANT_PHASE_2G_RUNTIME = 0x3,
|
||||
BT_8723D_1ANT_PHASE_5G_RUNTIME = 0x4,
|
||||
BT_8723D_1ANT_PHASE_BTMPMODE = 0x5,
|
||||
BT_8723D_1ANT_PHASE_ANTENNA_DET = 0x6,
|
||||
BT_8723D_1ANT_PHASE_COEX_POWERON = 0x7,
|
||||
BT_8723D_1ANT_PHASE_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_1ant_Scoreboard {
|
||||
BT_8723D_1ANT_SCOREBOARD_ACTIVE = BIT(0),
|
||||
BT_8723D_1ANT_SCOREBOARD_ONOFF = BIT(1),
|
||||
BT_8723D_1ANT_SCOREBOARD_SCAN = BIT(2),
|
||||
BT_8723D_1ANT_SCOREBOARD_UNDERTEST = BIT(3),
|
||||
BT_8723D_1ANT_SCOREBOARD_WLBUSY = BIT(6)
|
||||
};
|
||||
|
||||
struct coex_dm_8723d_1ant {
|
||||
/* hw setting */
|
||||
u8 pre_ant_pos_type;
|
||||
u8 cur_ant_pos_type;
|
||||
/* fw mechanism */
|
||||
boolean cur_ignore_wlan_act;
|
||||
boolean pre_ignore_wlan_act;
|
||||
u8 pre_ps_tdma;
|
||||
u8 cur_ps_tdma;
|
||||
u8 ps_tdma_para[5];
|
||||
u8 ps_tdma_du_adj_type;
|
||||
boolean pre_ps_tdma_on;
|
||||
boolean cur_ps_tdma_on;
|
||||
boolean pre_bt_auto_report;
|
||||
boolean cur_bt_auto_report;
|
||||
u8 pre_lps;
|
||||
u8 cur_lps;
|
||||
u8 pre_rpwm;
|
||||
u8 cur_rpwm;
|
||||
|
||||
/* sw mechanism */
|
||||
boolean pre_low_penalty_ra;
|
||||
boolean cur_low_penalty_ra;
|
||||
u32 pre_val0x6c0;
|
||||
u32 cur_val0x6c0;
|
||||
u32 pre_val0x6c4;
|
||||
u32 cur_val0x6c4;
|
||||
u32 pre_val0x6c8;
|
||||
u32 cur_val0x6c8;
|
||||
u8 pre_val0x6cc;
|
||||
u8 cur_val0x6cc;
|
||||
boolean limited_dig;
|
||||
|
||||
u32 backup_arfr_cnt1; /* Auto Rate Fallback Retry cnt */
|
||||
u32 backup_arfr_cnt2; /* Auto Rate Fallback Retry cnt */
|
||||
u16 backup_retry_limit;
|
||||
u8 backup_ampdu_max_time;
|
||||
|
||||
/* algorithm related */
|
||||
u8 pre_algorithm;
|
||||
u8 cur_algorithm;
|
||||
u8 bt_status;
|
||||
u8 wifi_chnl_info[3];
|
||||
|
||||
u32 pre_ra_mask;
|
||||
u32 cur_ra_mask;
|
||||
u8 pre_arfr_type;
|
||||
u8 cur_arfr_type;
|
||||
u8 pre_retry_limit_type;
|
||||
u8 cur_retry_limit_type;
|
||||
u8 pre_ampdu_time_type;
|
||||
u8 cur_ampdu_time_type;
|
||||
u32 arp_cnt;
|
||||
|
||||
u8 error_condition;
|
||||
};
|
||||
|
||||
struct coex_sta_8723d_1ant {
|
||||
boolean bt_disabled;
|
||||
boolean bt_link_exist;
|
||||
boolean sco_exist;
|
||||
boolean a2dp_exist;
|
||||
boolean hid_exist;
|
||||
boolean pan_exist;
|
||||
boolean bt_hi_pri_link_exist;
|
||||
u8 num_of_profile;
|
||||
|
||||
boolean under_lps;
|
||||
boolean under_ips;
|
||||
u32 specific_pkt_period_cnt;
|
||||
u32 high_priority_tx;
|
||||
u32 high_priority_rx;
|
||||
u32 low_priority_tx;
|
||||
u32 low_priority_rx;
|
||||
boolean is_hiPri_rx_overhead;
|
||||
s8 bt_rssi;
|
||||
boolean bt_tx_rx_mask;
|
||||
u8 pre_bt_rssi_state;
|
||||
u8 pre_wifi_rssi_state[4];
|
||||
u8 bt_info_c2h[BT_INFO_SRC_8723D_1ANT_MAX][10];
|
||||
u32 bt_info_c2h_cnt[BT_INFO_SRC_8723D_1ANT_MAX];
|
||||
boolean bt_whck_test;
|
||||
boolean c2h_bt_inquiry_page;
|
||||
boolean c2h_bt_remote_name_req;
|
||||
boolean c2h_bt_page; /* Add for win8.1 page out issue */
|
||||
boolean wifi_is_high_pri_task; /* Add for win8.1 page out issue */
|
||||
u8 bt_retry_cnt;
|
||||
u8 bt_info_ext;
|
||||
u8 bt_info_ext2;
|
||||
u32 pop_event_cnt;
|
||||
u8 scan_ap_num;
|
||||
|
||||
u32 crc_ok_cck;
|
||||
u32 crc_ok_11g;
|
||||
u32 crc_ok_11n;
|
||||
u32 crc_ok_11n_vht;
|
||||
|
||||
u32 crc_err_cck;
|
||||
u32 crc_err_11g;
|
||||
u32 crc_err_11n;
|
||||
u32 crc_err_11n_vht;
|
||||
|
||||
boolean cck_lock;
|
||||
boolean pre_ccklock;
|
||||
boolean cck_ever_lock;
|
||||
u8 coex_table_type;
|
||||
|
||||
boolean force_lps_on;
|
||||
|
||||
boolean concurrent_rx_mode_on;
|
||||
|
||||
u16 score_board;
|
||||
u8 isolation_btween_wb; /* 0~ 50 */
|
||||
|
||||
u8 a2dp_bit_pool;
|
||||
u8 cut_version;
|
||||
boolean acl_busy;
|
||||
boolean bt_create_connection;
|
||||
|
||||
u32 bt_coex_supported_feature;
|
||||
u32 bt_coex_supported_version;
|
||||
|
||||
u8 bt_ble_scan_type;
|
||||
u32 bt_ble_scan_para[3];
|
||||
|
||||
boolean run_time_state;
|
||||
boolean freeze_coexrun_by_btinfo;
|
||||
|
||||
boolean is_A2DP_3M;
|
||||
boolean voice_over_HOGP;
|
||||
u8 bt_info;
|
||||
boolean is_autoslot;
|
||||
u8 forbidden_slot;
|
||||
u8 hid_busy_num;
|
||||
u8 hid_pair_cnt;
|
||||
|
||||
u32 cnt_RemoteNameReq;
|
||||
u32 cnt_setupLink;
|
||||
u32 cnt_ReInit;
|
||||
u32 cnt_IgnWlanAct;
|
||||
u32 cnt_Page;
|
||||
u32 cnt_RoleSwitch;
|
||||
|
||||
u16 bt_reg_vendor_ac;
|
||||
u16 bt_reg_vendor_ae;
|
||||
|
||||
boolean is_setupLink;
|
||||
u8 wl_noisy_level;
|
||||
u32 gnt_error_cnt;
|
||||
|
||||
u8 bt_afh_map[10];
|
||||
u8 bt_relink_downcount;
|
||||
boolean is_tdma_btautoslot;
|
||||
boolean is_tdma_btautoslot_hang;
|
||||
};
|
||||
|
||||
#define BT_8723D_1ANT_ANTDET_PSD_POINTS 256 /* MAX:1024 */
|
||||
#define BT_8723D_1ANT_ANTDET_PSD_AVGNUM 1 /* MAX:3 */
|
||||
#define BT_8723D_1ANT_ANTDET_BUF_LEN 16
|
||||
|
||||
struct psdscan_sta_8723d_1ant {
|
||||
|
||||
u32 ant_det_bt_le_channel; /* BT LE Channel ex:2412 */
|
||||
u32 ant_det_bt_tx_time;
|
||||
u32 ant_det_pre_psdscan_peak_val;
|
||||
boolean ant_det_is_ant_det_available;
|
||||
u32 ant_det_psd_scan_peak_val;
|
||||
boolean ant_det_is_btreply_available;
|
||||
u32 ant_det_psd_scan_peak_freq;
|
||||
|
||||
u8 ant_det_result;
|
||||
u8 ant_det_peak_val[BT_8723D_1ANT_ANTDET_BUF_LEN];
|
||||
u8 ant_det_peak_freq[BT_8723D_1ANT_ANTDET_BUF_LEN];
|
||||
u32 ant_det_try_count;
|
||||
u32 ant_det_fail_count;
|
||||
u32 ant_det_inteval_count;
|
||||
u32 ant_det_thres_offset;
|
||||
|
||||
u32 real_cent_freq;
|
||||
s32 real_offset;
|
||||
u32 real_span;
|
||||
|
||||
u32 psd_band_width; /* unit: Hz */
|
||||
u32 psd_point; /* 128/256/512/1024 */
|
||||
u32 psd_report[1024]; /* unit:dB (20logx), 0~255 */
|
||||
u32 psd_report_max_hold[1024]; /* unit:dB (20logx), 0~255 */
|
||||
u32 psd_start_point;
|
||||
u32 psd_stop_point;
|
||||
u32 psd_max_value_point;
|
||||
u32 psd_max_value;
|
||||
u32 psd_max_value2;
|
||||
u32 psd_avg_value; /* filter loop_max_value that below BT_8723D_1ANT_ANTDET_PSDTHRES_1ANT, and average the rest*/
|
||||
u32 psd_loop_max_value[BT_8723D_1ANT_ANTDET_PSD_SWWEEPCOUNT]; /*max value in each loop */
|
||||
u32 psd_start_base;
|
||||
u32 psd_avg_num; /* 1/8/16/32 */
|
||||
u32 psd_gen_count;
|
||||
boolean is_AntDet_running;
|
||||
boolean is_psd_show_max_only;
|
||||
};
|
||||
|
||||
/* *******************************************
|
||||
* The following is interface which will notify coex module.
|
||||
* ******************************************* */
|
||||
void ex_halbtc8723d1ant_power_on_setting(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723d1ant_pre_load_firmware(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723d1ant_init_hw_config(IN struct btc_coexist *btcoexist,
|
||||
IN boolean wifi_only);
|
||||
void ex_halbtc8723d1ant_init_coex_dm(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723d1ant_ips_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723d1ant_lps_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723d1ant_scan_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723d1ant_connect_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723d1ant_media_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723d1ant_specific_packet_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723d1ant_bt_info_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 *tmp_buf, IN u8 length);
|
||||
void ex_halbtc8723d1ant_rf_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723d1ant_halt_notify(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723d1ant_pnp_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 pnp_state);
|
||||
void ex_halbtc8723d1ant_coex_dm_reset(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723d1ant_periodical(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723d1ant_set_antenna_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723d1ant_display_coex_info(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723d1ant_antenna_detection(IN struct btc_coexist *btcoexist,
|
||||
IN u32 cent_freq, IN u32 offset, IN u32 span, IN u32 seconds);
|
||||
void ex_halbtc8723d1ant_antenna_isolation(IN struct btc_coexist *btcoexist,
|
||||
IN u32 cent_freq, IN u32 offset, IN u32 span, IN u32 seconds);
|
||||
|
||||
void ex_halbtc8723d1ant_psd_scan(IN struct btc_coexist *btcoexist,
|
||||
IN u32 cent_freq, IN u32 offset, IN u32 span, IN u32 seconds);
|
||||
void ex_halbtc8723d1ant_display_ant_detection(IN struct btc_coexist *btcoexist);
|
||||
|
||||
#else
|
||||
#define ex_halbtc8723d1ant_power_on_setting(btcoexist)
|
||||
#define ex_halbtc8723d1ant_pre_load_firmware(btcoexist)
|
||||
#define ex_halbtc8723d1ant_init_hw_config(btcoexist, wifi_only)
|
||||
#define ex_halbtc8723d1ant_init_coex_dm(btcoexist)
|
||||
#define ex_halbtc8723d1ant_ips_notify(btcoexist, type)
|
||||
#define ex_halbtc8723d1ant_lps_notify(btcoexist, type)
|
||||
#define ex_halbtc8723d1ant_scan_notify(btcoexist, type)
|
||||
#define ex_halbtc8723d1ant_connect_notify(btcoexist, type)
|
||||
#define ex_halbtc8723d1ant_media_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8723d1ant_specific_packet_notify(btcoexist, type)
|
||||
#define ex_halbtc8723d1ant_bt_info_notify(btcoexist, tmp_buf, length)
|
||||
#define ex_halbtc8723d1ant_rf_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8723d1ant_halt_notify(btcoexist)
|
||||
#define ex_halbtc8723d1ant_pnp_notify(btcoexist, pnp_state)
|
||||
#define ex_halbtc8723d1ant_coex_dm_reset(btcoexist)
|
||||
#define ex_halbtc8723d1ant_periodical(btcoexist)
|
||||
#define ex_halbtc8723d1ant_display_coex_info(btcoexist)
|
||||
#define ex_halbtc8723d1ant_set_antenna_notify(btcoexist, type)
|
||||
#define ex_halbtc8723d1ant_antenna_detection(btcoexist, cent_freq, offset, span, seconds)
|
||||
#define ex_halbtc8723d1ant_antenna_isolation(btcoexist, cent_freq, offset, span, seconds)
|
||||
#define ex_halbtc8723d1ant_psd_scan(btcoexist, cent_freq, offset, span, seconds)
|
||||
#define ex_halbtc8723d1ant_display_ant_detection(btcoexist)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
6774
hal/btc/halbtc8723d2ant.c
Normal file
6774
hal/btc/halbtc8723d2ant.c
Normal file
File diff suppressed because it is too large
Load diff
418
hal/btc/halbtc8723d2ant.h
Normal file
418
hal/btc/halbtc8723d2ant.h
Normal file
|
@ -0,0 +1,418 @@
|
|||
|
||||
#if (BT_SUPPORT == 1 && COEX_SUPPORT == 1)
|
||||
|
||||
#if (RTL8723D_SUPPORT == 1)
|
||||
|
||||
/* *******************************************
|
||||
* The following is for 8723D 2Ant BT Co-exist definition
|
||||
* ******************************************* */
|
||||
#define BT_8723D_2ANT_COEX_DBG 0
|
||||
#define BT_AUTO_REPORT_ONLY_8723D_2ANT 1
|
||||
|
||||
|
||||
#define BT_INFO_8723D_2ANT_B_FTP BIT(7)
|
||||
#define BT_INFO_8723D_2ANT_B_A2DP BIT(6)
|
||||
#define BT_INFO_8723D_2ANT_B_HID BIT(5)
|
||||
#define BT_INFO_8723D_2ANT_B_SCO_BUSY BIT(4)
|
||||
#define BT_INFO_8723D_2ANT_B_ACL_BUSY BIT(3)
|
||||
#define BT_INFO_8723D_2ANT_B_INQ_PAGE BIT(2)
|
||||
#define BT_INFO_8723D_2ANT_B_SCO_ESCO BIT(1)
|
||||
#define BT_INFO_8723D_2ANT_B_CONNECTION BIT(0)
|
||||
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8723D_2ANT 2
|
||||
|
||||
|
||||
#define BT_8723D_2ANT_WIFI_RSSI_COEXSWITCH_THRES1 80 /* unit: % WiFi RSSI Threshold for 2-Ant free-run/2-Ant TDMA translation, default = 42 */
|
||||
#define BT_8723D_2ANT_BT_RSSI_COEXSWITCH_THRES1 80 /* unit: % BT RSSI Threshold for 2-Ant free-run/2-Ant TDMA translation, default = 46 */
|
||||
#define BT_8723D_2ANT_WIFI_RSSI_COEXSWITCH_THRES2 80 /* unit: % WiFi RSSI Threshold for 1-Ant TDMA/1-Ant PS-TDMA translation, default = 42 */
|
||||
#define BT_8723D_2ANT_BT_RSSI_COEXSWITCH_THRES2 80 /* unit: % BT RSSI Threshold for 1-Ant TDMA/1-Ant PS-TDMA translation, default = 46 */
|
||||
#define BT_8723D_2ANT_DEFAULT_ISOLATION 15 /* unit: dB */
|
||||
#define BT_8723D_2ANT_WIFI_MAX_TX_POWER 15 /* unit: dBm */
|
||||
#define BT_8723D_2ANT_BT_MAX_TX_POWER 3 /* unit: dBm */
|
||||
#define BT_8723D_2ANT_WIFI_SIR_THRES1 -15 /* unit: dB */
|
||||
#define BT_8723D_2ANT_WIFI_SIR_THRES2 -30 /* unit: dB */
|
||||
#define BT_8723D_2ANT_BT_SIR_THRES1 -15 /* unit: dB */
|
||||
#define BT_8723D_2ANT_BT_SIR_THRES2 -30 /* unit: dB */
|
||||
|
||||
|
||||
/* for Antenna detection */
|
||||
#define BT_8723D_2ANT_ANTDET_PSDTHRES_BACKGROUND 50
|
||||
#define BT_8723D_2ANT_ANTDET_PSDTHRES_2ANT_BADISOLATION 70
|
||||
#define BT_8723D_2ANT_ANTDET_PSDTHRES_2ANT_GOODISOLATION 52
|
||||
#define BT_8723D_2ANT_ANTDET_PSDTHRES_1ANT 40
|
||||
#define BT_8723D_2ANT_ANTDET_RETRY_INTERVAL 10 /* retry timer if ant det is fail, unit: second */
|
||||
#define BT_8723D_2ANT_ANTDET_SWEEPPOINT_DELAY 60000
|
||||
#define BT_8723D_2ANT_ANTDET_ENABLE 1
|
||||
#define BT_8723D_2ANT_ANTDET_BTTXTIME 100
|
||||
#define BT_8723D_2ANT_ANTDET_BTTXCHANNEL 39
|
||||
#define BT_8723D_2ANT_ANTDET_PSD_SWWEEPCOUNT 50
|
||||
|
||||
|
||||
#define BT_8723D_2ANT_LTECOEX_INDIRECTREG_ACCESS_TIMEOUT 30000
|
||||
|
||||
enum bt_8723d_2ant_signal_state {
|
||||
BT_8723D_2ANT_SIG_STA_SET_TO_LOW = 0x0,
|
||||
BT_8723D_2ANT_SIG_STA_SET_BY_HW = 0x0,
|
||||
BT_8723D_2ANT_SIG_STA_SET_TO_HIGH = 0x1,
|
||||
BT_8723D_2ANT_SIG_STA_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_2ant_path_ctrl_owner {
|
||||
BT_8723D_2ANT_PCO_BTSIDE = 0x0,
|
||||
BT_8723D_2ANT_PCO_WLSIDE = 0x1,
|
||||
BT_8723D_2ANT_PCO_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_2ant_gnt_ctrl_type {
|
||||
BT_8723D_2ANT_GNT_TYPE_CTRL_BY_PTA = 0x0,
|
||||
BT_8723D_2ANT_GNT_TYPE_CTRL_BY_SW = 0x1,
|
||||
BT_8723D_2ANT_GNT_TYPE_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_2ant_gnt_ctrl_block {
|
||||
BT_8723D_2ANT_GNT_BLOCK_RFC_BB = 0x0,
|
||||
BT_8723D_2ANT_GNT_BLOCK_RFC = 0x1,
|
||||
BT_8723D_2ANT_GNT_BLOCK_BB = 0x2,
|
||||
BT_8723D_2ANT_GNT_BLOCK_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_2ant_lte_coex_table_type {
|
||||
BT_8723D_2ANT_CTT_WL_VS_LTE = 0x0,
|
||||
BT_8723D_2ANT_CTT_BT_VS_LTE = 0x1,
|
||||
BT_8723D_2ANT_CTT_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_2ant_lte_break_table_type {
|
||||
BT_8723D_2ANT_LBTT_WL_BREAK_LTE = 0x0,
|
||||
BT_8723D_2ANT_LBTT_BT_BREAK_LTE = 0x1,
|
||||
BT_8723D_2ANT_LBTT_LTE_BREAK_WL = 0x2,
|
||||
BT_8723D_2ANT_LBTT_LTE_BREAK_BT = 0x3,
|
||||
BT_8723D_2ANT_LBTT_MAX
|
||||
};
|
||||
|
||||
enum bt_info_src_8723d_2ant {
|
||||
BT_INFO_SRC_8723D_2ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8723D_2ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8723D_2ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8723D_2ANT_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_2ant_bt_status {
|
||||
BT_8723D_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8723D_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8723D_2ANT_BT_STATUS_INQ_PAGE = 0x2,
|
||||
BT_8723D_2ANT_BT_STATUS_ACL_BUSY = 0x3,
|
||||
BT_8723D_2ANT_BT_STATUS_SCO_BUSY = 0x4,
|
||||
BT_8723D_2ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
|
||||
BT_8723D_2ANT_BT_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_2ant_coex_algo {
|
||||
BT_8723D_2ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8723D_2ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8723D_2ANT_COEX_ALGO_HID = 0x2,
|
||||
BT_8723D_2ANT_COEX_ALGO_A2DP = 0x3,
|
||||
BT_8723D_2ANT_COEX_ALGO_A2DP_PANHS = 0x4,
|
||||
BT_8723D_2ANT_COEX_ALGO_PANEDR = 0x5,
|
||||
BT_8723D_2ANT_COEX_ALGO_PANHS = 0x6,
|
||||
BT_8723D_2ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
|
||||
BT_8723D_2ANT_COEX_ALGO_PANEDR_HID = 0x8,
|
||||
BT_8723D_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
|
||||
BT_8723D_2ANT_COEX_ALGO_HID_A2DP = 0xa,
|
||||
BT_8723D_2ANT_COEX_ALGO_NOPROFILEBUSY = 0xb,
|
||||
BT_8723D_2ANT_COEX_ALGO_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_2ant_phase {
|
||||
BT_8723D_2ANT_PHASE_COEX_INIT = 0x0,
|
||||
BT_8723D_2ANT_PHASE_WLANONLY_INIT = 0x1,
|
||||
BT_8723D_2ANT_PHASE_WLAN_OFF = 0x2,
|
||||
BT_8723D_2ANT_PHASE_2G_RUNTIME = 0x3,
|
||||
BT_8723D_2ANT_PHASE_5G_RUNTIME = 0x4,
|
||||
BT_8723D_2ANT_PHASE_BTMPMODE = 0x5,
|
||||
BT_8723D_2ANT_PHASE_ANTENNA_DET = 0x6,
|
||||
BT_8723D_2ANT_PHASE_COEX_POWERON = 0x7,
|
||||
BT_8723D_2ANT_PHASE_MAX
|
||||
};
|
||||
|
||||
enum bt_8723d_2ant_Scoreboard {
|
||||
BT_8723D_2ANT_SCOREBOARD_ACTIVE = BIT(0),
|
||||
BT_8723D_2ANT_SCOREBOARD_ONOFF = BIT(1),
|
||||
BT_8723D_2ANT_SCOREBOARD_SCAN = BIT(2),
|
||||
BT_8723D_2ANT_SCOREBOARD_UNDERTEST = BIT(3),
|
||||
BT_8723D_2ANT_SCOREBOARD_WLBUSY = BIT(6)
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct coex_dm_8723d_2ant {
|
||||
/* fw mechanism */
|
||||
u8 pre_bt_dec_pwr_lvl;
|
||||
u8 cur_bt_dec_pwr_lvl;
|
||||
u8 pre_fw_dac_swing_lvl;
|
||||
u8 cur_fw_dac_swing_lvl;
|
||||
boolean cur_ignore_wlan_act;
|
||||
boolean pre_ignore_wlan_act;
|
||||
u8 pre_ps_tdma;
|
||||
u8 cur_ps_tdma;
|
||||
u8 ps_tdma_para[5];
|
||||
u8 ps_tdma_du_adj_type;
|
||||
boolean reset_tdma_adjust;
|
||||
boolean pre_ps_tdma_on;
|
||||
boolean cur_ps_tdma_on;
|
||||
boolean pre_bt_auto_report;
|
||||
boolean cur_bt_auto_report;
|
||||
|
||||
/* sw mechanism */
|
||||
boolean pre_rf_rx_lpf_shrink;
|
||||
boolean cur_rf_rx_lpf_shrink;
|
||||
u32 bt_rf_0x1e_backup;
|
||||
boolean pre_low_penalty_ra;
|
||||
boolean cur_low_penalty_ra;
|
||||
boolean pre_dac_swing_on;
|
||||
u32 pre_dac_swing_lvl;
|
||||
boolean cur_dac_swing_on;
|
||||
u32 cur_dac_swing_lvl;
|
||||
boolean pre_adc_back_off;
|
||||
boolean cur_adc_back_off;
|
||||
boolean pre_agc_table_en;
|
||||
boolean cur_agc_table_en;
|
||||
u32 pre_val0x6c0;
|
||||
u32 cur_val0x6c0;
|
||||
u32 pre_val0x6c4;
|
||||
u32 cur_val0x6c4;
|
||||
u32 pre_val0x6c8;
|
||||
u32 cur_val0x6c8;
|
||||
u8 pre_val0x6cc;
|
||||
u8 cur_val0x6cc;
|
||||
boolean limited_dig;
|
||||
|
||||
/* algorithm related */
|
||||
u8 pre_algorithm;
|
||||
u8 cur_algorithm;
|
||||
u8 bt_status;
|
||||
u8 wifi_chnl_info[3];
|
||||
|
||||
boolean need_recover0x948;
|
||||
u32 backup0x948;
|
||||
|
||||
u8 pre_lps;
|
||||
u8 cur_lps;
|
||||
u8 pre_rpwm;
|
||||
u8 cur_rpwm;
|
||||
|
||||
boolean is_switch_to_1dot5_ant;
|
||||
u8 switch_thres_offset;
|
||||
u32 arp_cnt;
|
||||
|
||||
u8 pre_ant_pos_type;
|
||||
u8 cur_ant_pos_type;
|
||||
};
|
||||
|
||||
struct coex_sta_8723d_2ant {
|
||||
boolean bt_disabled;
|
||||
boolean bt_link_exist;
|
||||
boolean sco_exist;
|
||||
boolean a2dp_exist;
|
||||
boolean hid_exist;
|
||||
boolean pan_exist;
|
||||
|
||||
boolean under_lps;
|
||||
boolean under_ips;
|
||||
u32 high_priority_tx;
|
||||
u32 high_priority_rx;
|
||||
u32 low_priority_tx;
|
||||
u32 low_priority_rx;
|
||||
boolean is_hiPri_rx_overhead;
|
||||
u8 bt_rssi;
|
||||
boolean bt_tx_rx_mask;
|
||||
u8 pre_bt_rssi_state;
|
||||
u8 pre_wifi_rssi_state[4];
|
||||
u8 bt_info_c2h[BT_INFO_SRC_8723D_2ANT_MAX][10];
|
||||
u32 bt_info_c2h_cnt[BT_INFO_SRC_8723D_2ANT_MAX];
|
||||
boolean bt_whck_test;
|
||||
boolean c2h_bt_inquiry_page;
|
||||
boolean c2h_bt_remote_name_req;
|
||||
u8 bt_retry_cnt;
|
||||
u8 bt_info_ext;
|
||||
u8 bt_info_ext2;
|
||||
u32 pop_event_cnt;
|
||||
u8 scan_ap_num;
|
||||
|
||||
u32 crc_ok_cck;
|
||||
u32 crc_ok_11g;
|
||||
u32 crc_ok_11n;
|
||||
u32 crc_ok_11n_vht;
|
||||
|
||||
u32 crc_err_cck;
|
||||
u32 crc_err_11g;
|
||||
u32 crc_err_11n;
|
||||
u32 crc_err_11n_vht;
|
||||
|
||||
boolean cck_lock;
|
||||
boolean pre_ccklock;
|
||||
boolean cck_ever_lock;
|
||||
u8 coex_table_type;
|
||||
boolean force_lps_on;
|
||||
|
||||
u8 dis_ver_info_cnt;
|
||||
|
||||
u8 a2dp_bit_pool;
|
||||
u8 cut_version;
|
||||
|
||||
boolean concurrent_rx_mode_on;
|
||||
|
||||
u16 score_board;
|
||||
u8 isolation_btween_wb; /* 0~ 50 */
|
||||
u8 wifi_coex_thres;
|
||||
u8 bt_coex_thres;
|
||||
u8 wifi_coex_thres2;
|
||||
u8 bt_coex_thres2;
|
||||
|
||||
u8 num_of_profile;
|
||||
boolean acl_busy;
|
||||
boolean bt_create_connection;
|
||||
boolean wifi_is_high_pri_task;
|
||||
u32 specific_pkt_period_cnt;
|
||||
u32 bt_coex_supported_feature;
|
||||
u32 bt_coex_supported_version;
|
||||
|
||||
u8 bt_ble_scan_type;
|
||||
u32 bt_ble_scan_para[3];
|
||||
|
||||
boolean run_time_state;
|
||||
boolean freeze_coexrun_by_btinfo;
|
||||
|
||||
boolean is_A2DP_3M;
|
||||
boolean voice_over_HOGP;
|
||||
u8 bt_info;
|
||||
boolean is_autoslot;
|
||||
u8 forbidden_slot;
|
||||
u8 hid_busy_num;
|
||||
u8 hid_pair_cnt;
|
||||
|
||||
u32 cnt_RemoteNameReq;
|
||||
u32 cnt_setupLink;
|
||||
u32 cnt_ReInit;
|
||||
u32 cnt_IgnWlanAct;
|
||||
u32 cnt_Page;
|
||||
u32 cnt_RoleSwitch;
|
||||
|
||||
u16 bt_reg_vendor_ac;
|
||||
u16 bt_reg_vendor_ae;
|
||||
|
||||
boolean is_setupLink;
|
||||
boolean wl_noisy_level;
|
||||
u32 gnt_error_cnt;
|
||||
|
||||
u8 bt_afh_map[10];
|
||||
u8 bt_relink_downcount;
|
||||
boolean is_tdma_btautoslot;
|
||||
boolean is_tdma_btautoslot_hang;
|
||||
};
|
||||
|
||||
#define BT_8723D_2ANT_ANTDET_PSD_POINTS 256 /* MAX:1024 */
|
||||
#define BT_8723D_2ANT_ANTDET_PSD_AVGNUM 1 /* MAX:3 */
|
||||
#define BT_8723D_2ANT_ANTDET_BUF_LEN 16
|
||||
|
||||
struct psdscan_sta_8723d_2ant {
|
||||
|
||||
u32 ant_det_bt_le_channel; /* BT LE Channel ex:2412 */
|
||||
u32 ant_det_bt_tx_time;
|
||||
u32 ant_det_pre_psdscan_peak_val;
|
||||
boolean ant_det_is_ant_det_available;
|
||||
u32 ant_det_psd_scan_peak_val;
|
||||
boolean ant_det_is_btreply_available;
|
||||
u32 ant_det_psd_scan_peak_freq;
|
||||
|
||||
u8 ant_det_result;
|
||||
u8 ant_det_peak_val[BT_8723D_2ANT_ANTDET_BUF_LEN];
|
||||
u8 ant_det_peak_freq[BT_8723D_2ANT_ANTDET_BUF_LEN];
|
||||
u32 ant_det_try_count;
|
||||
u32 ant_det_fail_count;
|
||||
u32 ant_det_inteval_count;
|
||||
u32 ant_det_thres_offset;
|
||||
|
||||
u32 real_cent_freq;
|
||||
s32 real_offset;
|
||||
u32 real_span;
|
||||
|
||||
u32 psd_band_width; /* unit: Hz */
|
||||
u32 psd_point; /* 128/256/512/1024 */
|
||||
u32 psd_report[1024]; /* unit:dB (20logx), 0~255 */
|
||||
u32 psd_report_max_hold[1024]; /* unit:dB (20logx), 0~255 */
|
||||
u32 psd_start_point;
|
||||
u32 psd_stop_point;
|
||||
u32 psd_max_value_point;
|
||||
u32 psd_max_value;
|
||||
u32 psd_max_value2;
|
||||
u32 psd_avg_value; /* filter loop_max_value that below BT_8723D_1ANT_ANTDET_PSDTHRES_1ANT, and average the rest*/
|
||||
u32 psd_loop_max_value[BT_8723D_2ANT_ANTDET_PSD_SWWEEPCOUNT]; /*max value in each loop */
|
||||
u32 psd_start_base;
|
||||
u32 psd_avg_num; /* 1/8/16/32 */
|
||||
u32 psd_gen_count;
|
||||
boolean is_AntDet_running;
|
||||
boolean is_psd_show_max_only;
|
||||
};
|
||||
|
||||
|
||||
/* *******************************************
|
||||
* The following is interface which will notify coex module.
|
||||
* ******************************************* */
|
||||
void ex_halbtc8723d2ant_power_on_setting(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723d2ant_pre_load_firmware(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723d2ant_init_hw_config(IN struct btc_coexist *btcoexist,
|
||||
IN boolean wifi_only);
|
||||
void ex_halbtc8723d2ant_init_coex_dm(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723d2ant_ips_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723d2ant_lps_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723d2ant_scan_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723d2ant_connect_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723d2ant_media_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723d2ant_specific_packet_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723d2ant_bt_info_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 *tmp_buf, IN u8 length);
|
||||
void ex_halbtc8723d2ant_rf_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723d2ant_halt_notify(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723d2ant_pnp_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 pnp_state);
|
||||
void ex_halbtc8723d2ant_set_antenna_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8723d2ant_periodical(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723d2ant_display_coex_info(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8723d2ant_antenna_detection(IN struct btc_coexist *btcoexist,
|
||||
IN u32 cent_freq, IN u32 offset, IN u32 span, IN u32 seconds);
|
||||
void ex_halbtc8723d2ant_display_ant_detection(IN struct btc_coexist *btcoexist);
|
||||
|
||||
|
||||
#else
|
||||
#define ex_halbtc8723d2ant_power_on_setting(btcoexist)
|
||||
#define ex_halbtc8723d2ant_pre_load_firmware(btcoexist)
|
||||
#define ex_halbtc8723d2ant_init_hw_config(btcoexist, wifi_only)
|
||||
#define ex_halbtc8723d2ant_init_coex_dm(btcoexist)
|
||||
#define ex_halbtc8723d2ant_ips_notify(btcoexist, type)
|
||||
#define ex_halbtc8723d2ant_lps_notify(btcoexist, type)
|
||||
#define ex_halbtc8723d2ant_scan_notify(btcoexist, type)
|
||||
#define ex_halbtc8723d2ant_connect_notify(btcoexist, type)
|
||||
#define ex_halbtc8723d2ant_media_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8723d2ant_specific_packet_notify(btcoexist, type)
|
||||
#define ex_halbtc8723d2ant_bt_info_notify(btcoexist, tmp_buf, length)
|
||||
#define ex_halbtc8723d2ant_rf_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8723d2ant_halt_notify(btcoexist)
|
||||
#define ex_halbtc8723d2ant_pnp_notify(btcoexist, pnp_state)
|
||||
#define ex_halbtc8723d2ant_periodical(btcoexist)
|
||||
#define ex_halbtc8723d2ant_display_coex_info(btcoexist)
|
||||
#define ex_halbtc8723d2ant_set_antenna_notify(btcoexist, type)
|
||||
#define ex_halbtc8723d2ant_display_ant_detection(btcoexist)
|
||||
#define ex_halbtc8723d2ant_antenna_detection(btcoexist, cent_freq, offset, span, seconds)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
3461
hal/btc/halbtc8812a1ant.c
Normal file
3461
hal/btc/halbtc8812a1ant.c
Normal file
File diff suppressed because it is too large
Load diff
230
hal/btc/halbtc8812a1ant.h
Normal file
230
hal/btc/halbtc8812a1ant.h
Normal file
|
@ -0,0 +1,230 @@
|
|||
|
||||
#if (BT_SUPPORT == 1 && COEX_SUPPORT == 1)
|
||||
|
||||
#if (RTL8812A_SUPPORT == 1)
|
||||
|
||||
/* *******************************************
|
||||
* The following is for 8812A 1ANT BT Co-exist definition
|
||||
* ******************************************* */
|
||||
#define BT_AUTO_REPORT_ONLY_8812A_1ANT 1
|
||||
|
||||
#define BT_INFO_8812A_1ANT_B_FTP BIT(7)
|
||||
#define BT_INFO_8812A_1ANT_B_A2DP BIT(6)
|
||||
#define BT_INFO_8812A_1ANT_B_HID BIT(5)
|
||||
#define BT_INFO_8812A_1ANT_B_SCO_BUSY BIT(4)
|
||||
#define BT_INFO_8812A_1ANT_B_ACL_BUSY BIT(3)
|
||||
#define BT_INFO_8812A_1ANT_B_INQ_PAGE BIT(2)
|
||||
#define BT_INFO_8812A_1ANT_B_SCO_ESCO BIT(1)
|
||||
#define BT_INFO_8812A_1ANT_B_CONNECTION BIT(0)
|
||||
|
||||
#define BT_INFO_8812A_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_) \
|
||||
(((_BT_INFO_EXT_&BIT(0))) ? true : false)
|
||||
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8812A_1ANT 2
|
||||
|
||||
#define BT_8812A_1ANT_WIFI_NOISY_THRESH 30 /* max: 255 */
|
||||
|
||||
enum bt_info_src_8812a_1ant {
|
||||
BT_INFO_SRC_8812A_1ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8812A_1ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8812A_1ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8812A_1ANT_MAX
|
||||
};
|
||||
|
||||
enum bt_8812a_1ant_bt_status {
|
||||
BT_8812A_1ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8812A_1ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8812A_1ANT_BT_STATUS_INQ_PAGE = 0x2,
|
||||
BT_8812A_1ANT_BT_STATUS_ACL_BUSY = 0x3,
|
||||
BT_8812A_1ANT_BT_STATUS_SCO_BUSY = 0x4,
|
||||
BT_8812A_1ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
|
||||
BT_8812A_1ANT_BT_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8812a_1ant_wifi_status {
|
||||
BT_8812A_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8812A_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN = 0x1,
|
||||
BT_8812A_1ANT_WIFI_STATUS_CONNECTED_SCAN = 0x2,
|
||||
BT_8812A_1ANT_WIFI_STATUS_CONNECTED_SPECIFIC_PKT = 0x3,
|
||||
BT_8812A_1ANT_WIFI_STATUS_CONNECTED_IDLE = 0x4,
|
||||
BT_8812A_1ANT_WIFI_STATUS_CONNECTED_BUSY = 0x5,
|
||||
BT_8812A_1ANT_WIFI_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8812a_1ant_coex_algo {
|
||||
BT_8812A_1ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8812A_1ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8812A_1ANT_COEX_ALGO_HID = 0x2,
|
||||
BT_8812A_1ANT_COEX_ALGO_A2DP = 0x3,
|
||||
BT_8812A_1ANT_COEX_ALGO_A2DP_PANHS = 0x4,
|
||||
BT_8812A_1ANT_COEX_ALGO_PANEDR = 0x5,
|
||||
BT_8812A_1ANT_COEX_ALGO_PANHS = 0x6,
|
||||
BT_8812A_1ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
|
||||
BT_8812A_1ANT_COEX_ALGO_PANEDR_HID = 0x8,
|
||||
BT_8812A_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
|
||||
BT_8812A_1ANT_COEX_ALGO_HID_A2DP = 0xa,
|
||||
BT_8812A_1ANT_COEX_ALGO_MAX = 0xb,
|
||||
};
|
||||
|
||||
struct coex_dm_8812a_1ant {
|
||||
/* hw setting */
|
||||
u8 pre_ant_pos_type;
|
||||
u8 cur_ant_pos_type;
|
||||
/* fw mechanism */
|
||||
boolean cur_ignore_wlan_act;
|
||||
boolean pre_ignore_wlan_act;
|
||||
u8 pre_ps_tdma;
|
||||
u8 cur_ps_tdma;
|
||||
u8 ps_tdma_para[5];
|
||||
u8 ps_tdma_du_adj_type;
|
||||
boolean auto_tdma_adjust;
|
||||
boolean pre_ps_tdma_on;
|
||||
boolean cur_ps_tdma_on;
|
||||
boolean pre_bt_auto_report;
|
||||
boolean cur_bt_auto_report;
|
||||
u8 pre_lps;
|
||||
u8 cur_lps;
|
||||
u8 pre_rpwm;
|
||||
u8 cur_rpwm;
|
||||
|
||||
/* sw mechanism */
|
||||
boolean pre_low_penalty_ra;
|
||||
boolean cur_low_penalty_ra;
|
||||
u32 pre_val0x6c0;
|
||||
u32 cur_val0x6c0;
|
||||
u32 pre_val0x6c4;
|
||||
u32 cur_val0x6c4;
|
||||
u32 pre_val0x6c8;
|
||||
u32 cur_val0x6c8;
|
||||
u8 pre_val0x6cc;
|
||||
u8 cur_val0x6cc;
|
||||
boolean limited_dig;
|
||||
|
||||
u32 backup_arfr_cnt1; /* Auto Rate Fallback Retry cnt */
|
||||
u32 backup_arfr_cnt2; /* Auto Rate Fallback Retry cnt */
|
||||
u16 backup_retry_limit;
|
||||
u8 backup_ampdu_max_time;
|
||||
|
||||
/* algorithm related */
|
||||
u8 pre_algorithm;
|
||||
u8 cur_algorithm;
|
||||
u8 bt_status;
|
||||
u8 wifi_chnl_info[3];
|
||||
|
||||
u32 pre_ra_mask;
|
||||
u32 cur_ra_mask;
|
||||
u8 pre_arfr_type;
|
||||
u8 cur_arfr_type;
|
||||
u8 pre_retry_limit_type;
|
||||
u8 cur_retry_limit_type;
|
||||
u8 pre_ampdu_time_type;
|
||||
u8 cur_ampdu_time_type;
|
||||
u32 arp_cnt;
|
||||
|
||||
u8 error_condition;
|
||||
};
|
||||
|
||||
struct coex_sta_8812a_1ant {
|
||||
boolean bt_disabled;
|
||||
boolean bt_link_exist;
|
||||
boolean sco_exist;
|
||||
boolean a2dp_exist;
|
||||
boolean hid_exist;
|
||||
boolean pan_exist;
|
||||
|
||||
boolean under_lps;
|
||||
boolean under_ips;
|
||||
u32 specific_pkt_period_cnt;
|
||||
u32 high_priority_tx;
|
||||
u32 high_priority_rx;
|
||||
u32 low_priority_tx;
|
||||
u32 low_priority_rx;
|
||||
s8 bt_rssi;
|
||||
boolean bt_tx_rx_mask;
|
||||
u8 pre_bt_rssi_state;
|
||||
u8 pre_wifi_rssi_state[4];
|
||||
boolean c2h_bt_info_req_sent;
|
||||
u8 bt_info_c2h[BT_INFO_SRC_8812A_1ANT_MAX][10];
|
||||
u32 bt_info_c2h_cnt[BT_INFO_SRC_8812A_1ANT_MAX];
|
||||
u32 bt_info_query_cnt;
|
||||
boolean c2h_bt_inquiry_page;
|
||||
boolean c2h_bt_page; /* Add for win8.1 page out issue */
|
||||
boolean wifi_is_high_pri_task; /* Add for win8.1 page out issue */
|
||||
u8 bt_retry_cnt;
|
||||
u8 bt_info_ext;
|
||||
u32 pop_event_cnt;
|
||||
u8 scan_ap_num;
|
||||
|
||||
u32 crc_ok_cck;
|
||||
u32 crc_ok_11g;
|
||||
u32 crc_ok_11n;
|
||||
u32 crc_ok_11n_agg;
|
||||
|
||||
u32 crc_err_cck;
|
||||
u32 crc_err_11g;
|
||||
u32 crc_err_11n;
|
||||
u32 crc_err_11n_agg;
|
||||
|
||||
boolean cck_lock;
|
||||
boolean pre_ccklock;
|
||||
u8 coex_table_type;
|
||||
|
||||
boolean force_lps_on;
|
||||
};
|
||||
|
||||
/* *******************************************
|
||||
* The following is interface which will notify coex module.
|
||||
* ******************************************* */
|
||||
void ex_halbtc8812a1ant_power_on_setting(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8812a1ant_pre_load_firmware(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8812a1ant_init_hw_config(IN struct btc_coexist *btcoexist,
|
||||
IN boolean wifi_only);
|
||||
void ex_halbtc8812a1ant_init_coex_dm(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8812a1ant_ips_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8812a1ant_lps_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8812a1ant_scan_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8812a1ant_connect_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8812a1ant_media_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8812a1ant_specific_packet_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8812a1ant_bt_info_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 *tmp_buf, IN u8 length);
|
||||
void ex_halbtc8812a1ant_rf_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8812a1ant_halt_notify(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8812a1ant_pnp_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 pnp_state);
|
||||
void ex_halbtc8812a1ant_coex_dm_reset(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8812a1ant_periodical(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8812a1ant_dbg_control(IN struct btc_coexist *btcoexist,
|
||||
IN u8 op_code, IN u8 op_len, IN u8 *pdata);
|
||||
void ex_halbtc8812a1ant_display_coex_info(IN struct btc_coexist *btcoexist);
|
||||
|
||||
#else
|
||||
#define ex_halbtc8812a1ant_power_on_setting(btcoexist)
|
||||
#define ex_halbtc8812a1ant_pre_load_firmware(btcoexist)
|
||||
#define ex_halbtc8812a1ant_init_hw_config(btcoexist, wifi_only)
|
||||
#define ex_halbtc8812a1ant_init_coex_dm(btcoexist)
|
||||
#define ex_halbtc8812a1ant_ips_notify(btcoexist, type)
|
||||
#define ex_halbtc8812a1ant_lps_notify(btcoexist, type)
|
||||
#define ex_halbtc8812a1ant_scan_notify(btcoexist, type)
|
||||
#define ex_halbtc8812a1ant_connect_notify(btcoexist, type)
|
||||
#define ex_halbtc8812a1ant_media_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8812a1ant_specific_packet_notify(btcoexist, type)
|
||||
#define ex_halbtc8812a1ant_bt_info_notify(btcoexist, tmp_buf, length)
|
||||
#define ex_halbtc8812a1ant_rf_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8812a1ant_halt_notify(btcoexist)
|
||||
#define ex_halbtc8812a1ant_pnp_notify(btcoexist, pnp_state)
|
||||
#define ex_halbtc8812a1ant_coex_dm_reset(btcoexist)
|
||||
#define ex_halbtc8812a1ant_periodical(btcoexist)
|
||||
#define ex_halbtc8812a1ant_dbg_control(btcoexist, op_code, op_len, pdata)
|
||||
#define ex_halbtc8812a1ant_display_coex_info(btcoexist)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
5624
hal/btc/halbtc8812a2ant.c
Normal file
5624
hal/btc/halbtc8812a2ant.c
Normal file
File diff suppressed because it is too large
Load diff
227
hal/btc/halbtc8812a2ant.h
Normal file
227
hal/btc/halbtc8812a2ant.h
Normal file
|
@ -0,0 +1,227 @@
|
|||
|
||||
#if (BT_SUPPORT == 1 && COEX_SUPPORT == 1)
|
||||
|
||||
#if (RTL8812A_SUPPORT == 1)
|
||||
|
||||
/* *******************************************
|
||||
* The following is for 8812A 2Ant BT Co-exist definition
|
||||
* ******************************************* */
|
||||
#define BT_AUTO_REPORT_ONLY_8812A_2ANT 0
|
||||
|
||||
#define BT_INFO_8812A_2ANT_B_FTP BIT(7)
|
||||
#define BT_INFO_8812A_2ANT_B_A2DP BIT(6)
|
||||
#define BT_INFO_8812A_2ANT_B_HID BIT(5)
|
||||
#define BT_INFO_8812A_2ANT_B_SCO_BUSY BIT(4)
|
||||
#define BT_INFO_8812A_2ANT_B_ACL_BUSY BIT(3)
|
||||
#define BT_INFO_8812A_2ANT_B_INQ_PAGE BIT(2)
|
||||
#define BT_INFO_8812A_2ANT_B_SCO_ESCO BIT(1)
|
||||
#define BT_INFO_8812A_2ANT_B_CONNECTION BIT(0)
|
||||
|
||||
#define BT_INFO_8812A_2ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_) \
|
||||
(((_BT_INFO_EXT_&BIT(0))) ? true : false)
|
||||
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8812A_2ANT 2
|
||||
#define NOISY_AP_NUM_THRESH_8812A 50
|
||||
|
||||
enum bt_info_src_8812a_2ant {
|
||||
BT_INFO_SRC_8812A_2ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8812A_2ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8812A_2ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8812A_2ANT_MAX
|
||||
};
|
||||
|
||||
enum bt_8812a_2ant_bt_status {
|
||||
BT_8812A_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8812A_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8812A_2ANT_BT_STATUS_INQ_PAGE = 0x2,
|
||||
BT_8812A_2ANT_BT_STATUS_ACL_BUSY = 0x3,
|
||||
BT_8812A_2ANT_BT_STATUS_SCO_BUSY = 0x4,
|
||||
BT_8812A_2ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
|
||||
BT_8812A_2ANT_BT_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8812a_2ant_coex_algo {
|
||||
BT_8812A_2ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8812A_2ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8812A_2ANT_COEX_ALGO_SCO_HID = 0x2,
|
||||
BT_8812A_2ANT_COEX_ALGO_HID = 0x3,
|
||||
BT_8812A_2ANT_COEX_ALGO_A2DP = 0x4,
|
||||
BT_8812A_2ANT_COEX_ALGO_A2DP_PANHS = 0x5,
|
||||
BT_8812A_2ANT_COEX_ALGO_PANEDR = 0x6,
|
||||
BT_8812A_2ANT_COEX_ALGO_PANHS = 0x7,
|
||||
BT_8812A_2ANT_COEX_ALGO_PANEDR_A2DP = 0x8,
|
||||
BT_8812A_2ANT_COEX_ALGO_PANEDR_HID = 0x9,
|
||||
BT_8812A_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0xa,
|
||||
BT_8812A_2ANT_COEX_ALGO_HID_A2DP_PANHS = 0xb,
|
||||
BT_8812A_2ANT_COEX_ALGO_HID_A2DP = 0xc,
|
||||
BT_8812A_2ANT_COEX_ALGO_MAX = 0xd
|
||||
};
|
||||
|
||||
struct coex_dm_8812a_2ant {
|
||||
/* fw mechanism */
|
||||
u8 pre_bt_dec_pwr_lvl;
|
||||
u8 cur_bt_dec_pwr_lvl;
|
||||
u8 pre_fw_dac_swing_lvl;
|
||||
u8 cur_fw_dac_swing_lvl;
|
||||
boolean cur_ignore_wlan_act;
|
||||
boolean pre_ignore_wlan_act;
|
||||
u8 pre_ps_tdma;
|
||||
u8 cur_ps_tdma;
|
||||
u8 ps_tdma_para[5];
|
||||
u8 ps_tdma_du_adj_type;
|
||||
boolean auto_tdma_adjust;
|
||||
boolean auto_tdma_adjust_low_rssi;
|
||||
boolean pre_ps_tdma_on;
|
||||
boolean cur_ps_tdma_on;
|
||||
boolean pre_bt_auto_report;
|
||||
boolean cur_bt_auto_report;
|
||||
u8 pre_lps;
|
||||
u8 cur_lps;
|
||||
u8 pre_rpwm;
|
||||
u8 cur_rpwm;
|
||||
|
||||
/* sw mechanism */
|
||||
boolean pre_rf_rx_lpf_shrink;
|
||||
boolean cur_rf_rx_lpf_shrink;
|
||||
u32 bt_rf_0x1e_backup;
|
||||
boolean pre_low_penalty_ra;
|
||||
boolean cur_low_penalty_ra;
|
||||
boolean pre_dac_swing_on;
|
||||
u32 pre_dac_swing_lvl;
|
||||
boolean cur_dac_swing_on;
|
||||
u32 cur_dac_swing_lvl;
|
||||
boolean pre_adc_back_off;
|
||||
boolean cur_adc_back_off;
|
||||
boolean pre_agc_table_en;
|
||||
boolean cur_agc_table_en;
|
||||
u32 pre_val0x6c0;
|
||||
u32 cur_val0x6c0;
|
||||
u32 pre_val0x6c4;
|
||||
u32 cur_val0x6c4;
|
||||
u32 pre_val0x6c8;
|
||||
u32 cur_val0x6c8;
|
||||
u8 pre_val0x6cc;
|
||||
u8 cur_val0x6cc;
|
||||
boolean limited_dig;
|
||||
u32 backup_arfr_cnt1; /* Auto Rate Fallback Retry cnt */
|
||||
u32 backup_arfr_cnt2; /* Auto Rate Fallback Retry cnt */
|
||||
u16 backup_retry_limit;
|
||||
u8 backup_ampdu_max_time;
|
||||
|
||||
/* algorithm related */
|
||||
u8 pre_algorithm;
|
||||
u8 cur_algorithm;
|
||||
u8 bt_status;
|
||||
u8 wifi_chnl_info[3];
|
||||
|
||||
u32 pre_ra_mask;
|
||||
u32 cur_ra_mask;
|
||||
u8 cur_ra_mask_type;
|
||||
u8 pre_arfr_type;
|
||||
u8 cur_arfr_type;
|
||||
u8 pre_retry_limit_type;
|
||||
u8 cur_retry_limit_type;
|
||||
u8 pre_ampdu_time_type;
|
||||
u8 cur_ampdu_time_type;
|
||||
|
||||
boolean cur_enable_pta;
|
||||
boolean pre_enable_pta;
|
||||
};
|
||||
|
||||
struct coex_sta_8812a_2ant {
|
||||
boolean bt_disabled;
|
||||
boolean bt_link_exist;
|
||||
boolean sco_exist;
|
||||
boolean a2dp_exist;
|
||||
boolean hid_exist;
|
||||
boolean pan_exist;
|
||||
boolean acl_busy;
|
||||
|
||||
boolean under_lps;
|
||||
boolean under_ips;
|
||||
u32 high_priority_tx;
|
||||
u32 high_priority_rx;
|
||||
u32 low_priority_tx;
|
||||
u32 low_priority_rx;
|
||||
u8 bt_rssi;
|
||||
u8 pre_bt_rssi_state;
|
||||
u8 pre_wifi_rssi_state[4];
|
||||
boolean c2h_bt_info_req_sent;
|
||||
u8 bt_info_c2h[BT_INFO_SRC_8812A_2ANT_MAX][10];
|
||||
u32 bt_info_c2h_cnt[BT_INFO_SRC_8812A_2ANT_MAX];
|
||||
u32 bt_info_query_cnt;
|
||||
boolean c2h_bt_inquiry_page;
|
||||
u8 bt_retry_cnt;
|
||||
u8 bt_info_ext;
|
||||
u8 scan_ap_num;
|
||||
boolean pre_bt_disabled;
|
||||
u32 pre_bt_info_c2h_cnt_bt_rsp;
|
||||
u32 pre_bt_info_c2h_cnt_bt_send;
|
||||
boolean force_lps_on;
|
||||
u32 bt_coex_supported_version;
|
||||
|
||||
u32 crc_ok_cck;
|
||||
u32 crc_ok_11g;
|
||||
u32 crc_ok_11n;
|
||||
u32 crc_ok_11n_vht;
|
||||
|
||||
u32 crc_err_cck;
|
||||
u32 crc_err_11g;
|
||||
u32 crc_err_11n;
|
||||
u32 crc_err_11n_vht;
|
||||
};
|
||||
|
||||
/* *******************************************
|
||||
* The following is interface which will notify coex module.
|
||||
* ******************************************* */
|
||||
void ex_halbtc8812a2ant_power_on_setting(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8812a2ant_init_hw_config(IN struct btc_coexist *btcoexist,
|
||||
IN boolean wifi_only);
|
||||
void ex_halbtc8812a2ant_init_coex_dm(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8812a2ant_ips_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8812a2ant_lps_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8812a2ant_scan_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8812a2ant_connect_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8812a2ant_media_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8812a2ant_specific_packet_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8812a2ant_bt_info_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 *tmp_buf, IN u8 length);
|
||||
void ex_halbtc8812a2ant_rf_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
|
||||
void ex_halbtc8812a2ant_halt_notify(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8812a2ant_periodical(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8812a2ant_display_coex_info(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8812a2ant_dbg_control(IN struct btc_coexist *btcoexist,
|
||||
IN u8 op_code, IN u8 op_len, IN u8 *pdata);
|
||||
void ex_halbtc8812a2ant_pta_off_on_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 bt_status);
|
||||
|
||||
#else
|
||||
#define ex_halbtc8812a2ant_power_on_setting(btcoexist)
|
||||
#define ex_halbtc8812a2ant_init_hw_config(btcoexist, wifi_only)
|
||||
#define ex_halbtc8812a2ant_init_coex_dm(btcoexist)
|
||||
#define ex_halbtc8812a2ant_ips_notify(btcoexist, type)
|
||||
#define ex_halbtc8812a2ant_lps_notify(btcoexist, type)
|
||||
#define ex_halbtc8812a2ant_scan_notify(btcoexist, type)
|
||||
#define ex_halbtc8812a2ant_connect_notify(btcoexist, type)
|
||||
#define ex_halbtc8812a2ant_media_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8812a2ant_specific_packet_notify(btcoexist, type)
|
||||
#define ex_halbtc8812a2ant_bt_info_notify(btcoexist, tmp_buf, length)
|
||||
#define ex_halbtc8812a2ant_rf_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8812a2ant_halt_notify(btcoexist)
|
||||
#define ex_halbtc8812a2ant_periodical(btcoexist)
|
||||
#define ex_halbtc8812a2ant_display_coex_info(btcoexist)
|
||||
#define ex_halbtc8812a2ant_dbg_control(btcoexist, op_code, op_len, pdata)
|
||||
#define ex_halbtc8812a2ant_pta_off_on_notify(btcoexist, bt_status)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
3289
hal/btc/halbtc8821a1ant.c
Normal file
3289
hal/btc/halbtc8821a1ant.c
Normal file
File diff suppressed because it is too large
Load diff
214
hal/btc/halbtc8821a1ant.h
Normal file
214
hal/btc/halbtc8821a1ant.h
Normal file
|
@ -0,0 +1,214 @@
|
|||
|
||||
#if (BT_SUPPORT == 1 && COEX_SUPPORT == 1)
|
||||
|
||||
#if (RTL8821A_SUPPORT == 1)
|
||||
|
||||
/* *******************************************
|
||||
* The following is for 8821A 1ANT BT Co-exist definition
|
||||
* ******************************************* */
|
||||
#define BT_AUTO_REPORT_ONLY_8821A_1ANT 1
|
||||
|
||||
#define BT_INFO_8821A_1ANT_B_FTP BIT(7)
|
||||
#define BT_INFO_8821A_1ANT_B_A2DP BIT(6)
|
||||
#define BT_INFO_8821A_1ANT_B_HID BIT(5)
|
||||
#define BT_INFO_8821A_1ANT_B_SCO_BUSY BIT(4)
|
||||
#define BT_INFO_8821A_1ANT_B_ACL_BUSY BIT(3)
|
||||
#define BT_INFO_8821A_1ANT_B_INQ_PAGE BIT(2)
|
||||
#define BT_INFO_8821A_1ANT_B_SCO_ESCO BIT(1)
|
||||
#define BT_INFO_8821A_1ANT_B_CONNECTION BIT(0)
|
||||
|
||||
#define BT_INFO_8821A_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_) \
|
||||
(((_BT_INFO_EXT_&BIT(0))) ? true : false)
|
||||
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8821A_1ANT 2
|
||||
|
||||
enum bt_info_src_8821a_1ant {
|
||||
BT_INFO_SRC_8821A_1ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8821A_1ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8821A_1ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8821A_1ANT_MAX
|
||||
};
|
||||
|
||||
enum bt_8821a_1ant_bt_status {
|
||||
BT_8821A_1ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8821A_1ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8821A_1ANT_BT_STATUS_INQ_PAGE = 0x2,
|
||||
BT_8821A_1ANT_BT_STATUS_ACL_BUSY = 0x3,
|
||||
BT_8821A_1ANT_BT_STATUS_SCO_BUSY = 0x4,
|
||||
BT_8821A_1ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
|
||||
BT_8821A_1ANT_BT_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8821a_1ant_wifi_status {
|
||||
BT_8821A_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8821A_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN = 0x1,
|
||||
BT_8821A_1ANT_WIFI_STATUS_CONNECTED_SCAN = 0x2,
|
||||
BT_8821A_1ANT_WIFI_STATUS_CONNECTED_SPECIFIC_PKT = 0x3,
|
||||
BT_8821A_1ANT_WIFI_STATUS_CONNECTED_IDLE = 0x4,
|
||||
BT_8821A_1ANT_WIFI_STATUS_CONNECTED_BUSY = 0x5,
|
||||
BT_8821A_1ANT_WIFI_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8821a_1ant_coex_algo {
|
||||
BT_8821A_1ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8821A_1ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8821A_1ANT_COEX_ALGO_HID = 0x2,
|
||||
BT_8821A_1ANT_COEX_ALGO_A2DP = 0x3,
|
||||
BT_8821A_1ANT_COEX_ALGO_A2DP_PANHS = 0x4,
|
||||
BT_8821A_1ANT_COEX_ALGO_PANEDR = 0x5,
|
||||
BT_8821A_1ANT_COEX_ALGO_PANHS = 0x6,
|
||||
BT_8821A_1ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
|
||||
BT_8821A_1ANT_COEX_ALGO_PANEDR_HID = 0x8,
|
||||
BT_8821A_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
|
||||
BT_8821A_1ANT_COEX_ALGO_HID_A2DP = 0xa,
|
||||
BT_8821A_1ANT_COEX_ALGO_MAX = 0xb,
|
||||
};
|
||||
|
||||
struct coex_dm_8821a_1ant {
|
||||
/* fw mechanism */
|
||||
boolean cur_ignore_wlan_act;
|
||||
boolean pre_ignore_wlan_act;
|
||||
u8 pre_ps_tdma;
|
||||
u8 cur_ps_tdma;
|
||||
u8 ps_tdma_para[5];
|
||||
u8 ps_tdma_du_adj_type;
|
||||
boolean auto_tdma_adjust;
|
||||
boolean pre_ps_tdma_on;
|
||||
boolean cur_ps_tdma_on;
|
||||
boolean pre_bt_auto_report;
|
||||
boolean cur_bt_auto_report;
|
||||
u8 pre_lps;
|
||||
u8 cur_lps;
|
||||
u8 pre_rpwm;
|
||||
u8 cur_rpwm;
|
||||
|
||||
/* sw mechanism */
|
||||
boolean pre_low_penalty_ra;
|
||||
boolean cur_low_penalty_ra;
|
||||
u32 pre_val0x6c0;
|
||||
u32 cur_val0x6c0;
|
||||
u32 pre_val0x6c4;
|
||||
u32 cur_val0x6c4;
|
||||
u32 pre_val0x6c8;
|
||||
u32 cur_val0x6c8;
|
||||
u8 pre_val0x6cc;
|
||||
u8 cur_val0x6cc;
|
||||
|
||||
u32 backup_arfr_cnt1; /* Auto Rate Fallback Retry cnt */
|
||||
u32 backup_arfr_cnt2; /* Auto Rate Fallback Retry cnt */
|
||||
u16 backup_retry_limit;
|
||||
u8 backup_ampdu_max_time;
|
||||
|
||||
/* algorithm related */
|
||||
u8 pre_algorithm;
|
||||
u8 cur_algorithm;
|
||||
u8 bt_status;
|
||||
u8 wifi_chnl_info[3];
|
||||
|
||||
u32 pre_ra_mask;
|
||||
u32 cur_ra_mask;
|
||||
u8 pre_arfr_type;
|
||||
u8 cur_arfr_type;
|
||||
u8 pre_retry_limit_type;
|
||||
u8 cur_retry_limit_type;
|
||||
u8 pre_ampdu_time_type;
|
||||
u8 cur_ampdu_time_type;
|
||||
u32 arp_cnt;
|
||||
|
||||
u8 error_condition;
|
||||
};
|
||||
|
||||
struct coex_sta_8821a_1ant {
|
||||
boolean bt_disabled;
|
||||
boolean bt_link_exist;
|
||||
boolean sco_exist;
|
||||
boolean a2dp_exist;
|
||||
boolean hid_exist;
|
||||
boolean pan_exist;
|
||||
|
||||
boolean under_lps;
|
||||
boolean under_ips;
|
||||
u32 specific_pkt_period_cnt;
|
||||
u32 high_priority_tx;
|
||||
u32 high_priority_rx;
|
||||
u32 low_priority_tx;
|
||||
u32 low_priority_rx;
|
||||
|
||||
u32 crc_ok_cck;
|
||||
u32 crc_ok_11g;
|
||||
u32 crc_ok_11n;
|
||||
u32 crc_ok_11n_vht;
|
||||
|
||||
u32 crc_err_cck;
|
||||
u32 crc_err_11g;
|
||||
u32 crc_err_11n;
|
||||
u32 crc_err_11n_vht;
|
||||
|
||||
u32 bt_coex_supported_version;
|
||||
u8 cut_version;
|
||||
u8 bt_rssi;
|
||||
u8 scan_ap_num;
|
||||
boolean bt_tx_rx_mask;
|
||||
u8 pre_bt_rssi_state;
|
||||
u8 pre_wifi_rssi_state[4];
|
||||
boolean c2h_bt_info_req_sent;
|
||||
u8 bt_info_c2h[BT_INFO_SRC_8821A_1ANT_MAX][10];
|
||||
u32 bt_info_c2h_cnt[BT_INFO_SRC_8821A_1ANT_MAX];
|
||||
boolean c2h_bt_inquiry_page;
|
||||
boolean c2h_bt_page; /* Add for win8.1 page out issue */
|
||||
boolean wifi_is_high_pri_task; /* Add for win8.1 page out issue */
|
||||
u8 bt_retry_cnt;
|
||||
u8 bt_info_ext;
|
||||
boolean bt_whck_test; /* Add for ASUS WHQL TEST that enable wifi test bt */
|
||||
};
|
||||
|
||||
/* *******************************************
|
||||
* The following is interface which will notify coex module.
|
||||
* ******************************************* */
|
||||
void ex_halbtc8821a1ant_power_on_setting(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821a1ant_init_hw_config(IN struct btc_coexist *btcoexist,
|
||||
IN boolean wifi_only);
|
||||
void ex_halbtc8821a1ant_init_coex_dm(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821a1ant_ips_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821a1ant_lps_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821a1ant_scan_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821a1ant_switchband_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821a1ant_connect_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821a1ant_media_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821a1ant_specific_packet_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821a1ant_bt_info_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 *tmp_buf, IN u8 length);
|
||||
void ex_halbtc8821a1ant_halt_notify(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821a1ant_pnp_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 pnp_state);
|
||||
void ex_halbtc8821a1ant_periodical(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821a1ant_display_coex_info(IN struct btc_coexist *btcoexist);
|
||||
|
||||
#else
|
||||
#define ex_halbtc8821a1ant_power_on_setting(btcoexist)
|
||||
#define ex_halbtc8821a1ant_init_hw_config(btcoexist, wifi_only)
|
||||
#define ex_halbtc8821a1ant_init_coex_dm(btcoexist)
|
||||
#define ex_halbtc8821a1ant_ips_notify(btcoexist, type)
|
||||
#define ex_halbtc8821a1ant_lps_notify(btcoexist, type)
|
||||
#define ex_halbtc8821a1ant_scan_notify(btcoexist, type)
|
||||
#define ex_halbtc8821a1ant_switchband_notify(btcoexist, type)
|
||||
#define ex_halbtc8821a1ant_connect_notify(btcoexist, type)
|
||||
#define ex_halbtc8821a1ant_media_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8821a1ant_specific_packet_notify(btcoexist, type)
|
||||
#define ex_halbtc8821a1ant_bt_info_notify(btcoexist, tmp_buf, length)
|
||||
#define ex_halbtc8821a1ant_halt_notify(btcoexist)
|
||||
#define ex_halbtc8821a1ant_pnp_notify(btcoexist, pnp_state)
|
||||
#define ex_halbtc8821a1ant_periodical(btcoexist)
|
||||
#define ex_halbtc8821a1ant_display_coex_info(btcoexist)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
4637
hal/btc/halbtc8821a2ant.c
Normal file
4637
hal/btc/halbtc8821a2ant.c
Normal file
File diff suppressed because it is too large
Load diff
211
hal/btc/halbtc8821a2ant.h
Normal file
211
hal/btc/halbtc8821a2ant.h
Normal file
|
@ -0,0 +1,211 @@
|
|||
|
||||
#if (BT_SUPPORT == 1 && COEX_SUPPORT == 1)
|
||||
|
||||
#if (RTL8821A_SUPPORT == 1)
|
||||
|
||||
/* *******************************************
|
||||
* The following is for 8821A 2Ant BT Co-exist definition
|
||||
* ******************************************* */
|
||||
#define BT_AUTO_REPORT_ONLY_8821A_2ANT 1
|
||||
|
||||
|
||||
#define BT_INFO_8821A_2ANT_B_FTP BIT(7)
|
||||
#define BT_INFO_8821A_2ANT_B_A2DP BIT(6)
|
||||
#define BT_INFO_8821A_2ANT_B_HID BIT(5)
|
||||
#define BT_INFO_8821A_2ANT_B_SCO_BUSY BIT(4)
|
||||
#define BT_INFO_8821A_2ANT_B_ACL_BUSY BIT(3)
|
||||
#define BT_INFO_8821A_2ANT_B_INQ_PAGE BIT(2)
|
||||
#define BT_INFO_8821A_2ANT_B_SCO_ESCO BIT(1)
|
||||
#define BT_INFO_8821A_2ANT_B_CONNECTION BIT(0)
|
||||
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8821A_2ANT 2
|
||||
|
||||
|
||||
#define BT_8821A_2ANT_WIFI_RSSI_COEXSWITCH_THRES 42 /* WiFi RSSI Threshold for 2-Ant TDMA/1-Ant PS-TDMA translation */
|
||||
#define BT_8821A_2ANT_BT_RSSI_COEXSWITCH_THRES 46 /* BT RSSI Threshold for 2-Ant TDMA/1-Ant PS-TDMA translation */
|
||||
|
||||
enum bt_info_src_8821a_2ant {
|
||||
BT_INFO_SRC_8821A_2ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8821A_2ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8821A_2ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8821A_2ANT_MAX
|
||||
};
|
||||
|
||||
enum bt_8821a_2ant_bt_status {
|
||||
BT_8821A_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8821A_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8821A_2ANT_BT_STATUS_INQ_PAGE = 0x2,
|
||||
BT_8821A_2ANT_BT_STATUS_ACL_BUSY = 0x3,
|
||||
BT_8821A_2ANT_BT_STATUS_SCO_BUSY = 0x4,
|
||||
BT_8821A_2ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
|
||||
BT_8821A_2ANT_BT_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8821a_2ant_coex_algo {
|
||||
BT_8821A_2ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8821A_2ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8821A_2ANT_COEX_ALGO_HID = 0x2,
|
||||
BT_8821A_2ANT_COEX_ALGO_A2DP = 0x3,
|
||||
BT_8821A_2ANT_COEX_ALGO_A2DP_PANHS = 0x4,
|
||||
BT_8821A_2ANT_COEX_ALGO_PANEDR = 0x5,
|
||||
BT_8821A_2ANT_COEX_ALGO_PANHS = 0x6,
|
||||
BT_8821A_2ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
|
||||
BT_8821A_2ANT_COEX_ALGO_PANEDR_HID = 0x8,
|
||||
BT_8821A_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
|
||||
BT_8821A_2ANT_COEX_ALGO_HID_A2DP = 0xa,
|
||||
BT_8821A_2ANT_COEX_ALGO_MAX = 0xb,
|
||||
};
|
||||
|
||||
struct coex_dm_8821a_2ant {
|
||||
/* fw mechanism */
|
||||
u8 pre_bt_dec_pwr_lvl;
|
||||
u8 cur_bt_dec_pwr_lvl;
|
||||
u8 pre_fw_dac_swing_lvl;
|
||||
u8 cur_fw_dac_swing_lvl;
|
||||
boolean cur_ignore_wlan_act;
|
||||
boolean pre_ignore_wlan_act;
|
||||
u8 pre_ps_tdma;
|
||||
u8 cur_ps_tdma;
|
||||
u8 ps_tdma_para[5];
|
||||
u8 ps_tdma_du_adj_type;
|
||||
boolean reset_tdma_adjust;
|
||||
boolean auto_tdma_adjust;
|
||||
boolean pre_ps_tdma_on;
|
||||
boolean cur_ps_tdma_on;
|
||||
boolean pre_bt_auto_report;
|
||||
boolean cur_bt_auto_report;
|
||||
|
||||
/* sw mechanism */
|
||||
boolean pre_rf_rx_lpf_shrink;
|
||||
boolean cur_rf_rx_lpf_shrink;
|
||||
u32 bt_rf_0x1e_backup;
|
||||
boolean pre_low_penalty_ra;
|
||||
boolean cur_low_penalty_ra;
|
||||
boolean pre_dac_swing_on;
|
||||
u32 pre_dac_swing_lvl;
|
||||
boolean cur_dac_swing_on;
|
||||
u32 cur_dac_swing_lvl;
|
||||
boolean pre_adc_back_off;
|
||||
boolean cur_adc_back_off;
|
||||
boolean pre_agc_table_en;
|
||||
boolean cur_agc_table_en;
|
||||
u32 pre_val0x6c0;
|
||||
u32 cur_val0x6c0;
|
||||
u32 pre_val0x6c4;
|
||||
u32 cur_val0x6c4;
|
||||
u32 pre_val0x6c8;
|
||||
u32 cur_val0x6c8;
|
||||
u8 pre_val0x6cc;
|
||||
u8 cur_val0x6cc;
|
||||
boolean limited_dig;
|
||||
|
||||
/* algorithm related */
|
||||
u8 pre_algorithm;
|
||||
u8 cur_algorithm;
|
||||
u8 bt_status;
|
||||
u8 wifi_chnl_info[3];
|
||||
|
||||
boolean need_recover0x948;
|
||||
u32 backup0x948;
|
||||
|
||||
u8 pre_lps;
|
||||
u8 cur_lps;
|
||||
u8 pre_rpwm;
|
||||
u8 cur_rpwm;
|
||||
};
|
||||
|
||||
struct coex_sta_8821a_2ant {
|
||||
boolean bt_disabled;
|
||||
boolean bt_link_exist;
|
||||
boolean sco_exist;
|
||||
boolean a2dp_exist;
|
||||
boolean hid_exist;
|
||||
boolean pan_exist;
|
||||
|
||||
boolean under_lps;
|
||||
boolean under_ips;
|
||||
u32 high_priority_tx;
|
||||
u32 high_priority_rx;
|
||||
u32 low_priority_tx;
|
||||
u32 low_priority_rx;
|
||||
u8 bt_rssi;
|
||||
boolean bt_tx_rx_mask;
|
||||
u8 pre_bt_rssi_state;
|
||||
u8 pre_wifi_rssi_state[4];
|
||||
boolean c2h_bt_info_req_sent;
|
||||
u8 bt_info_c2h[BT_INFO_SRC_8821A_2ANT_MAX][10];
|
||||
u32 bt_info_c2h_cnt[BT_INFO_SRC_8821A_2ANT_MAX];
|
||||
boolean bt_whck_test;
|
||||
boolean c2h_bt_inquiry_page;
|
||||
u8 bt_retry_cnt;
|
||||
u8 bt_info_ext;
|
||||
u8 scan_ap_num;
|
||||
u32 crc_ok_cck;
|
||||
u32 crc_ok_11g;
|
||||
u32 crc_ok_11n;
|
||||
u32 crc_ok_11n_vht;
|
||||
|
||||
u32 crc_err_cck;
|
||||
u32 crc_err_11g;
|
||||
u32 crc_err_11n;
|
||||
u32 crc_err_11n_vht;
|
||||
|
||||
u32 bt_coex_supported_version;
|
||||
u8 cut_version;
|
||||
u8 coex_table_type;
|
||||
boolean force_lps_on;
|
||||
|
||||
u8 dis_ver_info_cnt;
|
||||
};
|
||||
|
||||
/* *******************************************
|
||||
* The following is interface which will notify coex module.
|
||||
* ******************************************* */
|
||||
void ex_halbtc8821a2ant_power_on_setting(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821a2ant_pre_load_firmware(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821a2ant_init_hw_config(IN struct btc_coexist *btcoexist,
|
||||
IN boolean wifi_only);
|
||||
void ex_halbtc8821a2ant_init_coex_dm(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821a2ant_ips_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821a2ant_lps_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821a2ant_scan_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821a2ant_switchband_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821a2ant_connect_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821a2ant_media_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821a2ant_specific_packet_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821a2ant_bt_info_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 *tmp_buf, IN u8 length);
|
||||
void ex_halbtc8821a2ant_halt_notify(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821a2ant_pnp_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 pnp_state);
|
||||
void ex_halbtc8821a2ant_periodical(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821a2ant_display_coex_info(IN struct btc_coexist *btcoexist);
|
||||
|
||||
#else
|
||||
#define ex_halbtc8821a2ant_power_on_setting(btcoexist)
|
||||
#define ex_halbtc8821a2ant_pre_load_firmware(btcoexist)
|
||||
#define ex_halbtc8821a2ant_init_hw_config(btcoexist, wifi_only)
|
||||
#define ex_halbtc8821a2ant_init_coex_dm(btcoexist)
|
||||
#define ex_halbtc8821a2ant_ips_notify(btcoexist, type)
|
||||
#define ex_halbtc8821a2ant_lps_notify(btcoexist, type)
|
||||
#define ex_halbtc8821a2ant_scan_notify(btcoexist, type)
|
||||
#define ex_halbtc8821a2ant_switchband_notify(btcoexist, type)
|
||||
#define ex_halbtc8821a2ant_connect_notify(btcoexist, type)
|
||||
#define ex_halbtc8821a2ant_media_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8821a2ant_specific_packet_notify(btcoexist, type)
|
||||
#define ex_halbtc8821a2ant_bt_info_notify(btcoexist, tmp_buf, length)
|
||||
#define ex_halbtc8821a2ant_halt_notify(btcoexist)
|
||||
#define ex_halbtc8821a2ant_pnp_notify(btcoexist, pnp_state)
|
||||
#define ex_halbtc8821a2ant_periodical(btcoexist)
|
||||
#define ex_halbtc8821a2ant_display_coex_info(btcoexist)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
6674
hal/btc/halbtc8821c1ant.c
Normal file
6674
hal/btc/halbtc8821c1ant.c
Normal file
File diff suppressed because it is too large
Load diff
473
hal/btc/halbtc8821c1ant.h
Normal file
473
hal/btc/halbtc8821c1ant.h
Normal file
|
@ -0,0 +1,473 @@
|
|||
|
||||
#if (BT_SUPPORT == 1 && COEX_SUPPORT == 1)
|
||||
|
||||
#if (RTL8821C_SUPPORT == 1)
|
||||
|
||||
/* *******************************************
|
||||
* The following is for 8821C 1ANT BT Co-exist definition
|
||||
* ******************************************* */
|
||||
#define BT_8821C_1ANT_COEX_DBG 0
|
||||
#define BT_AUTO_REPORT_ONLY_8821C_1ANT 1
|
||||
|
||||
#define BT_INFO_8821C_1ANT_B_FTP BIT(7)
|
||||
#define BT_INFO_8821C_1ANT_B_A2DP BIT(6)
|
||||
#define BT_INFO_8821C_1ANT_B_HID BIT(5)
|
||||
#define BT_INFO_8821C_1ANT_B_SCO_BUSY BIT(4)
|
||||
#define BT_INFO_8821C_1ANT_B_ACL_BUSY BIT(3)
|
||||
#define BT_INFO_8821C_1ANT_B_INQ_PAGE BIT(2)
|
||||
#define BT_INFO_8821C_1ANT_B_SCO_ESCO BIT(1)
|
||||
#define BT_INFO_8821C_1ANT_B_CONNECTION BIT(0)
|
||||
|
||||
#define BT_INFO_8821C_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_) \
|
||||
(((_BT_INFO_EXT_&BIT(0))) ? true : false)
|
||||
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8821C_1ANT 2
|
||||
|
||||
#define BT_8821C_1ANT_WIFI_NOISY_THRESH 30 /* max: 255 */
|
||||
#define BT_8821C_1ANT_DEFAULT_ISOLATION 15 /* unit: dB */
|
||||
|
||||
|
||||
/* for Antenna detection */
|
||||
#define BT_8821C_1ANT_ANTDET_PSDTHRES_BACKGROUND 50
|
||||
#define BT_8821C_1ANT_ANTDET_PSDTHRES_2ANT_BADISOLATION 70
|
||||
#define BT_8821C_1ANT_ANTDET_PSDTHRES_2ANT_GOODISOLATION 55
|
||||
#define BT_8821C_1ANT_ANTDET_PSDTHRES_1ANT 35
|
||||
#define BT_8821C_1ANT_ANTDET_RETRY_INTERVAL 10 /* retry timer if ant det is fail, unit: second */
|
||||
#define BT_8821C_1ANT_ANTDET_SWEEPPOINT_DELAY 60000
|
||||
#define BT_8821C_1ANT_ANTDET_ENABLE 0
|
||||
#define BT_8821C_1ANT_ANTDET_BTTXTIME 100
|
||||
#define BT_8821C_1ANT_ANTDET_BTTXCHANNEL 39
|
||||
#define BT_8821C_1ANT_ANTDET_PSD_SWWEEPCOUNT 50
|
||||
|
||||
#define BT_8821C_1ANT_LTECOEX_INDIRECTREG_ACCESS_TIMEOUT 30000
|
||||
|
||||
enum bt_8821c_1ant_signal_state {
|
||||
BT_8821C_1ANT_SIG_STA_SET_TO_LOW = 0x0,
|
||||
BT_8821C_1ANT_SIG_STA_SET_BY_HW = 0x0,
|
||||
BT_8821C_1ANT_SIG_STA_SET_TO_HIGH = 0x1,
|
||||
BT_8821C_1ANT_SIG_STA_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_1ant_path_ctrl_owner {
|
||||
BT_8821C_1ANT_PCO_BTSIDE = 0x0,
|
||||
BT_8821C_1ANT_PCO_WLSIDE = 0x1,
|
||||
BT_8821C_1ANT_PCO_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_1ant_gnt_ctrl_type {
|
||||
BT_8821C_1ANT_GNT_TYPE_CTRL_BY_PTA = 0x0,
|
||||
BT_8821C_1ANT_GNT_TYPE_CTRL_BY_SW = 0x1,
|
||||
BT_8821C_1ANT_GNT_TYPE_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_1ant_gnt_ctrl_block {
|
||||
BT_8821C_1ANT_GNT_BLOCK_RFC_BB = 0x0,
|
||||
BT_8821C_1ANT_GNT_BLOCK_RFC = 0x1,
|
||||
BT_8821C_1ANT_GNT_BLOCK_BB = 0x2,
|
||||
BT_8821C_1ANT_GNT_BLOCK_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_1ant_lte_coex_table_type {
|
||||
BT_8821C_1ANT_CTT_WL_VS_LTE = 0x0,
|
||||
BT_8821C_1ANT_CTT_BT_VS_LTE = 0x1,
|
||||
BT_8821C_1ANT_CTT_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_1ant_lte_break_table_type {
|
||||
BT_8821C_1ANT_LBTT_WL_BREAK_LTE = 0x0,
|
||||
BT_8821C_1ANT_LBTT_BT_BREAK_LTE = 0x1,
|
||||
BT_8821C_1ANT_LBTT_LTE_BREAK_WL = 0x2,
|
||||
BT_8821C_1ANT_LBTT_LTE_BREAK_BT = 0x3,
|
||||
BT_8821C_1ANT_LBTT_MAX
|
||||
};
|
||||
|
||||
enum bt_info_src_8821c_1ant {
|
||||
BT_INFO_SRC_8821C_1ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8821C_1ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8821C_1ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8821C_1ANT_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_1ant_bt_status {
|
||||
BT_8821C_1ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8821C_1ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8821C_1ANT_BT_STATUS_INQ_PAGE = 0x2,
|
||||
BT_8821C_1ANT_BT_STATUS_ACL_BUSY = 0x3,
|
||||
BT_8821C_1ANT_BT_STATUS_SCO_BUSY = 0x4,
|
||||
BT_8821C_1ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
|
||||
BT_8821C_1ANT_BT_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_1ant_wifi_status {
|
||||
BT_8821C_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8821C_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN = 0x1,
|
||||
BT_8821C_1ANT_WIFI_STATUS_CONNECTED_SCAN = 0x2,
|
||||
BT_8821C_1ANT_WIFI_STATUS_CONNECTED_SPECIFIC_PKT = 0x3,
|
||||
BT_8821C_1ANT_WIFI_STATUS_CONNECTED_IDLE = 0x4,
|
||||
BT_8821C_1ANT_WIFI_STATUS_CONNECTED_BUSY = 0x5,
|
||||
BT_8821C_1ANT_WIFI_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_1ant_coex_algo {
|
||||
BT_8821C_1ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8821C_1ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8821C_1ANT_COEX_ALGO_HID = 0x2,
|
||||
BT_8821C_1ANT_COEX_ALGO_A2DP = 0x3,
|
||||
BT_8821C_1ANT_COEX_ALGO_A2DP_PANHS = 0x4,
|
||||
BT_8821C_1ANT_COEX_ALGO_PANEDR = 0x5,
|
||||
BT_8821C_1ANT_COEX_ALGO_PANHS = 0x6,
|
||||
BT_8821C_1ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
|
||||
BT_8821C_1ANT_COEX_ALGO_PANEDR_HID = 0x8,
|
||||
BT_8821C_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
|
||||
BT_8821C_1ANT_COEX_ALGO_HID_A2DP = 0xa,
|
||||
BT_8821C_1ANT_COEX_ALGO_MAX = 0xb,
|
||||
};
|
||||
|
||||
enum bt_8821c_1ant_ext_ant_switch_type {
|
||||
BT_8821C_1ANT_EXT_ANT_SWITCH_USE_DPDT = 0x0,
|
||||
BT_8821C_1ANT_EXT_ANT_SWITCH_USE_SPDT = 0x1,
|
||||
BT_8821C_1ANT_EXT_ANT_SWITCH_NONE = 0x2,
|
||||
BT_8821C_1ANT_EXT_ANT_SWITCH_MAX
|
||||
};
|
||||
|
||||
|
||||
enum bt_8821c_1ant_ext_ant_switch_ctrl_type {
|
||||
BT_8821C_1ANT_EXT_ANT_SWITCH_CTRL_BY_BBSW = 0x0,
|
||||
BT_8821C_1ANT_EXT_ANT_SWITCH_CTRL_BY_PTA = 0x1,
|
||||
BT_8821C_1ANT_EXT_ANT_SWITCH_CTRL_BY_ANTDIV = 0x2,
|
||||
BT_8821C_1ANT_EXT_ANT_SWITCH_CTRL_BY_MAC = 0x3,
|
||||
BT_8821C_1ANT_EXT_ANT_SWITCH_CTRL_BY_BT = 0x4,
|
||||
BT_8821C_1ANT_EXT_ANT_SWITCH_CTRL_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_1ant_ext_ant_switch_pos_type {
|
||||
BT_8821C_1ANT_EXT_ANT_SWITCH_TO_BT = 0x0,
|
||||
BT_8821C_1ANT_EXT_ANT_SWITCH_TO_WLG = 0x1,
|
||||
BT_8821C_1ANT_EXT_ANT_SWITCH_TO_WLA = 0x2,
|
||||
BT_8821C_1ANT_EXT_ANT_SWITCH_TO_NOCARE = 0x3,
|
||||
BT_8821C_1ANT_EXT_ANT_SWITCH_TO_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_1ant_ext_band_switch_pos_type {
|
||||
BT_8821C_1ANT_EXT_BAND_SWITCH_TO_WLG = 0x0,
|
||||
BT_8821C_1ANT_EXT_BAND_SWITCH_TO_WLA = 0x1,
|
||||
BT_8821C_1ANT_EXT_BAND_SWITCH_TO_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_1ant_int_block {
|
||||
BT_8821C_1ANT_INT_BLOCK_SWITCH_TO_WLG_OF_BTG = 0x0,
|
||||
BT_8821C_1ANT_INT_BLOCK_SWITCH_TO_WLG_OF_WLAG = 0x1,
|
||||
BT_8821C_1ANT_INT_BLOCK_SWITCH_TO_WLA_OF_WLAG = 0x2,
|
||||
BT_8821C_1ANT_INT_BLOCK_SWITCH_TO_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_1ant_phase {
|
||||
BT_8821C_1ANT_PHASE_COEX_INIT = 0x0,
|
||||
BT_8821C_1ANT_PHASE_WLANONLY_INIT = 0x1,
|
||||
BT_8821C_1ANT_PHASE_WLAN_OFF = 0x2,
|
||||
BT_8821C_1ANT_PHASE_2G_RUNTIME = 0x3,
|
||||
BT_8821C_1ANT_PHASE_5G_RUNTIME = 0x4,
|
||||
BT_8821C_1ANT_PHASE_BTMPMODE = 0x5,
|
||||
BT_8821C_1ANT_PHASE_ANTENNA_DET = 0x6,
|
||||
BT_8821C_1ANT_PHASE_COEX_POWERON = 0x7,
|
||||
BT_8821C_1ANT_PHASE_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_1ant_Scoreboard {
|
||||
BT_8821C_1ANT_SCOREBOARD_ACTIVE = BIT(0),
|
||||
BT_8821C_1ANT_SCOREBOARD_ONOFF = BIT(1),
|
||||
BT_8821C_1ANT_SCOREBOARD_SCAN = BIT(2)
|
||||
};
|
||||
|
||||
struct coex_dm_8821c_1ant {
|
||||
/* hw setting */
|
||||
u32 pre_ant_pos_type;
|
||||
u32 cur_ant_pos_type;
|
||||
/* fw mechanism */
|
||||
boolean cur_ignore_wlan_act;
|
||||
boolean pre_ignore_wlan_act;
|
||||
u8 pre_ps_tdma;
|
||||
u8 cur_ps_tdma;
|
||||
u8 ps_tdma_para[5];
|
||||
u8 ps_tdma_du_adj_type;
|
||||
boolean pre_ps_tdma_on;
|
||||
boolean cur_ps_tdma_on;
|
||||
boolean pre_bt_auto_report;
|
||||
boolean cur_bt_auto_report;
|
||||
u8 pre_lps;
|
||||
u8 cur_lps;
|
||||
u8 pre_rpwm;
|
||||
u8 cur_rpwm;
|
||||
|
||||
/* sw mechanism */
|
||||
boolean pre_low_penalty_ra;
|
||||
boolean cur_low_penalty_ra;
|
||||
u32 pre_val0x6c0;
|
||||
u32 cur_val0x6c0;
|
||||
u32 pre_val0x6c4;
|
||||
u32 cur_val0x6c4;
|
||||
u32 pre_val0x6c8;
|
||||
u32 cur_val0x6c8;
|
||||
u8 pre_val0x6cc;
|
||||
u8 cur_val0x6cc;
|
||||
boolean limited_dig;
|
||||
|
||||
u32 backup_arfr_cnt1; /* Auto Rate Fallback Retry cnt */
|
||||
u32 backup_arfr_cnt2; /* Auto Rate Fallback Retry cnt */
|
||||
u16 backup_retry_limit;
|
||||
u8 backup_ampdu_max_time;
|
||||
|
||||
/* algorithm related */
|
||||
u8 pre_algorithm;
|
||||
u8 cur_algorithm;
|
||||
u8 bt_status;
|
||||
u8 wifi_chnl_info[3];
|
||||
|
||||
u32 pre_ra_mask;
|
||||
u32 cur_ra_mask;
|
||||
u8 pre_arfr_type;
|
||||
u8 cur_arfr_type;
|
||||
u8 pre_retry_limit_type;
|
||||
u8 cur_retry_limit_type;
|
||||
u8 pre_ampdu_time_type;
|
||||
u8 cur_ampdu_time_type;
|
||||
u32 arp_cnt;
|
||||
|
||||
u32 pre_ext_ant_switch_status;
|
||||
u32 cur_ext_ant_switch_status;
|
||||
|
||||
u8 pre_ext_band_switch_status;
|
||||
u8 cur_ext_band_switch_status;
|
||||
|
||||
u8 pre_int_block_status;
|
||||
u8 cur_int_block_status;
|
||||
|
||||
u8 error_condition;
|
||||
};
|
||||
|
||||
struct coex_sta_8821c_1ant {
|
||||
boolean bt_disabled;
|
||||
boolean bt_link_exist;
|
||||
boolean sco_exist;
|
||||
boolean a2dp_exist;
|
||||
boolean hid_exist;
|
||||
boolean pan_exist;
|
||||
boolean bt_hi_pri_link_exist;
|
||||
u8 num_of_profile;
|
||||
|
||||
boolean under_lps;
|
||||
boolean under_ips;
|
||||
u32 specific_pkt_period_cnt;
|
||||
u32 high_priority_tx;
|
||||
u32 high_priority_rx;
|
||||
u32 low_priority_tx;
|
||||
u32 low_priority_rx;
|
||||
s8 bt_rssi;
|
||||
boolean bt_tx_rx_mask;
|
||||
u8 pre_bt_rssi_state;
|
||||
u8 pre_wifi_rssi_state[4];
|
||||
boolean c2h_bt_info_req_sent;
|
||||
u8 bt_info_c2h[BT_INFO_SRC_8821C_1ANT_MAX][10];
|
||||
u32 bt_info_c2h_cnt[BT_INFO_SRC_8821C_1ANT_MAX];
|
||||
boolean bt_whck_test;
|
||||
boolean c2h_bt_inquiry_page;
|
||||
boolean c2h_bt_remote_name_req;
|
||||
boolean c2h_bt_page; /* Add for win8.1 page out issue */
|
||||
boolean wifi_is_high_pri_task; /* Add for win8.1 page out issue */
|
||||
u8 bt_retry_cnt;
|
||||
u8 bt_info_ext;
|
||||
u8 bt_info_ext2;
|
||||
u32 pop_event_cnt;
|
||||
u8 scan_ap_num;
|
||||
|
||||
u32 crc_ok_cck;
|
||||
u32 crc_ok_11g;
|
||||
u32 crc_ok_11n;
|
||||
u32 crc_ok_11n_vht;
|
||||
|
||||
u32 crc_err_cck;
|
||||
u32 crc_err_11g;
|
||||
u32 crc_err_11n;
|
||||
u32 crc_err_11n_vht;
|
||||
|
||||
boolean cck_lock;
|
||||
boolean pre_ccklock;
|
||||
boolean cck_ever_lock;
|
||||
u8 coex_table_type;
|
||||
|
||||
boolean force_lps_on;
|
||||
u32 wrong_profile_notification;
|
||||
|
||||
boolean concurrent_rx_mode_on;
|
||||
|
||||
u16 score_board;
|
||||
u8 isolation_btween_wb; /* 0~ 50 */
|
||||
|
||||
u8 a2dp_bit_pool;
|
||||
u8 cut_version;
|
||||
boolean acl_busy;
|
||||
boolean wl_rf_off_on_event;
|
||||
boolean bt_create_connection;
|
||||
|
||||
u32 bt_coex_supported_feature;
|
||||
u32 bt_coex_supported_version;
|
||||
|
||||
u8 bt_ble_scan_type;
|
||||
u8 bt_ble_scan_para[3];
|
||||
|
||||
boolean run_time_state;
|
||||
boolean freeze_coexrun_by_btinfo;
|
||||
|
||||
boolean is_A2DP_3M;
|
||||
boolean voice_over_HOGP;
|
||||
u8 bt_info;
|
||||
boolean is_autoslot;
|
||||
u8 forbidden_slot;
|
||||
u8 hid_busy_num;
|
||||
u8 hid_pair_cnt;
|
||||
|
||||
u32 cnt_RemoteNameReq;
|
||||
u32 cnt_setupLink;
|
||||
u32 cnt_ReInit;
|
||||
u32 cnt_IgnWlanAct;
|
||||
u32 cnt_Page;
|
||||
|
||||
u16 bt_reg_vendor_ac;
|
||||
u16 bt_reg_vendor_ae;
|
||||
|
||||
boolean is_setupLink;
|
||||
};
|
||||
|
||||
|
||||
#define BT_8821C_1ANT_EXT_BAND_SWITCH_USE_DPDT 0
|
||||
#define BT_8821C_1ANT_EXT_BAND_SWITCH_USE_SPDT 1
|
||||
|
||||
|
||||
struct rfe_type_8821c_1ant {
|
||||
|
||||
u8 rfe_module_type;
|
||||
boolean ext_ant_switch_exist;
|
||||
u8 ext_ant_switch_type; /* 0:DPDT, 1:SPDT */
|
||||
u8 ext_ant_switch_ctrl_polarity; /* iF 0: DPDT_P=0, DPDT_N=1 => BTG to Main, WL_A+G to Aux */
|
||||
|
||||
boolean ext_band_switch_exist;
|
||||
u8 ext_band_switch_type; /* 0:DPDT, 1:SPDT */
|
||||
u8 ext_band_switch_ctrl_polarity;
|
||||
|
||||
boolean wlg_Locate_at_btg; /* If true: WLG at BTG, If false: WLG at WLAG */
|
||||
|
||||
boolean ext_ant_switch_diversity; /* If diversity on */
|
||||
};
|
||||
|
||||
#define BT_8821C_1ANT_ANTDET_PSD_POINTS 256 /* MAX:1024 */
|
||||
#define BT_8821C_1ANT_ANTDET_PSD_AVGNUM 1 /* MAX:3 */
|
||||
#define BT_8821C_1ANT_ANTDET_BUF_LEN 16
|
||||
|
||||
struct psdscan_sta_8821c_1ant {
|
||||
|
||||
u32 ant_det_bt_le_channel; /* BT LE Channel ex:2412 */
|
||||
u32 ant_det_bt_tx_time;
|
||||
u32 ant_det_pre_psdscan_peak_val;
|
||||
boolean ant_det_is_ant_det_available;
|
||||
u32 ant_det_psd_scan_peak_val;
|
||||
boolean ant_det_is_btreply_available;
|
||||
u32 ant_det_psd_scan_peak_freq;
|
||||
|
||||
u8 ant_det_result;
|
||||
u8 ant_det_peak_val[BT_8821C_1ANT_ANTDET_BUF_LEN];
|
||||
u8 ant_det_peak_freq[BT_8821C_1ANT_ANTDET_BUF_LEN];
|
||||
u32 ant_det_try_count;
|
||||
u32 ant_det_fail_count;
|
||||
u32 ant_det_inteval_count;
|
||||
u32 ant_det_thres_offset;
|
||||
|
||||
u32 real_cent_freq;
|
||||
s32 real_offset;
|
||||
u32 real_span;
|
||||
|
||||
u32 psd_band_width; /* unit: Hz */
|
||||
u32 psd_point; /* 128/256/512/1024 */
|
||||
u32 psd_report[1024]; /* unit:dB (20logx), 0~255 */
|
||||
u32 psd_report_max_hold[1024]; /* unit:dB (20logx), 0~255 */
|
||||
u32 psd_start_point;
|
||||
u32 psd_stop_point;
|
||||
u32 psd_max_value_point;
|
||||
u32 psd_max_value;
|
||||
u32 psd_max_value2;
|
||||
u32 psd_avg_value; /* filter loop_max_value that below BT_8821C_1ANT_ANTDET_PSDTHRES_1ANT, and average the rest*/
|
||||
u32 psd_loop_max_value[BT_8821C_1ANT_ANTDET_PSD_SWWEEPCOUNT]; /*max value in each loop */
|
||||
u32 psd_start_base;
|
||||
u32 psd_avg_num; /* 1/8/16/32 */
|
||||
u32 psd_gen_count;
|
||||
boolean is_AntDet_running;
|
||||
boolean is_psd_show_max_only;
|
||||
};
|
||||
|
||||
/* *******************************************
|
||||
* The following is interface which will notify coex module.
|
||||
* ******************************************* */
|
||||
void ex_halbtc8821c1ant_power_on_setting(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821c1ant_pre_load_firmware(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821c1ant_init_hw_config(IN struct btc_coexist *btcoexist,
|
||||
IN boolean wifi_only);
|
||||
void ex_halbtc8821c1ant_init_coex_dm(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821c1ant_ips_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821c1ant_lps_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821c1ant_scan_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821c1ant_switchband_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821c1ant_connect_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821c1ant_media_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821c1ant_specific_packet_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821c1ant_bt_info_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 *tmp_buf, IN u8 length);
|
||||
void ex_halbtc8821c1ant_rf_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821c1ant_halt_notify(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821c1ant_pnp_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 pnp_state);
|
||||
void ex_halbtc8821c1ant_coex_dm_reset(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821c1ant_periodical(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821c1ant_display_coex_info(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821c1ant_antenna_detection(IN struct btc_coexist *btcoexist,
|
||||
IN u32 cent_freq, IN u32 offset, IN u32 span, IN u32 seconds);
|
||||
void ex_halbtc8821c1ant_antenna_isolation(IN struct btc_coexist *btcoexist,
|
||||
IN u32 cent_freq, IN u32 offset, IN u32 span, IN u32 seconds);
|
||||
|
||||
void ex_halbtc8821c1ant_psd_scan(IN struct btc_coexist *btcoexist,
|
||||
IN u32 cent_freq, IN u32 offset, IN u32 span, IN u32 seconds);
|
||||
void ex_halbtc8821c1ant_display_ant_detection(IN struct btc_coexist *btcoexist);
|
||||
|
||||
#else
|
||||
#define ex_halbtc8821c1ant_power_on_setting(btcoexist)
|
||||
#define ex_halbtc8821c1ant_pre_load_firmware(btcoexist)
|
||||
#define ex_halbtc8821c1ant_init_hw_config(btcoexist, wifi_only)
|
||||
#define ex_halbtc8821c1ant_init_coex_dm(btcoexist)
|
||||
#define ex_halbtc8821c1ant_ips_notify(btcoexist, type)
|
||||
#define ex_halbtc8821c1ant_lps_notify(btcoexist, type)
|
||||
#define ex_halbtc8821c1ant_scan_notify(btcoexist, type)
|
||||
#define ex_halbtc8821c1ant_switchband_notify(btcoexist,type)
|
||||
#define ex_halbtc8821c1ant_connect_notify(btcoexist, type)
|
||||
#define ex_halbtc8821c1ant_media_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8821c1ant_specific_packet_notify(btcoexist, type)
|
||||
#define ex_halbtc8821c1ant_bt_info_notify(btcoexist, tmp_buf, length)
|
||||
#define ex_halbtc8821c1ant_rf_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8821c1ant_halt_notify(btcoexist)
|
||||
#define ex_halbtc8821c1ant_pnp_notify(btcoexist, pnp_state)
|
||||
#define ex_halbtc8821c1ant_coex_dm_reset(btcoexist)
|
||||
#define ex_halbtc8821c1ant_periodical(btcoexist)
|
||||
#define ex_halbtc8821c1ant_display_coex_info(btcoexist)
|
||||
#define ex_halbtc8821c1ant_antenna_detection(btcoexist, cent_freq, offset, span, seconds)
|
||||
#define ex_halbtc8821c1ant_antenna_isolation(btcoexist, cent_freq, offset, span, seconds)
|
||||
#define ex_halbtc8821c1ant_psd_scan(btcoexist, cent_freq, offset, span, seconds)
|
||||
#define ex_halbtc8821c1ant_display_ant_detection(btcoexist)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
6936
hal/btc/halbtc8821c2ant.c
Normal file
6936
hal/btc/halbtc8821c2ant.c
Normal file
File diff suppressed because it is too large
Load diff
478
hal/btc/halbtc8821c2ant.h
Normal file
478
hal/btc/halbtc8821c2ant.h
Normal file
|
@ -0,0 +1,478 @@
|
|||
|
||||
#if (BT_SUPPORT == 1 && COEX_SUPPORT == 1)
|
||||
|
||||
#if (RTL8821C_SUPPORT == 1)
|
||||
|
||||
/* *******************************************
|
||||
* The following is for 8821C 2Ant BT Co-exist definition
|
||||
* ******************************************* */
|
||||
#define BT_8821C_2ANT_COEX_DBG 0
|
||||
#define BT_AUTO_REPORT_ONLY_8821C_2ANT 1
|
||||
|
||||
|
||||
#define BT_INFO_8821C_2ANT_B_FTP BIT(7)
|
||||
#define BT_INFO_8821C_2ANT_B_A2DP BIT(6)
|
||||
#define BT_INFO_8821C_2ANT_B_HID BIT(5)
|
||||
#define BT_INFO_8821C_2ANT_B_SCO_BUSY BIT(4)
|
||||
#define BT_INFO_8821C_2ANT_B_ACL_BUSY BIT(3)
|
||||
#define BT_INFO_8821C_2ANT_B_INQ_PAGE BIT(2)
|
||||
#define BT_INFO_8821C_2ANT_B_SCO_ESCO BIT(1)
|
||||
#define BT_INFO_8821C_2ANT_B_CONNECTION BIT(0)
|
||||
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8821C_2ANT 2
|
||||
|
||||
|
||||
#define BT_8821C_2ANT_WIFI_RSSI_COEXSWITCH_THRES1 80 /* unit: % WiFi RSSI Threshold for 2-Ant free-run/2-Ant TDMA translation, default = 42 */
|
||||
#define BT_8821C_2ANT_BT_RSSI_COEXSWITCH_THRES1 80 /* unit: % BT RSSI Threshold for 2-Ant free-run/2-Ant TDMA translation, default = 46 */
|
||||
#define BT_8821C_2ANT_WIFI_RSSI_COEXSWITCH_THRES2 80 /* unit: % WiFi RSSI Threshold for 1-Ant TDMA/1-Ant PS-TDMA translation, default = 42 */
|
||||
#define BT_8821C_2ANT_BT_RSSI_COEXSWITCH_THRES2 80 /* unit: % BT RSSI Threshold for 1-Ant TDMA/1-Ant PS-TDMA translation, default = 46 */
|
||||
#define BT_8821C_2ANT_DEFAULT_ISOLATION 15 /* unit: dB */
|
||||
#define BT_8821C_2ANT_WIFI_MAX_TX_POWER 15 /* unit: dBm */
|
||||
#define BT_8821C_2ANT_BT_MAX_TX_POWER 3 /* unit: dBm */
|
||||
#define BT_8821C_2ANT_WIFI_SIR_THRES1 -15 /* unit: dB */
|
||||
#define BT_8821C_2ANT_WIFI_SIR_THRES2 -30 /* unit: dB */
|
||||
#define BT_8821C_2ANT_BT_SIR_THRES1 -15 /* unit: dB */
|
||||
#define BT_8821C_2ANT_BT_SIR_THRES2 -30 /* unit: dB */
|
||||
|
||||
|
||||
/* for Antenna detection */
|
||||
#define BT_8821C_2ANT_ANTDET_PSDTHRES_BACKGROUND 50
|
||||
#define BT_8821C_2ANT_ANTDET_PSDTHRES_2ANT_BADISOLATION 70
|
||||
#define BT_8821C_2ANT_ANTDET_PSDTHRES_2ANT_GOODISOLATION 52
|
||||
#define BT_8821C_2ANT_ANTDET_PSDTHRES_1ANT 40
|
||||
#define BT_8821C_2ANT_ANTDET_RETRY_INTERVAL 10 /* retry timer if ant det is fail, unit: second */
|
||||
#define BT_8821C_2ANT_ANTDET_SWEEPPOINT_DELAY 60000
|
||||
#define BT_8821C_2ANT_ANTDET_ENABLE 0
|
||||
#define BT_8821C_2ANT_ANTDET_BTTXTIME 100
|
||||
#define BT_8821C_2ANT_ANTDET_BTTXCHANNEL 39
|
||||
#define BT_8821C_2ANT_ANTDET_PSD_SWWEEPCOUNT 50
|
||||
|
||||
|
||||
#define BT_8821C_2ANT_LTECOEX_INDIRECTREG_ACCESS_TIMEOUT 30000
|
||||
|
||||
enum bt_8821c_2ant_signal_state {
|
||||
BT_8821C_2ANT_SIG_STA_SET_TO_LOW = 0x0,
|
||||
BT_8821C_2ANT_SIG_STA_SET_BY_HW = 0x0,
|
||||
BT_8821C_2ANT_SIG_STA_SET_TO_HIGH = 0x1,
|
||||
BT_8821C_2ANT_SIG_STA_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_2ant_path_ctrl_owner {
|
||||
BT_8821C_2ANT_PCO_BTSIDE = 0x0,
|
||||
BT_8821C_2ANT_PCO_WLSIDE = 0x1,
|
||||
BT_8821C_2ANT_PCO_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_2ant_gnt_ctrl_type {
|
||||
BT_8821C_2ANT_GNT_TYPE_CTRL_BY_PTA = 0x0,
|
||||
BT_8821C_2ANT_GNT_TYPE_CTRL_BY_SW = 0x1,
|
||||
BT_8821C_2ANT_GNT_TYPE_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_2ant_gnt_ctrl_block {
|
||||
BT_8821C_2ANT_GNT_BLOCK_RFC_BB = 0x0,
|
||||
BT_8821C_2ANT_GNT_BLOCK_RFC = 0x1,
|
||||
BT_8821C_2ANT_GNT_BLOCK_BB = 0x2,
|
||||
BT_8821C_2ANT_GNT_BLOCK_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_2ant_lte_coex_table_type {
|
||||
BT_8821C_2ANT_CTT_WL_VS_LTE = 0x0,
|
||||
BT_8821C_2ANT_CTT_BT_VS_LTE = 0x1,
|
||||
BT_8821C_2ANT_CTT_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_2ant_lte_break_table_type {
|
||||
BT_8821C_2ANT_LBTT_WL_BREAK_LTE = 0x0,
|
||||
BT_8821C_2ANT_LBTT_BT_BREAK_LTE = 0x1,
|
||||
BT_8821C_2ANT_LBTT_LTE_BREAK_WL = 0x2,
|
||||
BT_8821C_2ANT_LBTT_LTE_BREAK_BT = 0x3,
|
||||
BT_8821C_2ANT_LBTT_MAX
|
||||
};
|
||||
|
||||
enum bt_info_src_8821c_2ant {
|
||||
BT_INFO_SRC_8821C_2ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8821C_2ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8821C_2ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8821C_2ANT_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_2ant_bt_status {
|
||||
BT_8821C_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8821C_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8821C_2ANT_BT_STATUS_INQ_PAGE = 0x2,
|
||||
BT_8821C_2ANT_BT_STATUS_ACL_BUSY = 0x3,
|
||||
BT_8821C_2ANT_BT_STATUS_SCO_BUSY = 0x4,
|
||||
BT_8821C_2ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
|
||||
BT_8821C_2ANT_BT_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_2ant_coex_algo {
|
||||
BT_8821C_2ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8821C_2ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8821C_2ANT_COEX_ALGO_HID = 0x2,
|
||||
BT_8821C_2ANT_COEX_ALGO_A2DP = 0x3,
|
||||
BT_8821C_2ANT_COEX_ALGO_A2DP_PANHS = 0x4,
|
||||
BT_8821C_2ANT_COEX_ALGO_PANEDR = 0x5,
|
||||
BT_8821C_2ANT_COEX_ALGO_PANHS = 0x6,
|
||||
BT_8821C_2ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
|
||||
BT_8821C_2ANT_COEX_ALGO_PANEDR_HID = 0x8,
|
||||
BT_8821C_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
|
||||
BT_8821C_2ANT_COEX_ALGO_HID_A2DP = 0xa,
|
||||
BT_8821C_2ANT_COEX_ALGO_NOPROFILEBUSY = 0xb,
|
||||
BT_8821C_2ANT_COEX_ALGO_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_2ant_ext_ant_switch_type {
|
||||
BT_8821C_2ANT_EXT_ANT_SWITCH_USE_DPDT = 0x0,
|
||||
BT_8821C_2ANT_EXT_ANT_SWITCH_USE_SPDT = 0x1,
|
||||
BT_8821C_2ANT_EXT_ANT_SWITCH_NONE = 0x2,
|
||||
BT_8821C_2ANT_EXT_ANT_SWITCH_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_2ant_ext_ant_switch_ctrl_type {
|
||||
BT_8821C_2ANT_EXT_ANT_SWITCH_CTRL_BY_BBSW = 0x0,
|
||||
BT_8821C_2ANT_EXT_ANT_SWITCH_CTRL_BY_PTA = 0x1,
|
||||
BT_8821C_2ANT_EXT_ANT_SWITCH_CTRL_BY_ANTDIV = 0x2,
|
||||
BT_8821C_2ANT_EXT_ANT_SWITCH_CTRL_BY_MAC = 0x3,
|
||||
BT_8821C_2ANT_EXT_ANT_SWITCH_CTRL_BY_BT = 0x4,
|
||||
BT_8821C_2ANT_EXT_ANT_SWITCH_CTRL_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_2ant_ext_ant_switch_pos_type {
|
||||
BT_8821C_2ANT_EXT_ANT_SWITCH_MAIN_TO_BT = 0x0,
|
||||
BT_8821C_2ANT_EXT_ANT_SWITCH_MAIN_TO_WLG = 0x1,
|
||||
BT_8821C_2ANT_EXT_ANT_SWITCH_MAIN_TO_WLA = 0x2,
|
||||
BT_8821C_2ANT_EXT_ANT_SWITCH_MAIN_TO_NOCARE = 0x3,
|
||||
BT_8821C_2ANT_EXT_ANT_SWITCH_MAIN_TO_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_2ant_ext_band_switch_pos_type {
|
||||
BT_8821C_2ANT_EXT_BAND_SWITCH_TO_WLG = 0x0,
|
||||
BT_8821C_2ANT_EXT_BAND_SWITCH_TO_WLA = 0x1,
|
||||
BT_8821C_2ANT_EXT_BAND_SWITCH_TO_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_2ant_int_block {
|
||||
BT_8821C_2ANT_INT_BLOCK_SWITCH_TO_WLG_OF_BTG = 0x0,
|
||||
BT_8821C_2ANT_INT_BLOCK_SWITCH_TO_WLG_OF_WLAG = 0x1,
|
||||
BT_8821C_2ANT_INT_BLOCK_SWITCH_TO_WLA_OF_WLAG = 0x2,
|
||||
BT_8821C_2ANT_INT_BLOCK_SWITCH_TO_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_2ant_phase {
|
||||
BT_8821C_2ANT_PHASE_COEX_INIT = 0x0,
|
||||
BT_8821C_2ANT_PHASE_WLANONLY_INIT = 0x1,
|
||||
BT_8821C_2ANT_PHASE_WLAN_OFF = 0x2,
|
||||
BT_8821C_2ANT_PHASE_2G_RUNTIME = 0x3,
|
||||
BT_8821C_2ANT_PHASE_5G_RUNTIME = 0x4,
|
||||
BT_8821C_2ANT_PHASE_BTMPMODE = 0x5,
|
||||
BT_8821C_2ANT_PHASE_ANTENNA_DET = 0x6,
|
||||
BT_8821C_2ANT_PHASE_COEX_POWERON = 0x7,
|
||||
BT_8821C_2ANT_PHASE_2G_RUNTIME_CONCURRENT = 0x8,
|
||||
BT_8821C_2ANT_PHASE_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_2ant_Scoreboard {
|
||||
BT_8821C_2ANT_SCOREBOARD_ACTIVE = BIT(0),
|
||||
BT_8821C_2ANT_SCOREBOARD_ONOFF = BIT(1),
|
||||
BT_8821C_2ANT_SCOREBOARD_SCAN = BIT(2)
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct coex_dm_8821c_2ant {
|
||||
/* hw setting */
|
||||
u32 pre_ant_pos_type;
|
||||
u32 cur_ant_pos_type;
|
||||
/* fw mechanism */
|
||||
u8 pre_bt_dec_pwr_lvl;
|
||||
u8 cur_bt_dec_pwr_lvl;
|
||||
u8 pre_fw_dac_swing_lvl;
|
||||
u8 cur_fw_dac_swing_lvl;
|
||||
boolean cur_ignore_wlan_act;
|
||||
boolean pre_ignore_wlan_act;
|
||||
u8 pre_ps_tdma;
|
||||
u8 cur_ps_tdma;
|
||||
u8 ps_tdma_para[5];
|
||||
u8 ps_tdma_du_adj_type;
|
||||
boolean reset_tdma_adjust;
|
||||
boolean pre_ps_tdma_on;
|
||||
boolean cur_ps_tdma_on;
|
||||
boolean pre_bt_auto_report;
|
||||
boolean cur_bt_auto_report;
|
||||
|
||||
/* sw mechanism */
|
||||
boolean pre_rf_rx_lpf_shrink;
|
||||
boolean cur_rf_rx_lpf_shrink;
|
||||
u32 bt_rf_0x1e_backup;
|
||||
boolean pre_low_penalty_ra;
|
||||
boolean cur_low_penalty_ra;
|
||||
boolean pre_dac_swing_on;
|
||||
u32 pre_dac_swing_lvl;
|
||||
boolean cur_dac_swing_on;
|
||||
u32 cur_dac_swing_lvl;
|
||||
boolean pre_adc_back_off;
|
||||
boolean cur_adc_back_off;
|
||||
boolean pre_agc_table_en;
|
||||
boolean cur_agc_table_en;
|
||||
u32 pre_val0x6c0;
|
||||
u32 cur_val0x6c0;
|
||||
u32 pre_val0x6c4;
|
||||
u32 cur_val0x6c4;
|
||||
u32 pre_val0x6c8;
|
||||
u32 cur_val0x6c8;
|
||||
u8 pre_val0x6cc;
|
||||
u8 cur_val0x6cc;
|
||||
boolean limited_dig;
|
||||
|
||||
/* algorithm related */
|
||||
u8 pre_algorithm;
|
||||
u8 cur_algorithm;
|
||||
u8 bt_status;
|
||||
u8 wifi_chnl_info[3];
|
||||
|
||||
boolean need_recover0x948;
|
||||
u32 backup0x948;
|
||||
|
||||
u8 pre_lps;
|
||||
u8 cur_lps;
|
||||
u8 pre_rpwm;
|
||||
u8 cur_rpwm;
|
||||
|
||||
boolean is_switch_to_1dot5_ant;
|
||||
u8 switch_thres_offset;
|
||||
u32 arp_cnt;
|
||||
|
||||
u32 pre_ext_ant_switch_status;
|
||||
u32 cur_ext_ant_switch_status;
|
||||
|
||||
u8 pre_ext_band_switch_status;
|
||||
u8 cur_ext_band_switch_status;
|
||||
|
||||
u8 pre_int_block_status;
|
||||
u8 cur_int_block_status;
|
||||
};
|
||||
|
||||
struct coex_sta_8821c_2ant {
|
||||
boolean bt_disabled;
|
||||
boolean bt_link_exist;
|
||||
boolean sco_exist;
|
||||
boolean a2dp_exist;
|
||||
boolean hid_exist;
|
||||
boolean pan_exist;
|
||||
|
||||
boolean under_lps;
|
||||
boolean under_ips;
|
||||
u32 high_priority_tx;
|
||||
u32 high_priority_rx;
|
||||
u32 low_priority_tx;
|
||||
u32 low_priority_rx;
|
||||
u8 bt_rssi;
|
||||
boolean bt_tx_rx_mask;
|
||||
u8 pre_bt_rssi_state;
|
||||
u8 pre_wifi_rssi_state[4];
|
||||
boolean c2h_bt_info_req_sent;
|
||||
u8 bt_info_c2h[BT_INFO_SRC_8821C_2ANT_MAX][10];
|
||||
u32 bt_info_c2h_cnt[BT_INFO_SRC_8821C_2ANT_MAX];
|
||||
boolean bt_whck_test;
|
||||
boolean c2h_bt_inquiry_page;
|
||||
boolean c2h_bt_remote_name_req;
|
||||
u8 bt_retry_cnt;
|
||||
u8 bt_info_ext;
|
||||
u8 bt_info_ext2;
|
||||
u32 pop_event_cnt;
|
||||
u8 scan_ap_num;
|
||||
|
||||
u32 crc_ok_cck;
|
||||
u32 crc_ok_11g;
|
||||
u32 crc_ok_11n;
|
||||
u32 crc_ok_11n_vht;
|
||||
|
||||
u32 crc_err_cck;
|
||||
u32 crc_err_11g;
|
||||
u32 crc_err_11n;
|
||||
u32 crc_err_11n_vht;
|
||||
|
||||
boolean cck_lock;
|
||||
boolean pre_ccklock;
|
||||
boolean cck_ever_lock;
|
||||
|
||||
u8 coex_table_type;
|
||||
boolean force_lps_on;
|
||||
|
||||
u8 dis_ver_info_cnt;
|
||||
|
||||
u8 a2dp_bit_pool;
|
||||
u8 cut_version;
|
||||
|
||||
boolean concurrent_rx_mode_on;
|
||||
|
||||
u16 score_board;
|
||||
u8 isolation_btween_wb; /* 0~ 50 */
|
||||
u8 wifi_coex_thres;
|
||||
u8 bt_coex_thres;
|
||||
u8 wifi_coex_thres2;
|
||||
u8 bt_coex_thres2;
|
||||
|
||||
u8 num_of_profile;
|
||||
boolean acl_busy;
|
||||
boolean wl_rf_off_on_event;
|
||||
boolean bt_create_connection;
|
||||
boolean wifi_is_high_pri_task;
|
||||
u32 specific_pkt_period_cnt;
|
||||
u32 bt_coex_supported_feature;
|
||||
u32 bt_coex_supported_version;
|
||||
|
||||
u8 bt_ble_scan_type;
|
||||
u8 bt_ble_scan_para[3];
|
||||
|
||||
boolean run_time_state;
|
||||
boolean freeze_coexrun_by_btinfo;
|
||||
|
||||
boolean is_A2DP_3M;
|
||||
boolean voice_over_HOGP;
|
||||
u8 bt_info;
|
||||
boolean is_autoslot;
|
||||
u8 forbidden_slot;
|
||||
u8 hid_busy_num;
|
||||
u8 hid_pair_cnt;
|
||||
|
||||
u32 cnt_RemoteNameReq;
|
||||
u32 cnt_setupLink;
|
||||
u32 cnt_ReInit;
|
||||
u32 cnt_IgnWlanAct;
|
||||
u32 cnt_Page;
|
||||
|
||||
u16 bt_reg_vendor_ac;
|
||||
u16 bt_reg_vendor_ae;
|
||||
|
||||
boolean is_setupLink;
|
||||
};
|
||||
|
||||
|
||||
#define BT_8821C_2ANT_EXT_BAND_SWITCH_USE_DPDT 0
|
||||
#define BT_8821C_2ANT_EXT_BAND_SWITCH_USE_SPDT 1
|
||||
|
||||
|
||||
struct rfe_type_8821c_2ant {
|
||||
|
||||
u8 rfe_module_type;
|
||||
boolean ext_ant_switch_exist;
|
||||
u8 ext_ant_switch_type; /* 0:DPDT, 1:SPDT */
|
||||
u8 ext_ant_switch_ctrl_polarity; /* iF 0: DPDT_P=0, DPDT_N=1 => BTG to Main, WL_A+G to Aux */
|
||||
|
||||
boolean ext_band_switch_exist;
|
||||
u8 ext_band_switch_type; /* 0:DPDT, 1:SPDT */
|
||||
u8 ext_band_switch_ctrl_polarity;
|
||||
|
||||
boolean wlg_Locate_at_btg; /* If true: WLG at BTG, If false: WLG at WLAG */
|
||||
|
||||
boolean ext_ant_switch_diversity; /* If diversity on */
|
||||
};
|
||||
|
||||
#define BT_8821C_2ANT_ANTDET_PSD_POINTS 256 /* MAX:1024 */
|
||||
#define BT_8821C_2ANT_ANTDET_PSD_AVGNUM 1 /* MAX:3 */
|
||||
#define BT_8821C_2ANT_ANTDET_BUF_LEN 16
|
||||
|
||||
struct psdscan_sta_8821c_2ant {
|
||||
|
||||
u32 ant_det_bt_le_channel; /* BT LE Channel ex:2412 */
|
||||
u32 ant_det_bt_tx_time;
|
||||
u32 ant_det_pre_psdscan_peak_val;
|
||||
boolean ant_det_is_ant_det_available;
|
||||
u32 ant_det_psd_scan_peak_val;
|
||||
boolean ant_det_is_btreply_available;
|
||||
u32 ant_det_psd_scan_peak_freq;
|
||||
|
||||
u8 ant_det_result;
|
||||
u8 ant_det_peak_val[BT_8821C_2ANT_ANTDET_BUF_LEN];
|
||||
u8 ant_det_peak_freq[BT_8821C_2ANT_ANTDET_BUF_LEN];
|
||||
u32 ant_det_try_count;
|
||||
u32 ant_det_fail_count;
|
||||
u32 ant_det_inteval_count;
|
||||
u32 ant_det_thres_offset;
|
||||
|
||||
u32 real_cent_freq;
|
||||
s32 real_offset;
|
||||
u32 real_span;
|
||||
|
||||
u32 psd_band_width; /* unit: Hz */
|
||||
u32 psd_point; /* 128/256/512/1024 */
|
||||
u32 psd_report[1024]; /* unit:dB (20logx), 0~255 */
|
||||
u32 psd_report_max_hold[1024]; /* unit:dB (20logx), 0~255 */
|
||||
u32 psd_start_point;
|
||||
u32 psd_stop_point;
|
||||
u32 psd_max_value_point;
|
||||
u32 psd_max_value;
|
||||
u32 psd_max_value2;
|
||||
u32 psd_avg_value; /* filter loop_max_value that below BT_8821C_1ANT_ANTDET_PSDTHRES_1ANT, and average the rest*/
|
||||
u32 psd_loop_max_value[BT_8821C_2ANT_ANTDET_PSD_SWWEEPCOUNT]; /*max value in each loop */
|
||||
u32 psd_start_base;
|
||||
u32 psd_avg_num; /* 1/8/16/32 */
|
||||
u32 psd_gen_count;
|
||||
boolean is_AntDet_running;
|
||||
boolean is_psd_show_max_only;
|
||||
};
|
||||
|
||||
|
||||
/* *******************************************
|
||||
* The following is interface which will notify coex module.
|
||||
* ******************************************* */
|
||||
void ex_halbtc8821c2ant_power_on_setting(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821c2ant_pre_load_firmware(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821c2ant_init_hw_config(IN struct btc_coexist *btcoexist,
|
||||
IN boolean wifi_only);
|
||||
void ex_halbtc8821c2ant_init_coex_dm(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821c2ant_ips_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821c2ant_lps_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821c2ant_scan_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821c2ant_switchband_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821c2ant_connect_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821c2ant_media_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821c2ant_specific_packet_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821c2ant_bt_info_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 *tmp_buf, IN u8 length);
|
||||
void ex_halbtc8821c2ant_rf_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8821c2ant_halt_notify(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821c2ant_pnp_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 pnp_state);
|
||||
void ex_halbtc8821c2ant_periodical(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821c2ant_display_coex_info(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8821c2ant_antenna_detection(IN struct btc_coexist *btcoexist,
|
||||
IN u32 cent_freq, IN u32 offset, IN u32 span, IN u32 seconds);
|
||||
void ex_halbtc8821c2ant_display_ant_detection(IN struct btc_coexist *btcoexist);
|
||||
|
||||
|
||||
#else
|
||||
#define ex_halbtc8821c2ant_power_on_setting(btcoexist)
|
||||
#define ex_halbtc8821c2ant_pre_load_firmware(btcoexist)
|
||||
#define ex_halbtc8821c2ant_init_hw_config(btcoexist, wifi_only)
|
||||
#define ex_halbtc8821c2ant_init_coex_dm(btcoexist)
|
||||
#define ex_halbtc8821c2ant_ips_notify(btcoexist, type)
|
||||
#define ex_halbtc8821c2ant_lps_notify(btcoexist, type)
|
||||
#define ex_halbtc8821c2ant_scan_notify(btcoexist, type)
|
||||
#define ex_halbtc8821c2ant_switchband_notify(btcoexist,type)
|
||||
#define ex_halbtc8821c2ant_connect_notify(btcoexist, type)
|
||||
#define ex_halbtc8821c2ant_media_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8821c2ant_specific_packet_notify(btcoexist, type)
|
||||
#define ex_halbtc8821c2ant_bt_info_notify(btcoexist, tmp_buf, length)
|
||||
#define ex_halbtc8821c2ant_rf_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8821c2ant_halt_notify(btcoexist)
|
||||
#define ex_halbtc8821c2ant_pnp_notify(btcoexist, pnp_state)
|
||||
#define ex_halbtc8821c2ant_periodical(btcoexist)
|
||||
#define ex_halbtc8821c2ant_display_coex_info(btcoexist)
|
||||
#define ex_halbtc8821c2ant_display_ant_detection(btcoexist)
|
||||
#define ex_halbtc8821c2ant_antenna_detection(btcoexist, cent_freq, offset, span, seconds)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
186
hal/btc/halbtc8821cwifionly.c
Executable file
186
hal/btc/halbtc8821cwifionly.c
Executable file
|
@ -0,0 +1,186 @@
|
|||
#include "mp_precomp.h"
|
||||
|
||||
static struct rfe_type_8821c_wifi_only gl_rfe_type_8821c_1ant;
|
||||
static struct rfe_type_8821c_wifi_only *rfe_type = &gl_rfe_type_8821c_1ant;
|
||||
|
||||
|
||||
|
||||
VOID hal8821c_wifi_only_switch_antenna(
|
||||
IN struct wifi_only_cfg *pwifionlycfg,
|
||||
IN u1Byte is_5g
|
||||
)
|
||||
{
|
||||
boolean switch_polatiry_inverse = false;
|
||||
u8 regval_0xcb7 = 0;
|
||||
u8 pos_type, ctrl_type;
|
||||
|
||||
if (!rfe_type->ext_ant_switch_exist)
|
||||
return;
|
||||
|
||||
/* swap control polarity if use different switch control polarity*/
|
||||
/* Normal switch polarity for DPDT, 0xcb4[29:28] = 2b'01 => BTG to Main, WLG to Aux, 0xcb4[29:28] = 2b'10 => BTG to Aux, WLG to Main */
|
||||
/* Normal switch polarity for SPDT, 0xcb4[29:28] = 2b'01 => Ant to BTG, 0xcb4[29:28] = 2b'10 => Ant to WLG */
|
||||
if (rfe_type->ext_ant_switch_ctrl_polarity)
|
||||
switch_polatiry_inverse = !switch_polatiry_inverse;
|
||||
|
||||
/* swap control polarity if 1-Ant at Aux */
|
||||
if (rfe_type->ant_at_main_port == false)
|
||||
switch_polatiry_inverse = !switch_polatiry_inverse;
|
||||
|
||||
if (is_5g)
|
||||
pos_type = BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_TO_WLA;
|
||||
else
|
||||
pos_type = BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_TO_WLG;
|
||||
|
||||
switch (pos_type) {
|
||||
default:
|
||||
case BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_TO_WLA:
|
||||
|
||||
break;
|
||||
case BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_TO_WLG:
|
||||
if (!rfe_type->wlg_Locate_at_btg)
|
||||
switch_polatiry_inverse = !switch_polatiry_inverse;
|
||||
break;
|
||||
}
|
||||
|
||||
if (pwifionlycfg->haldata_info.ant_div_cfg)
|
||||
ctrl_type = BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_CTRL_BY_ANTDIV;
|
||||
else
|
||||
ctrl_type = BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_CTRL_BY_BBSW;
|
||||
|
||||
|
||||
switch (ctrl_type) {
|
||||
default:
|
||||
case BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_CTRL_BY_BBSW:
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0x4c, 0x01800000, 0x2);
|
||||
|
||||
/* BB SW, DPDT use RFE_ctrl8 and RFE_ctrl9 as control pin */
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0xcb4, 0x000000ff, 0x77);
|
||||
|
||||
regval_0xcb7 = (switch_polatiry_inverse == false ? 0x1 : 0x2);
|
||||
|
||||
/* 0xcb4[29:28] = 2b'01 for no switch_polatiry_inverse, DPDT_SEL_N =1, DPDT_SEL_P =0 */
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0xcb4, 0x30000000, regval_0xcb7);
|
||||
break;
|
||||
|
||||
case BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_CTRL_BY_ANTDIV:
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0x4c, 0x01800000, 0x2);
|
||||
|
||||
/* BB SW, DPDT use RFE_ctrl8 and RFE_ctrl9 as control pin */
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0xcb4, 0x000000ff, 0x88);
|
||||
|
||||
/* no regval_0xcb7 setup required, because antenna switch control value by antenna diversity */
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
VOID halbtc8821c_wifi_only_set_rfe_type(
|
||||
IN struct wifi_only_cfg *pwifionlycfg
|
||||
)
|
||||
{
|
||||
|
||||
/* the following setup should be got from Efuse in the future */
|
||||
rfe_type->rfe_module_type = (pwifionlycfg->haldata_info.rfe_type) & 0x1f;
|
||||
|
||||
rfe_type->ext_ant_switch_ctrl_polarity = 0;
|
||||
|
||||
switch (rfe_type->rfe_module_type) {
|
||||
case 0:
|
||||
default:
|
||||
rfe_type->ext_ant_switch_exist = true;
|
||||
rfe_type->ext_ant_switch_type =
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_USE_DPDT; /*2-Ant, DPDT, WLG*/
|
||||
rfe_type->wlg_Locate_at_btg = false;
|
||||
rfe_type->ant_at_main_port = true;
|
||||
break;
|
||||
case 1:
|
||||
rfe_type->ext_ant_switch_exist = true;
|
||||
rfe_type->ext_ant_switch_type =
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_USE_SPDT; /*1-Ant, Main, DPDT or SPDT, WLG */
|
||||
rfe_type->wlg_Locate_at_btg = false;
|
||||
rfe_type->ant_at_main_port = true;
|
||||
break;
|
||||
case 2:
|
||||
rfe_type->ext_ant_switch_exist = true;
|
||||
rfe_type->ext_ant_switch_type =
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_USE_SPDT; /*1-Ant, Main, DPDT or SPDT, BTG */
|
||||
rfe_type->wlg_Locate_at_btg = true;
|
||||
rfe_type->ant_at_main_port = true;
|
||||
break;
|
||||
case 3:
|
||||
rfe_type->ext_ant_switch_exist = true;
|
||||
rfe_type->ext_ant_switch_type =
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_USE_DPDT; /*1-Ant, Aux, DPDT, WLG */
|
||||
rfe_type->wlg_Locate_at_btg = false;
|
||||
rfe_type->ant_at_main_port = false;
|
||||
break;
|
||||
case 4:
|
||||
rfe_type->ext_ant_switch_exist = true;
|
||||
rfe_type->ext_ant_switch_type =
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_USE_DPDT; /*1-Ant, Aux, DPDT, BTG */
|
||||
rfe_type->wlg_Locate_at_btg = true;
|
||||
rfe_type->ant_at_main_port = false;
|
||||
break;
|
||||
case 5:
|
||||
rfe_type->ext_ant_switch_exist = false; /*2-Ant, no antenna switch, WLG*/
|
||||
rfe_type->ext_ant_switch_type =
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_NONE;
|
||||
rfe_type->wlg_Locate_at_btg = false;
|
||||
rfe_type->ant_at_main_port = true;
|
||||
break;
|
||||
case 6:
|
||||
rfe_type->ext_ant_switch_exist = false; /*2-Ant, no antenna switch, WLG*/
|
||||
rfe_type->ext_ant_switch_type =
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_NONE;
|
||||
rfe_type->wlg_Locate_at_btg = false;
|
||||
rfe_type->ant_at_main_port = true;
|
||||
break;
|
||||
case 7:
|
||||
rfe_type->ext_ant_switch_exist = true; /*2-Ant, DPDT, BTG*/
|
||||
rfe_type->ext_ant_switch_type =
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_USE_DPDT;
|
||||
rfe_type->wlg_Locate_at_btg = true;
|
||||
rfe_type->ant_at_main_port = true;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
ex_hal8821c_wifi_only_hw_config(
|
||||
IN struct wifi_only_cfg *pwifionlycfg
|
||||
)
|
||||
{
|
||||
halbtc8821c_wifi_only_set_rfe_type(pwifionlycfg);
|
||||
|
||||
/* set gnt_wl, gnt_bt control owner to WL*/
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0x70, 0x400000, 0x1);
|
||||
|
||||
/*gnt_wl=1 , gnt_bt=0*/
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0x1704, 0xffffffff, 0x7700);
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0x1700, 0xffffffff, 0xc00f0038);
|
||||
}
|
||||
|
||||
VOID
|
||||
ex_hal8821c_wifi_only_scannotify(
|
||||
IN struct wifi_only_cfg *pwifionlycfg,
|
||||
IN u1Byte is_5g
|
||||
)
|
||||
{
|
||||
hal8821c_wifi_only_switch_antenna(pwifionlycfg, is_5g);
|
||||
}
|
||||
|
||||
VOID
|
||||
ex_hal8821c_wifi_only_switchbandnotify(
|
||||
IN struct wifi_only_cfg *pwifionlycfg,
|
||||
IN u1Byte is_5g
|
||||
)
|
||||
{
|
||||
hal8821c_wifi_only_switch_antenna(pwifionlycfg, is_5g);
|
||||
}
|
||||
|
70
hal/btc/halbtc8821cwifionly.h
Executable file
70
hal/btc/halbtc8821cwifionly.h
Executable file
|
@ -0,0 +1,70 @@
|
|||
#ifndef __INC_HAL8821CWIFIONLYHWCFG_H
|
||||
#define __INC_HAL8821CWIFIONLYHWCFG_H
|
||||
|
||||
|
||||
struct rfe_type_8821c_wifi_only {
|
||||
|
||||
u8 rfe_module_type;
|
||||
boolean ext_ant_switch_exist;
|
||||
u8 ext_ant_switch_type; /* 0:DPDT, 1:SPDT */
|
||||
u8 ext_ant_switch_ctrl_polarity; /* iF 0: DPDT_P=0, DPDT_N=1 => BTG to Main, WL_A+G to Aux */
|
||||
|
||||
boolean ant_at_main_port;
|
||||
|
||||
boolean wlg_Locate_at_btg; /* If true: WLG at BTG, If false: WLG at WLAG */
|
||||
|
||||
boolean ext_ant_switch_diversity; /* If diversity on */
|
||||
};
|
||||
|
||||
enum bt_8821c_wifi_only_ext_ant_switch_type {
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_USE_DPDT = 0x0,
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_USE_SPDT = 0x1,
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_NONE = 0x2,
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_wifi_only_ext_ant_switch_ctrl_type {
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_CTRL_BY_BBSW = 0x0,
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_CTRL_BY_PTA = 0x1,
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_CTRL_BY_ANTDIV = 0x2,
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_CTRL_BY_MAC = 0x3,
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_CTRL_BY_BT = 0x4,
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_CTRL_MAX
|
||||
};
|
||||
|
||||
enum bt_8821c_wifi_only_ext_ant_switch_pos_type {
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_TO_BT = 0x0,
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_TO_WLG = 0x1,
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_TO_WLA = 0x2,
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_TO_NOCARE = 0x3,
|
||||
BT_8821C_WIFI_ONLY_EXT_ANT_SWITCH_TO_MAX
|
||||
};
|
||||
|
||||
|
||||
VOID
|
||||
hal8821c_wifi_only_switch_antenna(
|
||||
IN struct wifi_only_cfg *pwifionlycfg,
|
||||
IN u1Byte is_5g
|
||||
);
|
||||
|
||||
VOID
|
||||
halbtc8821c_wifi_only_set_rfe_type(
|
||||
IN struct wifi_only_cfg *pwifionlycfg
|
||||
);
|
||||
|
||||
|
||||
VOID
|
||||
ex_hal8821c_wifi_only_hw_config(
|
||||
IN struct wifi_only_cfg *pwifionlycfg
|
||||
);
|
||||
VOID
|
||||
ex_hal8821c_wifi_only_scannotify(
|
||||
IN struct wifi_only_cfg *pwifionlycfg,
|
||||
IN u1Byte is_5g
|
||||
);
|
||||
VOID
|
||||
ex_hal8821c_wifi_only_switchbandnotify(
|
||||
IN struct wifi_only_cfg *pwifionlycfg,
|
||||
IN u1Byte is_5g
|
||||
);
|
||||
#endif
|
6840
hal/btc/halbtc8822b1ant.c
Normal file
6840
hal/btc/halbtc8822b1ant.c
Normal file
File diff suppressed because it is too large
Load diff
433
hal/btc/halbtc8822b1ant.h
Normal file
433
hal/btc/halbtc8822b1ant.h
Normal file
|
@ -0,0 +1,433 @@
|
|||
|
||||
#if (BT_SUPPORT == 1 && COEX_SUPPORT == 1)
|
||||
|
||||
#if (RTL8822B_SUPPORT == 1)
|
||||
|
||||
/* *******************************************
|
||||
* The following is for 8822B 1ANT BT Co-exist definition
|
||||
* ******************************************* */
|
||||
#define BT_AUTO_REPORT_ONLY_8822B_1ANT 1
|
||||
|
||||
#define BT_INFO_8822B_1ANT_B_FTP BIT(7)
|
||||
#define BT_INFO_8822B_1ANT_B_A2DP BIT(6)
|
||||
#define BT_INFO_8822B_1ANT_B_HID BIT(5)
|
||||
#define BT_INFO_8822B_1ANT_B_SCO_BUSY BIT(4)
|
||||
#define BT_INFO_8822B_1ANT_B_ACL_BUSY BIT(3)
|
||||
#define BT_INFO_8822B_1ANT_B_INQ_PAGE BIT(2)
|
||||
#define BT_INFO_8822B_1ANT_B_SCO_ESCO BIT(1)
|
||||
#define BT_INFO_8822B_1ANT_B_CONNECTION BIT(0)
|
||||
|
||||
#define BT_INFO_8822B_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_) \
|
||||
(((_BT_INFO_EXT_&BIT(0))) ? true : false)
|
||||
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8822B_1ANT 2
|
||||
|
||||
#define BT_8822B_1ANT_WIFI_NOISY_THRESH 150 /* max: 255 */
|
||||
|
||||
/* for Antenna detection */
|
||||
#define BT_8822B_1ANT_ANTDET_PSDTHRES_BACKGROUND 50
|
||||
#define BT_8822B_1ANT_ANTDET_PSDTHRES_2ANT_BADISOLATION 70
|
||||
#define BT_8822B_1ANT_ANTDET_PSDTHRES_2ANT_GOODISOLATION 55
|
||||
#define BT_8822B_1ANT_ANTDET_PSDTHRES_1ANT 35
|
||||
#define BT_8822B_1ANT_ANTDET_RETRY_INTERVAL 10 /* retry timer if ant det is fail, unit: second */
|
||||
#define BT_8822B_1ANT_ANTDET_ENABLE 0
|
||||
#define BT_8822B_1ANT_ANTDET_COEXMECHANISMSWITCH_ENABLE 0
|
||||
|
||||
#define BT_8822B_1ANT_LTECOEX_INDIRECTREG_ACCESS_TIMEOUT 30000
|
||||
|
||||
|
||||
|
||||
enum bt_8822b_1ant_signal_state {
|
||||
BT_8822B_1ANT_SIG_STA_SET_TO_LOW = 0x0,
|
||||
BT_8822B_1ANT_SIG_STA_SET_BY_HW = 0x0,
|
||||
BT_8822B_1ANT_SIG_STA_SET_TO_HIGH = 0x1,
|
||||
BT_8822B_1ANT_SIG_STA_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_1ant_path_ctrl_owner {
|
||||
BT_8822B_1ANT_PCO_BTSIDE = 0x0,
|
||||
BT_8822B_1ANT_PCO_WLSIDE = 0x1,
|
||||
BT_8822B_1ANT_PCO_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_1ant_gnt_ctrl_type {
|
||||
BT_8822B_1ANT_GNT_CTRL_BY_PTA = 0x0,
|
||||
BT_8822B_1ANT_GNT_CTRL_BY_SW = 0x1,
|
||||
BT_8822B_1ANT_GNT_CTRL_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_1ant_gnt_ctrl_block {
|
||||
BT_8822B_1ANT_GNT_BLOCK_RFC_BB = 0x0,
|
||||
BT_8822B_1ANT_GNT_BLOCK_RFC = 0x1,
|
||||
BT_8822B_1ANT_GNT_BLOCK_BB = 0x2,
|
||||
BT_8822B_1ANT_GNT_BLOCK_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_1ant_lte_coex_table_type {
|
||||
BT_8822B_1ANT_CTT_WL_VS_LTE = 0x0,
|
||||
BT_8822B_1ANT_CTT_BT_VS_LTE = 0x1,
|
||||
BT_8822B_1ANT_CTT_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_1ant_lte_break_table_type {
|
||||
BT_8822B_1ANT_LBTT_WL_BREAK_LTE = 0x0,
|
||||
BT_8822B_1ANT_LBTT_BT_BREAK_LTE = 0x1,
|
||||
BT_8822B_1ANT_LBTT_LTE_BREAK_WL = 0x2,
|
||||
BT_8822B_1ANT_LBTT_LTE_BREAK_BT = 0x3,
|
||||
BT_8822B_1ANT_LBTT_MAX
|
||||
};
|
||||
|
||||
enum bt_info_src_8822b_1ant {
|
||||
BT_INFO_SRC_8822B_1ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8822B_1ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8822B_1ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8822B_1ANT_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_1ant_bt_status {
|
||||
BT_8822B_1ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8822B_1ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8822B_1ANT_BT_STATUS_INQ_PAGE = 0x2,
|
||||
BT_8822B_1ANT_BT_STATUS_ACL_BUSY = 0x3,
|
||||
BT_8822B_1ANT_BT_STATUS_SCO_BUSY = 0x4,
|
||||
BT_8822B_1ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
|
||||
BT_8822B_1ANT_BT_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_1ant_wifi_status {
|
||||
BT_8822B_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8822B_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN = 0x1,
|
||||
BT_8822B_1ANT_WIFI_STATUS_CONNECTED_SCAN = 0x2,
|
||||
BT_8822B_1ANT_WIFI_STATUS_CONNECTED_SPECIFIC_PKT = 0x3,
|
||||
BT_8822B_1ANT_WIFI_STATUS_CONNECTED_IDLE = 0x4,
|
||||
BT_8822B_1ANT_WIFI_STATUS_CONNECTED_BUSY = 0x5,
|
||||
BT_8822B_1ANT_WIFI_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_1ant_coex_algo {
|
||||
BT_8822B_1ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8822B_1ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8822B_1ANT_COEX_ALGO_HID = 0x2,
|
||||
BT_8822B_1ANT_COEX_ALGO_A2DP = 0x3,
|
||||
BT_8822B_1ANT_COEX_ALGO_A2DP_PANHS = 0x4,
|
||||
BT_8822B_1ANT_COEX_ALGO_PANEDR = 0x5,
|
||||
BT_8822B_1ANT_COEX_ALGO_PANHS = 0x6,
|
||||
BT_8822B_1ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
|
||||
BT_8822B_1ANT_COEX_ALGO_PANEDR_HID = 0x8,
|
||||
BT_8822B_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
|
||||
BT_8822B_1ANT_COEX_ALGO_HID_A2DP = 0xa,
|
||||
BT_8822B_1ANT_COEX_ALGO_MAX = 0xb,
|
||||
};
|
||||
|
||||
enum bt_8822b_1ant_ext_ant_switch_type {
|
||||
BT_8822B_1ANT_EXT_ANT_SWITCH_USE_SPDT = 0x0,
|
||||
BT_8822B_1ANT_EXT_ANT_SWITCH_USE_SP3T = 0x1,
|
||||
BT_8822B_1ANT_EXT_ANT_SWITCH_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_1ant_ext_ant_switch_ctrl_type {
|
||||
BT_8822B_1ANT_EXT_ANT_SWITCH_CTRL_BY_BBSW = 0x0,
|
||||
BT_8822B_1ANT_EXT_ANT_SWITCH_CTRL_BY_PTA = 0x1,
|
||||
BT_8822B_1ANT_EXT_ANT_SWITCH_CTRL_BY_ANTDIV = 0x2,
|
||||
BT_8822B_1ANT_EXT_ANT_SWITCH_CTRL_BY_MAC = 0x3,
|
||||
BT_8822B_1ANT_EXT_ANT_SWITCH_CTRL_BY_BT = 0x4,
|
||||
BT_8822B_1ANT_EXT_ANT_SWITCH_CTRL_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_1ant_ext_ant_switch_pos_type {
|
||||
BT_8822B_1ANT_EXT_ANT_SWITCH_TO_BT = 0x0,
|
||||
BT_8822B_1ANT_EXT_ANT_SWITCH_TO_WLG = 0x1,
|
||||
BT_8822B_1ANT_EXT_ANT_SWITCH_TO_WLA = 0x2,
|
||||
BT_8822B_1ANT_EXT_ANT_SWITCH_TO_NOCARE = 0x3,
|
||||
BT_8822B_1ANT_EXT_ANT_SWITCH_TO_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_1ant_phase {
|
||||
BT_8822B_1ANT_PHASE_COEX_INIT = 0x0,
|
||||
BT_8822B_1ANT_PHASE_WLANONLY_INIT = 0x1,
|
||||
BT_8822B_1ANT_PHASE_WLAN_OFF = 0x2,
|
||||
BT_8822B_1ANT_PHASE_2G_RUNTIME = 0x3,
|
||||
BT_8822B_1ANT_PHASE_5G_RUNTIME = 0x4,
|
||||
BT_8822B_1ANT_PHASE_BTMPMODE = 0x5,
|
||||
BT_8822B_1ANT_PHASE_MAX
|
||||
};
|
||||
|
||||
/*ADD SCOREBOARD TO FIX BT LPS 32K ISSUE WHILE WL BUSY*/
|
||||
enum bt_8822b_1ant_Scoreboard {
|
||||
BT_8822B_1ANT_SCOREBOARD_ACTIVE = BIT(0),
|
||||
BT_8822B_1ANT_SCOREBOARD_ONOFF = BIT(1),
|
||||
BT_8822B_1ANT_SCOREBOARD_SCAN = BIT(2),
|
||||
BT_8822B_1ANT_SCOREBOARD_UNDERTEST = BIT(3),
|
||||
BT_8822B_1ANT_SCOREBOARD_WLBUSY = BIT(6)
|
||||
};
|
||||
|
||||
struct coex_dm_8822b_1ant {
|
||||
/* hw setting */
|
||||
u32 pre_ant_pos_type;
|
||||
u32 cur_ant_pos_type;
|
||||
/* fw mechanism */
|
||||
boolean cur_ignore_wlan_act;
|
||||
boolean pre_ignore_wlan_act;
|
||||
u8 pre_ps_tdma;
|
||||
u8 cur_ps_tdma;
|
||||
u8 ps_tdma_para[5];
|
||||
u8 ps_tdma_du_adj_type;
|
||||
boolean auto_tdma_adjust;
|
||||
boolean pre_ps_tdma_on;
|
||||
boolean cur_ps_tdma_on;
|
||||
boolean pre_bt_auto_report;
|
||||
boolean cur_bt_auto_report;
|
||||
u8 pre_lps;
|
||||
u8 cur_lps;
|
||||
u8 pre_rpwm;
|
||||
u8 cur_rpwm;
|
||||
|
||||
/* sw mechanism */
|
||||
boolean pre_low_penalty_ra;
|
||||
boolean cur_low_penalty_ra;
|
||||
u32 pre_val0x6c0;
|
||||
u32 cur_val0x6c0;
|
||||
u32 pre_val0x6c4;
|
||||
u32 cur_val0x6c4;
|
||||
u32 pre_val0x6c8;
|
||||
u32 cur_val0x6c8;
|
||||
u8 pre_val0x6cc;
|
||||
u8 cur_val0x6cc;
|
||||
boolean limited_dig;
|
||||
|
||||
u32 backup_arfr_cnt1; /* Auto Rate Fallback Retry cnt */
|
||||
u32 backup_arfr_cnt2; /* Auto Rate Fallback Retry cnt */
|
||||
u16 backup_retry_limit;
|
||||
u8 backup_ampdu_max_time;
|
||||
|
||||
/* algorithm related */
|
||||
u8 pre_algorithm;
|
||||
u8 cur_algorithm;
|
||||
u8 bt_status;
|
||||
u8 wifi_chnl_info[3];
|
||||
|
||||
u32 pre_ra_mask;
|
||||
u32 cur_ra_mask;
|
||||
u8 pre_arfr_type;
|
||||
u8 cur_arfr_type;
|
||||
u8 pre_retry_limit_type;
|
||||
u8 cur_retry_limit_type;
|
||||
u8 pre_ampdu_time_type;
|
||||
u8 cur_ampdu_time_type;
|
||||
u32 arp_cnt;
|
||||
|
||||
u32 pre_ext_ant_switch_status;
|
||||
u32 cur_ext_ant_switch_status;
|
||||
|
||||
u8 error_condition;
|
||||
};
|
||||
|
||||
struct coex_sta_8822b_1ant {
|
||||
boolean bt_disabled;
|
||||
boolean bt_link_exist;
|
||||
boolean sco_exist;
|
||||
boolean a2dp_exist;
|
||||
boolean hid_exist;
|
||||
boolean pan_exist;
|
||||
boolean bt_hi_pri_link_exist;
|
||||
u8 num_of_profile;
|
||||
|
||||
boolean under_lps;
|
||||
boolean under_ips;
|
||||
u32 specific_pkt_period_cnt;
|
||||
u32 high_priority_tx;
|
||||
u32 high_priority_rx;
|
||||
u32 low_priority_tx;
|
||||
u32 low_priority_rx;
|
||||
s8 bt_rssi;
|
||||
boolean bt_tx_rx_mask;
|
||||
u8 pre_bt_rssi_state;
|
||||
u8 pre_wifi_rssi_state[4];
|
||||
boolean c2h_bt_info_req_sent;
|
||||
u8 bt_info_c2h[BT_INFO_SRC_8822B_1ANT_MAX][10];
|
||||
u32 bt_info_c2h_cnt[BT_INFO_SRC_8822B_1ANT_MAX];
|
||||
boolean bt_whck_test;
|
||||
boolean c2h_bt_inquiry_page;
|
||||
boolean c2h_bt_page; /* Add for win8.1 page out issue */
|
||||
boolean wifi_is_high_pri_task; /* Add for win8.1 page out issue */
|
||||
u8 bt_retry_cnt;
|
||||
u8 bt_info_ext;
|
||||
u32 pop_event_cnt;
|
||||
u8 scan_ap_num;
|
||||
|
||||
u32 crc_ok_cck;
|
||||
u32 crc_ok_11g;
|
||||
u32 crc_ok_11n;
|
||||
u32 crc_ok_11n_agg;
|
||||
u32 crc_ok_11n_vht;
|
||||
|
||||
u32 crc_err_cck;
|
||||
u32 crc_err_11g;
|
||||
u32 crc_err_11n;
|
||||
u32 crc_err_11n_agg;
|
||||
u32 crc_err_11n_vht;
|
||||
|
||||
boolean cck_lock;
|
||||
boolean pre_ccklock;
|
||||
boolean cck_ever_lock;
|
||||
u8 coex_table_type;
|
||||
|
||||
boolean force_lps_on;
|
||||
u32 wrong_profile_notification;
|
||||
|
||||
boolean concurrent_rx_mode_on;
|
||||
|
||||
u32 special_pkt_period_cnt;
|
||||
|
||||
u16 score_board;
|
||||
|
||||
u8 a2dp_bit_pool;
|
||||
u8 cut_version;
|
||||
boolean acl_busy;
|
||||
boolean wl_rf_off_on_event;
|
||||
boolean bt_create_connection;
|
||||
boolean run_time_state;
|
||||
|
||||
u32 bt_coex_supported_feature;
|
||||
u32 bt_coex_supported_version;
|
||||
};
|
||||
|
||||
struct rfe_type_8822b_1ant {
|
||||
|
||||
u8 rfe_module_type;
|
||||
boolean ext_ant_switch_exist;
|
||||
u8 ext_ant_switch_type;
|
||||
u8 ext_ant_switch_ctrl_polarity; /* iF 0: ANTSW(rfe_sel9)=0, ANTSWB(rfe_sel8)=1 => Ant to BT/5G */
|
||||
};
|
||||
|
||||
|
||||
#define BT_8822B_1ANT_ANTDET_PSD_POINTS 256 /* MAX:1024 */
|
||||
#define BT_8822B_1ANT_ANTDET_PSD_AVGNUM 1 /* MAX:3 */
|
||||
#define BT_8822B_1ANT_ANTDET_BUF_LEN 16
|
||||
|
||||
struct psdscan_sta_8822b_1ant {
|
||||
|
||||
u32 ant_det_bt_le_channel; /* BT LE Channel ex:2412 */
|
||||
u32 ant_det_bt_tx_time;
|
||||
u32 ant_det_pre_psdscan_peak_val;
|
||||
boolean ant_det_is_ant_det_available;
|
||||
u32 ant_det_psd_scan_peak_val;
|
||||
boolean ant_det_is_btreply_available;
|
||||
u32 ant_det_psd_scan_peak_freq;
|
||||
|
||||
u8 ant_det_result;
|
||||
u8 ant_det_peak_val[BT_8822B_1ANT_ANTDET_BUF_LEN];
|
||||
u8 ant_det_peak_freq[BT_8822B_1ANT_ANTDET_BUF_LEN];
|
||||
u32 ant_det_try_count;
|
||||
u32 ant_det_fail_count;
|
||||
u32 ant_det_inteval_count;
|
||||
u32 ant_det_thres_offset;
|
||||
|
||||
u32 real_cent_freq;
|
||||
s32 real_offset;
|
||||
u32 real_span;
|
||||
|
||||
u32 psd_band_width; /* unit: Hz */
|
||||
u32 psd_point; /* 128/256/512/1024 */
|
||||
u32 psd_report[1024]; /* unit:dB (20logx), 0~255 */
|
||||
u32 psd_report_max_hold[1024]; /* unit:dB (20logx), 0~255 */
|
||||
u32 psd_start_point;
|
||||
u32 psd_stop_point;
|
||||
u32 psd_max_value_point;
|
||||
u32 psd_max_value;
|
||||
u32 psd_start_base;
|
||||
u32 psd_avg_num; /* 1/8/16/32 */
|
||||
u32 psd_gen_count;
|
||||
boolean is_psd_running;
|
||||
boolean is_psd_show_max_only;
|
||||
};
|
||||
|
||||
/* *******************************************
|
||||
* The following is interface which will notify coex module.
|
||||
* ******************************************* */
|
||||
void ex_halbtc8822b1ant_power_on_setting(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8822b1ant_pre_load_firmware(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8822b1ant_init_hw_config(IN struct btc_coexist *btcoexist,
|
||||
IN boolean wifi_only);
|
||||
void ex_halbtc8822b1ant_init_coex_dm(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8822b1ant_ips_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b1ant_lps_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b1ant_scan_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b1ant_scan_notify_without_bt(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b1ant_switchband_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b1ant_switchband_notify_without_bt(IN struct btc_coexist
|
||||
*btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b1ant_connect_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b1ant_media_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b1ant_specific_packet_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b1ant_bt_info_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 *tmp_buf, IN u8 length);
|
||||
void ex_halbtc8822b1ant_rf_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b1ant_halt_notify(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8822b1ant_pnp_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 pnp_state);
|
||||
void ex_halbtc8822b1ant_ScoreBoardStatusNotify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 *tmp_buf, IN u8 length);
|
||||
void ex_halbtc8822b1ant_coex_dm_reset(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8822b1ant_periodical(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8822b1ant_display_coex_info(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8822b1ant_antenna_detection(IN struct btc_coexist *btcoexist,
|
||||
IN u32 cent_freq, IN u32 offset, IN u32 span, IN u32 seconds);
|
||||
void ex_halbtc8822b1ant_antenna_isolation(IN struct btc_coexist *btcoexist,
|
||||
IN u32 cent_freq, IN u32 offset, IN u32 span, IN u32 seconds);
|
||||
|
||||
void ex_halbtc8822b1ant_psd_scan(IN struct btc_coexist *btcoexist,
|
||||
IN u32 cent_freq, IN u32 offset, IN u32 span, IN u32 seconds);
|
||||
void ex_halbtc8822b1ant_display_ant_detection(IN struct btc_coexist *btcoexist);
|
||||
|
||||
void ex_halbtc8822b1ant_dbg_control(IN struct btc_coexist *btcoexist,
|
||||
IN u8 op_code, IN u8 op_len, IN u8 *pdata);
|
||||
|
||||
#else
|
||||
#define ex_halbtc8822b1ant_power_on_setting(btcoexist)
|
||||
#define ex_halbtc8822b1ant_pre_load_firmware(btcoexist)
|
||||
#define ex_halbtc8822b1ant_init_hw_config(btcoexist, wifi_only)
|
||||
#define ex_halbtc8822b1ant_init_coex_dm(btcoexist)
|
||||
#define ex_halbtc8822b1ant_ips_notify(btcoexist, type)
|
||||
#define ex_halbtc8822b1ant_lps_notify(btcoexist, type)
|
||||
#define ex_halbtc8822b1ant_scan_notify(btcoexist, type)
|
||||
#define ex_halbtc8822b1ant_scan_notify_without_bt(btcoexist, type)
|
||||
#define ex_halbtc8822b1ant_switchband_notify(btcoexist, type)
|
||||
#define ex_halbtc8822b1ant_switchband_notify_without_bt(btcoexist, type)
|
||||
#define ex_halbtc8822b1ant_connect_notify(btcoexist, type)
|
||||
#define ex_halbtc8822b1ant_media_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8822b1ant_specific_packet_notify(btcoexist, type)
|
||||
#define ex_halbtc8822b1ant_bt_info_notify(btcoexist, tmp_buf, length)
|
||||
#define ex_halbtc8822b1ant_rf_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8822b1ant_halt_notify(btcoexist)
|
||||
#define ex_halbtc8822b1ant_pnp_notify(btcoexist, pnp_state)
|
||||
#define ex_halbtc8822b1ant_ScoreBoardStatusNotify(btcoexist, tmp_buf, length)
|
||||
#define ex_halbtc8822b1ant_coex_dm_reset(btcoexist)
|
||||
#define ex_halbtc8822b1ant_periodical(btcoexist)
|
||||
#define ex_halbtc8822b1ant_display_coex_info(btcoexist)
|
||||
#define ex_halbtc8822b1ant_antenna_detection(btcoexist, cent_freq, offset, span, seconds)
|
||||
#define ex_halbtc8822b1ant_antenna_isolation(btcoexist, cent_freq, offset, span, seconds)
|
||||
#define ex_halbtc8822b1ant_psd_scan(btcoexist, cent_freq, offset, span, seconds)
|
||||
#define ex_halbtc8822b1ant_display_ant_detection(btcoexist)
|
||||
#define ex_halbtc8822b1ant_dbg_control(btcoexist, op_code, op_len, pdata)
|
||||
#endif
|
||||
#else
|
||||
|
||||
void ex_halbtc8822b1ant_init_hw_config_without_bt(IN struct btc_coexist
|
||||
*btcoexist);
|
||||
void ex_halbtc8822b1ant_switch_band_without_bt(IN struct btc_coexist *btcoexist,
|
||||
IN boolean wifi_only_5g);
|
||||
|
||||
|
||||
#endif
|
||||
|
5543
hal/btc/halbtc8822b2ant.c
Normal file
5543
hal/btc/halbtc8822b2ant.c
Normal file
File diff suppressed because it is too large
Load diff
493
hal/btc/halbtc8822b2ant.h
Normal file
493
hal/btc/halbtc8822b2ant.h
Normal file
|
@ -0,0 +1,493 @@
|
|||
|
||||
#if (BT_SUPPORT == 1 && COEX_SUPPORT == 1)
|
||||
|
||||
#if (RTL8822B_SUPPORT == 1)
|
||||
|
||||
/* *******************************************
|
||||
* The following is for 8822B 2Ant BT Co-exist definition
|
||||
* ******************************************* */
|
||||
#define BT_8822B_2ANT_COEX_DBG 1
|
||||
#define BT_AUTO_REPORT_ONLY_8822B_2ANT 1
|
||||
|
||||
|
||||
|
||||
|
||||
#define BT_INFO_8822B_2ANT_B_FTP BIT(7)
|
||||
#define BT_INFO_8822B_2ANT_B_A2DP BIT(6)
|
||||
#define BT_INFO_8822B_2ANT_B_HID BIT(5)
|
||||
#define BT_INFO_8822B_2ANT_B_SCO_BUSY BIT(4)
|
||||
#define BT_INFO_8822B_2ANT_B_ACL_BUSY BIT(3)
|
||||
#define BT_INFO_8822B_2ANT_B_INQ_PAGE BIT(2)
|
||||
#define BT_INFO_8822B_2ANT_B_SCO_ESCO BIT(1)
|
||||
#define BT_INFO_8822B_2ANT_B_CONNECTION BIT(0)
|
||||
|
||||
#define BTC_RSSI_COEX_THRESH_TOL_8822B_2ANT 2
|
||||
|
||||
|
||||
#define BT_8822B_2ANT_WIFI_RSSI_COEXSWITCH_THRES1 80 /* unit: % WiFi RSSI Threshold for 2-Ant free-run/2-Ant TDMA translation, default = 42 */
|
||||
#define BT_8822B_2ANT_BT_RSSI_COEXSWITCH_THRES1 80 /* unit: % BT RSSI Threshold for 2-Ant free-run/2-Ant TDMA translation, default = 46 */
|
||||
#define BT_8822B_2ANT_WIFI_RSSI_COEXSWITCH_THRES2 40 /* unit: % WiFi RSSI Threshold for 1-Ant TDMA/1-Ant PS-TDMA translation, default = 42 */
|
||||
#define BT_8822B_2ANT_BT_RSSI_COEXSWITCH_THRES2 35 /* unit: % BT RSSI Threshold for 1-Ant TDMA/1-Ant PS-TDMA translation, default = 46 */
|
||||
#define BT_8822B_2ANT_DEFAULT_ISOLATION 15 /* unit: dB */
|
||||
#define BT_8822B_2ANT_WIFI_MAX_TX_POWER 15 /* unit: dBm */
|
||||
#define BT_8822B_2ANT_BT_MAX_TX_POWER 3 /* unit: dBm */
|
||||
#define BT_8822B_2ANT_WIFI_SIR_THRES1 -15 /* unit: dB */
|
||||
#define BT_8822B_2ANT_WIFI_SIR_THRES2 -30 /* unit: dB */
|
||||
#define BT_8822B_2ANT_BT_SIR_THRES1 -15 /* unit: dB */
|
||||
#define BT_8822B_2ANT_BT_SIR_THRES2 -30 /* unit: dB */
|
||||
|
||||
|
||||
/* for Antenna detection */
|
||||
#define BT_8822B_2ANT_ANTDET_PSDTHRES_BACKGROUND 50
|
||||
#define BT_8822B_2ANT_ANTDET_PSDTHRES_2ANT_BADISOLATION 70
|
||||
#define BT_8822B_2ANT_ANTDET_PSDTHRES_2ANT_GOODISOLATION 52
|
||||
#define BT_8822B_2ANT_ANTDET_PSDTHRES_1ANT 40
|
||||
#define BT_8822B_2ANT_ANTDET_RETRY_INTERVAL 10 /* retry timer if ant det is fail, unit: second */
|
||||
#define BT_8822B_2ANT_ANTDET_SWEEPPOINT_DELAY 60000
|
||||
#define BT_8822B_2ANT_ANTDET_ENABLE 0
|
||||
#define BT_8822B_2ANT_ANTDET_BTTXTIME 100
|
||||
#define BT_8822B_2ANT_ANTDET_BTTXCHANNEL 39
|
||||
#define BT_8822B_2ANT_ANTDET_PSD_SWWEEPCOUNT 50
|
||||
|
||||
|
||||
#define BT_8822B_2ANT_LTECOEX_INDIRECTREG_ACCESS_TIMEOUT 30000
|
||||
|
||||
enum bt_8822b_2ant_signal_state {
|
||||
BT_8822B_2ANT_SIG_STA_SET_TO_LOW = 0x0,
|
||||
BT_8822B_2ANT_SIG_STA_SET_BY_HW = 0x0,
|
||||
BT_8822B_2ANT_SIG_STA_SET_TO_HIGH = 0x1,
|
||||
BT_8822B_2ANT_SIG_STA_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_2ant_path_ctrl_owner {
|
||||
BT_8822B_2ANT_PCO_BTSIDE = 0x0,
|
||||
BT_8822B_2ANT_PCO_WLSIDE = 0x1,
|
||||
BT_8822B_2ANT_PCO_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_2ant_gnt_ctrl_type {
|
||||
BT_8822B_2ANT_GNT_TYPE_CTRL_BY_PTA = 0x0,
|
||||
BT_8822B_2ANT_GNT_TYPE_CTRL_BY_SW = 0x1,
|
||||
BT_8822B_2ANT_GNT_TYPE_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_2ant_gnt_ctrl_block {
|
||||
BT_8822B_2ANT_GNT_BLOCK_RFC_BB = 0x0,
|
||||
BT_8822B_2ANT_GNT_BLOCK_RFC = 0x1,
|
||||
BT_8822B_2ANT_GNT_BLOCK_BB = 0x2,
|
||||
BT_8822B_2ANT_GNT_BLOCK_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_2ant_lte_coex_table_type {
|
||||
BT_8822B_2ANT_CTT_WL_VS_LTE = 0x0,
|
||||
BT_8822B_2ANT_CTT_BT_VS_LTE = 0x1,
|
||||
BT_8822B_2ANT_CTT_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_2ant_lte_break_table_type {
|
||||
BT_8822B_2ANT_LBTT_WL_BREAK_LTE = 0x0,
|
||||
BT_8822B_2ANT_LBTT_BT_BREAK_LTE = 0x1,
|
||||
BT_8822B_2ANT_LBTT_LTE_BREAK_WL = 0x2,
|
||||
BT_8822B_2ANT_LBTT_LTE_BREAK_BT = 0x3,
|
||||
BT_8822B_2ANT_LBTT_MAX
|
||||
};
|
||||
|
||||
enum bt_info_src_8822b_2ant {
|
||||
BT_INFO_SRC_8822B_2ANT_WIFI_FW = 0x0,
|
||||
BT_INFO_SRC_8822B_2ANT_BT_RSP = 0x1,
|
||||
BT_INFO_SRC_8822B_2ANT_BT_ACTIVE_SEND = 0x2,
|
||||
BT_INFO_SRC_8822B_2ANT_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_2ant_bt_status {
|
||||
BT_8822B_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0,
|
||||
BT_8822B_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1,
|
||||
BT_8822B_2ANT_BT_STATUS_INQ_PAGE = 0x2,
|
||||
BT_8822B_2ANT_BT_STATUS_ACL_BUSY = 0x3,
|
||||
BT_8822B_2ANT_BT_STATUS_SCO_BUSY = 0x4,
|
||||
BT_8822B_2ANT_BT_STATUS_ACL_SCO_BUSY = 0x5,
|
||||
BT_8822B_2ANT_BT_STATUS_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_2ant_coex_algo {
|
||||
BT_8822B_2ANT_COEX_ALGO_UNDEFINED = 0x0,
|
||||
BT_8822B_2ANT_COEX_ALGO_SCO = 0x1,
|
||||
BT_8822B_2ANT_COEX_ALGO_HID = 0x2,
|
||||
BT_8822B_2ANT_COEX_ALGO_A2DP = 0x3,
|
||||
BT_8822B_2ANT_COEX_ALGO_A2DP_PANHS = 0x4,
|
||||
BT_8822B_2ANT_COEX_ALGO_PANEDR = 0x5,
|
||||
BT_8822B_2ANT_COEX_ALGO_PANHS = 0x6,
|
||||
BT_8822B_2ANT_COEX_ALGO_PANEDR_A2DP = 0x7,
|
||||
BT_8822B_2ANT_COEX_ALGO_PANEDR_HID = 0x8,
|
||||
BT_8822B_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9,
|
||||
BT_8822B_2ANT_COEX_ALGO_HID_A2DP = 0xa,
|
||||
BT_8822B_2ANT_COEX_ALGO_NOPROFILEBUSY = 0xb,
|
||||
BT_8822B_2ANT_COEX_ALGO_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_2ant_ext_ant_switch_type {
|
||||
BT_8822B_2ANT_EXT_ANT_SWITCH_USE_DPDT = 0x0,
|
||||
BT_8822B_2ANT_EXT_ANT_SWITCH_USE_SPDT = 0x1,
|
||||
BT_8822B_2ANT_EXT_ANT_SWITCH_NONE = 0x2,
|
||||
BT_8822B_2ANT_EXT_ANT_SWITCH_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_2ant_ext_ant_switch_ctrl_type {
|
||||
BT_8822B_2ANT_EXT_ANT_SWITCH_CTRL_BY_BBSW = 0x0,
|
||||
BT_8822B_2ANT_EXT_ANT_SWITCH_CTRL_BY_PTA = 0x1,
|
||||
BT_8822B_2ANT_EXT_ANT_SWITCH_CTRL_BY_ANTDIV = 0x2,
|
||||
BT_8822B_2ANT_EXT_ANT_SWITCH_CTRL_BY_MAC = 0x3,
|
||||
BT_8822B_2ANT_EXT_ANT_SWITCH_CTRL_BY_BT = 0x4,
|
||||
BT_8822B_2ANT_EXT_ANT_SWITCH_CTRL_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_2ant_ext_ant_switch_pos_type {
|
||||
BT_8822B_2ANT_EXT_ANT_SWITCH_MAIN_TO_BT = 0x0,
|
||||
BT_8822B_2ANT_EXT_ANT_SWITCH_MAIN_TO_WLG = 0x1,
|
||||
BT_8822B_2ANT_EXT_ANT_SWITCH_MAIN_TO_WLA = 0x2,
|
||||
BT_8822B_2ANT_EXT_ANT_SWITCH_MAIN_TO_NOCARE = 0x3,
|
||||
BT_8822B_2ANT_EXT_ANT_SWITCH_MAIN_TO_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_2ant_ext_band_switch_pos_type {
|
||||
BT_8822B_2ANT_EXT_BAND_SWITCH_TO_WLG = 0x0,
|
||||
BT_8822B_2ANT_EXT_BAND_SWITCH_TO_WLA = 0x1,
|
||||
BT_8822B_2ANT_EXT_BAND_SWITCH_TO_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_2ant_int_block {
|
||||
BT_8822B_2ANT_INT_BLOCK_SWITCH_TO_WLG_OF_BTG = 0x0,
|
||||
BT_8822B_2ANT_INT_BLOCK_SWITCH_TO_WLG_OF_WLAG = 0x1,
|
||||
BT_8822B_2ANT_INT_BLOCK_SWITCH_TO_WLA_OF_WLAG = 0x2,
|
||||
BT_8822B_2ANT_INT_BLOCK_SWITCH_TO_MAX
|
||||
};
|
||||
|
||||
enum bt_8822b_2ant_phase {
|
||||
BT_8822B_2ANT_PHASE_COEX_INIT = 0x0,
|
||||
BT_8822B_2ANT_PHASE_WLANONLY_INIT = 0x1,
|
||||
BT_8822B_2ANT_PHASE_WLAN_OFF = 0x2,
|
||||
BT_8822B_2ANT_PHASE_2G_RUNTIME = 0x3,
|
||||
BT_8822B_2ANT_PHASE_5G_RUNTIME = 0x4,
|
||||
BT_8822B_2ANT_PHASE_BTMPMODE = 0x5,
|
||||
BT_8822B_2ANT_PHASE_ANTENNA_DET = 0x6,
|
||||
BT_8822B_2ANT_PHASE_COEX_POWERON = 0x7,
|
||||
BT_8822B_2ANT_PHASE_2G_RUNTIME_CONCURRENT = 0x8,
|
||||
BT_8822B_2ANT_PHASE_MAX
|
||||
};
|
||||
|
||||
/*ADD SCOREBOARD TO FIX BT LPS 32K ISSUE WHILE WL BUSY*/
|
||||
|
||||
enum bt_8822b_2ant_Scoreboard {
|
||||
BT_8822B_2ANT_SCOREBOARD_ACTIVE = BIT(0),
|
||||
BT_8822B_2ANT_SCOREBOARD_ONOFF = BIT(1),
|
||||
BT_8822B_2ANT_SCOREBOARD_SCAN = BIT(2),
|
||||
BT_8822B_2ANT_SCOREBOARD_UNDERTEST = BIT(3),
|
||||
BT_8822B_2ANT_SCOREBOARD_WLBUSY = BIT(6)
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
struct coex_dm_8822b_2ant {
|
||||
/* hw setting */
|
||||
u32 pre_ant_pos_type;
|
||||
u32 cur_ant_pos_type;
|
||||
/* fw mechanism */
|
||||
u8 pre_bt_dec_pwr_lvl;
|
||||
u8 cur_bt_dec_pwr_lvl;
|
||||
u8 pre_fw_dac_swing_lvl;
|
||||
u8 cur_fw_dac_swing_lvl;
|
||||
boolean cur_ignore_wlan_act;
|
||||
boolean pre_ignore_wlan_act;
|
||||
u8 pre_ps_tdma;
|
||||
u8 cur_ps_tdma;
|
||||
u8 ps_tdma_para[5];
|
||||
u8 ps_tdma_du_adj_type;
|
||||
boolean reset_tdma_adjust;
|
||||
boolean pre_ps_tdma_on;
|
||||
boolean cur_ps_tdma_on;
|
||||
boolean pre_bt_auto_report;
|
||||
boolean cur_bt_auto_report;
|
||||
|
||||
/* sw mechanism */
|
||||
boolean pre_rf_rx_lpf_shrink;
|
||||
boolean cur_rf_rx_lpf_shrink;
|
||||
u32 bt_rf_0x1e_backup;
|
||||
boolean pre_low_penalty_ra;
|
||||
boolean cur_low_penalty_ra;
|
||||
boolean pre_dac_swing_on;
|
||||
u32 pre_dac_swing_lvl;
|
||||
boolean cur_dac_swing_on;
|
||||
u32 cur_dac_swing_lvl;
|
||||
boolean pre_adc_back_off;
|
||||
boolean cur_adc_back_off;
|
||||
boolean pre_agc_table_en;
|
||||
boolean cur_agc_table_en;
|
||||
u32 pre_val0x6c0;
|
||||
u32 cur_val0x6c0;
|
||||
u32 pre_val0x6c4;
|
||||
u32 cur_val0x6c4;
|
||||
u32 pre_val0x6c8;
|
||||
u32 cur_val0x6c8;
|
||||
u8 pre_val0x6cc;
|
||||
u8 cur_val0x6cc;
|
||||
boolean limited_dig;
|
||||
|
||||
/* algorithm related */
|
||||
u8 pre_algorithm;
|
||||
u8 cur_algorithm;
|
||||
u8 bt_status;
|
||||
u8 wifi_chnl_info[3];
|
||||
|
||||
boolean need_recover0x948;
|
||||
u32 backup0x948;
|
||||
|
||||
u8 pre_lps;
|
||||
u8 cur_lps;
|
||||
u8 pre_rpwm;
|
||||
u8 cur_rpwm;
|
||||
|
||||
boolean is_switch_to_1dot5_ant;
|
||||
u8 switch_thres_offset;
|
||||
u32 arp_cnt;
|
||||
|
||||
u32 pre_ext_ant_switch_status;
|
||||
u32 cur_ext_ant_switch_status;
|
||||
|
||||
u8 pre_ext_band_switch_status;
|
||||
u8 cur_ext_band_switch_status;
|
||||
|
||||
u8 pre_int_block_status;
|
||||
u8 cur_int_block_status;
|
||||
};
|
||||
|
||||
struct coex_sta_8822b_2ant {
|
||||
boolean bt_disabled;
|
||||
boolean bt_link_exist;
|
||||
boolean sco_exist;
|
||||
boolean a2dp_exist;
|
||||
boolean hid_exist;
|
||||
boolean pan_exist;
|
||||
|
||||
boolean under_lps;
|
||||
boolean under_ips;
|
||||
u32 high_priority_tx;
|
||||
u32 high_priority_rx;
|
||||
u32 low_priority_tx;
|
||||
u32 low_priority_rx;
|
||||
u8 bt_rssi;
|
||||
boolean bt_tx_rx_mask;
|
||||
u8 pre_bt_rssi_state;
|
||||
u8 pre_wifi_rssi_state[4];
|
||||
boolean c2h_bt_info_req_sent;
|
||||
u8 bt_info_c2h[BT_INFO_SRC_8822B_2ANT_MAX][10];
|
||||
u32 bt_info_c2h_cnt[BT_INFO_SRC_8822B_2ANT_MAX];
|
||||
boolean bt_whck_test;
|
||||
boolean c2h_bt_inquiry_page;
|
||||
boolean c2h_bt_remote_name_req;
|
||||
u8 bt_retry_cnt;
|
||||
u8 bt_info_ext;
|
||||
u8 bt_info_ext2;
|
||||
u32 pop_event_cnt;
|
||||
u8 scan_ap_num;
|
||||
|
||||
u32 crc_ok_cck;
|
||||
u32 crc_ok_11g;
|
||||
u32 crc_ok_11n;
|
||||
u32 crc_ok_11n_agg;
|
||||
u32 crc_ok_11n_vht;
|
||||
|
||||
u32 crc_err_cck;
|
||||
u32 crc_err_11g;
|
||||
u32 crc_err_11n;
|
||||
u32 crc_err_11n_agg;
|
||||
u32 crc_err_11n_vht;
|
||||
|
||||
boolean cck_lock;
|
||||
boolean pre_ccklock;
|
||||
boolean cck_ever_lock;
|
||||
|
||||
u8 coex_table_type;
|
||||
boolean force_lps_on;
|
||||
|
||||
u8 dis_ver_info_cnt;
|
||||
|
||||
u8 a2dp_bit_pool;
|
||||
u8 cut_version;
|
||||
|
||||
boolean concurrent_rx_mode_on;
|
||||
|
||||
u16 score_board;
|
||||
u8 isolation_btween_wb; /* 0~ 50 */
|
||||
u8 wifi_coex_thres;
|
||||
u8 bt_coex_thres;
|
||||
u8 wifi_coex_thres2;
|
||||
u8 bt_coex_thres2;
|
||||
|
||||
u8 num_of_profile;
|
||||
boolean acl_busy;
|
||||
boolean wl_rf_off_on_event;
|
||||
boolean bt_create_connection;
|
||||
boolean wifi_is_high_pri_task;
|
||||
u32 specific_pkt_period_cnt;
|
||||
u32 bt_coex_supported_feature;
|
||||
u32 bt_coex_supported_version;
|
||||
|
||||
u8 bt_ble_scan_type;
|
||||
u8 bt_ble_scan_para[3];
|
||||
|
||||
boolean run_time_state;
|
||||
boolean freeze_coexrun_by_btinfo;
|
||||
|
||||
boolean is_A2DP_3M;
|
||||
boolean voice_over_HOGP;
|
||||
u8 bt_info;
|
||||
boolean is_autoslot;
|
||||
u8 forbidden_slot;
|
||||
u8 hid_busy_num;
|
||||
u8 hid_pair_cnt;
|
||||
|
||||
u32 cnt_RemoteNameReq;
|
||||
u32 cnt_setupLink;
|
||||
u32 cnt_ReInit;
|
||||
u32 cnt_IgnWlanAct;
|
||||
u32 cnt_Page;
|
||||
|
||||
u16 bt_reg_vendor_ac;
|
||||
u16 bt_reg_vendor_ae;
|
||||
|
||||
boolean is_setupLink;
|
||||
u8 wl_noisy_level;
|
||||
u32 gnt_error_cnt;
|
||||
|
||||
u8 bt_afh_map[10];
|
||||
u8 bt_relink_downcount;
|
||||
};
|
||||
|
||||
|
||||
#define BT_8822B_2ANT_EXT_BAND_SWITCH_USE_DPDT 0
|
||||
#define BT_8822B_2ANT_EXT_BAND_SWITCH_USE_SPDT 1
|
||||
|
||||
|
||||
struct rfe_type_8822b_2ant {
|
||||
|
||||
u8 rfe_module_type;
|
||||
boolean ext_ant_switch_exist;
|
||||
u8 ext_ant_switch_type; /* 0:DPDT, 1:SPDT */
|
||||
u8 ext_ant_switch_ctrl_polarity; /* iF 0: DPDT_P=0, DPDT_N=1 => BTG to Main, WL_A+G to Aux */
|
||||
|
||||
boolean ext_band_switch_exist;
|
||||
u8 ext_band_switch_type; /* 0:DPDT, 1:SPDT */
|
||||
u8 ext_band_switch_ctrl_polarity;
|
||||
|
||||
boolean wlg_Locate_at_btg; /* If true: WLG at BTG, If false: WLG at WLAG */
|
||||
|
||||
boolean ext_ant_switch_diversity; /* If diversity on */
|
||||
};
|
||||
|
||||
#define BT_8822B_2ANT_ANTDET_PSD_POINTS 256 /* MAX:1024 */
|
||||
#define BT_8822B_2ANT_ANTDET_PSD_AVGNUM 1 /* MAX:3 */
|
||||
#define BT_8822B_2ANT_ANTDET_BUF_LEN 16
|
||||
|
||||
struct psdscan_sta_8822b_2ant {
|
||||
|
||||
u32 ant_det_bt_le_channel; /* BT LE Channel ex:2412 */
|
||||
u32 ant_det_bt_tx_time;
|
||||
u32 ant_det_pre_psdscan_peak_val;
|
||||
boolean ant_det_is_ant_det_available;
|
||||
u32 ant_det_psd_scan_peak_val;
|
||||
boolean ant_det_is_btreply_available;
|
||||
u32 ant_det_psd_scan_peak_freq;
|
||||
|
||||
u8 ant_det_result;
|
||||
u8 ant_det_peak_val[BT_8822B_2ANT_ANTDET_BUF_LEN];
|
||||
u8 ant_det_peak_freq[BT_8822B_2ANT_ANTDET_BUF_LEN];
|
||||
u32 ant_det_try_count;
|
||||
u32 ant_det_fail_count;
|
||||
u32 ant_det_inteval_count;
|
||||
u32 ant_det_thres_offset;
|
||||
|
||||
u32 real_cent_freq;
|
||||
s32 real_offset;
|
||||
u32 real_span;
|
||||
|
||||
u32 psd_band_width; /* unit: Hz */
|
||||
u32 psd_point; /* 128/256/512/1024 */
|
||||
u32 psd_report[1024]; /* unit:dB (20logx), 0~255 */
|
||||
u32 psd_report_max_hold[1024]; /* unit:dB (20logx), 0~255 */
|
||||
u32 psd_start_point;
|
||||
u32 psd_stop_point;
|
||||
u32 psd_max_value_point;
|
||||
u32 psd_max_value;
|
||||
u32 psd_max_value2;
|
||||
u32 psd_avg_value; /* filter loop_max_value that below BT_8822B_1ANT_ANTDET_PSDTHRES_1ANT, and average the rest*/
|
||||
u32 psd_loop_max_value[BT_8822B_2ANT_ANTDET_PSD_SWWEEPCOUNT]; /*max value in each loop */
|
||||
u32 psd_start_base;
|
||||
u32 psd_avg_num; /* 1/8/16/32 */
|
||||
u32 psd_gen_count;
|
||||
boolean is_AntDet_running;
|
||||
boolean is_psd_show_max_only;
|
||||
};
|
||||
|
||||
|
||||
/* *******************************************
|
||||
* The following is interface which will notify coex module.
|
||||
* ******************************************* */
|
||||
void ex_halbtc8822b2ant_power_on_setting(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8822b2ant_pre_load_firmware(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8822b2ant_init_hw_config(IN struct btc_coexist *btcoexist,
|
||||
IN boolean wifi_only);
|
||||
void ex_halbtc8822b2ant_init_coex_dm(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8822b2ant_ips_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b2ant_lps_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b2ant_scan_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b2ant_switchband_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b2ant_connect_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b2ant_media_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b2ant_specific_packet_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b2ant_bt_info_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 *tmp_buf, IN u8 length);
|
||||
void ex_halbtc8822b2ant_rf_status_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 type);
|
||||
void ex_halbtc8822b2ant_halt_notify(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8822b2ant_pnp_notify(IN struct btc_coexist *btcoexist,
|
||||
IN u8 pnp_state);
|
||||
void ex_halbtc8822b2ant_periodical(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8822b2ant_display_coex_info(IN struct btc_coexist *btcoexist);
|
||||
void ex_halbtc8822b2ant_antenna_detection(IN struct btc_coexist *btcoexist,
|
||||
IN u32 cent_freq, IN u32 offset, IN u32 span, IN u32 seconds);
|
||||
void ex_halbtc8822b2ant_display_ant_detection(IN struct btc_coexist *btcoexist);
|
||||
|
||||
|
||||
#else
|
||||
#define ex_halbtc8822b2ant_power_on_setting(btcoexist)
|
||||
#define ex_halbtc8822b2ant_pre_load_firmware(btcoexist)
|
||||
#define ex_halbtc8822b2ant_init_hw_config(btcoexist, wifi_only)
|
||||
#define ex_halbtc8822b2ant_init_coex_dm(btcoexist)
|
||||
#define ex_halbtc8822b2ant_ips_notify(btcoexist, type)
|
||||
#define ex_halbtc8822b2ant_lps_notify(btcoexist, type)
|
||||
#define ex_halbtc8822b2ant_scan_notify(btcoexist, type)
|
||||
#define ex_halbtc8822b2ant_switchband_notify(btcoexist, type)
|
||||
#define ex_halbtc8822b2ant_connect_notify(btcoexist, type)
|
||||
#define ex_halbtc8822b2ant_media_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8822b2ant_specific_packet_notify(btcoexist, type)
|
||||
#define ex_halbtc8822b2ant_bt_info_notify(btcoexist, tmp_buf, length)
|
||||
#define ex_halbtc8822b2ant_rf_status_notify(btcoexist, type)
|
||||
#define ex_halbtc8822b2ant_halt_notify(btcoexist)
|
||||
#define ex_halbtc8822b2ant_pnp_notify(btcoexist, pnp_state)
|
||||
#define ex_halbtc8822b2ant_periodical(btcoexist)
|
||||
#define ex_halbtc8822b2ant_display_coex_info(btcoexist)
|
||||
#define ex_halbtc8822b2ant_display_ant_detection(btcoexist)
|
||||
#define ex_halbtc8822b2ant_antenna_detection(btcoexist, cent_freq, offset, span, seconds)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
54
hal/btc/halbtc8822bwifionly.c
Normal file
54
hal/btc/halbtc8822bwifionly.c
Normal file
|
@ -0,0 +1,54 @@
|
|||
#include "mp_precomp.h"
|
||||
|
||||
|
||||
VOID
|
||||
ex_hal8822b_wifi_only_hw_config(
|
||||
IN struct wifi_only_cfg *pwifionlycfg
|
||||
)
|
||||
{
|
||||
/*BB control*/
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0x4c, 0x01800000, 0x2);
|
||||
/*SW control*/
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0xcb4, 0xff, 0x77);
|
||||
/*antenna mux switch */
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0x974, 0x300, 0x3);
|
||||
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0x1990, 0x300, 0x0);
|
||||
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0xcbc, 0x80000, 0x0);
|
||||
/*switch to WL side controller and gnt_wl gnt_bt debug signal */
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0x70, 0xff000000, 0x0e);
|
||||
/*gnt_wl=1 , gnt_bt=0*/
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0x1704, 0xffffffff, 0x7700);
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0x1700, 0xffffffff, 0xc00f0038);
|
||||
}
|
||||
|
||||
VOID
|
||||
ex_hal8822b_wifi_only_scannotify(
|
||||
IN struct wifi_only_cfg *pwifionlycfg,
|
||||
IN u1Byte is_5g
|
||||
)
|
||||
{
|
||||
hal8822b_wifi_only_switch_antenna(pwifionlycfg, is_5g);
|
||||
}
|
||||
|
||||
VOID
|
||||
ex_hal8822b_wifi_only_switchbandnotify(
|
||||
IN struct wifi_only_cfg *pwifionlycfg,
|
||||
IN u1Byte is_5g
|
||||
)
|
||||
{
|
||||
hal8822b_wifi_only_switch_antenna(pwifionlycfg, is_5g);
|
||||
}
|
||||
|
||||
VOID
|
||||
hal8822b_wifi_only_switch_antenna(IN struct wifi_only_cfg *pwifionlycfg,
|
||||
IN u1Byte is_5g
|
||||
)
|
||||
{
|
||||
|
||||
if (is_5g)
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0xcbc, 0x300, 0x1);
|
||||
else
|
||||
halwifionly_phy_set_bb_reg(pwifionlycfg, 0xcbc, 0x300, 0x2);
|
||||
}
|
22
hal/btc/halbtc8822bwifionly.h
Normal file
22
hal/btc/halbtc8822bwifionly.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
#ifndef __INC_HAL8822BWIFIONLYHWCFG_H
|
||||
#define __INC_HAL8822BWIFIONLYHWCFG_H
|
||||
|
||||
VOID
|
||||
ex_hal8822b_wifi_only_hw_config(
|
||||
IN struct wifi_only_cfg *pwifionlycfg
|
||||
);
|
||||
VOID
|
||||
ex_hal8822b_wifi_only_scannotify(
|
||||
IN struct wifi_only_cfg *pwifionlycfg,
|
||||
IN u1Byte is_5g
|
||||
);
|
||||
VOID
|
||||
ex_hal8822b_wifi_only_switchbandnotify(
|
||||
IN struct wifi_only_cfg *pwifionlycfg,
|
||||
IN u1Byte is_5g
|
||||
);
|
||||
VOID
|
||||
hal8822b_wifi_only_switch_antenna(IN struct wifi_only_cfg *pwifionlycfg,
|
||||
IN u1Byte is_5g
|
||||
);
|
||||
#endif
|
1003
hal/btc/halbtcoutsrc.h
Normal file
1003
hal/btc/halbtcoutsrc.h
Normal file
File diff suppressed because it is too large
Load diff
90
hal/btc/mp_precomp.h
Normal file
90
hal/btc/mp_precomp.h
Normal file
|
@ -0,0 +1,90 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2013 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __MP_PRECOMP_H__
|
||||
#define __MP_PRECOMP_H__
|
||||
|
||||
#include <drv_types.h>
|
||||
#include <hal_data.h>
|
||||
|
||||
#define BT_TMP_BUF_SIZE 100
|
||||
|
||||
#ifdef PLATFORM_LINUX
|
||||
#define rsprintf snprintf
|
||||
#elif defined(PLATFORM_WINDOWS)
|
||||
#define rsprintf sprintf_s
|
||||
#endif
|
||||
|
||||
#define DCMD_Printf DBG_BT_INFO
|
||||
|
||||
#define delay_ms(ms) rtw_mdelay_os(ms)
|
||||
|
||||
#ifdef bEnable
|
||||
#undef bEnable
|
||||
#endif
|
||||
|
||||
#define WPP_SOFTWARE_TRACE 0
|
||||
|
||||
typedef enum _BTC_MSG_COMP_TYPE {
|
||||
COMP_COEX = 0,
|
||||
COMP_MAX
|
||||
} BTC_MSG_COMP_TYPE;
|
||||
extern u4Byte GLBtcDbgType[];
|
||||
|
||||
#define DBG_OFF 0
|
||||
#define DBG_SEC 1
|
||||
#define DBG_SERIOUS 2
|
||||
#define DBG_WARNING 3
|
||||
#define DBG_LOUD 4
|
||||
#define DBG_TRACE 5
|
||||
|
||||
#ifdef CONFIG_BT_COEXIST
|
||||
#define BT_SUPPORT 1
|
||||
#define COEX_SUPPORT 1
|
||||
#define HS_SUPPORT 1
|
||||
#else
|
||||
#define BT_SUPPORT 0
|
||||
#define COEX_SUPPORT 0
|
||||
#define HS_SUPPORT 0
|
||||
#endif
|
||||
|
||||
#include "halbtcoutsrc.h"
|
||||
#include "halbtc8192e1ant.h"
|
||||
#include "halbtc8192e2ant.h"
|
||||
#include "halbtc8723b1ant.h"
|
||||
#include "halbtc8723b2ant.h"
|
||||
#include "halbtc8812a1ant.h"
|
||||
#include "halbtc8812a2ant.h"
|
||||
#include "halbtc8821a1ant.h"
|
||||
#include "halbtc8821a2ant.h"
|
||||
#include "halbtc8703b1ant.h"
|
||||
#include "halbtc8723d1ant.h"
|
||||
#include "halbtc8723d2ant.h"
|
||||
#include "halbtc8822b1ant.h"
|
||||
#include "halbtc8822b2ant.h"
|
||||
#include "halbtc8821c1ant.h"
|
||||
#include "halbtc8821c2ant.h"
|
||||
|
||||
/* for wifi only mode */
|
||||
#include "hal_btcoex_wifionly.h"
|
||||
#include "halbtc8723bwifionly.h"
|
||||
#include "halbtc8822bwifionly.h"
|
||||
#include "halbtc8821cwifionly.h"
|
||||
|
||||
#endif /* __MP_PRECOMP_H__ */
|
106
hal/efuse/efuse_mask.h
Normal file
106
hal/efuse/efuse_mask.h
Normal file
|
@ -0,0 +1,106 @@
|
|||
|
||||
#if DEV_BUS_TYPE == RT_USB_INTERFACE
|
||||
|
||||
#if defined(CONFIG_RTL8188E)
|
||||
#include "rtl8188e/HalEfuseMask8188E_USB.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8812A)
|
||||
#include "rtl8812a/HalEfuseMask8812A_USB.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8821A)
|
||||
#include "rtl8812a/HalEfuseMask8821A_USB.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8192E)
|
||||
#include "rtl8192e/HalEfuseMask8192E_USB.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8723B)
|
||||
#include "rtl8723b/HalEfuseMask8723B_USB.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8814A)
|
||||
#include "rtl8814a/HalEfuseMask8814A_USB.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8703B)
|
||||
#include "rtl8703b/HalEfuseMask8703B_USB.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8723D)
|
||||
#include "rtl8723d/HalEfuseMask8723D_USB.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8188F)
|
||||
#include "rtl8188f/HalEfuseMask8188F_USB.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8822B)
|
||||
#include "rtl8822b/HalEfuseMask8822B_USB.h"
|
||||
#endif
|
||||
|
||||
#elif DEV_BUS_TYPE == RT_PCI_INTERFACE
|
||||
|
||||
#if defined(CONFIG_RTL8188E)
|
||||
#include "rtl8188e/HalEfuseMask8188E_PCIE.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8812A)
|
||||
#include "rtl8812a/HalEfuseMask8812A_PCIE.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8821A)
|
||||
#include "rtl8812a/HalEfuseMask8821A_PCIE.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8192E)
|
||||
#include "rtl8192e/HalEfuseMask8192E_PCIE.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8723B)
|
||||
#include "rtl8723b/HalEfuseMask8723B_PCIE.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8814A)
|
||||
#include "rtl8814a/HalEfuseMask8814A_PCIE.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8703B)
|
||||
#include "rtl8703b/HalEfuseMask8703B_PCIE.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8822B)
|
||||
#include "rtl8822b/HalEfuseMask8822B_PCIE.h"
|
||||
#endif
|
||||
#if defined(CONFIG_RTL8723D)
|
||||
#include "rtl8723d/HalEfuseMask8723D_PCIE.h"
|
||||
#endif
|
||||
|
||||
#elif DEV_BUS_TYPE == RT_SDIO_INTERFACE
|
||||
|
||||
#if defined(CONFIG_RTL8188E)
|
||||
#include "rtl8188e/HalEfuseMask8188E_SDIO.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8703B)
|
||||
#include "rtl8703b/HalEfuseMask8703B_SDIO.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8188F)
|
||||
#include "rtl8188f/HalEfuseMask8188F_SDIO.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8723D)
|
||||
#include "rtl8723d/HalEfuseMask8723D_SDIO.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8821C)
|
||||
#include "rtl8821c/HalEfuseMask8821C_SDIO.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8822B)
|
||||
#include "rtl8822b/HalEfuseMask8822B_SDIO.h"
|
||||
#endif
|
||||
#endif
|
101
hal/efuse/rtl8188e/HalEfuseMask8188E_PCIE.c
Normal file
101
hal/efuse/rtl8188e/HalEfuseMask8188E_PCIE.c
Normal file
|
@ -0,0 +1,101 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/* #include "Mp_Precomp.h" */
|
||||
/* #include "../odm_precomp.h" */
|
||||
|
||||
#include <drv_types.h>
|
||||
|
||||
#include "HalEfuseMask8188E_PCIE.h"
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* MPCIE.TXT
|
||||
******************************************************************************/
|
||||
|
||||
u1Byte Array_MP_8188E_MPCIE[] = {
|
||||
0xFF,
|
||||
0xF3,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x0F,
|
||||
0xF1,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0x70,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
|
||||
};
|
||||
|
||||
u2Byte
|
||||
EFUSE_GetArrayLen_MP_8188E_MPCIE(VOID)
|
||||
{
|
||||
return sizeof(Array_MP_8188E_MPCIE) / sizeof(u1Byte);
|
||||
}
|
||||
|
||||
VOID
|
||||
EFUSE_GetMaskArray_MP_8188E_MPCIE(
|
||||
IN OUT pu1Byte Array
|
||||
)
|
||||
{
|
||||
u2Byte len = EFUSE_GetArrayLen_MP_8188E_MPCIE(), i = 0;
|
||||
|
||||
for (i = 0; i < len; ++i)
|
||||
Array[i] = Array_MP_8188E_MPCIE[i];
|
||||
}
|
||||
BOOLEAN
|
||||
EFUSE_IsAddressMasked_MP_8188E_MPCIE(
|
||||
IN u2Byte Offset
|
||||
)
|
||||
{
|
||||
int r = Offset / 16;
|
||||
int c = (Offset % 16) / 2;
|
||||
int result = 0;
|
||||
|
||||
if (c < 4) /* Upper double word */
|
||||
result = (Array_MP_8188E_MPCIE[r] & (0x10 << c));
|
||||
else
|
||||
result = (Array_MP_8188E_MPCIE[r] & (0x01 << (c - 4)));
|
||||
|
||||
return (result > 0) ? 0 : 1;
|
||||
}
|
|
@ -18,13 +18,22 @@
|
|||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __INC_RF_8188E_HW_IMG_H
|
||||
#define __INC_RF_8188E_HW_IMG_H
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* RadioA_1T.TXT
|
||||
******************************************************************************/
|
||||
* MPCIE.TXT
|
||||
******************************************************************************/
|
||||
|
||||
enum HAL_STATUS ODM_ReadAndConfig_RadioA_1T_8188E(struct odm_dm_struct *odm);
|
||||
|
||||
#endif /* end of HWIMG_SUPPORT */
|
||||
u2Byte
|
||||
EFUSE_GetArrayLen_MP_8188E_MPCIE(VOID);
|
||||
|
||||
VOID
|
||||
EFUSE_GetMaskArray_MP_8188E_MPCIE(
|
||||
IN OUT pu1Byte Array
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
EFUSE_IsAddressMasked_MP_8188E_MPCIE(/* TC: Test Chip, MP: MP Chip */
|
||||
IN u2Byte Offset
|
||||
);
|
101
hal/efuse/rtl8188e/HalEfuseMask8188E_SDIO.c
Normal file
101
hal/efuse/rtl8188e/HalEfuseMask8188E_SDIO.c
Normal file
|
@ -0,0 +1,101 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/* #include "Mp_Precomp.h" */
|
||||
/* #include "../odm_precomp.h" */
|
||||
|
||||
#include <drv_types.h>
|
||||
|
||||
#include "HalEfuseMask8188E_SDIO.h"
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* MSDIO.TXT
|
||||
******************************************************************************/
|
||||
|
||||
u1Byte Array_MP_8188E_MSDIO[] = {
|
||||
0xFF,
|
||||
0xF3,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x0F,
|
||||
0xF1,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
|
||||
};
|
||||
|
||||
u2Byte
|
||||
EFUSE_GetArrayLen_MP_8188E_MSDIO(VOID)
|
||||
{
|
||||
return sizeof(Array_MP_8188E_MSDIO) / sizeof(u1Byte);
|
||||
}
|
||||
|
||||
VOID
|
||||
EFUSE_GetMaskArray_MP_8188E_MSDIO(
|
||||
IN OUT pu1Byte Array
|
||||
)
|
||||
{
|
||||
u2Byte len = EFUSE_GetArrayLen_MP_8188E_MSDIO(), i = 0;
|
||||
|
||||
for (i = 0; i < len; ++i)
|
||||
Array[i] = Array_MP_8188E_MSDIO[i];
|
||||
}
|
||||
BOOLEAN
|
||||
EFUSE_IsAddressMasked_MP_8188E_MSDIO(
|
||||
IN u2Byte Offset
|
||||
)
|
||||
{
|
||||
int r = Offset / 16;
|
||||
int c = (Offset % 16) / 2;
|
||||
int result = 0;
|
||||
|
||||
if (c < 4) /* Upper double word */
|
||||
result = (Array_MP_8188E_MSDIO[r] & (0x10 << c));
|
||||
else
|
||||
result = (Array_MP_8188E_MSDIO[r] & (0x01 << (c - 4)));
|
||||
|
||||
return (result > 0) ? 0 : 1;
|
||||
}
|
39
hal/efuse/rtl8188e/HalEfuseMask8188E_SDIO.h
Normal file
39
hal/efuse/rtl8188e/HalEfuseMask8188E_SDIO.h
Normal file
|
@ -0,0 +1,39 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* MSDIO.TXT
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
u2Byte
|
||||
EFUSE_GetArrayLen_MP_8188E_MSDIO(VOID);
|
||||
|
||||
VOID
|
||||
EFUSE_GetMaskArray_MP_8188E_MSDIO(
|
||||
IN OUT pu1Byte Array
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
EFUSE_IsAddressMasked_MP_8188E_MSDIO(/* TC: Test Chip, MP: MP Chip */
|
||||
IN u2Byte Offset
|
||||
);
|
100
hal/efuse/rtl8188e/HalEfuseMask8188E_USB.c
Normal file
100
hal/efuse/rtl8188e/HalEfuseMask8188E_USB.c
Normal file
|
@ -0,0 +1,100 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/* #include "Mp_Precomp.h" */
|
||||
/* #include "../odm_precomp.h" */
|
||||
|
||||
#include <drv_types.h>
|
||||
|
||||
#include "HalEfuseMask8188E_USB.h"
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* MUSB.TXT
|
||||
******************************************************************************/
|
||||
|
||||
u1Byte Array_MP_8188E_MUSB[] = {
|
||||
0xFF,
|
||||
0xF3,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x0F,
|
||||
0xF1,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0xF7,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
|
||||
};
|
||||
|
||||
u2Byte
|
||||
EFUSE_GetArrayLen_MP_8188E_MUSB(VOID)
|
||||
{
|
||||
return sizeof(Array_MP_8188E_MUSB) / sizeof(u1Byte);
|
||||
}
|
||||
|
||||
VOID
|
||||
EFUSE_GetMaskArray_MP_8188E_MUSB(
|
||||
IN OUT pu1Byte Array
|
||||
)
|
||||
{
|
||||
u2Byte len = EFUSE_GetArrayLen_MP_8188E_MUSB(), i = 0;
|
||||
|
||||
for (i = 0; i < len; ++i)
|
||||
Array[i] = Array_MP_8188E_MUSB[i];
|
||||
}
|
||||
BOOLEAN
|
||||
EFUSE_IsAddressMasked_MP_8188E_MUSB(
|
||||
IN u2Byte Offset
|
||||
)
|
||||
{
|
||||
int r = Offset / 16;
|
||||
int c = (Offset % 16) / 2;
|
||||
int result = 0;
|
||||
|
||||
if (c < 4) /* Upper double word */
|
||||
result = (Array_MP_8188E_MUSB[r] & (0x10 << c));
|
||||
else
|
||||
result = (Array_MP_8188E_MUSB[r] & (0x01 << (c - 4)));
|
||||
|
||||
return (result > 0) ? 0 : 1;
|
||||
}
|
|
@ -18,13 +18,22 @@
|
|||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __INC_MAC_8188E_HW_IMG_H
|
||||
#define __INC_MAC_8188E_HW_IMG_H
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* MAC_REG.TXT
|
||||
* MUSB.TXT
|
||||
******************************************************************************/
|
||||
|
||||
enum HAL_STATUS ODM_ReadAndConfig_MAC_REG_8188E(struct odm_dm_struct *pDM_Odm);
|
||||
|
||||
#endif /* end of HWIMG_SUPPORT */
|
||||
u2Byte
|
||||
EFUSE_GetArrayLen_MP_8188E_MUSB(VOID);
|
||||
|
||||
VOID
|
||||
EFUSE_GetMaskArray_MP_8188E_MUSB(
|
||||
IN OUT pu1Byte Array
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
EFUSE_IsAddressMasked_MP_8188E_MUSB(/* TC: Test Chip, MP: MP Chip */
|
||||
IN u2Byte Offset
|
||||
);
|
4474
hal/hal_btcoex.c
Normal file
4474
hal/hal_btcoex.c
Normal file
File diff suppressed because it is too large
Load diff
156
hal/hal_btcoex_wifionly.c
Normal file
156
hal/hal_btcoex_wifionly.c
Normal file
|
@ -0,0 +1,156 @@
|
|||
#include "btc/mp_precomp.h"
|
||||
#include <hal_btcoex_wifionly.h>
|
||||
|
||||
struct wifi_only_cfg GLBtCoexistWifiOnly;
|
||||
|
||||
void halwifionly_write1byte(PVOID pwifionlyContext, u32 RegAddr, u8 Data)
|
||||
{
|
||||
struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext;
|
||||
PADAPTER Adapter = pwifionlycfg->Adapter;
|
||||
|
||||
rtw_write8(Adapter, RegAddr, Data);
|
||||
}
|
||||
|
||||
void halwifionly_write2byte(PVOID pwifionlyContext, u32 RegAddr, u16 Data)
|
||||
{
|
||||
struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext;
|
||||
PADAPTER Adapter = pwifionlycfg->Adapter;
|
||||
|
||||
rtw_write16(Adapter, RegAddr, Data);
|
||||
}
|
||||
|
||||
void halwifionly_write4byte(PVOID pwifionlyContext, u32 RegAddr, u32 Data)
|
||||
{
|
||||
struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext;
|
||||
PADAPTER Adapter = pwifionlycfg->Adapter;
|
||||
|
||||
rtw_write32(Adapter, RegAddr, Data);
|
||||
}
|
||||
|
||||
u8 halwifionly_read1byte(PVOID pwifionlyContext, u32 RegAddr)
|
||||
{
|
||||
struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext;
|
||||
PADAPTER Adapter = pwifionlycfg->Adapter;
|
||||
|
||||
return rtw_read8(Adapter, RegAddr);
|
||||
}
|
||||
|
||||
u16 halwifionly_read2byte(PVOID pwifionlyContext, u32 RegAddr)
|
||||
{
|
||||
struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext;
|
||||
PADAPTER Adapter = pwifionlycfg->Adapter;
|
||||
|
||||
return rtw_read16(Adapter, RegAddr);
|
||||
}
|
||||
|
||||
u32 halwifionly_read4byte(PVOID pwifionlyContext, u32 RegAddr)
|
||||
{
|
||||
struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext;
|
||||
PADAPTER Adapter = pwifionlycfg->Adapter;
|
||||
|
||||
return rtw_read32(Adapter, RegAddr);
|
||||
}
|
||||
|
||||
void halwifionly_bitmaskwrite1byte(PVOID pwifionlyContext, u32 regAddr, u8 bitMask, u8 data)
|
||||
{
|
||||
u8 originalValue, bitShift = 0;
|
||||
u8 i;
|
||||
|
||||
struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext;
|
||||
PADAPTER Adapter = pwifionlycfg->Adapter;
|
||||
|
||||
if (bitMask != 0xff) {
|
||||
originalValue = rtw_read8(Adapter, regAddr);
|
||||
for (i = 0; i <= 7; i++) {
|
||||
if ((bitMask >> i) & 0x1)
|
||||
break;
|
||||
}
|
||||
bitShift = i;
|
||||
data = ((originalValue) & (~bitMask)) | (((data << bitShift)) & bitMask);
|
||||
}
|
||||
rtw_write8(Adapter, regAddr, data);
|
||||
}
|
||||
|
||||
void halwifionly_phy_set_rf_reg(PVOID pwifionlyContext, u8 eRFPath, u32 RegAddr, u32 BitMask, u32 Data)
|
||||
{
|
||||
struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext;
|
||||
PADAPTER Adapter = pwifionlycfg->Adapter;
|
||||
|
||||
phy_set_rf_reg(Adapter, eRFPath, RegAddr, BitMask, Data);
|
||||
}
|
||||
|
||||
void halwifionly_phy_set_bb_reg(PVOID pwifionlyContext, u32 RegAddr, u32 BitMask, u32 Data)
|
||||
{
|
||||
struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext;
|
||||
PADAPTER Adapter = pwifionlycfg->Adapter;
|
||||
|
||||
phy_set_bb_reg(Adapter, RegAddr, BitMask, Data);
|
||||
}
|
||||
|
||||
void hal_btcoex_wifionly_switchband_notify(PADAPTER padapter)
|
||||
{
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
u8 is_5g = _FALSE;
|
||||
|
||||
if (pHalData->current_band_type == BAND_ON_5G)
|
||||
is_5g = _TRUE;
|
||||
|
||||
if (IS_HARDWARE_TYPE_8822B(padapter))
|
||||
ex_hal8822b_wifi_only_switchbandnotify(&GLBtCoexistWifiOnly, is_5g);
|
||||
else if (IS_HARDWARE_TYPE_8821C(padapter))
|
||||
ex_hal8821c_wifi_only_switchbandnotify(&GLBtCoexistWifiOnly, is_5g);
|
||||
}
|
||||
|
||||
void hal_btcoex_wifionly_scan_notify(PADAPTER padapter)
|
||||
{
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
u8 is_5g = _FALSE;
|
||||
|
||||
if (pHalData->current_band_type == BAND_ON_5G)
|
||||
is_5g = _TRUE;
|
||||
|
||||
if (IS_HARDWARE_TYPE_8822B(padapter))
|
||||
ex_hal8822b_wifi_only_scannotify(&GLBtCoexistWifiOnly, is_5g);
|
||||
else if (IS_HARDWARE_TYPE_8821C(padapter))
|
||||
ex_hal8821c_wifi_only_scannotify(&GLBtCoexistWifiOnly, is_5g);
|
||||
}
|
||||
|
||||
void hal_btcoex_wifionly_hw_config(PADAPTER padapter)
|
||||
{
|
||||
struct wifi_only_cfg *pwifionlycfg = &GLBtCoexistWifiOnly;
|
||||
|
||||
if (IS_HARDWARE_TYPE_8723B(padapter))
|
||||
ex_hal8723b_wifi_only_hw_config(pwifionlycfg);
|
||||
else if (IS_HARDWARE_TYPE_8822B(padapter))
|
||||
ex_hal8822b_wifi_only_hw_config(pwifionlycfg);
|
||||
else if (IS_HARDWARE_TYPE_8821C(padapter))
|
||||
ex_hal8821c_wifi_only_hw_config(pwifionlycfg);
|
||||
}
|
||||
|
||||
void hal_btcoex_wifionly_initlizevariables(PADAPTER padapter)
|
||||
{
|
||||
struct wifi_only_cfg *pwifionlycfg = &GLBtCoexistWifiOnly;
|
||||
struct wifi_only_haldata *pwifionly_haldata = &pwifionlycfg->haldata_info;
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
|
||||
_rtw_memset(&GLBtCoexistWifiOnly, 0, sizeof(GLBtCoexistWifiOnly));
|
||||
|
||||
pwifionlycfg->Adapter = padapter;
|
||||
|
||||
#ifdef CONFIG_PCI_HCI
|
||||
pwifionlycfg->chip_interface = WIFIONLY_INTF_PCI;
|
||||
#elif defined(CONFIG_USB_HCI)
|
||||
pwifionlycfg->chip_interface = WIFIONLY_INTF_USB;
|
||||
#elif defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
|
||||
pwifionlycfg->chip_interface = WIFIONLY_INTF_SDIO;
|
||||
#else
|
||||
pwifionlycfg->chip_interface = WIFIONLY_INTF_UNKNOWN;
|
||||
#endif
|
||||
|
||||
pwifionly_haldata->customer_id = CUSTOMER_NORMAL;
|
||||
pwifionly_haldata->efuse_pg_antnum = pHalData->EEPROMBluetoothAntNum;
|
||||
pwifionly_haldata->efuse_pg_antpath = pHalData->ant_path;
|
||||
pwifionly_haldata->rfe_type = pHalData->rfe_type;
|
||||
pwifionly_haldata->ant_div_cfg = pHalData->AntDivCfg;
|
||||
}
|
||||
|
11407
hal/hal_com.c
11407
hal/hal_com.c
File diff suppressed because it is too large
Load diff
119
hal/hal_com_c2h.h
Normal file
119
hal/hal_com_c2h.h
Normal file
|
@ -0,0 +1,119 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __COMMON_C2H_H__
|
||||
#define __COMMON_C2H_H__
|
||||
|
||||
#define C2H_TYPE_REG 0
|
||||
#define C2H_TYPE_PKT 1
|
||||
|
||||
/*
|
||||
* C2H event format:
|
||||
* Fields TRIGGER PAYLOAD SEQ PLEN ID
|
||||
* BITS [127:120] [119:16] [15:8] [7:4] [3:0]
|
||||
*/
|
||||
#define C2H_ID(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)), 0, 4)
|
||||
#define C2H_PLEN(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)), 4, 4)
|
||||
#define C2H_SEQ(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)) + 1, 0, 8)
|
||||
#define C2H_PAYLOAD(_c2h) (((u8*)(_c2h)) + 2)
|
||||
|
||||
#define SET_C2H_ID(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)), 0, 4, _val)
|
||||
#define SET_C2H_PLEN(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)), 4, 4, _val)
|
||||
#define SET_C2H_SEQ(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)) + 1 , 0, 8, _val)
|
||||
|
||||
/*
|
||||
* C2H event format:
|
||||
* Fields TRIGGER PLEN PAYLOAD SEQ ID
|
||||
* BITS [127:120] [119:112] [111:16] [15:8] [7:0]
|
||||
*/
|
||||
#define C2H_ID_88XX(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)), 0, 8)
|
||||
#define C2H_SEQ_88XX(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)) + 1, 0, 8)
|
||||
#define C2H_PAYLOAD_88XX(_c2h) (((u8*)(_c2h)) + 2)
|
||||
#define C2H_PLEN_88XX(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)) + 14, 0, 8)
|
||||
#define C2H_TRIGGER_88XX(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)) + 15, 0, 8)
|
||||
|
||||
#define SET_C2H_ID_88XX(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)), 0, 8, _val)
|
||||
#define SET_C2H_SEQ_88XX(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)) + 1, 0, 8, _val)
|
||||
#define SET_C2H_PLEN_88XX(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)) + 14, 0, 8, _val)
|
||||
|
||||
typedef enum _C2H_EVT {
|
||||
C2H_DBG = 0x00,
|
||||
C2H_LB = 0x01,
|
||||
C2H_TXBF = 0x02,
|
||||
C2H_CCX_TX_RPT = 0x03,
|
||||
C2H_AP_REQ_TXRPT = 0x04,
|
||||
C2H_FW_SCAN_COMPLETE = 0x7,
|
||||
C2H_BT_INFO = 0x09,
|
||||
C2H_BT_MP_INFO = 0x0B,
|
||||
C2H_RA_RPT = 0x0C,
|
||||
C2H_SPC_STAT = 0x0D,
|
||||
C2H_RA_PARA_RPT = 0x0E,
|
||||
C2H_FW_CHNL_SWITCH_COMPLETE = 0x10,
|
||||
C2H_IQK_FINISH = 0x11,
|
||||
C2H_MAILBOX_STATUS = 0x15,
|
||||
C2H_P2P_RPORT = 0x16,
|
||||
C2H_MCC = 0x17,
|
||||
C2H_MAC_HIDDEN_RPT = 0x19,
|
||||
C2H_MAC_HIDDEN_RPT_2 = 0x1A,
|
||||
C2H_BCN_EARLY_RPT = 0x1E,
|
||||
C2H_DEFEATURE_DBG = 0x22,
|
||||
C2H_CUSTOMER_STR_RPT = 0x24,
|
||||
C2H_CUSTOMER_STR_RPT_2 = 0x25,
|
||||
C2H_DEFEATURE_RSVD = 0xFD,
|
||||
C2H_EXTEND = 0xff,
|
||||
} C2H_EVT;
|
||||
|
||||
typedef enum _EXTEND_C2H_EVT {
|
||||
EXTEND_C2H_DBG_PRINT = 0
|
||||
} EXTEND_C2H_EVT;
|
||||
|
||||
#define C2H_REG_LEN 16
|
||||
|
||||
/* C2H_IQK_FINISH, 0x11 */
|
||||
#define IQK_OFFLOAD_LEN 1
|
||||
void c2h_iqk_offload(_adapter *adapter, u8 *data, u8 len);
|
||||
int c2h_iqk_offload_wait(_adapter *adapter, u32 timeout_ms);
|
||||
#define rtl8812_iqk_wait c2h_iqk_offload_wait /* TODO: remove this after phydm call c2h_iqk_offload_wait instead */
|
||||
|
||||
#ifdef CONFIG_RTW_MAC_HIDDEN_RPT
|
||||
/* C2H_MAC_HIDDEN_RPT, 0x19 */
|
||||
#define MAC_HIDDEN_RPT_LEN 8
|
||||
int c2h_mac_hidden_rpt_hdl(_adapter *adapter, u8 *data, u8 len);
|
||||
|
||||
/* C2H_MAC_HIDDEN_RPT_2, 0x1A */
|
||||
#define MAC_HIDDEN_RPT_2_LEN 5
|
||||
int c2h_mac_hidden_rpt_2_hdl(_adapter *adapter, u8 *data, u8 len);
|
||||
int hal_read_mac_hidden_rpt(_adapter *adapter);
|
||||
#endif /* CONFIG_RTW_MAC_HIDDEN_RPT */
|
||||
|
||||
/* C2H_DEFEATURE_DBG, 0x22 */
|
||||
#define DEFEATURE_DBG_LEN 1
|
||||
int c2h_defeature_dbg_hdl(_adapter *adapter, u8 *data, u8 len);
|
||||
|
||||
#ifdef CONFIG_RTW_CUSTOMER_STR
|
||||
/* C2H_CUSTOMER_STR_RPT, 0x24 */
|
||||
#define CUSTOMER_STR_RPT_LEN 8
|
||||
int c2h_customer_str_rpt_hdl(_adapter *adapter, u8 *data, u8 len);
|
||||
|
||||
/* C2H_CUSTOMER_STR_RPT_2, 0x25 */
|
||||
#define CUSTOMER_STR_RPT_2_LEN 8
|
||||
int c2h_customer_str_rpt_2_hdl(_adapter *adapter, u8 *data, u8 len);
|
||||
#endif /* CONFIG_RTW_CUSTOMER_STR */
|
||||
|
||||
#endif /* __COMMON_C2H_H__ */
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue