From 9dde4572b40e248bb41b56d67857bcb01552eeea Mon Sep 17 00:00:00 2001 From: CGarces Date: Thu, 11 May 2017 20:35:20 +0200 Subject: [PATCH] Updated to v4.3.8_12406.20140929 --- Makefile | 208 +- core/efuse/rtw_efuse.c | 25 +- core/rtw_ap.c | 121 +- core/rtw_beamforming.c | 4 +- core/rtw_br_ext.c | 77 +- core/rtw_bt_mp.c | 6 +- core/rtw_btcoex.c | 63 +- core/rtw_cmd.c | 361 +- core/rtw_debug.c | 664 +- core/rtw_ieee80211.c | 93 +- core/rtw_ioctl_set.c | 4 +- core/rtw_iol.c | 4 +- core/rtw_mem.c | 103 + core/rtw_mlme.c | 291 +- core/rtw_mlme_ext.c | 725 +- core/rtw_mp.c | 284 +- core/rtw_mp_ioctl.c | 4 +- core/rtw_odm.c | 157 +- core/rtw_p2p.c | 42 +- core/rtw_pwrctrl.c | 25 +- core/rtw_recv.c | 411 +- core/rtw_security.c | 85 +- core/rtw_sreset.c | 8 +- core/rtw_sta_mgt.c | 46 +- core/rtw_tdls.c | 6 +- core/rtw_vht.c | 5 +- core/rtw_wlan_util.c | 976 +- core/rtw_xmit.c | 347 +- hal/HalPwrSeqCmd.c | 2 +- hal/OUTSRC-BTCoexist/HalBtc8188c2Ant.c | 14 +- hal/OUTSRC-BTCoexist/HalBtc8188c2Ant.h | 4 + hal/OUTSRC-BTCoexist/HalBtc8192d2Ant.c | 14 +- hal/OUTSRC-BTCoexist/HalBtc8192d2Ant.h | 4 + hal/OUTSRC-BTCoexist/HalBtc8192e1Ant.c | 14 +- hal/OUTSRC-BTCoexist/HalBtc8192e1Ant.h | 4 + hal/OUTSRC-BTCoexist/HalBtc8192e2Ant.c | 20 +- hal/OUTSRC-BTCoexist/HalBtc8192e2Ant.h | 4 + hal/OUTSRC-BTCoexist/HalBtc8723a1Ant.c | 7 - hal/OUTSRC-BTCoexist/HalBtc8723a2Ant.c | 14 +- hal/OUTSRC-BTCoexist/HalBtc8723a2Ant.h | 4 + hal/OUTSRC-BTCoexist/HalBtc8723b1Ant.c | 1210 +- hal/OUTSRC-BTCoexist/HalBtc8723b1Ant.h | 40 +- hal/OUTSRC-BTCoexist/HalBtc8723b2Ant.c | 112 +- hal/OUTSRC-BTCoexist/HalBtc8723b2Ant.h | 8 + hal/OUTSRC-BTCoexist/HalBtc8812a1Ant.c | 14 +- hal/OUTSRC-BTCoexist/HalBtc8812a1Ant.h | 4 + hal/OUTSRC-BTCoexist/HalBtc8812a2Ant.c | 14 +- hal/OUTSRC-BTCoexist/HalBtc8812a2Ant.h | 4 + hal/OUTSRC-BTCoexist/HalBtc8821a1Ant.c | 632 +- hal/OUTSRC-BTCoexist/HalBtc8821a1Ant.h | 18 +- hal/OUTSRC-BTCoexist/HalBtc8821a2Ant.c | 14 +- hal/OUTSRC-BTCoexist/HalBtc8821a2Ant.h | 4 + hal/OUTSRC-BTCoexist/HalBtc8821aCsr2Ant.c | 4437 +++++++ hal/OUTSRC-BTCoexist/HalBtc8821aCsr2Ant.h | 207 + hal/OUTSRC-BTCoexist/HalBtcOutSrc.h | 49 +- hal/OUTSRC-BTCoexist/Mp_Precomp.h | 1 + hal/OUTSRC/HalPhyRf.c | 4 +- hal/OUTSRC/Mp_Precomp.h | 24 + hal/OUTSRC/PhyDM_Adaptivity.c | 880 ++ hal/OUTSRC/PhyDM_Adaptivity.h | 146 + hal/OUTSRC/odm.c | 12851 +------------------ hal/OUTSRC/odm.h | 842 +- hal/OUTSRC/odm_ACS.c | 213 + hal/OUTSRC/odm_ACS.h | 60 + hal/OUTSRC/odm_AntDiv.c | 783 +- hal/OUTSRC/odm_AntDiv.h | 105 +- hal/OUTSRC/odm_CfoTracking.c | 357 + hal/OUTSRC/odm_CfoTracking.h | 66 + hal/OUTSRC/odm_DIG.c | 2006 +++ hal/OUTSRC/odm_DIG.h | 339 + hal/OUTSRC/odm_DynamicBBPowerSaving.c | 218 + hal/OUTSRC/odm_DynamicBBPowerSaving.h | 61 + hal/OUTSRC/odm_DynamicTxPower.c | 882 ++ hal/OUTSRC/odm_DynamicTxPower.h | 87 + hal/OUTSRC/odm_EdcaTurboCheck.c | 1915 +++ hal/OUTSRC/odm_EdcaTurboCheck.h | 150 + hal/OUTSRC/odm_HWConfig.c | 297 +- hal/OUTSRC/odm_HWConfig.h | 8 +- hal/OUTSRC/odm_NoiseMonitor.c | 197 + hal/OUTSRC/odm_NoiseMonitor.h | 49 + hal/OUTSRC/odm_PathDiv.c | 1585 +++ hal/OUTSRC/odm_PathDiv.h | 192 + hal/OUTSRC/odm_PowerTracking.c | 687 + hal/OUTSRC/odm_PowerTracking.h | 246 + hal/OUTSRC/odm_RXHP.c | 1685 +++ hal/OUTSRC/odm_RXHP.h | 104 + hal/OUTSRC/odm_RaInfo.c | 1595 +++ hal/OUTSRC/odm_RaInfo.h | 165 + hal/OUTSRC/odm_RegDefine11AC.h | 21 +- hal/OUTSRC/odm_RegDefine11N.h | 37 +- hal/OUTSRC/odm_debug.c | 1153 +- hal/OUTSRC/odm_debug.h | 771 +- hal/OUTSRC/odm_interface.c | 229 +- hal/OUTSRC/odm_interface.h | 64 +- hal/OUTSRC/odm_precomp.h | 30 +- hal/OUTSRC/odm_reg.h | 86 + hal/OUTSRC/odm_types.h | 154 +- hal/OUTSRC/rtl8192e/Hal8192EReg.h | 14 +- hal/OUTSRC/rtl8192e/HalHWImg8192E_BB.c | 1079 +- hal/OUTSRC/rtl8192e/HalHWImg8192E_BB.h | 4 +- hal/OUTSRC/rtl8192e/HalHWImg8192E_FW.c | 2 +- hal/OUTSRC/rtl8192e/HalHWImg8192E_FW_v18.c | 4831 ------- hal/OUTSRC/rtl8192e/HalHWImg8192E_FW_v18.h | 61 - hal/OUTSRC/rtl8192e/HalHWImg8192E_MAC.c | 221 +- hal/OUTSRC/rtl8192e/HalHWImg8192E_MAC.h | 2 +- hal/OUTSRC/rtl8192e/HalHWImg8192E_RF.c | 650 +- hal/OUTSRC/rtl8192e/HalHWImg8192E_RF.h | 7 +- hal/OUTSRC/rtl8192e/HalPhyRf_8192e.c | 391 +- hal/OUTSRC/rtl8192e/HalPhyRf_8192e.h | 2 +- hal/OUTSRC/rtl8192e/Mp_Precomp.h | 24 + hal/OUTSRC/rtl8192e/odm_RTL8192E.c | 5 +- hal/OUTSRC/rtl8192e/odm_RegConfig8192E.c | 1 + hal/hal_btcoex.c | 738 +- hal/hal_com.c | 909 +- hal/hal_com_phycfg.c | 24 +- hal/hal_dm.c | 196 + hal/hal_dm.h | 26 + hal/hal_intf.c | 117 +- hal/led/hal_usb_led.c | 16 +- hal/rtl8192e/rtl8192e_cmd.c | 554 +- hal/rtl8192e/rtl8192e_dm.c | 191 +- hal/rtl8192e/rtl8192e_hal_init.c | 625 +- hal/rtl8192e/rtl8192e_mp.c | 13 +- hal/rtl8192e/rtl8192e_phycfg.c | 56 +- hal/rtl8192e/rtl8192e_rxdesc.c | 21 +- hal/rtl8192e/usb/rtl8192eu_recv.c | 29 +- hal/rtl8192e/usb/rtl8192eu_xmit.c | 5 +- hal/rtl8192e/usb/usb_halinit.c | 201 +- hal/rtl8192e/usb/usb_ops_linux.c | 26 +- include/Hal8188EPhyReg.h | 1 + include/Hal8192CPhyReg.h | 1 + include/Hal8192DPhyReg.h | 3 +- include/Hal8192EPhyCfg.h | 7 + include/Hal8192EPhyReg.h | 6 +- include/Hal8812PhyReg.h | 5 + include/autoconf.h | 83 +- include/drv_conf.h | 30 + include/drv_types.h | 218 +- include/gspi_hal.h | 2 +- include/gspi_ops.h | 18 +- include/hal_btcoex.h | 12 +- include/hal_com.h | 65 + include/hal_com_h2c.h | 8 +- include/hal_com_phycfg.h | 4 +- include/hal_com_reg.h | 59 +- include/hal_data.h | 45 +- include/hal_gspi.h | 32 + include/hal_intf.h | 27 +- include/hal_pg.h | 2 +- include/ieee80211.h | 13 +- include/ioctl_cfg80211.h | 5 +- include/linux/wireless.h | 8 +- include/osdep_intf.h | 12 +- include/osdep_service.h | 4 +- include/pci_hal.h | 4 + include/pci_ops.h | 10 + include/rtl8188e_cmd.h | 5 +- include/rtl8188e_hal.h | 34 +- include/rtl8188e_led.h | 2 +- include/rtl8188e_recv.h | 2 +- include/rtl8188e_spec.h | 11 +- include/rtl8188e_xmit.h | 21 +- include/rtl8192c_cmd.h | 1 + include/rtl8192c_hal.h | 3 +- include/rtl8192c_recv.h | 4 +- include/rtl8192c_spec.h | 22 +- include/rtl8192c_xmit.h | 12 +- include/rtl8192d_cmd.h | 6 +- include/rtl8192d_hal.h | 1 + include/rtl8192d_recv.h | 2 + include/rtl8192d_spec.h | 5 +- include/rtl8192d_xmit.h | 12 +- include/rtl8192e_cmd.h | 7 +- include/rtl8192e_hal.h | 52 +- include/rtl8192e_recv.h | 35 +- include/rtl8192e_spec.h | 71 +- include/rtl8192e_xmit.h | 52 +- include/rtl8723a_cmd.h | 6 +- include/rtl8723a_hal.h | 8 +- include/rtl8723a_spec.h | 4 +- include/rtl8723a_xmit.h | 2 +- include/rtl8723b_cmd.h | 2 +- include/rtl8723b_hal.h | 20 +- include/rtl8723b_spec.h | 18 +- include/rtl8723b_xmit.h | 11 - include/rtl8812a_cmd.h | 2 + include/rtl8812a_hal.h | 11 - include/rtl8812a_recv.h | 6 + include/rtl8812a_spec.h | 11 +- include/rtl8812a_xmit.h | 13 +- include/rtl8821a_spec.h | 8 +- include/rtw_android.h | 3 + include/rtw_ap.h | 3 +- include/rtw_bt_mp.h | 2 +- include/rtw_btcoex.h | 5 +- include/rtw_cmd.h | 33 +- include/rtw_debug.h | 45 +- include/rtw_eeprom.h | 4 +- include/rtw_ht.h | 75 +- include/rtw_io.h | 5 + include/rtw_mem.h | 38 + include/rtw_mlme.h | 21 + include/rtw_mlme_ext.h | 57 +- include/rtw_mp.h | 73 +- include/rtw_mp_phy_regdef.h | 9 +- include/rtw_odm.h | 5 +- include/rtw_pwrctrl.h | 16 +- include/rtw_recv.h | 29 +- include/rtw_security.h | 24 + include/rtw_version.h | 2 +- include/rtw_wifi_regd.h | 8 +- include/rtw_xmit.h | 86 +- include/xmit_osdep.h | 4 + os_dep/linux/custom_gpio_linux.c | 37 +- os_dep/linux/ioctl_cfg80211.c | 357 +- os_dep/linux/ioctl_linux.c | 1311 +- os_dep/linux/mlme_linux.c | 32 +- os_dep/linux/os_intfs.c | 730 +- os_dep/linux/recv_linux.c | 31 +- os_dep/linux/rtw_android.c | 101 +- os_dep/linux/rtw_proc.c | 300 +- os_dep/linux/rtw_proc.h | 12 +- os_dep/linux/usb_intf.c | 471 +- os_dep/linux/usb_ops_linux.c | 9 +- os_dep/linux/wifi_regd.c | 90 +- os_dep/linux/xmit_linux.c | 172 +- os_dep/osdep_service.c | 32 +- platform/platform_ARM_SUNnI_sdio.c | 17 +- platform/platform_ARM_WMT_sdio.c | 51 + 229 files changed, 35553 insertions(+), 24316 deletions(-) create mode 100644 core/rtw_mem.c create mode 100644 hal/OUTSRC-BTCoexist/HalBtc8821aCsr2Ant.c create mode 100644 hal/OUTSRC-BTCoexist/HalBtc8821aCsr2Ant.h create mode 100644 hal/OUTSRC/Mp_Precomp.h create mode 100644 hal/OUTSRC/PhyDM_Adaptivity.c create mode 100644 hal/OUTSRC/PhyDM_Adaptivity.h create mode 100644 hal/OUTSRC/odm_ACS.c create mode 100644 hal/OUTSRC/odm_ACS.h create mode 100644 hal/OUTSRC/odm_CfoTracking.c create mode 100644 hal/OUTSRC/odm_CfoTracking.h create mode 100644 hal/OUTSRC/odm_DIG.c create mode 100644 hal/OUTSRC/odm_DIG.h create mode 100644 hal/OUTSRC/odm_DynamicBBPowerSaving.c create mode 100644 hal/OUTSRC/odm_DynamicBBPowerSaving.h create mode 100644 hal/OUTSRC/odm_DynamicTxPower.c create mode 100644 hal/OUTSRC/odm_DynamicTxPower.h create mode 100644 hal/OUTSRC/odm_EdcaTurboCheck.c create mode 100644 hal/OUTSRC/odm_EdcaTurboCheck.h create mode 100644 hal/OUTSRC/odm_NoiseMonitor.c create mode 100644 hal/OUTSRC/odm_NoiseMonitor.h create mode 100644 hal/OUTSRC/odm_PathDiv.c create mode 100644 hal/OUTSRC/odm_PathDiv.h create mode 100644 hal/OUTSRC/odm_PowerTracking.c create mode 100644 hal/OUTSRC/odm_PowerTracking.h create mode 100644 hal/OUTSRC/odm_RXHP.c create mode 100644 hal/OUTSRC/odm_RXHP.h create mode 100644 hal/OUTSRC/odm_RaInfo.c create mode 100644 hal/OUTSRC/odm_RaInfo.h delete mode 100644 hal/OUTSRC/rtl8192e/HalHWImg8192E_FW_v18.c delete mode 100644 hal/OUTSRC/rtl8192e/HalHWImg8192E_FW_v18.h create mode 100644 hal/OUTSRC/rtl8192e/Mp_Precomp.h create mode 100644 hal/hal_dm.c create mode 100644 hal/hal_dm.h create mode 100644 include/hal_gspi.h create mode 100644 include/rtw_mem.h create mode 100644 platform/platform_ARM_WMT_sdio.c diff --git a/Makefile b/Makefile index 0c800f8..6236101 100644 --- a/Makefile +++ b/Makefile @@ -53,10 +53,17 @@ CONFIG_TRAFFIC_PROTECT = y CONFIG_LOAD_PHY_PARA_FROM_FILE = y CONFIG_CALIBRATE_TX_POWER_BY_REGULATORY = n CONFIG_CALIBRATE_TX_POWER_TO_MAX = n -CONFIG_ODM_ADAPTIVITY = n +CONFIG_RTW_ADAPTIVITY_EN = disable +CONFIG_RTW_ADAPTIVITY_MODE = normal +CONFIG_SKIP_SIGNAL_SCALE_MAPPING = n +CONFIG_80211W = n +CONFIG_REDUCE_TX_CPU_LOADING = n +CONFIG_BR_EXT = y +CONFIG_ANTENNA_DIVERSITY = n ######################## Wake On Lan ########################## CONFIG_WOWLAN = n CONFIG_GPIO_WAKEUP = n +CONFIG_WAKEUP_GPIO_IDX = default CONFIG_PNO_SUPPORT = n CONFIG_PNO_SET_DEBUG = n CONFIG_AP_WOWLAN = n @@ -91,7 +98,6 @@ CONFIG_PLATFORM_ARM_URBETTER = n CONFIG_PLATFORM_ARM_TI_PANDA = n CONFIG_PLATFORM_MIPS_JZ4760 = n CONFIG_PLATFORM_DMP_PHILIPS = n -CONFIG_PLATFORM_TI_DM365 = n CONFIG_PLATFORM_MSTAR_TITANIA12 = n CONFIG_PLATFORM_MSTAR = n CONFIG_PLATFORM_SZEBOOK = n @@ -104,6 +110,10 @@ CONFIG_PLATFORM_ACTIONS_ATV5201 = n CONFIG_PLATFORM_ARM_RTD299X = n CONFIG_PLATFORM_ARM_SPREADTRUM_6820 = n CONFIG_PLATFORM_ARM_SPREADTRUM_8810 = n +CONFIG_PLATFORM_ARM_WMT = n +CONFIG_PLATFORM_TI_DM365 = n +CONFIG_PLATFORM_MOZART = n +CONFIG_PLATFORM_RTK119X = n ############################################################### CONFIG_DRVEXT_MODULE = n @@ -156,16 +166,28 @@ _HAL_INTFS_FILES := hal/hal_intf.o \ hal/hal_com.o \ hal/hal_com_phycfg.o \ hal/hal_phy.o \ + hal/hal_dm.o \ hal/hal_btcoex.o \ hal/hal_hci/hal_$(HCI_NAME).o \ hal/led/hal_$(HCI_NAME)_led.o - + _OUTSRC_FILES := hal/OUTSRC/odm_debug.o \ hal/OUTSRC/odm_AntDiv.o\ hal/OUTSRC/odm_interface.o\ hal/OUTSRC/odm_HWConfig.o\ hal/OUTSRC/odm.o\ - hal/OUTSRC/HalPhyRf.o + hal/OUTSRC/HalPhyRf.o\ + hal/OUTSRC/odm_EdcaTurboCheck.o\ + hal/OUTSRC/odm_DIG.o\ + hal/OUTSRC/odm_PathDiv.o\ + hal/OUTSRC/odm_RaInfo.o\ + hal/OUTSRC/odm_DynamicBBPowerSaving.o\ + hal/OUTSRC/odm_PowerTracking.o\ + hal/OUTSRC/odm_DynamicTxPower.o\ + hal/OUTSRC/PhyDM_Adaptivity.o\ + hal/OUTSRC/odm_CfoTracking.o\ + hal/OUTSRC/odm_NoiseMonitor.o\ + hal/OUTSRC/odm_ACS.o EXTRA_CFLAGS += -I$(src)/platform _PLATFORM_FILES := platform/platform_ops.o @@ -183,10 +205,11 @@ _OUTSRC_FILES += hal/OUTSRC-BTCoexist/HalBtc8188c2Ant.o \ hal/OUTSRC-BTCoexist/HalBtc8812a1Ant.o \ hal/OUTSRC-BTCoexist/HalBtc8812a2Ant.o \ hal/OUTSRC-BTCoexist/HalBtc8821a1Ant.o \ - hal/OUTSRC-BTCoexist/HalBtc8821a2Ant.o + hal/OUTSRC-BTCoexist/HalBtc8821a2Ant.o \ + hal/OUTSRC-BTCoexist/HalBtc8821aCsr2Ant.o endif - -########### HAL_RTL8192C ################################# + +########### HAL_RTL8192C ################################# ifeq ($(CONFIG_RTL8192C), y) RTL871X = rtl8192c @@ -211,7 +234,7 @@ _HAL_INTFS_FILES += hal/$(RTL871X)/$(RTL871X)_hal_init.o \ hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_halinit.o \ hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_led.o \ hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_xmit.o \ - hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_recv.o + hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_recv.o _HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops_linux.o @@ -271,7 +294,7 @@ endif _OUTSRC_FILES += hal/OUTSRC/$(RTL871X)/odm_RTL8192D.o\ hal/OUTSRC/$(RTL871X)/HalDMOutSrc8192D_CE.o - + ifeq ($(CONFIG_USB_HCI), y) _OUTSRC_FILES += hal/OUTSRC/$(RTL871X)/Hal8192DUFWImg_CE.o \ hal/OUTSRC/$(RTL871X)/Hal8192DUPHYImg_CE.o \ @@ -308,7 +331,7 @@ _HAL_INTFS_FILES += hal/HalPwrSeqCmd.o \ hal/$(RTL871X)/Hal8723PwrSeq.o\ hal/$(RTL871X)/$(RTL871X)_xmit.o \ hal/$(RTL871X)/$(RTL871X)_sreset.o - + _HAL_INTFS_FILES += hal/$(RTL871X)/$(RTL871X)_hal_init.o \ hal/$(RTL871X)/$(RTL871X)_phycfg.o \ hal/$(RTL871X)/$(RTL871X)_rf6052.o \ @@ -319,7 +342,7 @@ _HAL_INTFS_FILES += hal/$(RTL871X)/$(RTL871X)_hal_init.o \ hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_led.o \ hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_xmit.o \ hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_recv.o - + ifeq ($(CONFIG_SDIO_HCI), y) _HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops.o else @@ -370,6 +393,10 @@ ifeq ($(CONFIG_SDIO_HCI), y) MODULE_NAME = 8189es endif +ifeq ($(CONFIG_GSPI_HCI), y) +MODULE_NAME = 8189es +endif + ifeq ($(CONFIG_USB_HCI), y) MODULE_NAME = 8188eu endif @@ -407,7 +434,7 @@ endif ifeq ($(CONFIG_MP_INCLUDED), y) _HAL_INTFS_FILES += hal/$(RTL871X)/$(RTL871X)_mp.o -endif +endif #hal/OUTSRC/$(RTL871X)/Hal8188EFWImg_CE.o _OUTSRC_FILES += hal/OUTSRC/$(RTL871X)/HalHWImg8188E_MAC.o\ @@ -530,10 +557,6 @@ _OUTSRC_FILES += hal/OUTSRC/$(RTL871X)/HalHWImg8812A_FW.o\ hal/OUTSRC/$(RTL871X)/HalHWImg8812A_MAC.o\ hal/OUTSRC/$(RTL871X)/HalHWImg8812A_BB.o\ hal/OUTSRC/$(RTL871X)/HalHWImg8812A_RF.o\ - hal/OUTSRC/$(RTL871X)/HalHWImg8812A_TestChip_FW.o\ - hal/OUTSRC/$(RTL871X)/HalHWImg8812A_TestChip_MAC.o\ - hal/OUTSRC/$(RTL871X)/HalHWImg8812A_TestChip_BB.o\ - hal/OUTSRC/$(RTL871X)/HalHWImg8812A_TestChip_RF.o\ hal/OUTSRC/$(RTL871X)/HalPhyRf_8812A.o\ hal/OUTSRC/$(RTL871X)/odm_RegConfig8812A.o\ hal/OUTSRC/$(RTL871X)/odm_RTL8812A.o @@ -561,14 +584,12 @@ _OUTSRC_FILES += hal/OUTSRC/rtl8821a/HalHWImg8821A_FW.o\ hal/OUTSRC/rtl8821a/HalHWImg8821A_MAC.o\ hal/OUTSRC/rtl8821a/HalHWImg8821A_BB.o\ hal/OUTSRC/rtl8821a/HalHWImg8821A_RF.o\ - hal/OUTSRC/rtl8821a/HalHWImg8821A_TestChip_MAC.o\ - hal/OUTSRC/rtl8821a/HalHWImg8821A_TestChip_BB.o\ - hal/OUTSRC/rtl8821a/HalHWImg8821A_TestChip_RF.o\ hal/OUTSRC/rtl8812a/HalPhyRf_8812A.o\ hal/OUTSRC/rtl8821a/HalPhyRf_8821A.o\ hal/OUTSRC/rtl8821a/odm_RegConfig8821A.o\ - hal/OUTSRC/rtl8821a/odm_RTL8821A.o -endif + hal/OUTSRC/rtl8821a/odm_RTL8821A.o\ + hal/OUTSRC/rtl8821a/PhyDM_IQK_8821A.o +endif endif @@ -599,7 +620,7 @@ _HAL_INTFS_FILES += hal/$(RTL871X)/$(RTL871X)_hal_init.o \ hal/$(RTL871X)/$(RTL871X)_dm.o \ hal/$(RTL871X)/$(RTL871X)_rxdesc.o \ hal/$(RTL871X)/$(RTL871X)_cmd.o \ - + _HAL_INTFS_FILES += \ hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_halinit.o \ @@ -628,14 +649,14 @@ _OUTSRC_FILES += hal/OUTSRC/$(RTL871X)/HalHWImg8723B_BB.o\ endif -########### AUTO_CFG ################################# - +########### AUTO_CFG ################################# + ifeq ($(CONFIG_AUTOCFG_CP), y) -ifeq ($(CONFIG_MULTIDRV), y) +ifeq ($(CONFIG_MULTIDRV), y) $(shell cp $(TopDIR)/autoconf_multidrv_$(HCI_NAME)_linux.h $(TopDIR)/include/autoconf.h) else -ifeq ($(CONFIG_RTL8188E)$(CONFIG_SDIO_HCI),yy) +ifeq ($(CONFIG_RTL8188E)$(CONFIG_SDIO_HCI),yy) $(shell cp $(TopDIR)/autoconf_rtl8189e_$(HCI_NAME)_linux.h $(TopDIR)/include/autoconf.h) else $(shell cp $(TopDIR)/autoconf_$(RTL871X)_$(HCI_NAME)_linux.h $(TopDIR)/include/autoconf.h) @@ -689,6 +710,14 @@ endif ifeq ($(CONFIG_EFUSE_CONFIG_FILE), y) EXTRA_CFLAGS += -DCONFIG_EFUSE_CONFIG_FILE +ifeq ($(MODULE_NAME), 8189es) +EXTRA_CFLAGS += -DEFUSE_MAP_PATH=\"/system/etc/wifi/wifi_efuse_8189e.map\" +else ifeq ($(MODULE_NAME), 8723bs) +EXTRA_CFLAGS += -DEFUSE_MAP_PATH=\"/system/etc/wifi/wifi_efuse_8723bs.map\" +else +EXTRA_CFLAGS += -DEFUSE_MAP_PATH=\"/system/etc/wifi/wifi_efuse_$(MODULE_NAME).map\" +endif +EXTRA_CFLAGS += -DWIFIMAC_PATH=\"/data/wifimac.txt\" endif ifeq ($(CONFIG_EXT_CLK), y) @@ -701,6 +730,8 @@ endif ifeq ($(CONFIG_LOAD_PHY_PARA_FROM_FILE), y) EXTRA_CFLAGS += -DCONFIG_LOAD_PHY_PARA_FROM_FILE +#EXTRA_CFLAGS += -DREALTEK_CONFIG_PATH=\"/lib/firmware/\" +EXTRA_CFLAGS += -DREALTEK_CONFIG_PATH=\"\" endif ifeq ($(CONFIG_CALIBRATE_TX_POWER_BY_REGULATORY), y) @@ -711,8 +742,24 @@ ifeq ($(CONFIG_CALIBRATE_TX_POWER_TO_MAX), y) EXTRA_CFLAGS += -DCONFIG_CALIBRATE_TX_POWER_TO_MAX endif -ifeq ($(CONFIG_ODM_ADAPTIVITY), y) -EXTRA_CFLAGS += -DCONFIG_ODM_ADAPTIVITY +ifeq ($(CONFIG_RTW_ADAPTIVITY_EN), disable) +EXTRA_CFLAGS += -DCONFIG_RTW_ADAPTIVITY_EN=0 +else ifeq ($(CONFIG_RTW_ADAPTIVITY_EN), enable) +EXTRA_CFLAGS += -DCONFIG_RTW_ADAPTIVITY_EN=1 +endif + +ifeq ($(CONFIG_RTW_ADAPTIVITY_MODE), normal) +EXTRA_CFLAGS += -DCONFIG_RTW_ADAPTIVITY_MODE=0 +else ifeq ($(CONFIG_RTW_ADAPTIVITY_MODE), carrier_sense) +EXTRA_CFLAGS += -DCONFIG_RTW_ADAPTIVITY_MODE=1 +endif + +ifeq ($(CONFIG_SKIP_SIGNAL_SCALE_MAPPING), y) +EXTRA_CFLAGS += -DCONFIG_SKIP_SIGNAL_SCALE_MAPPING +endif + +ifeq ($(CONFIG_80211W), y) +EXTRA_CFLAGS += -DCONFIG_IEEE80211W endif ifeq ($(CONFIG_WOWLAN), y) @@ -740,12 +787,31 @@ ifeq ($(CONFIG_GPIO_WAKEUP), y) EXTRA_CFLAGS += -DCONFIG_GPIO_WAKEUP endif +ifneq ($(CONFIG_WAKEUP_GPIO_IDX), default) +EXTRA_CFLAGS += -DWAKEUP_GPIO_IDX=$(CONFIG_WAKEUP_GPIO_IDX) +endif + ifeq ($(CONFIG_RTW_SDIO_PM_KEEP_POWER), y) ifeq ($(CONFIG_SDIO_HCI), y) EXTRA_CFLAGS += -DCONFIG_RTW_SDIO_PM_KEEP_POWER endif endif +ifeq ($(CONFIG_REDUCE_TX_CPU_LOADING), y) +EXTRA_CFLAGS += -DCONFIG_REDUCE_TX_CPU_LOADING +endif + +ifeq ($(CONFIG_BR_EXT), y) +BR_NAME = br0 +EXTRA_CFLAGS += -DCONFIG_BR_EXT +EXTRA_CFLAGS += '-DCONFIG_BR_EXT_BRNAME="'$(BR_NAME)'"' +endif + +ifeq ($(CONFIG_ANTENNA_DIVERSITY), y) +EXTRA_CFLAGS += -DCONFIG_ANTENNA_DIVERSITY +endif + + ifeq ($(CONFIG_PLATFORM_I386_PC), y) EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN SUBARCH := $(shell uname -m | sed -e s/i.86/i386/) @@ -913,7 +979,7 @@ KSRC ?= /lib/modules/2.6.31-770-g0e46b52/source endif ifeq ($(CONFIG_PLATFORM_FS_MX61), y) -EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN +EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN ARCH := arm CROSS_COMPILE := /home/share/CusEnv/FreeScale/arm-eabi-4.4.3/bin/arm-eabi- KSRC ?= /home/share/CusEnv/FreeScale/FS_kernel_env @@ -931,10 +997,24 @@ endif ifeq ($(CONFIG_PLATFORM_TI_DM365), y) EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_TI_DM365 +EXTRA_CFLAGS += -DCONFIG_USE_USB_BUFFER_ALLOC_RX +EXTRA_CFLAGS += -DCONFIG_SINGLE_XMIT_BUF -DCONFIG_SINGLE_RECV_BUF ARCH := arm -CROSS_COMPILE := /home/cnsd4/Appro/mv_pro_5.0/montavista/pro/devkit/arm/v5t_le/bin/arm_v5t_le- +#CROSS_COMPILE := /home/cnsd4/Appro/mv_pro_5.0/montavista/pro/devkit/arm/v5t_le/bin/arm_v5t_le- +#KSRC := /home/cnsd4/Appro/mv_pro_5.0/montavista/pro/devkit/lsp/ti-davinci/linux-dm365 +CROSS_COMPILE := /opt/montavista/pro5.0/devkit/arm/v5t_le/bin/arm-linux- +KSRC:= /home/vivotek/lsp/DM365/kernel_platform/kernel/linux-2.6.18 +KERNELOUTPUT := ${PRODUCTDIR}/tmp KVER := 2.6.18 -KSRC := /home/cnsd4/Appro/mv_pro_5.0/montavista/pro/devkit/lsp/ti-davinci/linux-dm365 +endif + +ifeq ($(CONFIG_PLATFORM_MOZART), y) +EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_MOZART +ARCH := arm +CROSS_COMPILE := /home/vivotek/lsp/mozart3v2/Mozart3e_Toolchain/build_arm_nofpu/usr/bin/arm-linux- +KVER := $(shell uname -r) +KSRC:= /opt/Vivotek/lsp/mozart3v2/kernel_platform/kernel/mozart_kernel-1.17 +KERNELOUTPUT := /home/pink/sample/ODM/IP8136W-VINT/tmp/kernel endif ifeq ($(CONFIG_PLATFORM_TEGRA3_CARDHU), y) @@ -1016,6 +1096,7 @@ MODULE_NAME := wlan endif ifeq ($(CONFIG_PLATFORM_ARM_RK3066), y) +EXTRA_CFLAGS += -DCONFIG_PLATFORM_ARM_RK3066 EXTRA_CFLAGS += -DRTW_ENABLE_WIFI_CONTROL_FUNC EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE @@ -1060,7 +1141,7 @@ endif ifeq ($(CONFIG_PLATFORM_SZEBOOK), y) EXTRA_CFLAGS += -DCONFIG_BIG_ENDIAN ARCH:=arm -CROSS_COMPILE:=/opt/crosstool2/bin/armeb-unknown-linux-gnueabi- +CROSS_COMPILE:=/opt/crosstool2/bin/armeb-unknown-linux-gnueabi- KVER:= 2.6.31.6 KSRC:= ../code/linux-2.6.31.6-2020/ endif @@ -1184,13 +1265,17 @@ _PLATFORM_FILES += platform/platform_ARM_SUNnI_sdio.o endif ARCH := arm -CROSS_COMPILE := /home/android_sdk/Allwinner/a23/android-jb42/lichee/out/android/common/buildroot/external-toolchain/bin/arm-linux-gnueabi- -KVER := 3.4.39 -KSRC :=/home/android_sdk/Allwinner/a23/android-jb42/lichee/linux-3.4 +# ===Cross compile setting for Android 4.2 SDK === +#CROSS_COMPILE := /home/android_sdk/Allwinner/a23/android-jb42/lichee/out/android/common/buildroot/external-toolchain/bin/arm-linux-gnueabi- +#KSRC :=/home/android_sdk/Allwinner/a23/android-jb42/lichee/linux-3.4 +# ===Cross compile setting for Android 4.4 SDK === +CROSS_COMPILE := /home/android_sdk/Allwinner/a23/android-kk44/lichee/out/android/common/buildroot/external-toolchain/bin/arm-linux-gnueabi- +KSRC :=/home/android_sdk/Allwinner/a23/android-kk44/lichee/linux-3.4 endif ifeq ($(CONFIG_PLATFORM_ACTIONS_ATV5201), y) EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ACTIONS_ATV5201 +EXTRA_CFLAGS += -DCONFIG_SDIO_DISABLE_RXFIFO_POLLING_LOOP ARCH := mips CROSS_COMPILE := mipsel-linux-gnu- KVER := $(KERNEL_VER) @@ -1236,7 +1321,53 @@ _PLATFORM_FILES += platform/platform_sprd_sdio.o endif endif -ifeq ($(CONFIG_MULTIDRV), y) +ifeq ($(CONFIG_PLATFORM_ARM_WMT), y) +EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN +EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE +EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT +EXTRA_CFLAGS += -DCONFIG_PLATFORM_OPS +ifeq ($(CONFIG_SDIO_HCI), y) +_PLATFORM_FILES += platform/platform_ARM_WMT_sdio.o +endif +ARCH := arm +CROSS_COMPILE := /home/android_sdk/WonderMedia/wm8880-android4.4/toolchain/arm_201103_gcc4.5.2/mybin/arm_1103_le- +KSRC := /home/android_sdk/WonderMedia/wm8880-android4.4/kernel4.4/ +MODULE_NAME :=8189es_kk +endif + +ifeq ($(CONFIG_PLATFORM_RTK119X), y) +EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN +#EXTRA_CFLAGS += -DCONFIG_PLATFORM_ARM_SUN7I +EXTRA_CFLAGS += -DCONFIG_TRAFFIC_PROTECT +# default setting for Android 4.1, 4.2 +EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE +EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT +#EXTRA_CFLAGS += -DCONFIG_P2P_IPS -DCONFIG_QOS_OPTIMIZATION +EXTRA_CFLAGS += -DCONFIG_QOS_OPTIMIZATION + +#EXTRA_CFLAGS += -DCONFIG_#PLATFORM_OPS +ifeq ($(CONFIG_USB_HCI), y) +EXTRA_CFLAGS += -DCONFIG_USE_USB_BUFFER_ALLOC_TX +#_PLATFORM_FILES += platform/platform_ARM_SUNxI_usb.o +endif +ifeq ($(CONFIG_SDIO_HCI), y) +_PLATFORM_FILES += platform/platform_ARM_SUNnI_sdio.o +endif + +ARCH := arm + +# ==== Cross compile setting for Android 4.4 SDK ===== +#CROSS_COMPILE := arm-linux-gnueabihf- +KVER := 3.10.24 +#KSRC :=/home/android_sdk/Allwinner/a20/android-kitkat44/lichee/linux-3.4 +CROSS_COMPILE := /home/realtek/software_phoenix/phoenix/toolchain/usr/local/arm-2013.11/bin/arm-linux-gnueabihf- +KSRC := /home/realtek/software_phoenix/linux-kernel +MODULE_NAME := 8192eu + +endif + + +ifeq ($(CONFIG_MULTIDRV), y) ifeq ($(CONFIG_SDIO_HCI), y) MODULE_NAME := rtw_sdio @@ -1253,6 +1384,7 @@ endif endif +USER_MODULE_NAME ?= ifneq ($(USER_MODULE_NAME),) MODULE_NAME := $(USER_MODULE_NAME) endif @@ -1292,7 +1424,7 @@ $(MODULE_NAME)-$(CONFIG_INTEL_WIDI) += core/rtw_intel_widi.o $(MODULE_NAME)-$(CONFIG_WAPI_SUPPORT) += core/rtw_wapi.o \ core/rtw_wapi_sms4.o - + $(MODULE_NAME)-y += $(_OS_INTFS_FILES) $(MODULE_NAME)-y += $(_HAL_INTFS_FILES) $(MODULE_NAME)-y += $(_OUTSRC_FILES) @@ -1342,7 +1474,7 @@ config_r: clean: cd hal/OUTSRC/ ; rm -fr */*.mod.c */*.mod */*.o */.*.cmd */*.ko - cd hal/OUTSRC/ ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko + cd hal/OUTSRC/ ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko cd hal/led ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko cd hal ; rm -fr */*/*.mod.c */*/*.mod */*/*.o */*/.*.cmd */*/*.ko cd hal ; rm -fr */*.mod.c */*.mod */*.o */.*.cmd */*.ko diff --git a/core/efuse/rtw_efuse.c b/core/efuse/rtw_efuse.c index 5d3f80a..ce2df7e 100644 --- a/core/efuse/rtw_efuse.c +++ b/core/efuse/rtw_efuse.c @@ -433,7 +433,8 @@ efuse_OneByteRead( u32 tmpidx = 0; u8 bResult; u8 readbyte; - + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + //DBG_871X("===> EFUSE_OneByteRead(), addr = %x\n", addr); //DBG_871X("===> EFUSE_OneByteRead() start, 0x34 = 0x%X\n", rtw_read32(pAdapter, EFUSE_TEST)); @@ -442,9 +443,12 @@ efuse_OneByteRead( bResult = Efuse_Read1ByteFromFakeContent(pAdapter, addr, data); return bResult; } - + if( IS_HARDWARE_TYPE_8723B(pAdapter) || - (IS_HARDWARE_TYPE_8192E(pAdapter) && IS_VENDOR_8192E_B_CUT(pAdapter))) + (IS_HARDWARE_TYPE_8192E(pAdapter) && (!IS_A_CUT(pHalData->VersionID))) || + //(IS_HARDWARE_TYPE_8188E(pAdapter) && ((IS_I_CUT(pHalData->VersionID)) || (IS_J_CUT(pHalData->VersionID)))) + (IS_VENDOR_8188E_I_CUT_SERIES(pAdapter)) + ) { // <20130121, Kordan> For SMIC EFUSE specificatoin. //0x34[11]: SW force PGMEN input of efuse to high. (for the bank selected by 0x34[9:8]) @@ -495,7 +499,8 @@ efuse_OneByteWrite( u8 tmpidx = 0; u8 bResult=_FALSE; u32 efuseValue = 0; - + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + //DBG_871X("===> EFUSE_OneByteWrite(), addr = %x data=%x\n", addr, data); //DBG_871X("===> EFUSE_OneByteWrite() start, 0x34 = 0x%X\n", rtw_read32(pAdapter, EFUSE_TEST)); @@ -517,7 +522,11 @@ efuse_OneByteWrite( // <20130227, Kordan> 8192E MP chip A-cut had better not set 0x34[11] until B-Cut. - if (IS_HARDWARE_TYPE_8723B(pAdapter)||(IS_HARDWARE_TYPE_8192E(pAdapter) && IS_VENDOR_8192E_B_CUT(pAdapter))) + if ( IS_HARDWARE_TYPE_8723B(pAdapter) || + (IS_HARDWARE_TYPE_8192E(pAdapter) && (!IS_A_CUT(pHalData->VersionID))) || + //(IS_HARDWARE_TYPE_8188E(pAdapter) && ((IS_I_CUT(pHalData->VersionID)) || (IS_J_CUT(pHalData->VersionID)))) + (IS_VENDOR_8188E_I_CUT_SERIES(pAdapter)) + ) { // <20130121, Kordan> For SMIC EFUSE specificatoin. //0x34[11]: SW force PGMEN input of efuse to high. (for the bank selected by 0x34[9:8]) @@ -548,7 +557,11 @@ efuse_OneByteWrite( } // disable Efuse program enable - if (IS_HARDWARE_TYPE_8723B(pAdapter)) + if ( IS_HARDWARE_TYPE_8723B(pAdapter) || + (IS_HARDWARE_TYPE_8192E(pAdapter) && (!IS_A_CUT(pHalData->VersionID))) || + //(IS_HARDWARE_TYPE_8188E(pAdapter) && ((IS_I_CUT(pHalData->VersionID)) || (IS_J_CUT(pHalData->VersionID)))) + (IS_VENDOR_8188E_I_CUT_SERIES(pAdapter)) + ) { PHY_SetMacReg(pAdapter, EFUSE_TEST, BIT(11), 0); } diff --git a/core/rtw_ap.c b/core/rtw_ap.c index 4190fa3..ca63436 100644 --- a/core/rtw_ap.c +++ b/core/rtw_ap.c @@ -71,9 +71,9 @@ void free_mlme_ap_info(_adapter *padapter) //free bc/mc sta_info psta = rtw_get_bcmc_stainfo(padapter); - _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + //_enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); rtw_free_stainfo(padapter, psta); - _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + //_exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); _rtw_spinlock_free(&pmlmepriv->bcn_update_lock); @@ -405,9 +405,9 @@ void expire_timeout_chk(_adapter *padapter) _exit_critical_bh(&pstapriv->auth_list_lock, &irqL); - _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + //_enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); rtw_free_stainfo(padapter, psta); - _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + //_exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); _enter_critical_bh(&pstapriv->auth_list_lock, &irqL); } @@ -877,8 +877,6 @@ void update_bmc_sta(_adapter *padapter) if(psta) { psta->aid = 0;//default set to 0 - //psta->mac_id = psta->aid+4; - psta->mac_id = psta->aid + 1;//mac_id=1 for bc/mc stainfo pmlmeinfo->FW_sta_info[psta->mac_id].psta = psta; @@ -992,33 +990,46 @@ void update_sta_info_apmode(_adapter *padapter, struct sta_info *psta) //check if sta supports rx ampdu phtpriv_sta->ampdu_enable = phtpriv_ap->ampdu_enable; - //check if sta support s Short GI 20M + phtpriv_sta->rx_ampdu_min_spacing = (phtpriv_sta->ht_cap.ampdu_params_info&IEEE80211_HT_CAP_AMPDU_DENSITY)>>2; + + // bwmode + if((phtpriv_sta->ht_cap.cap_info & phtpriv_ap->ht_cap.cap_info) & cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH)) + { + psta->bw_mode = CHANNEL_WIDTH_40; + } + else + { + psta->bw_mode = CHANNEL_WIDTH_20; + } + + if(pmlmeext->cur_bwmode < psta->bw_mode) + { + psta->bw_mode = pmlmeext->cur_bwmode; + } + + phtpriv_sta->ch_offset = pmlmeext->cur_ch_offset; + + + //check if sta support s Short GI 20M if((phtpriv_sta->ht_cap.cap_info & phtpriv_ap->ht_cap.cap_info) & cpu_to_le16(IEEE80211_HT_CAP_SGI_20)) { phtpriv_sta->sgi_20m = _TRUE; } - //check if sta support s Short GI 40M + + //check if sta support s Short GI 40M if((phtpriv_sta->ht_cap.cap_info & phtpriv_ap->ht_cap.cap_info) & cpu_to_le16(IEEE80211_HT_CAP_SGI_40)) { - phtpriv_sta->sgi_40m = _TRUE; - } - - // bwmode - if((phtpriv_sta->ht_cap.cap_info & phtpriv_ap->ht_cap.cap_info) & cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH)) - { - phtpriv_sta->ch_offset = pmlmeext->cur_ch_offset; - psta->bw_mode = CHANNEL_WIDTH_40; - } - else - { - psta->bw_mode = CHANNEL_WIDTH_20; + if(psta->bw_mode == CHANNEL_WIDTH_40) //according to psta->bw_mode + phtpriv_sta->sgi_40m = _TRUE; + else + phtpriv_sta->sgi_40m = _FALSE; } psta->qos_option = _TRUE; // B0 Config LDPC Coding Capability if (TEST_FLAG(phtpriv_ap->ldpc_cap, LDPC_HT_ENABLE_TX) && - GET_HT_CAPABILITY_ELE_LDPC_CAP((u8 *)(&phtpriv_sta->ht_cap))) + GET_HT_CAP_ELE_LDPC_CAP((u8 *)(&phtpriv_sta->ht_cap))) { SET_FLAG(cur_ldpc_cap, (LDPC_HT_ENABLE_TX | LDPC_HT_CAP_TX)); DBG_871X("Enable HT Tx LDPC for STA(%d)\n",psta->aid); @@ -1026,7 +1037,7 @@ void update_sta_info_apmode(_adapter *padapter, struct sta_info *psta) // B7 B8 B9 Config STBC setting if (TEST_FLAG(phtpriv_ap->stbc_cap, STBC_HT_ENABLE_TX) && - GET_HT_CAPABILITY_ELE_RX_STBC((u8 *)(&phtpriv_sta->ht_cap))) + GET_HT_CAP_ELE_RX_STBC((u8 *)(&phtpriv_sta->ht_cap))) { SET_FLAG(cur_stbc_cap, (STBC_HT_ENABLE_TX | STBC_HT_CAP_TX) ); DBG_871X("Enable HT Tx STBC for STA(%d)\n",psta->aid); @@ -1720,9 +1731,14 @@ int rtw_check_beacon_data(_adapter *padapter, u8 *pbuf, int len) if(p && ie_len>0) { u8 rf_type=0; - u8 max_rx_ampdu_factor=0; + HT_CAP_AMPDU_FACTOR max_rx_ampdu_factor=MAX_AMPDU_FACTOR_64K; struct rtw_ieee80211_ht_cap *pht_cap = (struct rtw_ieee80211_ht_cap *)(p+2); + if (0) { + DBG_871X(FUNC_ADPT_FMT" HT_CAP_IE from upper layer:\n", FUNC_ADPT_ARG(padapter)); + dump_ht_cap_ie_content(RTW_DBGDUMP, p+2, ie_len); + } + pHT_caps_ie=p; ht_cap = _TRUE; @@ -1730,6 +1746,7 @@ int rtw_check_beacon_data(_adapter *padapter, u8 *pbuf, int len) rtw_ht_use_default_setting(padapter); + /* Update HT Capabilities Info field */ if (pmlmepriv->htpriv.sgi_20m == _FALSE) pht_cap->cap_info &= ~(IEEE80211_HT_CAP_SGI_20); @@ -1751,8 +1768,9 @@ int rtw_check_beacon_data(_adapter *padapter, u8 *pbuf, int len) pht_cap->cap_info &= ~(IEEE80211_HT_CAP_RX_STBC_3R); } + /* Update A-MPDU Parameters field */ pht_cap->ampdu_params_info &= ~(IEEE80211_HT_CAP_AMPDU_FACTOR|IEEE80211_HT_CAP_AMPDU_DENSITY); - + if((psecuritypriv->wpa_pairwise_cipher & WPA_CIPHER_CCMP) || (psecuritypriv->wpa2_pairwise_cipher & WPA_CIPHER_CCMP)) { @@ -1766,11 +1784,25 @@ int rtw_check_beacon_data(_adapter *padapter, u8 *pbuf, int len) rtw_hal_get_def_var(padapter, HW_VAR_MAX_RX_AMPDU_FACTOR, &max_rx_ampdu_factor); pht_cap->ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_FACTOR & max_rx_ampdu_factor); //set Max Rx AMPDU size to 64K - rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); - if(rf_type == RF_1T1R) - { - pht_cap->supp_mcs_set[0] = 0xff; - pht_cap->supp_mcs_set[1] = 0x0; + /* Update Supported MCS Set field */ + { + int i; + + rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); + + /* RX MCS Bitmask */ + switch(rf_type) + { + case RF_1T1R: + case RF_1T2R: //? + set_mcs_rate_by_mask(HT_CAP_ELE_RX_MCS_MAP(pht_cap), MCS_RATE_1R); + break; + case RF_2T2R: + default: + set_mcs_rate_by_mask(HT_CAP_ELE_RX_MCS_MAP(pht_cap), MCS_RATE_2R); + } + for (i = 0; i < 10; i++) + *(HT_CAP_ELE_RX_MCS_MAP(pht_cap)+i) &= padapter->mlmeextpriv.default_supported_mcs_set[i]; } #ifdef CONFIG_BEAMFORMING @@ -1800,7 +1832,11 @@ int rtw_check_beacon_data(_adapter *padapter, u8 *pbuf, int len) #endif //CONFIG_BEAMFORMING _rtw_memcpy(&pmlmepriv->htpriv.ht_cap, p+2, ie_len); - + + if (0) { + DBG_871X(FUNC_ADPT_FMT" HT_CAP_IE driver masked:\n", FUNC_ADPT_ARG(padapter)); + dump_ht_cap_ie_content(RTW_DBGDUMP, p+2, ie_len); + } } //parsing HT_INFO_IE @@ -2363,7 +2399,7 @@ static void update_bcn_vendor_spec_ie(_adapter *padapter, u8*oui) } -void update_beacon(_adapter *padapter, u8 ie_id, u8 *oui, u8 tx) +void _update_beacon(_adapter *padapter, u8 ie_id, u8 *oui, u8 tx, const char *tag) { _irqL irqL; struct mlme_priv *pmlmepriv; @@ -2441,6 +2477,8 @@ void update_beacon(_adapter *padapter, u8 ie_id, u8 *oui, u8 tx) if(tx) { //send_beacon(padapter);//send_beacon must execute on TSR level + if (0) + DBG_871X(FUNC_ADPT_FMT" ie_id:%u - %s\n", FUNC_ADPT_ARG(padapter), ie_id, tag); set_tx_beacon_cmd(padapter); } #else @@ -2890,7 +2928,7 @@ u8 ap_free_sta(_adapter *padapter, struct sta_info *psta, bool active, u16 reaso //report_del_sta_event(padapter, psta->hwaddr, reason); //clear cam entry / key - rtw_clearstakey_cmd(padapter, (u8*)psta, (u8)rtw_get_camid(psta->mac_id), _TRUE); + rtw_clearstakey_cmd(padapter, psta, _TRUE); _enter_critical_bh(&psta->lock, &irqL); @@ -2916,9 +2954,9 @@ u8 ap_free_sta(_adapter *padapter, struct sta_info *psta, bool active, u16 reaso beacon_updated = bss_cap_update_on_sta_leave(padapter, psta); - _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + //_enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); rtw_free_stainfo(padapter, psta); - _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + //_exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); return beacon_updated; @@ -2973,12 +3011,10 @@ int rtw_sta_flush(_adapter *padapter) struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); u8 bc_addr[ETH_ALEN] = {0xff,0xff,0xff,0xff,0xff,0xff}; - DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(padapter->pnetdev)); - if((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE) return ret; - + DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(padapter->pnetdev)); _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); phead = &pstapriv->asoc_list; plist = get_next(phead); @@ -3129,13 +3165,14 @@ void rtw_ap_restore_network(_adapter *padapter) if (psta == NULL) { DBG_871X(FUNC_ADPT_FMT" sta_info is null\n", FUNC_ADPT_ARG(padapter)); } else if (psta->state &_FW_LINKED) { + rtw_sta_media_status_rpt(padapter, psta, 1); Update_RA_Entry(padapter, psta); //pairwise key /* per sta pairwise key and settings */ if( (padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) || (padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)) { - rtw_setstakey_cmd(padapter, (unsigned char *)psta, _TRUE,_FALSE); + rtw_setstakey_cmd(padapter, psta, _TRUE,_FALSE); } } } @@ -3178,13 +3215,14 @@ void start_ap_mode(_adapter *padapter) for(i=0; ista_aid[i] = NULL; +/* to avoid memory leak issue, don't set to NULL directly pmlmepriv->wps_beacon_ie = NULL; pmlmepriv->wps_probe_resp_ie = NULL; pmlmepriv->wps_assoc_resp_ie = NULL; pmlmepriv->p2p_beacon_ie = NULL; pmlmepriv->p2p_probe_resp_ie = NULL; - +*/ //for ACL _rtw_init_listhead(&(pacl_list->acl_node_q.queue)); @@ -3212,6 +3250,7 @@ void stop_ap_mode(_adapter *padapter) pmlmepriv->update_bcn = _FALSE; pmlmeext->bstart_bss = _FALSE; + padapter->netif_up = _FALSE; //_rtw_spinlock_free(&pmlmepriv->bcn_update_lock); //reset and init security priv , this can refine with rtw_reset_securitypriv @@ -3247,9 +3286,9 @@ void stop_ap_mode(_adapter *padapter) rtw_free_all_stainfo(padapter); psta = rtw_get_bcmc_stainfo(padapter); - _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + //_enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); rtw_free_stainfo(padapter, psta); - _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + //_exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); rtw_init_bcmc_stainfo(padapter); diff --git a/core/rtw_beamforming.c b/core/rtw_beamforming.c index a3b44c3..8d8c614 100644 --- a/core/rtw_beamforming.c +++ b/core/rtw_beamforming.c @@ -330,7 +330,7 @@ BOOLEAN issue_ht_ndpa_packet(PADAPTER Adapter, u8 *ra, CHANNEL_WIDTH bw, u8 qidx update_mgntframe_attrib(Adapter, pattrib); if (qidx == BCN_QUEUE_INX) - pattrib->qsel = 0x10; + pattrib->qsel = QSLT_BEACON; pattrib->rate = MGN_MCS8; pattrib->bwmode = bw; pattrib->order = 1; @@ -412,7 +412,7 @@ BOOLEAN issue_vht_ndpa_packet(PADAPTER Adapter, u8 *ra, u16 aid, CHANNEL_WIDTH b update_mgntframe_attrib(Adapter, pattrib); if (qidx == BCN_QUEUE_INX) - pattrib->qsel = 0x10; + pattrib->qsel = QSLT_BEACON; pattrib->rate = MGN_VHT2SS_MCS0; pattrib->bwmode = bw; pattrib->subtype = WIFI_NDPA; diff --git a/core/rtw_br_ext.c b/core/rtw_br_ext.c index 88a517a..f90f790 100644 --- a/core/rtw_br_ext.c +++ b/core/rtw_br_ext.c @@ -247,7 +247,7 @@ static int update_nd_link_layer_addr(unsigned char *data, int len, unsigned char if (len >= 8) { mac = scan_tlv(&data[8], len-8, 1, 1); if (mac) { - _DEBUG_INFO("Router Solicitation, replace MAC From: %02x:%02x:%02x:%02x:%02x:%02x, To: %02x:%02x:%02x:%02x:%02x:%02x\n", + DBG_871X("Router Solicitation, replace MAC From: %02x:%02x:%02x:%02x:%02x:%02x, To: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0],mac[1],mac[2],mac[3],mac[4],mac[5], replace_mac[0],replace_mac[1],replace_mac[2],replace_mac[3],replace_mac[4],replace_mac[5]); memcpy(mac, replace_mac, 6); @@ -259,7 +259,7 @@ static int update_nd_link_layer_addr(unsigned char *data, int len, unsigned char if (len >= 16) { mac = scan_tlv(&data[16], len-16, 1, 1); if (mac) { - _DEBUG_INFO("Router Advertisement, replace MAC From: %02x:%02x:%02x:%02x:%02x:%02x, To: %02x:%02x:%02x:%02x:%02x:%02x\n", + DBG_871X("Router Advertisement, replace MAC From: %02x:%02x:%02x:%02x:%02x:%02x, To: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0],mac[1],mac[2],mac[3],mac[4],mac[5], replace_mac[0],replace_mac[1],replace_mac[2],replace_mac[3],replace_mac[4],replace_mac[5]); memcpy(mac, replace_mac, 6); @@ -271,7 +271,7 @@ static int update_nd_link_layer_addr(unsigned char *data, int len, unsigned char if (len >= 24) { mac = scan_tlv(&data[24], len-24, 1, 1); if (mac) { - _DEBUG_INFO("Neighbor Solicitation, replace MAC From: %02x:%02x:%02x:%02x:%02x:%02x, To: %02x:%02x:%02x:%02x:%02x:%02x\n", + DBG_871X("Neighbor Solicitation, replace MAC From: %02x:%02x:%02x:%02x:%02x:%02x, To: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0],mac[1],mac[2],mac[3],mac[4],mac[5], replace_mac[0],replace_mac[1],replace_mac[2],replace_mac[3],replace_mac[4],replace_mac[5]); memcpy(mac, replace_mac, 6); @@ -283,7 +283,7 @@ static int update_nd_link_layer_addr(unsigned char *data, int len, unsigned char if (len >= 24) { mac = scan_tlv(&data[24], len-24, 2, 1); if (mac) { - _DEBUG_INFO("Neighbor Advertisement, replace MAC From: %02x:%02x:%02x:%02x:%02x:%02x, To: %02x:%02x:%02x:%02x:%02x:%02x\n", + DBG_871X("Neighbor Advertisement, replace MAC From: %02x:%02x:%02x:%02x:%02x:%02x, To: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0],mac[1],mac[2],mac[3],mac[4],mac[5], replace_mac[0],replace_mac[1],replace_mac[2],replace_mac[3],replace_mac[4],replace_mac[5]); memcpy(mac, replace_mac, 6); @@ -295,7 +295,7 @@ static int update_nd_link_layer_addr(unsigned char *data, int len, unsigned char if (len >= 40) { mac = scan_tlv(&data[40], len-40, 2, 1); if (mac) { - _DEBUG_INFO("Redirect, replace MAC From: %02x:%02x:%02x:%02x:%02x:%02x, To: %02x:%02x:%02x:%02x:%02x:%02x\n", + DBG_871X("Redirect, replace MAC From: %02x:%02x:%02x:%02x:%02x:%02x, To: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0],mac[1],mac[2],mac[3],mac[4],mac[5], replace_mac[0],replace_mac[1],replace_mac[2],replace_mac[3],replace_mac[4],replace_mac[5]); memcpy(mac, replace_mac, 6); @@ -439,7 +439,7 @@ static int __nat25_db_network_lookup_and_replace(_adapter *priv, atomic_inc(&db->use_count); #ifdef CL_IPV6_PASS - DEBUG_INFO("NAT25: Lookup M:%02x%02x%02x%02x%02x%02x N:%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x" + DBG_871X("NAT25: Lookup M:%02x%02x%02x%02x%02x%02x N:%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x" "%02x%02x%02x%02x%02x%02x\n", db->macAddr[0], db->macAddr[1], @@ -465,7 +465,7 @@ static int __nat25_db_network_lookup_and_replace(_adapter *priv, db->networkAddr[15], db->networkAddr[16]); #else - DEBUG_INFO("NAT25: Lookup M:%02x%02x%02x%02x%02x%02x N:%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n", + DBG_871X("NAT25: Lookup M:%02x%02x%02x%02x%02x%02x N:%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n", db->macAddr[0], db->macAddr[1], db->macAddr[2], @@ -815,7 +815,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method) //in class A, B, C, host address is all zero or all one is illegal if (iph->saddr == 0) return 0; - DEBUG_INFO("NAT25: Insert IP, SA=%08x, DA=%08x\n", iph->saddr, iph->daddr); + DBG_871X("NAT25: Insert IP, SA=%08x, DA=%08x\n", iph->saddr, iph->daddr); __nat25_generate_ipv4_network_addr(networkAddr, &iph->saddr); //record source IP address and , source mac address into db __nat25_db_network_insert(priv, skb->data+ETH_ALEN, networkAddr); @@ -826,7 +826,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method) case NAT25_LOOKUP: { - DEBUG_INFO("NAT25: Lookup IP, SA=%08x, DA=%08x\n", iph->saddr, iph->daddr); + DBG_871X("NAT25: Lookup IP, SA=%08x, DA=%08x\n", iph->saddr, iph->daddr); #ifdef SUPPORT_TX_MCAST2UNI if (priv->pshare->rf_ft_var.mc2u_disable || ((((OPMODE & (WIFI_STATION_STATE|WIFI_ASOC_STATE)) @@ -840,12 +840,12 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method) if (!__nat25_db_network_lookup_and_replace(priv, skb, networkAddr)) { if (*((unsigned char *)&iph->daddr + 3) == 0xff) { // L2 is unicast but L3 is broadcast, make L2 bacome broadcast - DEBUG_INFO("NAT25: Set DA as boardcast\n"); + DBG_871X("NAT25: Set DA as boardcast\n"); memset(skb->data, 0xff, ETH_ALEN); } else { // forward unknow IP packet to upper TCP/IP - DEBUG_INFO("NAT25: Replace DA with BR's MAC\n"); + DBG_871X("NAT25: Replace DA with BR's MAC\n"); if ( (*(u32 *)priv->br_mac) == 0 && (*(u16 *)(priv->br_mac+4)) == 0 ) { void netdev_br_init(struct net_device *netdev); printk("Re-init netdev_br_init() due to br_mac==0!\n"); @@ -885,7 +885,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method) case NAT25_INSERT: { - DEBUG_INFO("NAT25: Insert ARP, MAC=%02x%02x%02x%02x%02x%02x\n", arp_ptr[0], + DBG_871X("NAT25: Insert ARP, MAC=%02x%02x%02x%02x%02x%02x\n", arp_ptr[0], arp_ptr[1], arp_ptr[2], arp_ptr[3], arp_ptr[4], arp_ptr[5]); // change to ARP sender mac address to wlan STA address @@ -904,7 +904,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method) case NAT25_LOOKUP: { - DEBUG_INFO("NAT25: Lookup ARP\n"); + DBG_871X("NAT25: Lookup ARP\n"); arp_ptr += arp->ar_hln; sender = (unsigned int *)arp_ptr; @@ -930,8 +930,9 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method) /*---------------------------------------------------*/ /* Handle IPX and Apple Talk frame */ /*---------------------------------------------------*/ - else if((protocol == __constant_htons(ETH_P_IPX)) || - (protocol <= __constant_htons(ETH_FRAME_LEN))) + else if((protocol == __constant_htons(ETH_P_IPX)) || + (protocol == __constant_htons(ETH_P_ATALK)) || + (protocol == __constant_htons(ETH_P_AARP))) { unsigned char ipx_header[2] = {0xFF, 0xFF}; struct ipxhdr *ipx = NULL; @@ -941,14 +942,14 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method) if(protocol == __constant_htons(ETH_P_IPX)) { - DEBUG_INFO("NAT25: Protocol=IPX (Ethernet II)\n"); + DBG_871X("NAT25: Protocol=IPX (Ethernet II)\n"); ipx = (struct ipxhdr *)framePtr; } - else if(protocol <= __constant_htons(ETH_FRAME_LEN)) + else //if(protocol <= __constant_htons(ETH_FRAME_LEN)) { if(!memcmp(ipx_header, framePtr, 2)) { - DEBUG_INFO("NAT25: Protocol=IPX (Ethernet 802.3)\n"); + DBG_871X("NAT25: Protocol=IPX (Ethernet 802.3)\n"); ipx = (struct ipxhdr *)framePtr; } else @@ -968,7 +969,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method) { framePtr += 5; // eliminate the SNAP header - DEBUG_INFO("NAT25: Protocol=IPX (Ethernet SNAP)\n"); + DBG_871X("NAT25: Protocol=IPX (Ethernet SNAP)\n"); ipx = (struct ipxhdr *)framePtr; } else if(!memcmp(aarp_snap_id, framePtr, 5)) @@ -996,18 +997,14 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method) if(!memcmp(ipx_header, framePtr, 2)) { - DEBUG_INFO("NAT25: Protocol=IPX (Ethernet 802.2)\n"); + DBG_871X("NAT25: Protocol=IPX (Ethernet 802.2)\n"); ipx = (struct ipxhdr *)framePtr; } else return -1; } - else - return -1; } } - else - return -1; /* IPX */ if(ipx != NULL) @@ -1017,14 +1014,14 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method) case NAT25_CHECK: if(!memcmp(skb->data+ETH_ALEN, ipx->ipx_source.node, ETH_ALEN)) { - DEBUG_INFO("NAT25: Check IPX skb_copy\n"); + DBG_871X("NAT25: Check IPX skb_copy\n"); return 0; } return -1; case NAT25_INSERT: { - DEBUG_INFO("NAT25: Insert IPX, Dest=%08x,%02x%02x%02x%02x%02x%02x,%04x Source=%08x,%02x%02x%02x%02x%02x%02x,%04x\n", + DBG_871X("NAT25: Insert IPX, Dest=%08x,%02x%02x%02x%02x%02x%02x,%04x Source=%08x,%02x%02x%02x%02x%02x%02x,%04x\n", ipx->ipx_dest.net, ipx->ipx_dest.node[0], ipx->ipx_dest.node[1], @@ -1044,7 +1041,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method) if(!memcmp(skb->data+ETH_ALEN, ipx->ipx_source.node, ETH_ALEN)) { - DEBUG_INFO("NAT25: Use IPX Net, and Socket as network addr\n"); + DBG_871X("NAT25: Use IPX Net, and Socket as network addr\n"); __nat25_generate_ipx_network_addr_with_socket(networkAddr, &ipx->ipx_source.net, &ipx->ipx_source.sock); @@ -1066,7 +1063,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method) { if(!memcmp(GET_MY_HWADDR(priv), ipx->ipx_dest.node, ETH_ALEN)) { - DEBUG_INFO("NAT25: Lookup IPX, Modify Destination IPX Node addr\n"); + DBG_871X("NAT25: Lookup IPX, Modify Destination IPX Node addr\n"); __nat25_generate_ipx_network_addr_with_socket(networkAddr, &ipx->ipx_dest.net, &ipx->ipx_dest.sock); @@ -1109,7 +1106,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method) // change to AARP source mac address to wlan STA address memcpy(ea->hw_src, GET_MY_HWADDR(priv), ETH_ALEN); - DEBUG_INFO("NAT25: Insert AARP, Source=%d,%d Destination=%d,%d\n", + DBG_871X("NAT25: Insert AARP, Source=%d,%d Destination=%d,%d\n", ea->pa_src_net, ea->pa_src_node, ea->pa_dst_net, @@ -1125,7 +1122,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method) case NAT25_LOOKUP: { - DEBUG_INFO("NAT25: Lookup AARP, Source=%d,%d Destination=%d,%d\n", + DBG_871X("NAT25: Lookup AARP, Source=%d,%d Destination=%d,%d\n", ea->pa_src_net, ea->pa_src_node, ea->pa_dst_net, @@ -1155,7 +1152,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method) case NAT25_INSERT: { - DEBUG_INFO("NAT25: Insert DDP, Source=%d,%d Destination=%d,%d\n", + DBG_871X("NAT25: Insert DDP, Source=%d,%d Destination=%d,%d\n", ddp->deh_snet, ddp->deh_snode, ddp->deh_dnet, @@ -1171,7 +1168,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method) case NAT25_LOOKUP: { - DEBUG_INFO("NAT25: Lookup DDP, Source=%d,%d Destination=%d,%d\n", + DBG_871X("NAT25: Lookup DDP, Source=%d,%d Destination=%d,%d\n", ddp->deh_snet, ddp->deh_snode, ddp->deh_dnet, @@ -1248,7 +1245,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method) if(__nat25_add_pppoe_tag(skb, tag) < 0) return -1; - DEBUG_INFO("NAT25: Insert PPPoE, forward %s packet\n", + DBG_871X("NAT25: Insert PPPoE, forward %s packet\n", (ph->code == PADI_CODE ? "PADI" : "PADR")); } else { // not add relay tag @@ -1269,7 +1266,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method) } else // session phase { - DEBUG_INFO("NAT25: Insert PPPoE, insert session packet to %s\n", skb->dev->name); + DBG_871X("NAT25: Insert PPPoE, insert session packet to %s\n", skb->dev->name); __nat25_generate_pppoe_network_addr(networkAddr, skb->data, &(ph->sid)); @@ -1327,7 +1324,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method) if (offset > 0) tag->tag_len = htons(tagLen-MAGIC_CODE_LEN-RTL_RELAY_TAG_LEN); - DEBUG_INFO("NAT25: Lookup PPPoE, forward %s Packet from %s\n", + DBG_871X("NAT25: Lookup PPPoE, forward %s Packet from %s\n", (ph->code == PADO_CODE ? "PADO" : "PADS"), skb->dev->name); } else { // not add relay tag @@ -1342,7 +1339,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method) else { if(ph->sid != 0) { - DEBUG_INFO("NAT25: Lookup PPPoE, lookup session packet from %s\n", skb->dev->name); + DBG_871X("NAT25: Lookup PPPoE, lookup session packet from %s\n", skb->dev->name); __nat25_generate_pppoe_network_addr(networkAddr, skb->data+ETH_ALEN, &(ph->sid)); __nat25_db_network_lookup_and_replace(priv, skb, networkAddr); @@ -1426,7 +1423,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method) case NAT25_INSERT: { - DEBUG_INFO("NAT25: Insert IP, SA=%4x:%4x:%4x:%4x:%4x:%4x:%4x:%4x," + DBG_871X("NAT25: Insert IP, SA=%4x:%4x:%4x:%4x:%4x:%4x:%4x:%4x," " DA=%4x:%4x:%4x:%4x:%4x:%4x:%4x:%4x\n", iph->saddr.s6_addr16[0],iph->saddr.s6_addr16[1],iph->saddr.s6_addr16[2],iph->saddr.s6_addr16[3], iph->saddr.s6_addr16[4],iph->saddr.s6_addr16[5],iph->saddr.s6_addr16[6],iph->saddr.s6_addr16[7], @@ -1455,7 +1452,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method) return 0; case NAT25_LOOKUP: - DEBUG_INFO("NAT25: Lookup IP, SA=%4x:%4x:%4x:%4x:%4x:%4x:%4x:%4x," + DBG_871X("NAT25: Lookup IP, SA=%4x:%4x:%4x:%4x:%4x:%4x:%4x:%4x," " DA=%4x:%4x:%4x:%4x:%4x:%4x:%4x:%4x\n", iph->saddr.s6_addr16[0],iph->saddr.s6_addr16[1],iph->saddr.s6_addr16[2],iph->saddr.s6_addr16[3], iph->saddr.s6_addr16[4],iph->saddr.s6_addr16[5],iph->saddr.s6_addr16[6],iph->saddr.s6_addr16[7], @@ -1571,7 +1568,7 @@ void mac_clone(_adapter *priv, unsigned char *addr) struct sockaddr sa; memcpy(sa.sa_data, addr, ETH_ALEN); - DEBUG_INFO("MAC Clone: Addr=%02x%02x%02x%02x%02x%02x\n", + DBG_871X("MAC Clone: Addr=%02x%02x%02x%02x%02x%02x\n", addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]); rtl8192cd_set_hwaddr(priv->dev, &sa); } @@ -1650,7 +1647,7 @@ void dhcp_flag_bcast(_adapter *priv, struct sk_buff *skb) { register int sum = 0; - DEBUG_INFO("DHCP: change flag of DHCP request to broadcast.\n"); + DBG_871X("DHCP: change flag of DHCP request to broadcast.\n"); // or BROADCAST flag dhcph->flags |= htons(BROADCAST_FLAG); // recalculate checksum diff --git a/core/rtw_bt_mp.c b/core/rtw_bt_mp.c index c9554f7..73f2105 100644 --- a/core/rtw_bt_mp.c +++ b/core/rtw_bt_mp.c @@ -107,10 +107,6 @@ mptbt_CheckC2hFrame( return c2hStatus; } -#if defined(CONFIG_RTL8723A) -extern s32 FillH2CCmd(PADAPTER padapter, u8 ElementID, u32 CmdLen, u8 *pCmdBuffer); -#endif - BT_CTRL_STATUS mptbt_SendH2c( PADAPTER Adapter, @@ -140,7 +136,7 @@ mptbt_SendH2c( pMptCtx->MptBtC2hEvent = _FALSE; #if defined(CONFIG_RTL8723A) - FillH2CCmd(Adapter, 70, h2cCmdLen, (pu1Byte)pH2c); + rtw_hal_fill_h2c_cmd(Adapter, 70, h2cCmdLen, (pu1Byte)pH2c); #elif defined(CONFIG_RTL8723B) rtl8723b_set_FwBtMpOper_cmd(Adapter, pH2c->opCode, pH2c->opCodeVer, pH2c->reqNum, pH2c->buf); #endif diff --git a/core/rtw_btcoex.c b/core/rtw_btcoex.c index ea5931c..157b875 100644 --- a/core/rtw_btcoex.c +++ b/core/rtw_btcoex.c @@ -28,6 +28,16 @@ void rtw_btcoex_Initialize(PADAPTER padapter) hal_btcoex_Initialize(padapter); } +void rtw_btcoex_PowerOnSetting(PADAPTER padapter) +{ + hal_btcoex_PowerOnSetting(padapter); +} + +void rtw_btcoex_PreLoadFirmware(PADAPTER padapter) +{ + hal_btcoex_PreLoadFirmware(padapter); +} + void rtw_btcoex_HAL_Initialize(PADAPTER padapter, u8 bWifiOnly) { hal_btcoex_InitHwConfig(padapter, bWifiOnly); @@ -240,9 +250,9 @@ void rtw_btcoex_SetChipType(PADAPTER padapter, u8 chipType) hal_btcoex_SetChipType(padapter, chipType); } -void rtw_btcoex_SetPGAntNum(PADAPTER padapter, u8 antNum, u8 antInverse) +void rtw_btcoex_SetPGAntNum(PADAPTER padapter, u8 antNum) { - hal_btcoex_SetPgAntNum(padapter, antNum, antInverse); + hal_btcoex_SetPgAntNum(padapter, antNum); } u8 rtw_btcoex_GetPGAntNum(PADAPTER padapter) @@ -250,6 +260,11 @@ u8 rtw_btcoex_GetPGAntNum(PADAPTER padapter) return hal_btcoex_GetPgAntNum(padapter); } +void rtw_btcoex_SetSingleAntPath(PADAPTER padapter, u8 singleAntPath) +{ + hal_btcoex_SetSingleAntPath(padapter, singleAntPath); +} + u32 rtw_btcoex_GetRaMask(PADAPTER padapter) { return hal_btcoex_GetRaMask(padapter); @@ -291,15 +306,53 @@ u8 rtw_btcoex_IsBtLinkExist(PADAPTER padapter) void rtw_btcoex_RejectApAggregatedPacket(PADAPTER padapter, u8 enable) { struct mlme_ext_info *pmlmeinfo; - struct sta_info *psta; pmlmeinfo = &padapter->mlmeextpriv.mlmext_info; - psta = rtw_get_stainfo(&padapter->stapriv, get_bssid(&padapter->mlmepriv)); if (_TRUE == enable) { + struct sta_info *psta = NULL; + pmlmeinfo->bAcceptAddbaReq = _FALSE; - send_delba(padapter, 0, psta->hwaddr); + + if ((pmlmeinfo->state & 0x03) == WIFI_FW_STATION_STATE) { + psta = rtw_get_stainfo(&padapter->stapriv, get_bssid(&padapter->mlmepriv)); + if (psta) + send_delba(padapter, 0, psta->hwaddr); + } else if ((pmlmeinfo->state & 0x03) == WIFI_FW_AP_STATE) { + _irqL irqL; + _list *phead, *plist; + u8 peer_num = 0; + char peers[NUM_STA]; + struct sta_priv *pstapriv = &padapter->stapriv; + int i; + + _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); + + phead = &pstapriv->asoc_list; + plist = get_next(phead); + + while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) { + int stainfo_offset; + + psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list); + plist = get_next(plist); + + stainfo_offset = rtw_stainfo_offset(pstapriv, psta); + if (stainfo_offset_valid(stainfo_offset)) + peers[peer_num++] = stainfo_offset; + } + + _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); + + if (peer_num) { + for (i = 0; i < peer_num; i++) { + psta = rtw_get_stainfo_by_offset(pstapriv, peers[i]); + if (psta) + send_delba(padapter, 0, psta->hwaddr); + } + } + } } else { diff --git a/core/rtw_cmd.c b/core/rtw_cmd.c index fb77701..84b9b74 100644 --- a/core/rtw_cmd.c +++ b/core/rtw_cmd.c @@ -209,6 +209,9 @@ since only spin_lock is used. ISR/Call-Back functions can't call this sub-function. */ +#ifdef DBG_CMD_QUEUE +extern u8 dump_cmd_id; +#endif sint _rtw_enqueue_cmd(_queue *queue, struct cmd_obj *obj) { @@ -219,11 +222,52 @@ _func_enter_; if (obj == NULL) goto exit; + if(obj->cmdsz > MAX_CMDSZ ){ + DBG_871X("%s failed due to obj->cmdsz(%d) > MAX_CMDSZ(%d) \n",__FUNCTION__, obj->cmdsz,MAX_CMDSZ); + goto exit; + } //_enter_critical_bh(&queue->lock, &irqL); _enter_critical(&queue->lock, &irqL); rtw_list_insert_tail(&obj->list, &queue->queue); + #ifdef DBG_CMD_QUEUE + if(dump_cmd_id){ + printk("%s===> cmdcode:0x%02x\n",__FUNCTION__,obj->cmdcode); + if(obj->cmdcode == GEN_CMD_CODE(_Set_MLME_EVT)){ + if(obj->parmbuf){ + struct C2HEvent_Header *pc2h_evt_hdr = (struct C2HEvent_Header *)(obj->parmbuf); + printk("pc2h_evt_hdr->ID:0x%02x(%d)\n",pc2h_evt_hdr->ID,pc2h_evt_hdr->ID); + } + } + if(obj->cmdcode == GEN_CMD_CODE(_Set_Drv_Extra)){ + if(obj->parmbuf){ + struct drvextra_cmd_parm *pdrvextra_cmd_parm =(struct drvextra_cmd_parm*)(obj->parmbuf); + printk("pdrvextra_cmd_parm->ec_id:0x%02x\n",pdrvextra_cmd_parm->ec_id); + } + } + } + + if (queue->queue.prev->next != &queue->queue) + { + DBG_871X("[%d] head %p, tail %p, tail->prev->next %p[tail], tail->next %p[head]\n", __LINE__, + &queue->queue, queue->queue.prev, queue->queue.prev->prev->next, queue->queue.prev->next); + + DBG_871X("==========%s============\n",__FUNCTION__); + DBG_871X("head:%p,obj_addr:%p\n",&queue->queue,obj); + DBG_871X("padapter: %p\n",obj->padapter); + DBG_871X("cmdcode: 0x%02x\n",obj->cmdcode); + DBG_871X("res: %d\n",obj->res); + DBG_871X("parmbuf: %p\n",obj->parmbuf); + DBG_871X("cmdsz: %d\n",obj->cmdsz); + DBG_871X("rsp: %p\n",obj->rsp); + DBG_871X("rspsz: %d\n",obj->rspsz); + DBG_871X("sctx: %p\n",obj->sctx); + DBG_871X("list->next: %p\n",obj->list.next); + DBG_871X("list->prev: %p\n",obj->list.prev); + } + #endif //DBG_CMD_QUEUE + //_exit_critical_bh(&queue->lock, &irqL); _exit_critical(&queue->lock, &irqL); @@ -243,11 +287,51 @@ _func_enter_; //_enter_critical_bh(&(queue->lock), &irqL); _enter_critical(&queue->lock, &irqL); - if (rtw_is_list_empty(&(queue->queue))) + + #ifdef DBG_CMD_QUEUE + if (queue->queue.prev->next != &queue->queue) + { + DBG_871X("[%d] head %p, tail %p, tail->prev->next %p[tail], tail->next %p[head]\n", __LINE__, + &queue->queue, queue->queue.prev, queue->queue.prev->prev->next, queue->queue.prev->next); + } + #endif //DBG_CMD_QUEUE + + + if (rtw_is_list_empty(&(queue->queue))){ obj = NULL; + } else { obj = LIST_CONTAINOR(get_next(&(queue->queue)), struct cmd_obj, list); + + #ifdef DBG_CMD_QUEUE + if (queue->queue.prev->next != &queue->queue){ + DBG_871X("==========%s============\n",__FUNCTION__); + DBG_871X("head:%p,obj_addr:%p\n",&queue->queue,obj); + DBG_871X("padapter: %p\n",obj->padapter); + DBG_871X("cmdcode: 0x%02x\n",obj->cmdcode); + DBG_871X("res: %d\n",obj->res); + DBG_871X("parmbuf: %p\n",obj->parmbuf); + DBG_871X("cmdsz: %d\n",obj->cmdsz); + DBG_871X("rsp: %p\n",obj->rsp); + DBG_871X("rspsz: %d\n",obj->rspsz); + DBG_871X("sctx: %p\n",obj->sctx); + DBG_871X("list->next: %p\n",obj->list.next); + DBG_871X("list->prev: %p\n",obj->list.prev); + } + + if(dump_cmd_id){ + DBG_871X("%s===> cmdcode:0x%02x\n",__FUNCTION__,obj->cmdcode); + if(obj->cmdcode == GEN_CMD_CODE(_Set_Drv_Extra)){ + if(obj->parmbuf){ + struct drvextra_cmd_parm *pdrvextra_cmd_parm =(struct drvextra_cmd_parm*)(obj->parmbuf); + printk("pdrvextra_cmd_parm->ec_id:0x%02x\n",pdrvextra_cmd_parm->ec_id); + } + } + + } + #endif //DBG_CMD_QUEUE + rtw_list_delete(&obj->list); } @@ -330,7 +414,7 @@ int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj) bAllow = _TRUE; if( (pcmdpriv->padapter->hw_init_completed ==_FALSE && bAllow == _FALSE) - || pcmdpriv->cmdthd_running== _FALSE //com_thread not running + || ATOMIC_READ(&(pcmdpriv->cmdthd_running)) == _FALSE //com_thread not running ) { //DBG_871X("%s:%s: drop cmdcode:%u, hw_init_completed:%u, cmdthd_running:%u\n", caller_func, __FUNCTION__, @@ -404,14 +488,16 @@ _func_exit_; void rtw_free_cmd_obj(struct cmd_obj *pcmd) { + struct drvextra_cmd_parm *extra_parm = NULL; _func_enter_; - if((pcmd->cmdcode!=_JoinBss_CMD_) &&(pcmd->cmdcode!= _CreateBss_CMD_)) - { - //free parmbuf in cmd_obj - rtw_mfree((unsigned char*)pcmd->parmbuf, pcmd->cmdsz); - } - + if(pcmd->parmbuf != NULL){ + if((pcmd->cmdcode!=_JoinBss_CMD_) &&(pcmd->cmdcode!= _CreateBss_CMD_)) + { + //free parmbuf in cmd_obj + rtw_mfree((unsigned char*)pcmd->parmbuf, pcmd->cmdsz); + } + } if(pcmd->rsp!=NULL) { if(pcmd->rspsz!= 0) @@ -430,8 +516,9 @@ _func_exit_; void rtw_stop_cmd_thread(_adapter *adapter) { - if(adapter->cmdThread && adapter->cmdpriv.cmdthd_running == _TRUE - && adapter->cmdpriv.stop_req == 0) + if(adapter->cmdThread && + ATOMIC_READ(&(adapter->cmdpriv.cmdthd_running)) == _TRUE && + adapter->cmdpriv.stop_req == 0) { adapter->cmdpriv.stop_req = 1; _rtw_up_sema(&adapter->cmdpriv.cmd_queue_sema); @@ -451,7 +538,7 @@ thread_return rtw_cmd_thread(thread_context context) PADAPTER padapter = (PADAPTER)context; struct cmd_priv *pcmdpriv = &(padapter->cmdpriv); struct drvextra_cmd_parm *extra_parm = NULL; - + _irqL irqL; _func_enter_; thread_enter("RTW_CMD_THREAD"); @@ -460,7 +547,7 @@ _func_enter_; prspbuf = pcmdpriv->rsp_buf; pcmdpriv->stop_req = 0; - pcmdpriv->cmdthd_running=_TRUE; + ATOMIC_SET(&(pcmdpriv->cmdthd_running), _TRUE); _rtw_up_sema(&pcmdpriv->terminate_cmdthread_sema); RT_TRACE(_module_rtl871x_cmd_c_,_drv_info_,("start r871x rtw_cmd_thread !!!!\n")); @@ -484,11 +571,14 @@ _func_enter_; break; } + _enter_critical(&pcmdpriv->cmd_queue.lock, &irqL); if(rtw_is_list_empty(&(pcmdpriv->cmd_queue.queue))) { //DBG_871X("%s: cmd queue is empty!\n", __func__); + _exit_critical(&pcmdpriv->cmd_queue.lock, &irqL); continue; } + _exit_critical(&pcmdpriv->cmd_queue.lock, &irqL); #ifdef CONFIG_LPS_LCLK if (rtw_register_cmd_alive(padapter) != _SUCCESS) @@ -519,6 +609,11 @@ _next: if( _FAIL == rtw_cmd_filter(pcmdpriv, pcmd) ) { pcmd->res = H2C_DROPPED; + if (pcmd->cmdcode == GEN_CMD_CODE(_Set_Drv_Extra)) { + extra_parm = (struct drvextra_cmd_parm *)pcmd->parmbuf; + if (extra_parm && extra_parm->pbuf && extra_parm->size > 0) + rtw_mfree(extra_parm->pbuf, extra_parm->size); + } goto post_process; } @@ -526,6 +621,10 @@ _next: pcmd->cmdsz = _RND4((pcmd->cmdsz));//_RND4 + if(pcmd->cmdsz > MAX_CMDSZ ){ + DBG_871X("%s cmdsz:%d > MAX_CMDSZ:%d\n",__FUNCTION__,pcmd->cmdsz,MAX_CMDSZ); + } + _rtw_memcpy(pcmdbuf, pcmd->parmbuf, pcmd->cmdsz); if(pcmd->cmdcode < (sizeof(wlancmds) /sizeof(struct cmd_hdl))) @@ -607,8 +706,6 @@ post_process: goto _next; } - pcmdpriv->cmdthd_running=_FALSE; - // free all cmd_obj resources do{ @@ -619,7 +716,6 @@ post_process: #endif break; } - //DBG_871X("%s: leaving... drop cmdcode:%u size:%d\n", __FUNCTION__, pcmd->cmdcode, pcmd->cmdsz); if (pcmd->cmdcode == GEN_CMD_CODE(_Set_Drv_Extra)) { @@ -633,6 +729,7 @@ post_process: }while(1); _rtw_up_sema(&pcmdpriv->terminate_cmdthread_sema); + ATOMIC_SET(&(pcmdpriv->cmdthd_running), _FALSE); _func_exit_; @@ -1345,6 +1442,8 @@ _func_enter_; } } + pmlmeinfo->assoc_AP_vendor = check_assoc_AP(pnetwork->network.IEs, pnetwork->network.IELength); + psecnetwork=(WLAN_BSSID_EX *)&psecuritypriv->sec_bss; if(psecnetwork==NULL) { @@ -1416,7 +1515,7 @@ _func_enter_; { rtw_ht_use_default_setting(padapter); - rtw_build_wmm_ie_ht(padapter, &psecnetwork->IEs[12], &psecnetwork->IELength); + rtw_build_wmm_ie_ht(padapter, &psecnetwork->IEs[0], &psecnetwork->IELength); //rtw_restructure_ht_ie rtw_restructure_ht_ie(padapter, &pnetwork->network.IEs[12], &psecnetwork->IEs[0], @@ -1437,8 +1536,6 @@ _func_enter_; #endif //CONFIG_80211N_HT - pmlmeinfo->assoc_AP_vendor = check_assoc_AP(pnetwork->network.IEs, pnetwork->network.IELength); - #if 0 psecuritypriv->supplicant_ie[0]=(u8)psecnetwork->IELength; @@ -1570,7 +1667,7 @@ _func_exit_; return res; } -u8 rtw_setstakey_cmd(_adapter *padapter, u8 *psta, u8 unicast_key, bool enqueue) +u8 rtw_setstakey_cmd(_adapter *padapter, struct sta_info *sta, u8 unicast_key, bool enqueue) { struct cmd_obj* ph2c; struct set_stakey_parm *psetstakey_para; @@ -1579,7 +1676,6 @@ u8 rtw_setstakey_cmd(_adapter *padapter, u8 *psta, u8 unicast_key, bool enqueue) struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct security_priv *psecuritypriv = &padapter->securitypriv; - struct sta_info* sta = (struct sta_info* )psta; u8 res=_SUCCESS; _func_enter_; @@ -1651,7 +1747,7 @@ _func_exit_; return res; } -u8 rtw_clearstakey_cmd(_adapter *padapter, u8 *psta, u8 entry, u8 enqueue) +u8 rtw_clearstakey_cmd(_adapter *padapter, struct sta_info *sta, u8 enqueue) { struct cmd_obj* ph2c; struct set_stakey_parm *psetstakey_para; @@ -1659,14 +1755,18 @@ u8 rtw_clearstakey_cmd(_adapter *padapter, u8 *psta, u8 entry, u8 enqueue) struct set_stakey_rsp *psetstakey_rsp = NULL; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct security_priv *psecuritypriv = &padapter->securitypriv; - struct sta_info* sta = (struct sta_info* )psta; + s16 cam_id = 0; u8 res=_SUCCESS; _func_enter_; if(!enqueue) { - clear_cam_entry(padapter, entry); + while((cam_id = rtw_camid_search(padapter, sta->hwaddr, -1)) >= 0) { + DBG_871X_LEVEL(_drv_always_, "clear key for addr:"MAC_FMT", camid:%d\n", MAC_ARG(sta->hwaddr), cam_id); + clear_cam_entry(padapter, cam_id); + rtw_camid_free(padapter, cam_id); + } } else { @@ -1698,8 +1798,6 @@ _func_enter_; _rtw_memcpy(psetstakey_para->addr, sta->hwaddr, ETH_ALEN); psetstakey_para->algorithm = _NO_PRIVACY_; - - psetstakey_para->id = entry; res = rtw_enqueue_cmd(pcmdpriv, ph2c); @@ -2103,15 +2201,11 @@ _func_enter_; else { //no need to enqueue, do the cmd hdl directly and free cmd parameter - if( H2C_SUCCESS !=set_chplan_hdl(padapter, (unsigned char *)setChannelPlan_param) ) + if( H2C_SUCCESS != set_chplan_hdl(padapter, (unsigned char *)setChannelPlan_param) ) res = _FAIL; rtw_mfree((u8 *)setChannelPlan_param, sizeof(struct SetChannelPlan_param)); } - - //do something based on res... - if(res == _SUCCESS) - padapter->mlmepriv.ChannelPlan = chplan; exit: @@ -2288,7 +2382,14 @@ static void collect_traffic_statistics(_adapter *padapter) u8 traffic_status_watchdog(_adapter *padapter, u8 from_timer) { u8 bEnterPS = _FALSE; - u16 BusyThreshold = 100; +#ifdef CONFIG_BT_COEXIST + u16 BusyThresholdHigh = 25; + u16 BusyThresholdLow = 10; +#else + u16 BusyThresholdHigh = 100; + u16 BusyThresholdLow = 75; +#endif + u16 BusyThreshold = BusyThresholdHigh; u8 bBusyTraffic = _FALSE, bTxBusyTraffic = _FALSE, bRxBusyTraffic = _FALSE; u8 bHigherBusyTraffic = _FALSE, bHigherBusyRxTraffic = _FALSE, bHigherBusyTxTraffic = _FALSE; @@ -2309,16 +2410,12 @@ u8 traffic_status_watchdog(_adapter *padapter, u8 from_timer) if((check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE) /*&& !MgntInitAdapterInProgress(pMgntInfo)*/) { -#ifdef CONFIG_BT_COEXIST - if( pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > 25 || - pmlmepriv->LinkDetectInfo.NumTxOkInPeriod > 25 ) -#else // !CONFIG_BT_COEXIST // if we raise bBusyTraffic in last watchdog, using lower threshold. if (pmlmepriv->LinkDetectInfo.bBusyTraffic) - BusyThreshold = 75; + BusyThreshold = BusyThresholdLow; + if( pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > BusyThreshold || pmlmepriv->LinkDetectInfo.NumTxOkInPeriod > BusyThreshold ) -#endif // !CONFIG_BT_COEXIST { bBusyTraffic = _TRUE; @@ -2521,6 +2618,7 @@ void dynamic_chk_wk_hdl(_adapter *padapter) { linked_status_chk(padapter); traffic_status_watchdog(padapter, 0); + dm_DynamicUsbTxAgg(padapter, 0); } #ifdef CONFIG_BEAMFORMING @@ -3042,8 +3140,6 @@ _func_exit_; #ifdef CONFIG_AP_MODE -extern u32 g_wait_hiq_empty; - static void rtw_chk_hi_queue_hdl(_adapter *padapter) { struct sta_info *psta_bmc; @@ -3057,7 +3153,7 @@ static void rtw_chk_hi_queue_hdl(_adapter *padapter) rtw_hal_get_hwreg(padapter, HW_VAR_CHK_HI_QUEUE_EMPTY, &empty); - while(_FALSE == empty && rtw_get_passing_time_ms(start) < g_wait_hiq_empty) + while(_FALSE == empty && rtw_get_passing_time_ms(start) < rtw_get_wait_hiq_empty_ms()) { rtw_msleep_os(100); rtw_hal_get_hwreg(padapter, HW_VAR_CHK_HI_QUEUE_EMPTY, &empty); @@ -3076,7 +3172,7 @@ static void rtw_chk_hi_queue_hdl(_adapter *padapter) pstapriv->sta_dz_bitmap &= ~BIT(0); if (update_tim == _TRUE) - update_beacon(padapter, _TIM_IE_, NULL, _TRUE); + _update_beacon(padapter, _TIM_IE_, NULL, _TRUE, "bmc sleepq and HIQ empty"); } else //re check again { @@ -3123,6 +3219,147 @@ exit: } #endif +#ifdef CONFIG_BT_COEXIST +struct btinfo { + u8 cid; + u8 len; + + u8 bConnection:1; + u8 bSCOeSCO:1; + u8 bInQPage:1; + u8 bACLBusy:1; + u8 bSCOBusy:1; + u8 bHID:1; + u8 bA2DP:1; + u8 bFTP:1; + + u8 retry_cnt:4; + u8 rsvd_34:1; + u8 rsvd_35:1; + u8 rsvd_36:1; + u8 rsvd_37:1; + + u8 rssi; + + u8 rsvd_50:1; + u8 rsvd_51:1; + u8 rsvd_52:1; + u8 rsvd_53:1; + u8 rsvd_54:1; + u8 rsvd_55:1; + u8 eSCO_SCO:1; + u8 Master_Slave:1; + + u8 rsvd_6; + u8 rsvd_7; +}; + +void btinfo_evt_dump(void *sel, void *buf) +{ + struct btinfo *info = (struct btinfo *)buf; + + DBG_871X_SEL_NL(sel, "cid:0x%02x, len:%u\n", info->cid, info->len); + + if (info->len > 2) + DBG_871X_SEL_NL(sel, "byte2:%s%s%s%s%s%s%s%s\n" + , info->bConnection?"bConnection ":"" + , info->bSCOeSCO?"bSCOeSCO ":"" + , info->bInQPage?"bInQPage ":"" + , info->bACLBusy?"bACLBusy ":"" + , info->bSCOBusy?"bSCOBusy ":"" + , info->bHID?"bHID ":"" + , info->bA2DP?"bA2DP ":"" + , info->bFTP?"bFTP":"" + ); + + if (info->len > 3) + DBG_871X_SEL_NL(sel, "retry_cnt:%u\n", info->retry_cnt); + + if (info->len > 4) + DBG_871X_SEL_NL(sel, "rssi:%u\n", info->rssi); + + if (info->len > 5) + DBG_871X_SEL_NL(sel, "byte5:%s%s\n" + , info->eSCO_SCO?"eSCO_SCO ":"" + , info->Master_Slave?"Master_Slave ":"" + ); +} + +static void rtw_btinfo_hdl(_adapter *adapter, u8 *buf, u16 buf_len) +{ + #define BTINFO_WIFI_FETCH 0x23 + #define BTINFO_BT_AUTO_RPT 0x27 + struct btinfo *info = (struct btinfo *)buf; + u8 cmd_idx; + u8 len; + + cmd_idx = info->cid; + + if (info->len > buf_len-2) { + rtw_warn_on(1); + len = buf_len-2; + } else { + len = info->len; + } + +//#define DBG_PROC_SET_BTINFO_EVT +#ifdef DBG_PROC_SET_BTINFO_EVT + btinfo_evt_dump(RTW_DBGDUMP, info); +#endif + + /* transform BT-FW btinfo to WiFI-FW C2H format and notify */ + if (cmd_idx == BTINFO_WIFI_FETCH) + buf[1] = 0; + else if (cmd_idx == BTINFO_BT_AUTO_RPT) + buf[1] = 2; + rtw_btcoex_BtInfoNotify(adapter ,len+1, &buf[1]); +} + +u8 rtw_btinfo_cmd(_adapter *adapter, u8 *buf, u16 len) +{ + struct cmd_obj *ph2c; + struct drvextra_cmd_parm *pdrvextra_cmd_parm; + u8 *btinfo; + struct cmd_priv *pcmdpriv = &adapter->cmdpriv; + u8 res = _SUCCESS; + + ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); + if (ph2c == NULL) { + res = _FAIL; + goto exit; + } + + pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); + if (pdrvextra_cmd_parm == NULL) { + rtw_mfree((u8*)ph2c, sizeof(struct cmd_obj)); + res = _FAIL; + goto exit; + } + + btinfo = rtw_zmalloc(len); + if (btinfo == NULL) { + rtw_mfree((u8*)ph2c, sizeof(struct cmd_obj)); + rtw_mfree((u8*)pdrvextra_cmd_parm, sizeof(struct drvextra_cmd_parm)); + res = _FAIL; + goto exit; + } + + pdrvextra_cmd_parm->ec_id = BTINFO_WK_CID; + pdrvextra_cmd_parm->type = 0; + pdrvextra_cmd_parm->size = len; + pdrvextra_cmd_parm->pbuf = btinfo; + + _rtw_memcpy(btinfo, buf, len); + + init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra)); + + res = rtw_enqueue_cmd(pcmdpriv, ph2c); + +exit: + return res; +} +#endif + //#ifdef CONFIG_C2H_PACKET_EN u8 rtw_c2h_packet_wk_cmd(PADAPTER padapter, u8 *pbuf, u16 length) { @@ -3196,6 +3433,42 @@ exit: } //#endif //CONFIG_C2H_PACKET_EN +u8 rtw_run_in_thread_cmd(PADAPTER padapter, void (*func)(void*), void* context) +{ + struct cmd_priv *pcmdpriv; + struct cmd_obj *ph2c; + struct RunInThread_param *parm; + s32 res = _SUCCESS; + +_func_enter_; + + pcmdpriv = &padapter->cmdpriv; + + ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); + if (NULL == ph2c) { + res = _FAIL; + goto exit; + } + + parm = (struct RunInThread_param*)rtw_zmalloc(sizeof(struct RunInThread_param)); + if (NULL == parm) { + rtw_mfree((u8*)ph2c, sizeof(struct cmd_obj)); + res = _FAIL; + goto exit; + } + + parm->func = func; + parm->context = context; + init_h2fwcmd_w_parm_no_rsp(ph2c, parm, GEN_CMD_CODE(_RunInThreadCMD)); + + res = rtw_enqueue_cmd(pcmdpriv, ph2c); +exit: + +_func_exit_; + + return res; +} + s32 c2h_evt_hdl(_adapter *adapter, u8 *c2h_evt, c2h_id_filter filter) { s32 ret = _FAIL; @@ -3355,7 +3628,11 @@ u8 rtw_drvextra_cmd_hdl(_adapter *padapter, unsigned char *pbuf) case DM_RA_MSK_WK_CID: rtw_dm_ra_mask_hdl(padapter, (struct sta_info *)pdrvextra_cmd->pbuf); break; - +#ifdef CONFIG_BT_COEXIST + case BTINFO_WK_CID: + rtw_btinfo_hdl(padapter ,pdrvextra_cmd->pbuf, pdrvextra_cmd->size); + break; +#endif default: break; } diff --git a/core/rtw_debug.c b/core/rtw_debug.c index 175110c..4d6b5cc 100644 --- a/core/rtw_debug.c +++ b/core/rtw_debug.c @@ -151,6 +151,36 @@ void rf_reg_dump(void *sel, _adapter *adapter) } } +static u8 fwdl_test_chksum_fail = 0; +static u8 fwdl_test_wintint_rdy_fail = 0; + +bool rtw_fwdl_test_trigger_chksum_fail() +{ + if (fwdl_test_chksum_fail) { + DBG_871X_LEVEL(_drv_always_, "fwdl test case: trigger chksum_fail\n"); + fwdl_test_chksum_fail--; + return _TRUE; + } + return _FALSE; +} + +bool rtw_fwdl_test_trigger_wintint_rdy_fail() +{ + if (fwdl_test_wintint_rdy_fail) { + DBG_871X_LEVEL(_drv_always_, "fwdl test case: trigger wintint_rdy_fail\n"); + fwdl_test_wintint_rdy_fail--; + return _TRUE; + } + return _FALSE; +} + +static u32 g_wait_hiq_empty_ms = 0; + +u32 rtw_get_wait_hiq_empty_ms() +{ + return g_wait_hiq_empty_ms; +} + #ifdef CONFIG_PROC_DEBUG ssize_t proc_set_write_reg(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) { @@ -281,6 +311,23 @@ int proc_get_sec_info(struct seq_file *m, void *v) DBG_871X_SEL_NL(m, "hw_decrypted=%d\n", sec->hw_decrypted); +#ifdef DBG_SW_SEC_CNT + DBG_871X_SEL_NL(m, "wep_sw_enc_cnt=%llu, %llu, %llu\n" + , sec->wep_sw_enc_cnt_bc , sec->wep_sw_enc_cnt_mc, sec->wep_sw_enc_cnt_uc); + DBG_871X_SEL_NL(m, "wep_sw_dec_cnt=%llu, %llu, %llu\n" + , sec->wep_sw_dec_cnt_bc , sec->wep_sw_dec_cnt_mc, sec->wep_sw_dec_cnt_uc); + + DBG_871X_SEL_NL(m, "tkip_sw_enc_cnt=%llu, %llu, %llu\n" + , sec->tkip_sw_enc_cnt_bc , sec->tkip_sw_enc_cnt_mc, sec->tkip_sw_enc_cnt_uc); + DBG_871X_SEL_NL(m, "tkip_sw_dec_cnt=%llu, %llu, %llu\n" + , sec->tkip_sw_dec_cnt_bc , sec->tkip_sw_dec_cnt_mc, sec->tkip_sw_dec_cnt_uc); + + DBG_871X_SEL_NL(m, "aes_sw_enc_cnt=%llu, %llu, %llu\n" + , sec->aes_sw_enc_cnt_bc , sec->aes_sw_enc_cnt_mc, sec->aes_sw_enc_cnt_uc); + DBG_871X_SEL_NL(m, "aes_sw_dec_cnt=%llu, %llu, %llu\n" + , sec->aes_sw_dec_cnt_bc , sec->aes_sw_dec_cnt_mc, sec->aes_sw_dec_cnt_uc); +#endif /* DBG_SW_SEC_CNT */ + return 0; } @@ -449,15 +496,18 @@ int proc_get_survey_info(struct seq_file *m, void *v) struct wlan_network *pnetwork = NULL; _list *plist, *phead; s32 notify_signal; + s16 notify_noise = 0; u16 index = 0; _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); phead = get_list_head(queue); + if(!phead) + return 0; plist = get_next(phead); - if ((!phead) || (!plist)) + if (!plist) return 0; - DBG_871X_SEL_NL(m, "%5s %-17s %3s %-3s %-4s %5s %s\n","index", "bssid", "ch", "dBm", "SdBm", "age", "ssid"); + DBG_871X_SEL_NL(m, "%5s %-17s %3s %-3s %-4s %-4s %5s %s\n","index", "bssid", "ch", "RSSI", "SdBm", "Noise", "age", "ssid"); while(1) { if (rtw_end_of_queue_search(phead,plist)== _TRUE) @@ -473,13 +523,18 @@ int proc_get_survey_info(struct seq_file *m, void *v) } else { notify_signal = translate_percentage_to_dbm(pnetwork->network.PhyInfo.SignalStrength);//dbm } + + #if defined(CONFIG_SIGNAL_DISPLAY_DBM) && defined(CONFIG_BACKGROUND_NOISE_MONITOR) + rtw_hal_get_odm_var(padapter, HAL_ODM_NOISE_MONITOR,&(pnetwork->network.Configuration.DSConfig), &(notify_noise)); + #endif - DBG_871X_SEL_NL(m, "%5d "MAC_FMT" %3d %3d %4d %5d %s\n", + DBG_871X_SEL_NL(m, "%5d "MAC_FMT" %3d %3d %4d %4d %5d %s\n", ++index, MAC_ARG(pnetwork->network.MacAddress), pnetwork->network.Configuration.DSConfig, (int)pnetwork->network.Rssi, notify_signal, + notify_noise, rtw_get_passing_time_ms((u32)pnetwork->last_scanned), //translate_percentage_to_dbm(pnetwork->network.PhyInfo.SignalStrength), pnetwork->network.Ssid.Ssid); @@ -547,8 +602,14 @@ int proc_get_adapter_state(struct seq_file *m, void *v) struct net_device *dev = m->private; _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); - DBG_871X_SEL_NL(m, "bSurpriseRemoved=%d, bDriverStopped=%d\n", - padapter->bSurpriseRemoved, padapter->bDriverStopped); +#ifdef CONFIG_CONCURRENT_MODE + DBG_871X_SEL_NL(m, "name=%s, iface_type=%d, bSurpriseRemoved=%d, bDriverStopped=%d\n", + dev->name, padapter->iface_type, + padapter->bSurpriseRemoved, padapter->bDriverStopped); +#else + DBG_871X_SEL_NL(m, "name=%s, bSurpriseRemoved=%d, bDriverStopped=%d\n", + dev->name, padapter->bSurpriseRemoved, padapter->bDriverStopped); +#endif return 0; } @@ -562,6 +623,8 @@ int proc_get_trx_info(struct seq_file *m, void *v) struct recv_priv *precvpriv = &padapter->recvpriv; struct hw_xmit *phwxmit; + dump_os_queue(m, padapter); + DBG_871X_SEL_NL(m, "free_xmitbuf_cnt=%d, free_xmitframe_cnt=%d\n" , pxmitpriv->free_xmitbuf_cnt, pxmitpriv->free_xmitframe_cnt); DBG_871X_SEL_NL(m, "free_ext_xmitbuf_cnt=%d, free_xframe_ext_cnt=%d\n" @@ -582,14 +645,48 @@ int proc_get_trx_info(struct seq_file *m, void *v) return 0; } +int proc_get_dis_pwt(struct seq_file *m, void *v) +{ + struct net_device *dev = m->private; + _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); + u8 dis_pwt = 0; + rtw_hal_get_def_var(padapter, HAL_DEF_DBG_DIS_PWT, &(dis_pwt)); + DBG_871X_SEL_NL(m, " Tx Power training mode:%s \n",(dis_pwt==_TRUE)?"Disable":"Enable"); + return 0; +} +ssize_t proc_set_dis_pwt(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) +{ + struct net_device *dev = data; + _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); + char tmp[4]={0}; + u8 dis_pwt = 0; + + if (count < 1) + return -EFAULT; + if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) { + + int num = sscanf(tmp, "%hhx", &dis_pwt); + DBG_871X("Set Tx Power training mode:%s \n",(dis_pwt==_TRUE)?"Disable":"Enable"); + + if (num >= 1) + rtw_hal_set_def_var(padapter, HAL_DEF_DBG_DIS_PWT, &(dis_pwt)); + } + + return count; + +} + int proc_get_rate_ctl(struct seq_file *m, void *v) { struct net_device *dev = m->private; int i; _adapter *adapter = (_adapter *)rtw_netdev_priv(dev); - + u8 data_rate = 0,sgi=0; + if (adapter->fix_rate != 0xff) { - DBG_871X_SEL_NL(m, "FIX\n"); + data_rate = adapter->fix_rate & 0x7F; + sgi = adapter->fix_rate >>7; + DBG_871X_SEL_NL(m, "FIXED %s%s\n", HDATA_RATE(data_rate),sgi?" SGI":" LGI"); DBG_871X_SEL_NL(m, "0x%02x\n", adapter->fix_rate); } else { DBG_871X_SEL_NL(m, "RA\n"); @@ -619,9 +716,6 @@ ssize_t proc_set_rate_ctl(struct file *file, const char __user *buffer, size_t c return count; } -u8 g_fwdl_chksum_fail = 0; -u8 g_fwdl_wintint_rdy_fail = 0; - ssize_t proc_set_fwdl_test_case(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) { struct net_device *dev = data; @@ -632,14 +726,12 @@ ssize_t proc_set_fwdl_test_case(struct file *file, const char __user *buffer, si return -EFAULT; if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) { - int num = sscanf(tmp, "%hhu %hhu", &g_fwdl_chksum_fail, &g_fwdl_wintint_rdy_fail); + int num = sscanf(tmp, "%hhu %hhu", &fwdl_test_chksum_fail, &fwdl_test_wintint_rdy_fail); } return count; } -u32 g_wait_hiq_empty = 0; - ssize_t proc_set_wait_hiq_empty(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) { struct net_device *dev = data; @@ -650,7 +742,7 @@ ssize_t proc_set_wait_hiq_empty(struct file *file, const char __user *buffer, si return -EFAULT; if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) { - int num = sscanf(tmp, "%u", &g_wait_hiq_empty); + int num = sscanf(tmp, "%u", &g_wait_hiq_empty_ms); } return count; @@ -695,24 +787,268 @@ int proc_get_suspend_resume_info(struct seq_file *m, void *v) return 0; } -int proc_get_rx_signal(struct seq_file *m, void *v) +#ifdef CONFIG_DBG_COUNTER + +int proc_get_rx_logs(struct seq_file *m, void *v) { struct net_device *dev = m->private; _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct rx_logs *rx_logs = &padapter->rx_logs; + + DBG_871X_SEL_NL(m, + "intf_rx=%d\n" + "intf_rx_err_recvframe=%d\n" + "intf_rx_err_skb=%d\n" + "intf_rx_report=%d\n" + "core_rx=%d\n" + "core_rx_pre=%d\n" + "core_rx_pre_ver_err=%d\n" + "core_rx_pre_mgmt=%d\n" + "core_rx_pre_mgmt_err_80211w=%d\n" + "core_rx_pre_mgmt_err=%d\n" + "core_rx_pre_ctrl=%d\n" + "core_rx_pre_ctrl_err=%d\n" + "core_rx_pre_data=%d\n" + "core_rx_pre_data_wapi_seq_err=%d\n" + "core_rx_pre_data_wapi_key_err=%d\n" + "core_rx_pre_data_handled=%d\n" + "core_rx_pre_data_err=%d\n" + "core_rx_pre_data_unknown=%d\n" + "core_rx_pre_unknown=%d\n" + "core_rx_enqueue=%d\n" + "core_rx_dequeue=%d\n" + "core_rx_post=%d\n" + "core_rx_post_decrypt=%d\n" + "core_rx_post_decrypt_wep=%d\n" + "core_rx_post_decrypt_tkip=%d\n" + "core_rx_post_decrypt_aes=%d\n" + "core_rx_post_decrypt_wapi=%d\n" + "core_rx_post_decrypt_hw=%d\n" + "core_rx_post_decrypt_unknown=%d\n" + "core_rx_post_decrypt_err=%d\n" + "core_rx_post_defrag_err=%d\n" + "core_rx_post_portctrl_err=%d\n" + "core_rx_post_indicate=%d\n" + "core_rx_post_indicate_in_oder=%d\n" + "core_rx_post_indicate_reoder=%d\n" + "core_rx_post_indicate_err=%d\n" + "os_indicate=%d\n" + "os_indicate_ap_mcast=%d\n" + "os_indicate_ap_forward=%d\n" + "os_indicate_ap_self=%d\n" + "os_indicate_err=%d\n" + "os_netif_ok=%d\n" + "os_netif_err=%d\n", + rx_logs->intf_rx, + rx_logs->intf_rx_err_recvframe, + rx_logs->intf_rx_err_skb, + rx_logs->intf_rx_report, + rx_logs->core_rx, + rx_logs->core_rx_pre, + rx_logs->core_rx_pre_ver_err, + rx_logs->core_rx_pre_mgmt, + rx_logs->core_rx_pre_mgmt_err_80211w, + rx_logs->core_rx_pre_mgmt_err, + rx_logs->core_rx_pre_ctrl, + rx_logs->core_rx_pre_ctrl_err, + rx_logs->core_rx_pre_data, + rx_logs->core_rx_pre_data_wapi_seq_err, + rx_logs->core_rx_pre_data_wapi_key_err, + rx_logs->core_rx_pre_data_handled, + rx_logs->core_rx_pre_data_err, + rx_logs->core_rx_pre_data_unknown, + rx_logs->core_rx_pre_unknown, + rx_logs->core_rx_enqueue, + rx_logs->core_rx_dequeue, + rx_logs->core_rx_post, + rx_logs->core_rx_post_decrypt, + rx_logs->core_rx_post_decrypt_wep, + rx_logs->core_rx_post_decrypt_tkip, + rx_logs->core_rx_post_decrypt_aes, + rx_logs->core_rx_post_decrypt_wapi, + rx_logs->core_rx_post_decrypt_hw, + rx_logs->core_rx_post_decrypt_unknown, + rx_logs->core_rx_post_decrypt_err, + rx_logs->core_rx_post_defrag_err, + rx_logs->core_rx_post_portctrl_err, + rx_logs->core_rx_post_indicate, + rx_logs->core_rx_post_indicate_in_oder, + rx_logs->core_rx_post_indicate_reoder, + rx_logs->core_rx_post_indicate_err, + rx_logs->os_indicate, + rx_logs->os_indicate_ap_mcast, + rx_logs->os_indicate_ap_forward, + rx_logs->os_indicate_ap_self, + rx_logs->os_indicate_err, + rx_logs->os_netif_ok, + rx_logs->os_netif_err + ); - DBG_871X_SEL_NL(m, "rssi:%d\n", padapter->recvpriv.rssi); - //DBG_871X_SEL_NL(m, "rxpwdb:%d\n", padapter->recvpriv.rxpwdb); - DBG_871X_SEL_NL(m, "signal_strength:%u\n", padapter->recvpriv.signal_strength); - DBG_871X_SEL_NL(m, "signal_qual:%u\n", padapter->recvpriv.signal_qual); - DBG_871X_SEL_NL(m, "noise:%u\n", padapter->recvpriv.noise); - rtw_odm_get_perpkt_rssi(m,padapter); - #ifdef DBG_RX_SIGNAL_DISPLAY_RAW_DATA - rtw_get_raw_rssi_info(m,padapter); - #endif return 0; } +int proc_get_tx_logs(struct seq_file *m, void *v) +{ + struct net_device *dev = m->private; + _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); + struct tx_logs *tx_logs = &padapter->tx_logs; + + DBG_871X_SEL_NL(m, + "os_tx=%d\n" + "os_tx_err_up=%d\n" + "os_tx_err_xmit=%d\n" + "os_tx_m2u=%d\n" + "os_tx_m2u_ignore_fw_linked=%d\n" + "os_tx_m2u_ignore_self=%d\n" + "os_tx_m2u_entry=%d\n" + "os_tx_m2u_entry_err_xmit=%d\n" + "os_tx_m2u_entry_err_skb=%d\n" + "os_tx_m2u_stop=%d\n" + "core_tx=%d\n" + "core_tx_err_pxmitframe=%d\n" + "core_tx_err_brtx=%d\n" + "core_tx_upd_attrib=%d\n" + "core_tx_upd_attrib_adhoc=%d\n" + "core_tx_upd_attrib_sta=%d\n" + "core_tx_upd_attrib_ap=%d\n" + "core_tx_upd_attrib_unknown=%d\n" + "core_tx_upd_attrib_dhcp=%d\n" + "core_tx_upd_attrib_icmp=%d\n" + "core_tx_upd_attrib_active=%d\n" + "core_tx_upd_attrib_err_ucast_sta=%d\n" + "core_tx_upd_attrib_err_ucast_ap_link=%d\n" + "core_tx_upd_attrib_err_sta=%d\n" + "core_tx_upd_attrib_err_link=%d\n" + "core_tx_upd_attrib_err_sec=%d\n" + "core_tx_ap_enqueue_warn_fwstate=%d\n" + "core_tx_ap_enqueue_warn_sta=%d\n" + "core_tx_ap_enqueue_warn_nosta=%d\n" + "core_tx_ap_enqueue_warn_link=%d\n" + "core_tx_ap_enqueue_warn_trigger=%d\n" + "core_tx_ap_enqueue_mcast=%d\n" + "core_tx_ap_enqueue_ucast=%d\n" + "core_tx_ap_enqueue=%d\n" + "intf_tx=%d\n" + "intf_tx_pending_ac=%d\n" + "intf_tx_pending_fw_under_survey=%d\n" + "intf_tx_pending_fw_under_linking=%d\n" + "intf_tx_pending_xmitbuf=%d\n" + "intf_tx_enqueue=%d\n" + "core_tx_enqueue=%d\n" + "core_tx_enqueue_class=%d\n" + "core_tx_enqueue_class_err_sta=%d\n" + "core_tx_enqueue_class_err_nosta=%d\n" + "core_tx_enqueue_class_err_fwlink=%d\n" + "intf_tx_direct=%d\n" + "intf_tx_direct_err_coalesce=%d\n" + "intf_tx_dequeue=%d\n" + "intf_tx_dequeue_err_coalesce=%d\n" + "intf_tx_dump_xframe=%d\n" + "intf_tx_dump_xframe_err_txdesc=%d\n" + "intf_tx_dump_xframe_err_port=%d\n", + tx_logs->os_tx, + tx_logs->os_tx_err_up, + tx_logs->os_tx_err_xmit, + tx_logs->os_tx_m2u, + tx_logs->os_tx_m2u_ignore_fw_linked, + tx_logs->os_tx_m2u_ignore_self, + tx_logs->os_tx_m2u_entry, + tx_logs->os_tx_m2u_entry_err_xmit, + tx_logs->os_tx_m2u_entry_err_skb, + tx_logs->os_tx_m2u_stop, + tx_logs->core_tx, + tx_logs->core_tx_err_pxmitframe, + tx_logs->core_tx_err_brtx, + tx_logs->core_tx_upd_attrib, + tx_logs->core_tx_upd_attrib_adhoc, + tx_logs->core_tx_upd_attrib_sta, + tx_logs->core_tx_upd_attrib_ap, + tx_logs->core_tx_upd_attrib_unknown, + tx_logs->core_tx_upd_attrib_dhcp, + tx_logs->core_tx_upd_attrib_icmp, + tx_logs->core_tx_upd_attrib_active, + tx_logs->core_tx_upd_attrib_err_ucast_sta, + tx_logs->core_tx_upd_attrib_err_ucast_ap_link, + tx_logs->core_tx_upd_attrib_err_sta, + tx_logs->core_tx_upd_attrib_err_link, + tx_logs->core_tx_upd_attrib_err_sec, + tx_logs->core_tx_ap_enqueue_warn_fwstate, + tx_logs->core_tx_ap_enqueue_warn_sta, + tx_logs->core_tx_ap_enqueue_warn_nosta, + tx_logs->core_tx_ap_enqueue_warn_link, + tx_logs->core_tx_ap_enqueue_warn_trigger, + tx_logs->core_tx_ap_enqueue_mcast, + tx_logs->core_tx_ap_enqueue_ucast, + tx_logs->core_tx_ap_enqueue, + tx_logs->intf_tx, + tx_logs->intf_tx_pending_ac, + tx_logs->intf_tx_pending_fw_under_survey, + tx_logs->intf_tx_pending_fw_under_linking, + tx_logs->intf_tx_pending_xmitbuf, + tx_logs->intf_tx_enqueue, + tx_logs->core_tx_enqueue, + tx_logs->core_tx_enqueue_class, + tx_logs->core_tx_enqueue_class_err_sta, + tx_logs->core_tx_enqueue_class_err_nosta, + tx_logs->core_tx_enqueue_class_err_fwlink, + tx_logs->intf_tx_direct, + tx_logs->intf_tx_direct_err_coalesce, + tx_logs->intf_tx_dequeue, + tx_logs->intf_tx_dequeue_err_coalesce, + tx_logs->intf_tx_dump_xframe, + tx_logs->intf_tx_dump_xframe_err_txdesc, + tx_logs->intf_tx_dump_xframe_err_port + ); + + return 0; +} + +int proc_get_int_logs(struct seq_file *m, void *v) +{ + struct net_device *dev = m->private; + _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); + + DBG_871X_SEL_NL(m, + "all=%d\n" + "err=%d\n" + "tbdok=%d\n" + "tbder=%d\n" + "bcnderr=%d\n" + "bcndma=%d\n" + "bcndma_e=%d\n" + "rx=%d\n" + "rx_rdu=%d\n" + "rx_fovw=%d\n" + "txfovw=%d\n" + "mgntok=%d\n" + "highdok=%d\n" + "bkdok=%d\n" + "bedok=%d\n" + "vidok=%d\n" + "vodok=%d\n", + padapter->int_logs.all, + padapter->int_logs.err, + padapter->int_logs.tbdok, + padapter->int_logs.tbder, + padapter->int_logs.bcnderr, + padapter->int_logs.bcndma, + padapter->int_logs.bcndma_e, + padapter->int_logs.rx, + padapter->int_logs.rx_rdu, + padapter->int_logs.rx_fovw, + padapter->int_logs.txfovw, + padapter->int_logs.mgntok, + padapter->int_logs.highdok, + padapter->int_logs.bkdok, + padapter->int_logs.bedok, + padapter->int_logs.vidok, + padapter->int_logs.vodok + ); + + return 0; +} + +#endif // CONFIG_DBG_COUNTER int proc_get_hw_status(struct seq_file *m, void *v) { @@ -727,6 +1063,26 @@ int proc_get_hw_status(struct seq_file *m, void *v) return 0; } +int proc_get_rx_signal(struct seq_file *m, void *v) +{ + struct net_device *dev = m->private; + _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + + DBG_871X_SEL_NL(m, "rssi:%d\n", padapter->recvpriv.rssi); + //DBG_871X_SEL_NL(m, "rxpwdb:%d\n", padapter->recvpriv.rxpwdb); + DBG_871X_SEL_NL(m, "signal_strength:%u\n", padapter->recvpriv.signal_strength); + DBG_871X_SEL_NL(m, "signal_qual:%u\n", padapter->recvpriv.signal_qual); + + rtw_get_noise(padapter); + DBG_871X_SEL_NL(m, "noise:%d\n", padapter->recvpriv.noise); + #ifdef DBG_RX_SIGNAL_DISPLAY_RAW_DATA + rtw_odm_get_perpkt_rssi(m,padapter); + rtw_get_raw_rssi_info(m,padapter); + #endif + return 0; +} + ssize_t proc_set_rx_signal(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) { struct net_device *dev = data; @@ -790,10 +1146,10 @@ ssize_t proc_set_ht_enable(struct file *file, const char __user *buffer, size_t int num = sscanf(tmp, "%d ", &mode); - if( pregpriv && mode >= 0 && mode < 2 ) + if( pregpriv && mode < 2 ) { pregpriv->ht_enable= mode; - printk("ht_enable=%d\n", pregpriv->ht_enable); + DBG_871X("ht_enable=%d\n", pregpriv->ht_enable); } } @@ -913,7 +1269,7 @@ ssize_t proc_set_rx_ampdu(struct file *file, const char __user *buffer, size_t c int num = sscanf(tmp, "%d ", &mode); - if( pregpriv && mode >= 0 && mode < 2 ) + if( pregpriv && mode < 2 ) { pmlmeinfo->bAcceptAddbaReq = mode; DBG_871X("pmlmeinfo->bAcceptAddbaReq=%d \n",pmlmeinfo->bAcceptAddbaReq); @@ -928,7 +1284,135 @@ ssize_t proc_set_rx_ampdu(struct file *file, const char __user *buffer, size_t c return count; } +int proc_get_rx_ampdu_factor(struct seq_file *m, void *v) +{ + struct net_device *dev = m->private; + _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); + + if(padapter) + { + DBG_871X_SEL_NL(m,"rx ampdu factor = %x\n",padapter->driver_rx_ampdu_factor); + } + + return 0; +} + +ssize_t proc_set_rx_ampdu_factor(struct file *file, const char __user *buffer + , size_t count, loff_t *pos, void *data) +{ + struct net_device *dev = data; + _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); + char tmp[32]; + u32 factor; + + if (count < 1) + return -EFAULT; + + if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) + { + + int num = sscanf(tmp, "%d ", &factor); + + if( padapter && (num == 1) ) + { + DBG_871X("padapter->driver_rx_ampdu_factor = %x\n", factor); + + if(factor > 0x03) + padapter->driver_rx_ampdu_factor = 0xFF; + else + padapter->driver_rx_ampdu_factor = factor; + } + } + + return count; +} + +int proc_get_rx_ampdu_density(struct seq_file *m, void *v) +{ + struct net_device *dev = m->private; + _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); + + + if(padapter) + { + DBG_871X_SEL_NL(m,"rx ampdu densityg = %x\n",padapter->driver_rx_ampdu_spacing); + } + + return 0; +} + +ssize_t proc_set_rx_ampdu_density(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) +{ + struct net_device *dev = data; + _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); + char tmp[32]; + u32 density; + + if (count < 1) + return -EFAULT; + + if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) + { + + int num = sscanf(tmp, "%d ", &density); + + if( padapter && (num == 1) ) + { + DBG_871X("padapter->driver_rx_ampdu_spacing = %x\n", density); + + if(density > 0x07) + padapter->driver_rx_ampdu_spacing = 0xFF; + else + padapter->driver_rx_ampdu_spacing = density; + } + } + + return count; +} + +int proc_get_tx_ampdu_density(struct seq_file *m, void *v) +{ + struct net_device *dev = m->private; + _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); + + + if(padapter) + { + DBG_871X_SEL_NL(m,"tx ampdu density = %x\n",padapter->driver_ampdu_spacing); + } + + return 0; +} + +ssize_t proc_set_tx_ampdu_density(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) +{ + struct net_device *dev = data; + _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); + char tmp[32]; + u32 density; + + if (count < 1) + return -EFAULT; + + if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) + { + + int num = sscanf(tmp, "%d ", &density); + + if( padapter && (num == 1) ) + { + DBG_871X("padapter->driver_ampdu_spacing = %x\n", density); + + if(density > 0x07) + padapter->driver_ampdu_spacing = 0xFF; + else + padapter->driver_ampdu_spacing = density; + } + } + + return count; +} #endif //CONFIG_80211N_HT int proc_get_en_fwps(struct seq_file *m, void *v) @@ -963,7 +1447,7 @@ ssize_t proc_set_en_fwps(struct file *file, const char __user *buffer, size_t co int num = sscanf(tmp, "%d ", &mode); - if( pregpriv && mode >= 0 && mode < 2 ) + if( pregpriv && mode < 2 ) { pregpriv->check_fw_ps = mode; DBG_871X("pregpriv->check_fw_ps=%d \n",pregpriv->check_fw_ps); @@ -1027,13 +1511,14 @@ ssize_t proc_set_rx_stbc(struct file *file, const char __user *buffer, size_t co } #endif //CONFIG_80211N_HT -int proc_get_rssi_disp(struct seq_file *m, void *v) +/*int proc_get_rssi_disp(struct seq_file *m, void *v) { struct net_device *dev = m->private; return 0; } +*/ -ssize_t proc_set_rssi_disp(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) +/*ssize_t proc_set_rssi_disp(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) { struct net_device *dev = data; _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); @@ -1072,7 +1557,7 @@ ssize_t proc_set_rssi_disp(struct file *file, const char __user *buffer, size_t } - +*/ #ifdef CONFIG_AP_MODE int proc_get_all_sta_info(struct seq_file *m, void *v) @@ -1114,6 +1599,11 @@ int proc_get_all_sta_info(struct seq_file *m, void *v) DBG_871X_SEL_NL(m, "agg_enable_bitmap=%x, candidate_tid_bitmap=%x\n", psta->htpriv.agg_enable_bitmap, psta->htpriv.candidate_tid_bitmap); #endif //CONFIG_80211N_HT DBG_871X_SEL_NL(m, "sleepq_len=%d\n", psta->sleepq_len); + DBG_871X_SEL_NL(m, "sta_xmitpriv.vo_q_qcnt=%d\n", psta->sta_xmitpriv.vo_q.qcnt); + DBG_871X_SEL_NL(m, "sta_xmitpriv.vi_q_qcnt=%d\n", psta->sta_xmitpriv.vi_q.qcnt); + DBG_871X_SEL_NL(m, "sta_xmitpriv.be_q_qcnt=%d\n", psta->sta_xmitpriv.be_q.qcnt); + DBG_871X_SEL_NL(m, "sta_xmitpriv.bk_q_qcnt=%d\n", psta->sta_xmitpriv.bk_q.qcnt); + DBG_871X_SEL_NL(m, "capability=0x%x\n", psta->capability); DBG_871X_SEL_NL(m, "flags=0x%x\n", psta->flags); DBG_871X_SEL_NL(m, "wpa_psk=0x%x\n", psta->wpa_psk); @@ -1182,7 +1672,7 @@ int proc_get_best_channel(struct seq_file *m, void *v) index_5G = i; } - for (i=0; pmlmeext->channel_set[i].ChannelNum !=0; i++) { + for (i=0; (i < MAX_CHANNEL_NUM) && (pmlmeext->channel_set[i].ChannelNum !=0) ; i++) { // 2.4G if ( pmlmeext->channel_set[i].ChannelNum == 6 ) { if ( pmlmeext->channel_set[i].rx_count < pmlmeext->channel_set[index_24G].rx_count ) { @@ -1386,5 +1876,113 @@ ssize_t proc_set_sreset(struct file *file, const char __user *buffer, size_t cou } #endif /* DBG_CONFIG_ERROR_DETECT */ +#ifdef CONFIG_PCI_HCI + +int proc_get_rx_ring(struct seq_file *m, void *v) +{ + _irqL irqL; + struct net_device *dev = m->private; + _adapter *padapter = (_adapter *) rtw_netdev_priv(dev); + struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter); + struct recv_priv *precvpriv = &padapter->recvpriv; + struct rtw_rx_ring *rx_ring = &precvpriv->rx_ring[RX_MPDU_QUEUE]; + int i, j; + + DBG_871X_SEL_NL(m, "rx ring (%p)\n", rx_ring); + DBG_871X_SEL_NL(m, " dma: 0x%08x\n", (int) rx_ring->dma); + DBG_871X_SEL_NL(m, " idx: %d\n", rx_ring->idx); + + _enter_critical(&pdvobjpriv->irq_th_lock, &irqL); + for (i=0; irxringcount; i++) + { + struct recv_stat *entry = &rx_ring->desc[i]; + struct sk_buff *skb = rx_ring->rx_buf[i]; + + DBG_871X_SEL_NL(m, " desc[%03d]: %p, rx_buf[%03d]: 0x%08x\n", + i, entry, i, cpu_to_le32(*((dma_addr_t *)skb->cb))); + + for (j=0; jirq_th_lock, &irqL); + + return 0; +} + +int proc_get_tx_ring(struct seq_file *m, void *v) +{ + _irqL irqL; + struct net_device *dev = m->private; + _adapter *padapter = (_adapter *) rtw_netdev_priv(dev); + struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter); + struct xmit_priv *pxmitpriv = &padapter->xmitpriv; + int i, j, k; + + _enter_critical(&pdvobjpriv->irq_th_lock, &irqL); + for (i = 0; i < PCI_MAX_TX_QUEUE_COUNT; i++) + { + struct rtw_tx_ring *tx_ring = &pxmitpriv->tx_ring[i]; + + DBG_871X_SEL_NL(m, "tx ring[%d] (%p)\n", i, tx_ring); + DBG_871X_SEL_NL(m, " dma: 0x%08x\n", (int) tx_ring->dma); + DBG_871X_SEL_NL(m, " idx: %d\n", tx_ring->idx); + DBG_871X_SEL_NL(m, " entries: %d\n", tx_ring->entries); +// DBG_871X_SEL_NL(m, " queue: %d\n", tx_ring->queue); + DBG_871X_SEL_NL(m, " qlen: %d\n", tx_ring->qlen); + + for (j=0; j < pxmitpriv->txringcount[i]; j++) + { + struct tx_desc *entry = &tx_ring->desc[j]; + + DBG_871X_SEL_NL(m, " desc[%03d]: %p\n", j, entry); + for (k=0; k < sizeof(*entry)/4; k++) + { + if ((k % 4) == 0) + DBG_871X_SEL_NL(m, " 0x%03x", k); + + DBG_871X_SEL_NL(m, " 0x%08x ", ((int *) entry)[k]); + + if ((k % 4) == 3) + DBG_871X_SEL_NL(m, "\n"); + } + } + } + _exit_critical(&pdvobjpriv->irq_th_lock, &irqL); + + return 0; +} + +#endif + +int proc_get_new_bcn_max(struct seq_file *m, void *v) +{ + extern int new_bcn_max; + + DBG_871X_SEL_NL(m, "%d", new_bcn_max); + return 0; +} + +ssize_t proc_set_new_bcn_max(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) +{ + char tmp[32]; + extern int new_bcn_max; + + if(count < 1) + return -EFAULT; + + if(buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) + sscanf(tmp, "%d ", &new_bcn_max); + + return count; +} + #endif diff --git a/core/rtw_ieee80211.c b/core/rtw_ieee80211.c index 97eba25..354e7fc 100644 --- a/core/rtw_ieee80211.c +++ b/core/rtw_ieee80211.c @@ -150,7 +150,6 @@ u8 *rtw_set_ie uint *frlen //frame length ) { -_func_enter_; *pbuf = (u8)index; *(pbuf + 1) = (u8)len; @@ -161,7 +160,6 @@ _func_enter_; *frlen = *frlen + (len + 2); return (pbuf + len + 2); -_func_exit_; } inline u8 *rtw_set_ie_ch_switch(u8 *buf, u32 *buf_len, u8 ch_switch_mode, @@ -1112,7 +1110,7 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen, elems->wme_tspec_len = elen; break; default: - DBG_871X("unknown WME " + DBG_871X_LEVEL(_drv_warning_, "unknown WME " "information element ignored " "(subtype=%d len=%lu)\n", pos[4], (unsigned long) elen); @@ -1125,7 +1123,7 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen, elems->wps_ie_len = elen; break; default: - DBG_871X("Unknown Microsoft " + DBG_871X_LEVEL(_drv_warning_, "Unknown Microsoft " "information element ignored " "(type=%d len=%lu)\n", pos[3], (unsigned long) elen); @@ -1140,7 +1138,7 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen, elems->vendor_ht_cap_len = elen; break; default: - DBG_871X("Unknown Broadcom " + DBG_871X_LEVEL(_drv_warning_, "Unknown Broadcom " "information element ignored " "(type=%d len=%lu)\n", pos[3], (unsigned long) elen); @@ -1149,7 +1147,7 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen, break; default: - DBG_871X("unknown vendor specific information " + DBG_871X_LEVEL(_drv_warning_, "unknown vendor specific information " "element ignored (vendor OUI %02x:%02x:%02x " "len=%lu)\n", pos[0], pos[1], pos[2], (unsigned long) elen); @@ -1290,9 +1288,10 @@ ParseRes rtw_ieee802_11_parse_elems(u8 *start, uint len, unknown++; if (!show_errors) break; - DBG_871X("IEEE 802.11 element parse " - "ignored unknown element (id=%d elen=%d)\n", - id, elen); + DBG_871X_LEVEL(_drv_warning_, + "IEEE 802.11 element parse " + "ignored unknown element (id=%d elen=%d)\n", + id, elen); break; } @@ -1387,21 +1386,56 @@ void rtw_macaddr_cfg(u8 *mac_addr) DBG_871X("rtw_macaddr_cfg MAC Address = "MAC_FMT"\n", MAC_ARG(mac_addr)); } -void dump_ies(u8 *buf, u32 buf_len) +#ifdef CONFIG_80211N_HT +void dump_ht_cap_ie_content(void *sel, u8 *buf, u32 buf_len) +{ + if (buf_len != 26) { + DBG_871X_SEL_NL(sel, "Invalid HT capability IE len:%d != %d\n", buf_len, 26); + return; + } + + DBG_871X_SEL_NL(sel, "HT Capabilities Info:%02x%02x\n", *(buf), *(buf+1)); + DBG_871X_SEL_NL(sel, "A-MPDU Parameters:"HT_AMPDU_PARA_FMT"\n" + , HT_AMPDU_PARA_ARG(HT_CAP_ELE_AMPDU_PARA(buf))); + DBG_871X_SEL_NL(sel, "Supported MCS Set:"HT_SUP_MCS_SET_FMT"\n" + , HT_SUP_MCS_SET_ARG(HT_CAP_ELE_SUP_MCS_SET(buf))); +} + +void dump_ht_cap_ie(void *sel, u8 *ie, u32 ie_len) +{ + u8* pos = (u8*)ie; + u16 id; + u16 len; + + u8 *ht_cap_ie; + sint ht_cap_ielen; + + ht_cap_ie = rtw_get_ie(ie, _HT_CAPABILITY_IE_, &ht_cap_ielen, ie_len); + if(!ie || ht_cap_ie != ie) + return; + + dump_ht_cap_ie_content(sel, ht_cap_ie+2, ht_cap_ielen); +} +#endif /* CONFIG_80211N_HT */ + +void dump_ies(void *sel, u8 *buf, u32 buf_len) { u8* pos = (u8*)buf; u8 id, len; - while(pos-buf<=buf_len){ + while(pos-buf+10) - // dump_ies(ie, ielen); + // dump_ies(RTW_DBGDUMP, ie, ielen); break; } } @@ -1763,12 +1797,11 @@ void rtw_WLAN_BSSID_EX_remove_p2p_attr(WLAN_BSSID_EX *bss_ex, u8 attr_id) if( (p2p_ie=rtw_get_p2p_ie(bss_ex->IEs+_FIXED_IE_LENGTH_, bss_ex->IELength-_FIXED_IE_LENGTH_, NULL, &p2p_ielen_ori)) ) { - #if 0 + if (0) if(rtw_get_p2p_attr(p2p_ie, p2p_ielen_ori, attr_id, NULL, NULL)) { DBG_871X("rtw_get_p2p_attr: GOT P2P_ATTR:%u!!!!!!!!\n", attr_id); - dump_ies(bss_ex->IEs+_FIXED_IE_LENGTH_, bss_ex->IELength-_FIXED_IE_LENGTH_); + dump_ies(RTW_DBGDUMP, bss_ex->IEs+_FIXED_IE_LENGTH_, bss_ex->IELength-_FIXED_IE_LENGTH_); } - #endif p2p_ielen=rtw_p2p_attr_remove(p2p_ie, p2p_ielen_ori, attr_id); if(p2p_ielen != p2p_ielen_ori) { @@ -1781,10 +1814,10 @@ void rtw_WLAN_BSSID_EX_remove_p2p_attr(WLAN_BSSID_EX *bss_ex, u8 attr_id) _rtw_memset(next_ie+remain_len, 0, p2p_ielen_ori-p2p_ielen); bss_ex->IELength -= p2p_ielen_ori-p2p_ielen; - #if 0 - DBG_871X("remove P2P_ATTR:%u!\n", attr_id); - dump_ies(bss_ex->IEs+_FIXED_IE_LENGTH_, bss_ex->IELength-_FIXED_IE_LENGTH_); - #endif + if (0) { + DBG_871X("remove P2P_ATTR:%u!\n", attr_id); + dump_ies(RTW_DBGDUMP, bss_ex->IEs+_FIXED_IE_LENGTH_, bss_ex->IELength-_FIXED_IE_LENGTH_); + } } } } @@ -1792,7 +1825,7 @@ void rtw_WLAN_BSSID_EX_remove_p2p_attr(WLAN_BSSID_EX *bss_ex, u8 attr_id) #endif //CONFIG_P2P #ifdef CONFIG_WFD -void dump_wfd_ie(u8 *ie, u32 ie_len) +void dump_wfd_ie(void *sel, u8 *ie, u32 ie_len) { u8* pos = (u8*)ie; u8 id; @@ -1809,7 +1842,7 @@ void dump_wfd_ie(u8 *ie, u32 ie_len) id = *pos; len = RTW_GET_BE16(pos+1); - DBG_871X("%s ID:%u, LEN:%u\n", __FUNCTION__, id, len); + DBG_871X_SEL_NL(sel, "%s ID:%u, LEN:%u\n", __FUNCTION__, id, len); pos+=(3+len); } diff --git a/core/rtw_ioctl_set.c b/core/rtw_ioctl_set.c index 255453b..59b88f4 100644 --- a/core/rtw_ioctl_set.c +++ b/core/rtw_ioctl_set.c @@ -1254,11 +1254,11 @@ _func_enter_; //Set key to CAM through H2C command if(bgrouptkey)//never go to here { - res=rtw_setstakey_cmd(padapter, (unsigned char *)stainfo, _FALSE, _TRUE); + res=rtw_setstakey_cmd(padapter, stainfo, _FALSE, _TRUE); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("\n rtw_set_802_11_add_key:rtw_setstakey_cmd(group)\n")); } else{ - res=rtw_setstakey_cmd(padapter, (unsigned char *)stainfo, _TRUE, _TRUE); + res=rtw_setstakey_cmd(padapter, stainfo, _TRUE, _TRUE); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("\n rtw_set_802_11_add_key:rtw_setstakey_cmd(unicast)\n")); } diff --git a/core/rtw_iol.c b/core/rtw_iol.c index 45dc60d..3524e1c 100644 --- a/core/rtw_iol.c +++ b/core/rtw_iol.c @@ -50,7 +50,7 @@ struct xmit_frame *rtw_IOL_accquire_xmit_frame(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; @@ -62,7 +62,7 @@ struct xmit_frame *rtw_IOL_accquire_xmit_frame(ADAPTER *adapter) else { pattrib = &xmit_frame->attrib; update_mgntframe_attrib(adapter, pattrib); - pattrib->qsel = 0x10; + pattrib->qsel = QSLT_BEACON; pattrib->pktlen = pattrib->last_txcmdsz = 0; } #endif diff --git a/core/rtw_mem.c b/core/rtw_mem.c new file mode 100644 index 0000000..a4de3e6 --- /dev/null +++ b/core/rtw_mem.c @@ -0,0 +1,103 @@ + +#include +#include + +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]; +} + +struct sk_buff *rtw_alloc_skb_premem(void) +{ + struct sk_buff *skb = NULL; + + 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) >= 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__); + +#ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX + for(i=0; idata; + 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); + diff --git a/core/rtw_mlme.c b/core/rtw_mlme.c index 2767872..891976f 100644 --- a/core/rtw_mlme.c +++ b/core/rtw_mlme.c @@ -25,13 +25,6 @@ extern void indicate_wx_scan_complete_event(_adapter *padapter); extern u8 rtw_do_join(_adapter * padapter); -#ifdef CONFIG_DISABLE_MCS13TO15 -extern unsigned char MCS_rate_2R_MCS13TO15_OFF[16]; -extern unsigned char MCS_rate_2R[16]; -#else //CONFIG_DISABLE_MCS13TO15 -extern unsigned char MCS_rate_2R[16]; -#endif //CONFIG_DISABLE_MCS13TO15 -extern unsigned char MCS_rate_1R[16]; sint _rtw_init_mlme_priv (_adapter* padapter) { @@ -162,7 +155,10 @@ void rtw_free_mlme_priv_ie_data(struct mlme_priv *pmlmepriv) void _rtw_free_mlme_priv (struct mlme_priv *pmlmepriv) { _func_enter_; - + if (NULL == pmlmepriv){ + rtw_warn_on(1); + goto exit; + } rtw_free_mlme_priv_ie_data(pmlmepriv); if(pmlmepriv){ @@ -172,6 +168,7 @@ _func_enter_; rtw_vmfree(pmlmepriv->free_bss_buf, MAX_BSS_CNT * sizeof(struct wlan_network)); } } +exit: _func_exit_; } @@ -540,15 +537,18 @@ void rtw_free_network(struct mlme_priv *pmlmepriv, struct wlan_network *pnetwork _func_enter_; RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("rtw_free_network==> ssid = %s \n\n" , pnetwork->network.Ssid.Ssid)); _rtw_free_network(pmlmepriv, pnetwork, is_freeall); -_func_exit_; +_func_exit_; } -void rtw_free_network_nolock(struct mlme_priv *pmlmepriv, struct wlan_network *pnetwork ); -void rtw_free_network_nolock(struct mlme_priv *pmlmepriv, struct wlan_network *pnetwork ) +void rtw_free_network_nolock(_adapter * padapter, struct wlan_network *pnetwork ); +void rtw_free_network_nolock(_adapter * padapter, struct wlan_network *pnetwork ) { _func_enter_; //RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("rtw_free_network==> ssid = %s \n\n" , pnetwork->network.Ssid.Ssid)); - _rtw_free_network_nolock(pmlmepriv, pnetwork); + _rtw_free_network_nolock(&(padapter->mlmepriv), pnetwork); +#ifdef CONFIG_IOCTL_CFG80211 + rtw_cfg80211_unlink_bss(padapter, pnetwork); +#endif //CONFIG_IOCTL_CFG80211 _func_exit_; } @@ -1493,16 +1493,16 @@ _func_enter_; rtw_tdls_cmd(adapter, myid(&(adapter->eeprompriv)), TDLS_RS_RCR); rtw_reset_tdls_info(adapter); rtw_free_all_stainfo(adapter); - _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + //_enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); } else #endif //CONFIG_TDLS { - _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + //_enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); rtw_free_stainfo(adapter, psta); } - _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + //_exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); } @@ -1513,9 +1513,9 @@ _func_enter_; rtw_free_all_stainfo(adapter); psta = rtw_get_bcmc_stainfo(adapter); - _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + //_enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); rtw_free_stainfo(adapter, psta); - _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + //_exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); rtw_init_bcmc_stainfo(adapter); } @@ -1527,32 +1527,14 @@ _func_enter_; if(pwlan) { pwlan->fixed = _FALSE; + + DBG_871X("free disconnecting network\n"); + rtw_free_network_nolock(adapter, pwlan); #ifdef CONFIG_P2P if(!rtw_p2p_chk_state(&adapter->wdinfo, P2P_STATE_NONE)) { - u32 p2p_ielen=0; - u8 *p2p_ie; - //u16 capability; - u8 *pcap = NULL; - u32 capability_len=0; - - //DBG_871X("free disconnecting network\n"); - //rtw_free_network_nolock(pmlmepriv, pwlan); - - if((p2p_ie=rtw_get_p2p_ie(pwlan->network.IEs+_FIXED_IE_LENGTH_, pwlan->network.IELength-_FIXED_IE_LENGTH_, NULL, &p2p_ielen))) - { - pcap = rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_CAPABILITY, NULL, &capability_len); - if(pcap && capability_len==2) - { - u16 cap = *(u16*)pcap ; - *(u16*)pcap = cap&0x00ff;//clear group capability when free this network - } - - } - rtw_set_scan_deny(adapter, 2000); - //rtw_clear_scan_deny(adapter); - + //rtw_clear_scan_deny(adapter); } #endif //CONFIG_P2P } @@ -1565,7 +1547,7 @@ _func_enter_; if((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) && (adapter->stapriv.asoc_sta_count== 1)) /*||check_fwstate(pmlmepriv, WIFI_STATION_STATE)*/) { - rtw_free_network_nolock(pmlmepriv, pwlan); + rtw_free_network_nolock(adapter, pwlan); } if(lock_scanned_queue) @@ -1648,6 +1630,8 @@ void rtw_indicate_disconnect( _adapter *padapter ) WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network); struct sta_info *psta; struct sta_priv *pstapriv = &padapter->stapriv; + u8 *wps_ie=NULL; + uint wpsie_len=0; _func_enter_; @@ -1655,6 +1639,22 @@ _func_enter_; _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING|WIFI_UNDER_WPS); + // force to clear cur_network_scanned's SELECTED REGISTRAR + if (pmlmepriv->cur_network_scanned) { + WLAN_BSSID_EX *current_joined_bss = &(pmlmepriv->cur_network_scanned->network); + if (current_joined_bss) { + wps_ie=rtw_get_wps_ie(current_joined_bss->IEs +_FIXED_IE_LENGTH_, + current_joined_bss->IELength-_FIXED_IE_LENGTH_, NULL, &wpsie_len); + if (wps_ie && wpsie_len>0) { + u8 *attr = NULL; + u32 attr_len; + attr=rtw_get_wps_attr(wps_ie, wpsie_len, WPS_ATTR_SELECTED_REGISTRAR, + NULL, &attr_len); + if (attr) + *(attr + 4) = 0; + } + } + } //DBG_871X("clear wps when %s\n", __func__); if(rtw_to_roam(padapter) > 0) @@ -1821,6 +1821,7 @@ static struct sta_info *rtw_joinbss_update_stainfo(_adapter *padapter, struct wl _rtw_memset((u8 *)&psta->dot11tkiptxmickey, 0, sizeof (union Keytype)); _rtw_memset((u8 *)&psta->dot11txpn, 0, sizeof (union pn48)); + psta->dot11txpn.val = psta->dot11txpn.val + 1; #ifdef CONFIG_IEEE80211W _rtw_memset((u8 *)&psta->dot11wtxpn, 0, sizeof (union pn48)); #endif //CONFIG_IEEE80211W @@ -2042,9 +2043,9 @@ _func_enter_; pcur_sta = rtw_get_stainfo(pstapriv, cur_network->network.MacAddress); if(pcur_sta){ - _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL2); + //_enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL2); rtw_free_stainfo(adapter, pcur_sta); - _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL2); + //_exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL2); } ptarget_wlan = rtw_find_network(&pmlmepriv->scanned_queue, pnetwork->network.MacAddress); @@ -2395,7 +2396,7 @@ _func_enter_; #ifdef CONFIG_RTL8711 //submit SetStaKey_cmd to tell fw, fw will allocate an CAM entry for this sta - rtw_setstakey_cmd(adapter, (unsigned char*)psta, _FALSE, _TRUE); + rtw_setstakey_cmd(adapter, psta, _FALSE, _TRUE); #endif exit: @@ -2496,7 +2497,7 @@ _func_enter_; pwlan = rtw_find_network(&pmlmepriv->scanned_queue, tgt_network->network.MacAddress); if (pwlan) { pwlan->fixed = _FALSE; - rtw_free_network_nolock(pmlmepriv, pwlan); + rtw_free_network_nolock(adapter, pwlan); } _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); @@ -2512,9 +2513,9 @@ _func_enter_; check_fwstate(pmlmepriv,WIFI_ADHOC_STATE)) { - _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + //_enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); rtw_free_stainfo(adapter, psta); - _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + //_exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); if(adapter->stapriv.asoc_sta_count== 1) //a sta + bc/mc_stainfo (not Ibss_stainfo) { @@ -2526,7 +2527,7 @@ _func_enter_; if(pwlan) { pwlan->fixed = _FALSE; - rtw_free_network_nolock(pmlmepriv, pwlan); + rtw_free_network_nolock(adapter, pwlan); } _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); //re-create ibss @@ -2720,6 +2721,8 @@ void rtw_scan_timeout_handler (_adapter *adapter) void rtw_mlme_reset_auto_scan_int(_adapter *adapter) { struct mlme_priv *mlme = &adapter->mlmepriv; + struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv; + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); #ifdef CONFIG_P2P if(!rtw_p2p_chk_state(&adapter->wdinfo, P2P_STATE_NONE)) { @@ -2727,8 +2730,11 @@ void rtw_mlme_reset_auto_scan_int(_adapter *adapter) goto exit; } #endif - - if(adapter->registrypriv.wifi_spec) { + if(pmlmeinfo->VHT_enable) //disable auto scan when connect to 11AC AP + { + mlme->auto_scan_int_ms = 0; + } + else if(adapter->registrypriv.wifi_spec && is_client_associated_to_ap(adapter) == _TRUE) { mlme->auto_scan_int_ms = 60*1000; #ifdef CONFIG_LAYER2_ROAMING } else if(rtw_chk_roam_flags(adapter, RTW_ROAM_ACTIVE)) { @@ -2812,6 +2818,8 @@ void rtw_dynamic_check_timer_handlder(_adapter *adapter) { if(adapter->net_closed == _TRUE && pbuddy_adapter->net_closed == _TRUE) { + if (pmlmepriv->LinkDetectInfo.bBusyTraffic == _TRUE) + pmlmepriv->LinkDetectInfo.bBusyTraffic = _FALSE; return; } } @@ -2819,6 +2827,8 @@ void rtw_dynamic_check_timer_handlder(_adapter *adapter) #endif //CONFIG_CONCURRENT_MODE if(adapter->net_closed == _TRUE) { + if (pmlmepriv->LinkDetectInfo.bBusyTraffic == _TRUE) + pmlmepriv->LinkDetectInfo.bBusyTraffic = _FALSE; return; } @@ -3504,22 +3514,67 @@ static int SecIsInPMKIDList(_adapter *Adapter, u8 *bssid) // 13th element in the array is the IE length // -static int rtw_append_pmkid(_adapter *Adapter,int iEntry, u8 *ie, uint ie_len) +static int rtw_append_pmkid(_adapter *adapter,int iEntry, u8 *ie, uint ie_len) { - struct security_priv *psecuritypriv=&Adapter->securitypriv; + struct security_priv *sec=&adapter->securitypriv; - if(ie[13]<=20){ - // The RSN IE didn't include the PMK ID, append the PMK information - ie[ie_len]=1; - ie_len++; - ie[ie_len]=0; //PMKID count = 0x0100 - ie_len++; - _rtw_memcpy( &ie[ie_len], &psecuritypriv->PMKIDList[iEntry].PMKID, 16); - - ie_len+=16; - ie[13]+=18;//PMKID length = 2+16 + if (ie[13] > 20) { + int i; + u16 pmkid_cnt = RTW_GET_LE16(ie+14+20); + if (pmkid_cnt == 1 && _rtw_memcmp(ie+14+20+2, &sec->PMKIDList[iEntry].PMKID, 16)) { + DBG_871X(FUNC_ADPT_FMT" has carried the same PMKID:"KEY_FMT"\n" + , FUNC_ADPT_ARG(adapter), KEY_ARG(&sec->PMKIDList[iEntry].PMKID)); + goto exit; + } + DBG_871X(FUNC_ADPT_FMT" remove original PMKID, count:%u\n" + , FUNC_ADPT_ARG(adapter), pmkid_cnt); + + for (i=0;iPMKIDList[iEntry].PMKID)); + + RTW_PUT_LE16(&ie[ie_len], 1); + ie_len += 2; + + _rtw_memcpy(&ie[ie_len], &sec->PMKIDList[iEntry].PMKID, 16); + ie_len += 16; + + ie[13] += 18;//PMKID length = 2+16 + } + +exit: + return (ie_len); +} + +static int rtw_remove_pmkid(_adapter *adapter, u8 *ie, uint ie_len) +{ + struct security_priv *sec=&adapter->securitypriv; + int i; + u16 pmkid_cnt = RTW_GET_LE16(ie+14+20); + + if (ie[13] <= 20) + goto exit; + + DBG_871X(FUNC_ADPT_FMT" remove original PMKID, count:%u\n" + , FUNC_ADPT_ARG(adapter), pmkid_cnt); + + for (i=0;iassoc_bssid); if(iEntry<0) { - return ielength; + if(authmode == _WPA2_IE_ID_) + ielength = rtw_remove_pmkid(adapter, out_ie, ielength); } else { if(authmode == _WPA2_IE_ID_) - { ielength=rtw_append_pmkid(adapter, iEntry, out_ie, ielength); - } } _func_exit_; @@ -3710,17 +3764,10 @@ void rtw_joinbss_reset(_adapter *padapter) { u8 threshold; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - -#ifdef CONFIG_80211N_HT - struct ht_priv *phtpriv = &pmlmepriv->htpriv; -#endif - //todo: if you want to do something io/reg/hw setting before join_bss, please add code here - - - -#ifdef CONFIG_80211N_HT +#ifdef CONFIG_80211N_HT + struct ht_priv *phtpriv = &pmlmepriv->htpriv; pmlmepriv->num_FortyMHzIntolerant = 0; @@ -3744,9 +3791,9 @@ void rtw_joinbss_reset(_adapter *padapter) threshold = 1; rtw_hal_set_hwreg(padapter, HW_VAR_RXDMA_AGG_PG_TH, (u8 *)(&threshold)); } -#endif +#endif//#if defined( CONFIG_USB_HCI) || defined (CONFIG_SDIO_HCI) -#endif +#endif//#ifdef CONFIG_80211N_HT } @@ -3845,6 +3892,7 @@ unsigned int rtw_restructure_ht_ie(_adapter *padapter, u8 *in_ie, u8 *out_ie, ui struct registry_priv *pregistrypriv = &padapter->registrypriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct ht_priv *phtpriv = &pmlmepriv->htpriv; + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; phtpriv->ht_option = _FALSE; @@ -3918,17 +3966,21 @@ unsigned int rtw_restructure_ht_ie(_adapter *padapter, u8 *in_ie, u8 *out_ie, ui } } + //fill default supported_mcs_set + _rtw_memcpy(ht_capie.supp_mcs_set, pmlmeext->default_supported_mcs_set, 16); + + //update default supported_mcs_set rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); -#ifdef RTL8192C_RECONFIG_TO_1T1R - rf_type = RF_1T1R; -#endif - switch (rf_type) { + + switch(rf_type) + { case RF_1T1R: + if (stbc_rx_enable) ht_capie.cap_info |= IEEE80211_HT_CAP_RX_STBC_1R;//RX STBC One spatial stream - _rtw_memcpy(ht_capie.supp_mcs_set, MCS_rate_1R, 16); - break; + set_mcs_rate_by_mask(ht_capie.supp_mcs_set, MCS_RATE_1R); + break; case RF_2T2R: case RF_1T2R: @@ -3939,11 +3991,11 @@ unsigned int rtw_restructure_ht_ie(_adapter *padapter, u8 *in_ie, u8 *out_ie, ui #ifdef CONFIG_DISABLE_MCS13TO15 if(((cbw40_enable == 1) && (operation_bw == CHANNEL_WIDTH_40)) && (pregistrypriv->wifi_spec!=1)) - _rtw_memcpy(ht_capie.supp_mcs_set, MCS_rate_2R_MCS13TO15_OFF, 16); + set_mcs_rate_by_mask(ht_capie.supp_mcs_set, MCS_RATE_2R_13TO15_OFF); else - _rtw_memcpy(ht_capie.supp_mcs_set, MCS_rate_2R, 16); + set_mcs_rate_by_mask(ht_capie.supp_mcs_set, MCS_RATE_2R); #else //CONFIG_DISABLE_MCS13TO15 - _rtw_memcpy(ht_capie.supp_mcs_set, MCS_rate_2R, 16); + set_mcs_rate_by_mask(ht_capie.supp_mcs_set, MCS_RATE_2R); #endif //CONFIG_DISABLE_MCS13TO15 break; } @@ -3970,14 +4022,25 @@ unsigned int rtw_restructure_ht_ie(_adapter *padapter, u8 *in_ie, u8 *out_ie, ui #endif */ - rtw_hal_get_def_var(padapter, HW_VAR_MAX_RX_AMPDU_FACTOR, &max_rx_ampdu_factor); + if(padapter->driver_rx_ampdu_factor != 0xFF) + max_rx_ampdu_factor = (HT_CAP_AMPDU_FACTOR)padapter->driver_rx_ampdu_factor; + else + rtw_hal_get_def_var(padapter, HW_VAR_MAX_RX_AMPDU_FACTOR, &max_rx_ampdu_factor); + + //rtw_hal_get_def_var(padapter, HW_VAR_MAX_RX_AMPDU_FACTOR, &max_rx_ampdu_factor); ht_capie.ampdu_params_info = (max_rx_ampdu_factor&0x03); - if(padapter->securitypriv.dot11PrivacyAlgrthm == _AES_ ) - ht_capie.ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY&(0x07<<2)); + if(padapter->driver_rx_ampdu_spacing != 0xFF) + { + ht_capie.ampdu_params_info |= (( padapter->driver_rx_ampdu_spacing&0x07) <<2); + } else - ht_capie.ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY&0x00); - + { + if(padapter->securitypriv.dot11PrivacyAlgrthm == _AES_ ) + ht_capie.ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY&(0x07<<2)); + else + ht_capie.ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY&0x00); + } #ifdef CONFIG_BEAMFORMING ht_capie.tx_BF_cap_info = 0; @@ -4053,7 +4116,9 @@ void rtw_update_ht_cap(_adapter *padapter, u8 *pie, uint ie_len, u8 channel) { if(pregistrypriv->wifi_spec==1) { - phtpriv->ampdu_enable = _FALSE; + //remove this part because testbed AP should disable RX AMPDU + //phtpriv->ampdu_enable = _FALSE; + phtpriv->ampdu_enable = _TRUE; } else { @@ -4062,7 +4127,8 @@ void rtw_update_ht_cap(_adapter *padapter, u8 *pie, uint ie_len, u8 channel) } else if(pregistrypriv->ampdu_enable==2) { - phtpriv->ampdu_enable = _TRUE; + //remove this part because testbed AP should disable RX AMPDU + //phtpriv->ampdu_enable = _TRUE; } @@ -4105,34 +4171,31 @@ void rtw_update_ht_cap(_adapter *padapter, u8 *pie, uint ie_len, u8 channel) int i; u8 rf_type; - padapter->HalFunc.GetHwRegHandler(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); + rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); + + //update the MCS set + for (i = 0; i < 16; i++) + pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= pmlmeext->default_supported_mcs_set[i]; //update the MCS rates - for (i = 0; i < 16; i++) + switch(rf_type) { - if((rf_type == RF_1T1R) || (rf_type == RF_1T2R)) - { - pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_1R[i]; - } - else - { - #ifdef CONFIG_DISABLE_MCS13TO15 - if(pmlmeext->cur_bwmode == CHANNEL_WIDTH_40 && pregistrypriv->wifi_spec != 1 ) - { - pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_2R_MCS13TO15_OFF[i]; - } + case RF_1T1R: + case RF_1T2R: + set_mcs_rate_by_mask(pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate, MCS_RATE_1R); + break; + case RF_2T2R: + default: +#ifdef CONFIG_DISABLE_MCS13TO15 + if(pmlmeext->cur_bwmode == CHANNEL_WIDTH_40 && pregistrypriv->wifi_spec != 1 ) + set_mcs_rate_by_mask(pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate, MCS_RATE_2R_13TO15_OFF); else - pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_2R[i]; - #else - pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_2R[i]; - #endif //CONFIG_DISABLE_MCS13TO15 - } - #ifdef RTL8192C_RECONFIG_TO_1T1R - { - pmlmeinfo->HT_caps.HT_cap_element.MCS_rate[i] &= MCS_rate_1R[i]; - } - #endif + set_mcs_rate_by_mask(pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate, MCS_RATE_2R); +#else //CONFIG_DISABLE_MCS13TO15 + set_mcs_rate_by_mask(pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate, MCS_RATE_2R); +#endif //CONFIG_DISABLE_MCS13TO15 } + //switch to the 40M Hz mode accoring to the AP //pmlmeext->cur_bwmode = CHANNEL_WIDTH_40; switch ((pmlmeinfo->HT_info.infos[0] & 0x3)) diff --git a/core/rtw_mlme_ext.c b/core/rtw_mlme_ext.c index 83af410..f7da0e4 100644 --- a/core/rtw_mlme_ext.c +++ b/core/rtw_mlme_ext.c @@ -113,16 +113,6 @@ unsigned char RSN_TKIP_CIPHER[4] = {0x00, 0x0f, 0xac, 0x02}; extern unsigned char REALTEK_96B_IE[]; -/******************************************************** -MCS rate definitions -*********************************************************/ -#ifdef CONFIG_DISABLE_MCS13TO15 -unsigned char MCS_rate_2R_MCS13TO15_OFF[16] = {0xff, 0x1f, 0x0, 0x0, 0x01, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; -unsigned char MCS_rate_2R[16] = {0xff, 0xff, 0x0, 0x0, 0x01, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; -#else //CONFIG_DISABLE_MCS13TO15 -unsigned char MCS_rate_2R[16] = {0xff, 0xff, 0x0, 0x0, 0x01, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; -#endif //CONFIG_DISABLE_MCS13TO15 -unsigned char MCS_rate_1R[16] = {0xff, 0x00, 0x0, 0x0, 0x01, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; /******************************************************** ChannelPlan definitions @@ -181,7 +171,7 @@ static RT_CHANNEL_PLAN_5G RTW_ChannelPlan5G[RT_CHANNEL_DOMAIN_5G_MAX] = { {{56,60,64,149,153,157,161,165},8}, // 0x10, RT_CHANNEL_DOMAIN_5G_NCC2 {{149,153,157,161,165},5}, // 0x11, RT_CHANNEL_DOMAIN_5G_NCC3 {{36,40,44,48},4}, // 0x12, RT_CHANNEL_DOMAIN_5G_ETSI4 - {{36,40,44,48,52,56,60,64,100,104,108,112,116,136,140,149,153,157,161,165},20}, // 0x13, RT_CHANNEL_DOMAIN_5G_ETSI5 + {{36,40,44,48,52,56,60,64,100,104,108,112,116,132,136,140,149,153,157,161,165},21}, // 0x13, RT_CHANNEL_DOMAIN_5G_ETSI5 {{149,153,157,161},4}, // 0x14, RT_CHANNEL_DOMAIN_5G_FCC8 {{36,40,44,48,52,56,60,64},8}, // 0x15, RT_CHANNEL_DOMAIN_5G_ETSI6 {{36,40,44,48,52,56,60,64,149,153,157,161,165},13}, // 0x16, RT_CHANNEL_DOMAIN_5G_ETSI7 @@ -191,14 +181,17 @@ static RT_CHANNEL_PLAN_5G RTW_ChannelPlan5G[RT_CHANNEL_DOMAIN_5G_MAX] = { {{36,40,44,48,52,56,60,64,132,136,140,149,153,157,161,165},16}, // 0x1A, RT_CHANNEL_DOMAIN_5G_ETSI11 {{52,56,60,64,100,104,108,112,116,132,136,140,149,153,157,161,165},17}, // 0x1B, RT_CHANNEL_DOMAIN_5G_NCC4 {{149,153,157,161},4}, // 0x1C, RT_CHANNEL_DOMAIN_5G_ETSI12 - {{36,40,44,48,100,104,108,112,116,132,136,140,149,153,157,161,165},17}, // 0x1D, RT_CHANNEL_DOMAIN_5G_FCC9 - {{36,40,44,48,100,104,108,112,116,132,136,140},12}, // 0x1E, RT_CHANNEL_DOMAIN_5G_ETSI13 - {{36,40,44,48,52,56,60,64,100,104,108,112,116,132,136,140,149,153,157,161},20}, // 0x1F, RT_CHANNEL_DOMAIN_5G_FCC10 - + {{36,40,44,48,52,56,60,64,100,104,108,112,116,132,136,140,149,153,157,161,165},21}, // 0x1D, RT_CHANNEL_DOMAIN_5G_FCC9 + {{36,40,44,48,52,56,60,64,100,104,108,112,116,132,136,140},16}, // 0x1E, RT_CHANNEL_DOMAIN_5G_ETSI13 + {{36,40,44,48,52,56,60,64,100,104,108,112,116,132,136,140,149,153,157,161},20}, // 0x1F, RT_CHANNEL_DOMAIN_5G_FCC10 + {{36,40,44,48,52,56,60,64,100,104,108,112,116,120,124,149,153,157,161},19}, // 0x20, RT_CHANNEL_DOMAIN_5G_KCC2 + {{36,40,44,48,52,56,60,64,100,104,108,112,116,132,136,140,149,153,157,161,165},21}, // 0x21, RT_CHANNEL_DOMAIN_5G_FCC11 + {{56,60,64,100,104,108,112,116,132,136,140,149,153,157,161,165},16}, // 0x22, RT_CHANNEL_DOMAIN_5G_NCC5 + {{36,40,44,48},4}, // 0x23, RT_CHANNEL_DOMAIN_5G_MKK4 //===== Driver self defined for old channel plan Compatible ,Remember to modify if have new channel plan definition ===== - {{36,40,44,48,52,56,60,64,100,104,108,112,116,132,136,140,149,153,157,161,165},21}, // 0x20, RT_CHANNEL_DOMAIN_5G_FCC - {{36,40,44,48},4}, // 0x21, RT_CHANNEL_DOMAIN_5G_JAPAN_NO_DFS - {{36,40,44,48,149,153,157,161},8}, // 0x22, RT_CHANNEL_DOMAIN_5G_FCC4_NO_DFS + {{36,40,44,48,52,56,60,64,100,104,108,112,116,132,136,140,149,153,157,161,165},21}, // 0x30, RT_CHANNEL_DOMAIN_5G_FCC + {{36,40,44,48},4}, // 0x31, RT_CHANNEL_DOMAIN_5G_JAPAN_NO_DFS + {{36,40,44,48,149,153,157,161},8}, // 0x32, RT_CHANNEL_DOMAIN_5G_FCC4_NO_DFS }; static RT_CHANNEL_PLAN_MAP RTW_ChannelPlanMap[RT_CHANNEL_DOMAIN_MAX] = { @@ -244,7 +237,7 @@ static RT_CHANNEL_PLAN_MAP RTW_ChannelPlanMap[RT_CHANNEL_DOMAIN_MAX] = { {0x02,0x04}, //0x25, RT_CHANNEL_DOMAIN_FCC1_FCC1 {0x00,0x01}, //0x26, RT_CHANNEL_DOMAIN_WORLD_ETSI1 {0x03,0x0C}, //0x27, RT_CHANNEL_DOMAIN_MKK1_MKK1 - {0x00,0x0B}, //0x28, RT_CHANNEL_DOMAIN_WORLD_KCC1 + {0x00,0x20}, //0x28, RT_CHANNEL_DOMAIN_5G_KCC2 {0x00,0x05}, //0x29, RT_CHANNEL_DOMAIN_WORLD_FCC2 {0x00,0x00}, //0x2A, {0x00,0x00}, //0x2B, @@ -256,12 +249,12 @@ static RT_CHANNEL_PLAN_MAP RTW_ChannelPlanMap[RT_CHANNEL_DOMAIN_MAX] = { {0x00,0x07}, //0x31, RT_CHANNEL_DOMAIN_WORLD_FCC4 {0x00,0x08}, //0x32, RT_CHANNEL_DOMAIN_WORLD_FCC5 {0x00,0x09}, //0x33, RT_CHANNEL_DOMAIN_WORLD_FCC6 - {0x02,0x0A}, //0x34, RT_CHANNEL_DOMAIN_FCC1_FCC7 + {0x02,0x21}, //0x34, RT_CHANNEL_DOMAIN_5G_FCC11 {0x00,0x02}, //0x35, RT_CHANNEL_DOMAIN_WORLD_ETSI2 {0x00,0x03}, //0x36, RT_CHANNEL_DOMAIN_WORLD_ETSI3 {0x03,0x0D}, //0x37, RT_CHANNEL_DOMAIN_MKK1_MKK2 {0x03,0x0E}, //0x38, RT_CHANNEL_DOMAIN_MKK1_MKK3 - {0x02,0x0F}, //0x39, RT_CHANNEL_DOMAIN_FCC1_NCC1 + {0x02,0x22}, //0x39, RT_CHANNEL_DOMAIN_5G_NCC5 {0x00,0x00}, //0x3A, {0x00,0x00}, //0x3B, {0x00,0x00}, //0x3C, @@ -278,6 +271,12 @@ static RT_CHANNEL_PLAN_MAP RTW_ChannelPlanMap[RT_CHANNEL_DOMAIN_MAX] = { {0x00,0x15}, //0x47, RT_CHANNEL_DOMAIN_WORLD_ETSI6 {0x00,0x16}, //0x48, RT_CHANNEL_DOMAIN_WORLD_ETSI7 {0x00,0x17}, //0x49, RT_CHANNEL_DOMAIN_WORLD_ETSI8 + {0x00,0x00}, //0x4A, + {0x00,0x00}, //0x4B, + {0x00,0x00}, //0x4C, + {0x00,0x00}, //0x4D, + {0x00,0x00}, //0x4E, + {0x00,0x00}, //0x4F, {0x00,0x18}, //0x50, RT_CHANNEL_DOMAIN_WORLD_ETSI9 {0x00,0x19}, //0x51, RT_CHANNEL_DOMAIN_WORLD_ETSI10 {0x00,0x1A}, //0x52, RT_CHANNEL_DOMAIN_WORLD_ETSI11 @@ -286,9 +285,10 @@ static RT_CHANNEL_PLAN_MAP RTW_ChannelPlanMap[RT_CHANNEL_DOMAIN_MAX] = { {0x02,0x1D}, //0x55, RT_CHANNEL_DOMAIN_FCC1_FCC9 {0x00,0x1E}, //0x56, RT_CHANNEL_DOMAIN_WORLD_ETSI13 {0x02,0x1F}, //0x57, RT_CHANNEL_DOMAIN_FCC1_FCC10 + {0x01,0x23}, //0x58, RT_CHANNEL_DOMAIN_WORLD_MKK4 }; -static RT_CHANNEL_PLAN_MAP RTW_CHANNEL_PLAN_MAP_REALTEK_DEFINE = {0x03,0x02}; //use the conbination for max channel numbers +static RT_CHANNEL_PLAN_MAP RTW_CHANNEL_PLAN_MAP_REALTEK_DEFINE = {0x00,0x02}; //use the conbination for max channel numbers /* * Search the @param ch in given @param ch_set @@ -345,19 +345,25 @@ int init_hw_mlme_ext(_adapter *padapter) return _SUCCESS; } +void init_mlme_default_rate_set(_adapter* padapter) +{ + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; + + unsigned char mixed_datarate[NumRates] = {_1M_RATE_, _2M_RATE_, _5M_RATE_, _11M_RATE_, _6M_RATE_,_9M_RATE_, _12M_RATE_, _18M_RATE_, _24M_RATE_, _36M_RATE_, _48M_RATE_, _54M_RATE_, 0xff}; + unsigned char mixed_basicrate[NumRates] ={_1M_RATE_, _2M_RATE_, _5M_RATE_, _11M_RATE_, _6M_RATE_, _12M_RATE_, _24M_RATE_, 0xff,}; + unsigned char supported_mcs_set[16] = {0xff, 0xff, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; + + _rtw_memcpy(pmlmeext->datarate, mixed_datarate, NumRates); + _rtw_memcpy(pmlmeext->basicrate, mixed_basicrate, NumRates); + + _rtw_memcpy(pmlmeext->default_supported_mcs_set, supported_mcs_set, sizeof(pmlmeext->default_supported_mcs_set)); +} + static void init_mlme_ext_priv_value(_adapter* padapter) { struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); -#ifdef CONFIG_TDLS - u8 i; -#endif - - //unsigned char default_channel_set[MAX_CHANNEL_NUM] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, 0}; - unsigned char mixed_datarate[NumRates] = {_1M_RATE_, _2M_RATE_, _5M_RATE_, _11M_RATE_, _6M_RATE_,_9M_RATE_, _12M_RATE_, _18M_RATE_, _24M_RATE_, _36M_RATE_, _48M_RATE_, _54M_RATE_, 0xff}; - unsigned char mixed_basicrate[NumRates] ={_1M_RATE_, _2M_RATE_, _5M_RATE_, _11M_RATE_, _6M_RATE_, _12M_RATE_, _24M_RATE_, 0xff,}; - ATOMIC_SET(&pmlmeext->event_seq, 0); pmlmeext->mgnt_seq = 0;//reset to zero when disconnect at client mode #ifdef CONFIG_IEEE80211W @@ -373,10 +379,7 @@ static void init_mlme_ext_priv_value(_adapter* padapter) pmlmeext->cur_wireless_mode = padapter->registrypriv.wireless_mode; - //_rtw_memcpy(pmlmeext->channel_set, DefaultChannelPlan[padapter->mlmepriv.ChannelPlan].Channel, DefaultChannelPlan[padapter->mlmepriv.ChannelPlan].Len); - //_rtw_memcpy(pmlmeext->channel_set, default_channel_set, MAX_CHANNEL_NUM); - _rtw_memcpy(pmlmeext->datarate, mixed_datarate, NumRates); - _rtw_memcpy(pmlmeext->basicrate, mixed_basicrate, NumRates); + init_mlme_default_rate_set(padapter); if(pmlmeext->cur_channel > 14) pmlmeext->tx_rate = IEEE80211_OFDM_RATE_6MB; @@ -487,14 +490,13 @@ static u8 init_channel_set(_adapter* padapter, u8 ChannelPlan, RT_CHANNEL_INFO * u8 b5GBand = _FALSE, b2_4GBand = _FALSE; u8 Index2G = 0, Index5G=0; - _rtw_memset(channel_set, 0, sizeof(RT_CHANNEL_INFO)*MAX_CHANNEL_NUM); - - if(ChannelPlan >= RT_CHANNEL_DOMAIN_MAX && ChannelPlan != RT_CHANNEL_DOMAIN_REALTEK_DEFINE) - { + if (!rtw_is_channel_plan_valid(ChannelPlan)) { DBG_871X("ChannelPlan ID %x error !!!!!\n",ChannelPlan); return chanset_size; } + _rtw_memset(channel_set, 0, sizeof(RT_CHANNEL_INFO)*MAX_CHANNEL_NUM); + if(IsSupported24G(padapter->registrypriv.wireless_mode)) { b2_4GBand = _TRUE; @@ -579,6 +581,8 @@ static u8 init_channel_set(_adapter* padapter, u8 ChannelPlan, RT_CHANNEL_INFO * } } + Hal_ChannelPlanToRegulation(padapter, ChannelPlan); + DBG_871X("%s ChannelPlan ID %x Chan num:%d \n",__FUNCTION__,ChannelPlan,chanset_size); return chanset_size; } @@ -918,12 +922,13 @@ unsigned int OnProbeReq(_adapter *padapter, union recv_frame *precv_frame) // Commented by Kurt 2012/10/16 // IOT issue: Google Nexus7 use 1M rate to send p2p_probe_req after GO nego completed and Nexus7 is client -#ifdef CONFIG_WIFI_TEST - if ( pattrib->data_rate <= 3 ) - { - wifi_test_chk_rate = 0; - } -#endif //CONFIG_WIFI_TEST + if (padapter->registrypriv.wifi_spec == 1) + { + if ( pattrib->data_rate <= 3 ) + { + wifi_test_chk_rate = 0; + } + } if( wifi_test_chk_rate == 1 ) { @@ -1290,8 +1295,23 @@ unsigned int OnBeacon(_adapter *padapter, union recv_frame *precv_frame) pbss = (WLAN_BSSID_EX*)rtw_malloc(sizeof(WLAN_BSSID_EX)); if (pbss) { if (collect_bss_info(padapter, precv_frame, pbss) == _SUCCESS) { + struct beacon_keys recv_beacon; + update_network(&(pmlmepriv->cur_network.network), pbss, padapter, _TRUE); rtw_get_bcn_info(&(pmlmepriv->cur_network)); + + // update bcn keys + if (rtw_get_bcn_keys(padapter, pframe, len, &recv_beacon) == _TRUE) { + DBG_871X("%s: beacon keys ready\n", __func__); + _rtw_memcpy(&pmlmepriv->cur_beacon_keys, + &recv_beacon, sizeof(recv_beacon)); + pmlmepriv->new_beacon_cnts = 0; + } + else { + DBG_871X_LEVEL(_drv_err_, "%s: get beacon keys failed\n", __func__); + _rtw_memset(&pmlmepriv->cur_beacon_keys, 0, sizeof(recv_beacon)); + pmlmepriv->new_beacon_cnts = 0; + } } rtw_mfree((u8*)pbss, sizeof(WLAN_BSSID_EX)); } @@ -2238,6 +2258,10 @@ unsigned int OnAssocReq(_adapter *padapter, union recv_frame *precv_frame) if (elems.vht_op_mode_notify && elems.vht_op_mode_notify_len == 1) { _rtw_memcpy(&pstat->vhtpriv.vht_op_mode_notify, elems.vht_op_mode_notify, 1); } + else // for Frame without Operating Mode notify ie; default: 80M + { + pstat->vhtpriv.vht_op_mode_notify = CHANNEL_WIDTH_80; + } } else { pstat->flags &= ~WLAN_STA_VHT; @@ -3185,7 +3209,7 @@ void issue_p2p_GO_request(_adapter *padapter, u8* raddr) // Value: // Todo the tie breaker bit. - p2pie[ p2pielen++ ] = ( ( pwdinfo->intent << 1 ) | BIT(0) ); + p2pie[ p2pielen++ ] = ( ( pwdinfo->intent << 1 ) & 0xFE ); // Configuration Timeout // Type: @@ -5820,8 +5844,7 @@ unsigned int on_action_public_p2p(union recv_frame *precv_frame) result = process_p2p_group_negotation_req( pwdinfo, frame_body, len ); issue_p2p_GO_response( padapter, GetAddr2Ptr(pframe), frame_body, len, result ); #ifdef CONFIG_INTEL_WIDI - if( (padapter->mlmepriv.widi_state == INTEL_WIDI_STATE_LISTEN) && (padapter->mlmepriv.widi_state != INTEL_WIDI_STATE_WFD_CONNECTION) ) - { + if (padapter->mlmepriv.widi_state == INTEL_WIDI_STATE_LISTEN) { padapter->mlmepriv.widi_state = INTEL_WIDI_STATE_WFD_CONNECTION; _cancel_timer_ex(&(padapter->mlmepriv.listen_timer)); intel_widi_wk_cmd(padapter, INTEL_WIDI_LISTEN_STOP_WK, NULL, 0); @@ -6070,8 +6093,7 @@ unsigned int on_action_public_p2p(union recv_frame *precv_frame) _set_timer( &pwdinfo->restore_p2p_state_timer, 3000 ); } #ifdef CONFIG_INTEL_WIDI - if( (padapter->mlmepriv.widi_state == INTEL_WIDI_STATE_LISTEN) && (padapter->mlmepriv.widi_state != INTEL_WIDI_STATE_WFD_CONNECTION) ) - { + if (padapter->mlmepriv.widi_state == INTEL_WIDI_STATE_LISTEN) { padapter->mlmepriv.widi_state = INTEL_WIDI_STATE_WFD_CONNECTION; _cancel_timer_ex(&(padapter->mlmepriv.listen_timer)); intel_widi_wk_cmd(padapter, INTEL_WIDI_LISTEN_STOP_WK, NULL, 0); @@ -6156,8 +6178,7 @@ unsigned int on_action_public_p2p(union recv_frame *precv_frame) rtw_p2p_set_state(pwdinfo, P2P_STATE_RX_PROVISION_DIS_REQ); _set_timer( &pwdinfo->restore_p2p_state_timer, P2P_PROVISION_TIMEOUT ); #ifdef CONFIG_INTEL_WIDI - if( (padapter->mlmepriv.widi_state == INTEL_WIDI_STATE_LISTEN) && (padapter->mlmepriv.widi_state != INTEL_WIDI_STATE_WFD_CONNECTION) ) - { + if (padapter->mlmepriv.widi_state == INTEL_WIDI_STATE_LISTEN) { padapter->mlmepriv.widi_state = INTEL_WIDI_STATE_WFD_CONNECTION; _cancel_timer_ex(&(padapter->mlmepriv.listen_timer)); intel_widi_wk_cmd(padapter, INTEL_WIDI_LISTEN_STOP_WK, NULL, 0); @@ -6389,10 +6410,7 @@ unsigned int OnAction_p2p(_adapter *padapter, union recv_frame *precv_frame) u8 *pframe = precv_frame->u.hdr.rx_data; uint len = precv_frame->u.hdr.len; struct wifidirect_info *pwdinfo = &( padapter->wdinfo ); - - DBG_871X("%s\n", __FUNCTION__); - //check RA matches or not if (!_rtw_memcmp(myid(&(padapter->eeprompriv)), GetAddr1Ptr(pframe), ETH_ALEN))//for if1, sta/ap mode return _SUCCESS; @@ -6550,7 +6568,7 @@ void update_mgntframe_attrib(_adapter *padapter, struct pkt_attrib *pattrib) pattrib->nr_frags = 1; pattrib->priority = 7; pattrib->mac_id = 0; - pattrib->qsel = 0x12; + pattrib->qsel = QSLT_MGNT; pattrib->pktlen = 0; @@ -6734,7 +6752,11 @@ void issue_beacon(_adapter *padapter, int timeout_ms) //DBG_871X("%s\n", __FUNCTION__); +#ifdef CONFIG_BCN_ICF + if ((pmgntframe = rtw_alloc_bcnxmitframe(pxmitpriv)) == NULL) +#else if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) +#endif { DBG_871X("%s, alloc mgnt frame fail\n", __FUNCTION__); return; @@ -6746,7 +6768,7 @@ void issue_beacon(_adapter *padapter, int timeout_ms) //update attribute pattrib = &pmgntframe->attrib; update_mgntframe_attrib(padapter, pattrib); - pattrib->qsel = 0x10; + pattrib->qsel = QSLT_BEACON; #ifdef CONFIG_CONCURRENT_MODE if(padapter->iface_type == IFACE_PORT1) pattrib->mbssid = 1; @@ -8872,6 +8894,7 @@ void issue_action_BA(_adapter *padapter, unsigned char *raddr, unsigned char act u16 BA_timeout_value; u16 BA_starting_seqctrl; HT_CAP_AMPDU_FACTOR max_rx_ampdu_factor; + u8 ba_rxbuf_sz; struct xmit_frame *pmgntframe; struct pkt_attrib *pattrib; u8 *pframe; @@ -8885,7 +8908,6 @@ void issue_action_BA(_adapter *padapter, unsigned char *raddr, unsigned char act struct registry_priv *pregpriv = &padapter->registrypriv; #ifdef CONFIG_80211N_HT - DBG_871X("%s, category=%d, action=%d, status=%d\n", __FUNCTION__, category, action, status); if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) { @@ -8932,28 +8954,12 @@ void issue_action_BA(_adapter *padapter, unsigned char *raddr, unsigned char act } while (pmlmeinfo->dialogToken == 0); pframe = rtw_set_fixed_ie(pframe, 1, &(pmlmeinfo->dialogToken), &(pattrib->pktlen)); -#ifdef CONFIG_BT_COEXIST - if (rtw_btcoex_IsBTCoexCtrlAMPDUSize(padapter) == _TRUE) - { - // A-MSDU NOT Supported - BA_para_set = 0; - // immediate Block Ack - BA_para_set |= (1 << 1) & IEEE80211_ADDBA_PARAM_POLICY_MASK; - // TID - BA_para_set |= (status << 2) & IEEE80211_ADDBA_PARAM_TID_MASK; - // max buffer size is 8 MSDU - BA_para_set |= (8 << 6) & RTW_IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK; - } - else -#endif - { - #if defined(CONFIG_RTL8188E) && defined(CONFIG_SDIO_HCI) - BA_para_set = (0x0802 | ((status & 0xf) << 2)); //immediate ack & 16 buffer size - #else - BA_para_set = (0x1002 | ((status & 0xf) << 2)); //immediate ack & 64 buffer size - #endif - } - //sys_mib.BA_para_set = 0x0802; //immediate ack & 32 buffer size + #if defined(CONFIG_RTL8188E) && defined(CONFIG_SDIO_HCI) + BA_para_set = (0x0802 | ((status & 0xf) << 2)); //immediate ack & 16 buffer size + #else + BA_para_set = (0x1002 | ((status & 0xf) << 2)); //immediate ack & 64 buffer size + #endif + BA_para_set = cpu_to_le16(BA_para_set); pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(BA_para_set)), &(pattrib->pktlen)); @@ -8976,49 +8982,57 @@ void issue_action_BA(_adapter *padapter, unsigned char *raddr, unsigned char act BA_starting_seqctrl = cpu_to_le16(BA_starting_seqctrl); pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(BA_starting_seqctrl)), &(pattrib->pktlen)); + DBG_871X("%s, category=%d, action=%d, status=%d\n", __FUNCTION__, category, action, status); break; case 1: //ADDBA rsp pframe = rtw_set_fixed_ie(pframe, 1, &(pmlmeinfo->ADDBA_req.dialog_token), &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&status), &(pattrib->pktlen)); - /* - //BA_para_set = cpu_to_le16((le16_to_cpu(pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x1000); //64 buffer size - #if defined(CONFIG_RTL8188E )&& defined (CONFIG_SDIO_HCI) - BA_para_set = ((le16_to_cpu(pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x0800); //32buffer size - #else - BA_para_set = ((le16_to_cpu(pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x1000); //64 buffer size - #endif - */ - rtw_hal_get_def_var(padapter, HW_VAR_MAX_RX_AMPDU_FACTOR, &max_rx_ampdu_factor); - if(MAX_AMPDU_FACTOR_64K == max_rx_ampdu_factor) - BA_para_set = ((le16_to_cpu(pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x1000); //64 buffer size - else if(MAX_AMPDU_FACTOR_32K == max_rx_ampdu_factor) - BA_para_set = ((le16_to_cpu(pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x0800); //32 buffer size - else if(MAX_AMPDU_FACTOR_16K == max_rx_ampdu_factor) - BA_para_set = ((le16_to_cpu(pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x0400); //16 buffer size - else if(MAX_AMPDU_FACTOR_8K == max_rx_ampdu_factor) - BA_para_set = ((le16_to_cpu(pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x0200); //8 buffer size + + BA_para_set = le16_to_cpu(pmlmeinfo->ADDBA_req.BA_para_set); + + if(padapter->driver_rx_ampdu_factor != 0xFF) + max_rx_ampdu_factor = (HT_CAP_AMPDU_FACTOR)padapter->driver_rx_ampdu_factor; else - BA_para_set = ((le16_to_cpu(pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x1000); //64 buffer size - -#ifdef CONFIG_BT_COEXIST - if (rtw_btcoex_IsBTCoexCtrlAMPDUSize(padapter) == _TRUE) - { - // max buffer size is 8 MSDU - BA_para_set &= ~RTW_IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK; - BA_para_set |= (8 << 6) & RTW_IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK; - } -#endif - - if(pregpriv->ampdu_amsdu==0)//disabled - BA_para_set = cpu_to_le16(BA_para_set & ~BIT(0)); - else if(pregpriv->ampdu_amsdu==1)//enabled - BA_para_set = cpu_to_le16(BA_para_set | BIT(0)); - else //auto - BA_para_set = cpu_to_le16(BA_para_set); + rtw_hal_get_def_var(padapter, HW_VAR_MAX_RX_AMPDU_FACTOR, &max_rx_ampdu_factor); + if(MAX_AMPDU_FACTOR_64K == max_rx_ampdu_factor) + ba_rxbuf_sz = 64; + else if(MAX_AMPDU_FACTOR_32K == max_rx_ampdu_factor) + ba_rxbuf_sz = 32; + else if(MAX_AMPDU_FACTOR_16K == max_rx_ampdu_factor) + ba_rxbuf_sz = 16; + else if(MAX_AMPDU_FACTOR_8K == max_rx_ampdu_factor) + ba_rxbuf_sz = 8; + else + ba_rxbuf_sz = 64; + + #ifdef CONFIG_BT_COEXIST + if (rtw_btcoex_IsBTCoexCtrlAMPDUSize(padapter) == _TRUE) + ba_rxbuf_sz = rtw_btcoex_GetAMPDUSize(padapter); + #endif + + if (padapter->fix_ba_rxbuf_bz != 0xFF) + ba_rxbuf_sz = padapter->fix_ba_rxbuf_bz; + + if (ba_rxbuf_sz > 127) + ba_rxbuf_sz = 127; + + BA_para_set &= ~RTW_IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK; + BA_para_set |= (ba_rxbuf_sz << 6) & RTW_IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK; + + if (!padapter->registrypriv.wifi_spec) { + if(pregpriv->ampdu_amsdu==0)//disabled + BA_para_set &= ~BIT(0); + else if(pregpriv->ampdu_amsdu==1)//enabled + BA_para_set |= BIT(0); + } + + BA_para_set = cpu_to_le16(BA_para_set); + pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(BA_para_set)), &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(pmlmeinfo->ADDBA_req.BA_timeout_value)), &(pattrib->pktlen)); + DBG_871X("%s, category=%d, action=%d, status=%d, rxbuf_sz=%u\n", __FUNCTION__, category, action, status, ba_rxbuf_sz); break; case 2://DELBA BA_para_set = (status & 0x1F) << 3; @@ -9028,6 +9042,7 @@ void issue_action_BA(_adapter *padapter, unsigned char *raddr, unsigned char act reason_code = 37;//Requested from peer STA as it does not want to use the mechanism reason_code = cpu_to_le16(reason_code); pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(reason_code)), &(pattrib->pktlen)); + DBG_871X("%s, category=%d, action=%d, status=%d\n", __FUNCTION__, category, action, status); break; default: break; @@ -9198,6 +9213,140 @@ static void issue_action_BSSCoexistPacket(_adapter *padapter) #endif //CONFIG_80211N_HT } +// Spatial Multiplexing Powersave (SMPS) action frame +int _issue_action_SM_PS(_adapter *padapter , unsigned char *raddr , u8 NewMimoPsMode , u8 wait_ack) +{ + + int ret=0; + unsigned char category = RTW_WLAN_CATEGORY_HT; + u8 action = RTW_WLAN_ACTION_HT_SM_PS; + u8 sm_power_control=0; + struct xmit_frame *pmgntframe; + struct pkt_attrib *pattrib; + unsigned char *pframe; + struct rtw_ieee80211_hdr *pwlanhdr; + unsigned short *fctrl; + struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + struct wifidirect_info *pwdinfo = &( padapter->wdinfo); + + if(NewMimoPsMode==WLAN_HT_CAP_SM_PS_DISABLED) + { + sm_power_control = sm_power_control & ~(BIT(0)); // SM Power Save Enable = 0 SM Power Save Disable + } + else if(NewMimoPsMode==WLAN_HT_CAP_SM_PS_STATIC) + { + sm_power_control = sm_power_control | BIT(0); // SM Power Save Enable = 1 SM Power Save Enable + sm_power_control = sm_power_control & ~(BIT(1)); // SM Mode = 0 Static Mode + } + else if(NewMimoPsMode==WLAN_HT_CAP_SM_PS_DYNAMIC) + { + sm_power_control = sm_power_control | BIT(0); // SM Power Save Enable = 1 SM Power Save Enable + sm_power_control = sm_power_control | BIT(1); // SM Mode = 1 Dynamic Mode + } + else + return ret; + + DBG_871X("%s, sm_power_control=%u, NewMimoPsMode=%u\n", __FUNCTION__ , sm_power_control , NewMimoPsMode ); + + if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) + return ret; + + //update attribute + pattrib = &pmgntframe->attrib; + update_mgntframe_attrib(padapter, pattrib); + + _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET); + + pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET; + pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; + + fctrl = &(pwlanhdr->frame_ctl); + *(fctrl) = 0; + + _rtw_memcpy(pwlanhdr->addr1, raddr, ETH_ALEN); /* RA */ + _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); /* TA */ + _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); /* DA = RA */ + + SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); + pmlmeext->mgnt_seq++; + SetFrameSubType(pframe, WIFI_ACTION); + + pframe += sizeof(struct rtw_ieee80211_hdr_3addr); + pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); + + /* category, action */ + pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); + + pframe = rtw_set_fixed_ie(pframe, 1, &(sm_power_control), &(pattrib->pktlen)); + + pattrib->last_txcmdsz = pattrib->pktlen; + + if(wait_ack) + { + ret = dump_mgntframe_and_wait_ack(padapter, pmgntframe); + } + else + { + dump_mgntframe(padapter, pmgntframe); + ret = _SUCCESS; + } + + if (ret != _SUCCESS) + DBG_8192C("%s, ack to\n", __func__); + + return ret; +} + +int issue_action_SM_PS_wait_ack(_adapter *padapter, unsigned char *raddr, u8 NewMimoPsMode, int try_cnt, int wait_ms) +{ + int ret = 0; + int i = 0; + u32 start = rtw_get_current_time(); + + do { + ret = _issue_action_SM_PS(padapter, raddr, NewMimoPsMode , wait_ms>0?_TRUE:_FALSE ); + + i++; + + if (padapter->bDriverStopped || padapter->bSurpriseRemoved) + break; + + if(i < try_cnt && wait_ms > 0 && ret==_FAIL) + rtw_msleep_os(wait_ms); + + }while((istapriv; @@ -9350,6 +9499,7 @@ void site_survey(_adapter *padapter) struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); u32 initialgain = 0; + u32 channel_scan_time_ms = 0,val32 = 0; #ifdef CONFIG_P2P @@ -9524,28 +9674,43 @@ void site_survey(_adapter *padapter) } } } + #if defined(CONFIG_ATMEL_RC_PATCH) // treat wlan0 & p2p0 in same way, may be changed in near feature. // assume home channel is 6, channel switch sequence will be // 1,2-6-3,4-6-5,6-6-7,8-6-9,10-6-11,12-6-13,14 //if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)==_TRUE) - if( stay_buddy_ch == 1 ) - set_survey_timer(pmlmeext, pmlmeext->chan_scan_time * RTW_STAY_AP_CH_MILLISECOND ); + if( stay_buddy_ch == 1 ){ + channel_scan_time_ms = pmlmeext->chan_scan_time * RTW_STAY_AP_CH_MILLISECOND; + } else { if( check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) - set_survey_timer(pmlmeext, 20); + channel_scan_time_ms = 20; else - set_survey_timer(pmlmeext, 40); + channel_scan_time_ms = 40 } #elif defined(CONFIG_STA_MODE_SCAN_UNDER_AP_MODE) if( stay_buddy_ch == 1 ) - set_survey_timer(pmlmeext, pmlmeext->chan_scan_time * RTW_STAY_AP_CH_MILLISECOND ); - else - set_survey_timer(pmlmeext, pmlmeext->chan_scan_time); + channel_scan_time_ms = pmlmeext->chan_scan_time * RTW_STAY_AP_CH_MILLISECOND ; + else + channel_scan_time_ms = pmlmeext->chan_scan_time; #else - set_survey_timer(pmlmeext, pmlmeext->chan_scan_time); + channel_scan_time_ms = pmlmeext->chan_scan_time; #endif + + set_survey_timer(pmlmeext, channel_scan_time_ms); +#if defined(CONFIG_SIGNAL_DISPLAY_DBM) && defined(CONFIG_BACKGROUND_NOISE_MONITOR) + { + struct noise_info info; + info.bPauseDIG = _FALSE; + info.IGIValue = 0; + info.max_time = channel_scan_time_ms/2;//ms + info.chan = survey_channel; + rtw_hal_set_odm_var(padapter, HAL_ODM_NOISE_MONITOR,&info, _FALSE); + } +#endif + } else { @@ -9605,12 +9770,13 @@ void site_survey(_adapter *padapter) rtw_p2p_set_state(pwdinfo, P2P_STATE_FIND_PHASE_LISTEN); pmlmeext->sitesurvey_res.state = SCAN_DISABLE; - initialgain = 0xff; //restore RX GAIN - rtw_hal_set_hwreg(padapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain)); - //turn on dynamic functions + //turn on phy-dynamic functions Restore_DM_Func_Flag(padapter); //Switch_DM_Func(padapter, DYNAMIC_FUNC_DIG|DYNAMIC_FUNC_HP|DYNAMIC_FUNC_SS, _TRUE); + initialgain = 0xff; //restore RX GAIN + rtw_hal_set_hwreg(padapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain)); + _set_timer( &pwdinfo->find_phase_timer, ( u32 ) ( ( u32 ) ( pwdinfo->listen_dwell ) * 100 ) ); } else @@ -9685,11 +9851,13 @@ void site_survey(_adapter *padapter) //config MSR Set_MSR(padapter, (pmlmeinfo->state & 0x3)); - initialgain = 0xff; //restore RX GAIN - rtw_hal_set_hwreg(padapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain)); - //turn on dynamic functions + //turn on phy-dynamic functions Restore_DM_Func_Flag(padapter); //Switch_DM_Func(padapter, DYNAMIC_ALL_FUNC_ENABLE, _TRUE); + + initialgain = 0xff; //restore RX GAIN + rtw_hal_set_hwreg(padapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain)); + if (is_client_associated_to_ap(padapter) == _TRUE) { @@ -10070,6 +10238,7 @@ void start_clnt_join(_adapter* padapter) struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); WLAN_BSSID_EX *pnetwork = (WLAN_BSSID_EX*)(&(pmlmeinfo->network)); int beacon_timeout; + u8 ASIX_ID[]= {0x00, 0x0E, 0xC6}; //update wireless mode update_wireless_mode(padapter); @@ -10077,6 +10246,12 @@ void start_clnt_join(_adapter* padapter) //udpate capability caps = rtw_get_capability((WLAN_BSSID_EX *)pnetwork); update_capinfo(padapter, caps); + + //check if sta is ASIX peer and fix IOT issue if it is. + if (_rtw_memcmp(get_my_bssid(&pmlmeinfo->network) ,ASIX_ID ,3)) { + u8 iot_flag = _TRUE; + rtw_hal_set_hwreg(padapter, HW_VAR_ASIX_IOT, (u8 *)(&iot_flag)); + } if (caps&cap_ESS) { Set_MSR(padapter, WIFI_FW_STATION_STATE); @@ -10959,6 +11134,8 @@ void update_sta_info(_adapter *padapter, struct sta_info *psta) psta->htpriv.ampdu_enable = pmlmepriv->htpriv.ampdu_enable; + psta->htpriv.rx_ampdu_min_spacing = (pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para&IEEE80211_HT_CAP_AMPDU_DENSITY)>>2; + if (support_short_GI(padapter, &(pmlmeinfo->HT_caps), CHANNEL_WIDTH_20)) psta->htpriv.sgi_20m = _TRUE; @@ -11018,16 +11195,39 @@ static void rtw_mlmeext_disconnect(_adapter *padapter) struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + WLAN_BSSID_EX *pnetwork = (WLAN_BSSID_EX*)(&(pmlmeinfo->network)); u8 state_backup = (pmlmeinfo->state&0x03); + u8 ASIX_ID[]= {0x00, 0x0E, 0xC6}; //set_opmode_cmd(padapter, infra_client_with_mlme); +#if 1 + /* + * For safety, prevent from keeping macid sleep. + * If we can sure all power mode enter/leave are paired, + * this check can be removed. + * Lucas@20131113 + */ + /* wakeup macid after disconnect. */ + { + struct sta_info *psta; + psta = rtw_get_stainfo(&padapter->stapriv, get_my_bssid(pnetwork)); + if (psta) + rtw_hal_macid_wakeup(padapter, psta->mac_id); + } +#endif + rtw_hal_set_hwreg(padapter, HW_VAR_MLME_DISCONNECT, 0); rtw_hal_set_hwreg(padapter, HW_VAR_BSSID, null_addr); //set MSR to no link state -> infra. mode Set_MSR(padapter, _HW_STATE_STATION_); + //check if sta is ASIX peer and fix IOT issue if it is. + if (_rtw_memcmp(get_my_bssid(&pmlmeinfo->network) ,ASIX_ID ,3)) { + u8 iot_flag = _FALSE; + rtw_hal_set_hwreg(padapter, HW_VAR_ASIX_IOT, (u8 *)(&iot_flag)); + } pmlmeinfo->state = WIFI_FW_NULL_STATE; if(state_backup == WIFI_FW_STATION_STATE) @@ -11159,6 +11359,10 @@ void mlmeext_joinbss_event_callback(_adapter *padapter, int join_res) set_sta_rate(padapter, psta); rtw_sta_media_status_rpt(padapter, psta, 1); + + /* wakeup macid after join bss successfully to ensure + the subsequent data frames can be sent out normally */ + rtw_hal_macid_wakeup(padapter, psta->mac_id); } if (rtw_port_switch_chk(padapter) == _TRUE) @@ -11278,10 +11482,10 @@ void _linked_info_dump(_adapter *padapter) { int i; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - u8 mac_id; + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); int UndecoratedSmoothedPWDB; - struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter); + struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); + struct macid_ctl_t *macid_ctl = dvobj_to_macidctl(dvobj); if(padapter->bLinkInfoDump){ @@ -11316,13 +11520,13 @@ void _linked_info_dump(_adapter *padapter) _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); } - for(i=0; inum; i++) { - if(pdvobj->macid[i] == _TRUE) - { - if(i !=1) //skip bc/mc sta - //============ tx info ============ - rtw_hal_get_def_var(padapter, HW_DEF_RA_INFO_DUMP, &i); + if(rtw_macid_is_used(macid_ctl, i) + && !rtw_macid_is_bmc(macid_ctl, i) /* skip bc/mc sta */ + ) { + //============ tx info ============ + rtw_hal_get_def_var(padapter, HW_DEF_RA_INFO_DUMP, &i); } } rtw_hal_set_def_var(padapter, HAL_DEF_DBG_RX_INFO_DUMP, NULL); @@ -12097,14 +12301,14 @@ u8 createbss_hdl(_adapter *padapter, u8 *pbuf) pmlmeinfo->agg_enable_bitmap = 0; pmlmeinfo->candidate_tid_bitmap = 0; - //disable dynamic functions, such as high power, DIG - Save_DM_Func_Flag(padapter); - Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, _FALSE); - //config the initial gain under linking, need to write the BB registers //initialgain = 0x1E; //rtw_hal_set_hwreg(padapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain)); + //disable dynamic functions, such as high power, DIG + Save_DM_Func_Flag(padapter); + Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, _FALSE); + //cancel link timer _cancel_timer_ex(&pmlmeext->link_timer); @@ -12144,48 +12348,6 @@ u8 join_cmd_hdl(_adapter *padapter, u8 *pbuf) //u32 acparm; u8 ch, bw, offset; -#if 1 - /* - * For safety, prevent from keeping macid sleep. - * If we can sure all power mode enter/leave are paired, - * this check can be removed. - * Lucas@20131113 - */ - { - struct sta_info *psta; - psta = rtw_get_stainfo(&padapter->stapriv, get_my_bssid(pnetwork)); - if (psta) - rtw_hal_macid_wakeup(padapter, psta->mac_id); - } -#endif - -#ifdef CONFIG_BT_COEXIST -{ - static u8 bw_mode = 0; - - if (0 == bw_mode) - { - bw_mode = pregpriv->bw_mode; // keep original bw_mode - DBG_871X(FUNC_ADPT_FMT ": [BTCOEX] Save bw_mode(0x%02x)\n", - FUNC_ADPT_ARG(padapter), pregpriv->bw_mode); - } - - if ((rtw_btcoex_1Ant(padapter) == _TRUE) - && (rtw_btcoex_IsBtLinkExist(padapter) == _TRUE)) - { - pregpriv->bw_mode = 0x00; - DBG_871X(FUNC_ADPT_FMT ": [BTCOEX] Change bw_mode to 20MHz(0x%02x)\n", - FUNC_ADPT_ARG(padapter), pregpriv->bw_mode); - } - else - { - pregpriv->bw_mode = bw_mode; - DBG_871X(FUNC_ADPT_FMT ": [BTCOEX] Restore bw_mode(0x%02x)\n", - FUNC_ADPT_ARG(padapter), pregpriv->bw_mode); - } -} -#endif // CONFIG_BT_COEXIST - //check already connecting to AP or not if (pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) { @@ -12401,22 +12563,6 @@ u8 disconnect_hdl(_adapter *padapter, unsigned char *pbuf) WLAN_BSSID_EX *pnetwork = (WLAN_BSSID_EX*)(&(pmlmeinfo->network)); u8 val8; - -#if 1 - /* - * For safety, prevent from keeping macid sleep. - * If we can sure all power mode enter/leave are paired, - * this check can be removed. - * Lucas@20131113 - */ - { - struct sta_info *psta; - psta = rtw_get_stainfo(&padapter->stapriv, get_my_bssid(pnetwork)); - if (psta) - rtw_hal_macid_wakeup(padapter, psta->mac_id); - } -#endif - if (is_client_associated_to_ap(padapter)) { #ifdef CONFIG_DFS @@ -12666,10 +12812,6 @@ u8 sitesurvey_cmd_hdl(_adapter *padapter, u8 *pbuf) #endif #endif /* CONFIG_FIND_BEST_CHANNEL */ - //disable dynamic functions, such as high power, DIG - Save_DM_Func_Flag(padapter); - Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, _FALSE); - //config the initial gain under scaning, need to write the BB registers #ifdef CONFIG_P2P #ifdef CONFIG_IOCTL_CFG80211 @@ -12684,6 +12826,10 @@ u8 sitesurvey_cmd_hdl(_adapter *padapter, u8 *pbuf) initialgain = 0x1e; rtw_hal_set_hwreg(padapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain)); + + //disable dynamic functions, such as high power, DIG + Save_DM_Func_Flag(padapter); + Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, _FALSE); //set MSR to no link state Set_MSR(padapter, _HW_STATE_NOLINK_); @@ -12716,23 +12862,38 @@ u8 setauth_hdl(_adapter *padapter, unsigned char *pbuf) u8 setkey_hdl(_adapter *padapter, u8 *pbuf) { - unsigned short ctrl; + u16 ctrl = 0; + s16 cam_id = 0; struct setkey_parm *pparm = (struct setkey_parm *)pbuf; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - unsigned char null_sta[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + unsigned char null_addr[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + u8 *addr; //main tx key for wep. if(pparm->set_tx) pmlmeinfo->key_index = pparm->keyid; - - //write cam - ctrl = BIT(15) | ((pparm->algorithm) << 2) | pparm->keyid; - DBG_871X_LEVEL(_drv_always_, "set group key to hw: alg:%d(WEP40-1 WEP104-5 TKIP-2 AES-4) " - "keyid:%d\n", pparm->algorithm, pparm->keyid); - write_cam(padapter, pparm->keyid, ctrl, null_sta, pparm->key); - + cam_id = rtw_camid_alloc(padapter, NULL, pparm->keyid); + + if (cam_id < 0){ + } else { + if (cam_id > 3) /* not default key, searched by A2 */ + addr = get_bssid(&padapter->mlmepriv); + else + addr = null_addr; + + ctrl = BIT(15) | BIT6 |((pparm->algorithm) << 2) | pparm->keyid; + write_cam(padapter, cam_id, ctrl, addr, pparm->key); + DBG_871X_LEVEL(_drv_always_, "set group key camid:%d, addr:"MAC_FMT", kid:%d, type:%s\n" + ,cam_id, MAC_ARG(addr), pparm->keyid, security_type_str(pparm->algorithm)); + } + + #ifdef DYNAMIC_CAMID_ALLOC + if (cam_id >=0 && cam_id <=3) + rtw_hal_set_hwreg(padapter, HW_VAR_SEC_DK_CFG, (u8*)_TRUE); + #endif + //allow multicast packets to driver padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_ON_RCR_AM, null_addr); @@ -12741,8 +12902,8 @@ u8 setkey_hdl(_adapter *padapter, u8 *pbuf) u8 set_stakey_hdl(_adapter *padapter, u8 *pbuf) { - u16 ctrl=0; - u8 cam_id = 0;//cam_entry + u16 ctrl = 0; + s16 cam_id = 0; u8 ret = H2C_SUCCESS; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); @@ -12753,82 +12914,38 @@ u8 set_stakey_hdl(_adapter *padapter, u8 *pbuf) struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; #endif //CONFIG_TDLS - //cam_entry: - //0~3 for default key + if(pparm->algorithm == _NO_PRIVACY_) + goto write_to_cam; - //for concurrent mode (ap+sta, sta+sta): - //default key is disable, using sw encrypt/decrypt - //camid 0, 1, 2, 3 is default entry for default key/group key - //macid = 1 is for bc/mc stainfo, no mapping to camid - //macid = 0 mapping to camid 4 - //for macid >=2, camid = macid+3; - - - if(pparm->algorithm == _NO_PRIVACY_) // clear cam entry - { - clear_cam_entry(padapter, pparm->id); - ret = H2C_SUCCESS; - goto exit_set_stakey_hdl; + psta = rtw_get_stainfo(pstapriv, pparm->addr); + if (!psta) { + DBG_871X_LEVEL(_drv_always_, "%s sta:"MAC_FMT" not found\n", __func__, MAC_ARG(pparm->addr)); + ret = H2C_REJECTED; + goto exit; } - if((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE) - { - psta = rtw_get_stainfo(pstapriv, pparm->addr); - if(psta) - { - ctrl = (BIT(15) | ((pparm->algorithm) << 2)); - - DBG_871X("r871x_set_stakey_hdl(): enc_algorithm=%d\n", pparm->algorithm); - - if((psta->mac_id == 1) || (psta->mac_id>(NUM_STA-4))) - { - DBG_871X("r871x_set_stakey_hdl():set_stakey failed, mac_id(aid)=%d\n", psta->mac_id); - ret = H2C_REJECTED; - goto exit_set_stakey_hdl; - } - - cam_id = (u8)rtw_get_camid(psta->mac_id);//0~3 for default key, cmd_id=macid + 3; - - DBG_871X("Write CAM, mac_addr=%x:%x:%x:%x:%x:%x, cam_entry=%d\n", pparm->addr[0], - pparm->addr[1], pparm->addr[2], pparm->addr[3], pparm->addr[4], - pparm->addr[5], cam_id); - - write_cam(padapter, cam_id, ctrl, pparm->addr, pparm->key); - - ret = H2C_SUCCESS_RSP; - goto exit_set_stakey_hdl; - - } - else - { - DBG_871X("r871x_set_stakey_hdl(): sta has been free\n"); - ret = H2C_REJECTED; - goto exit_set_stakey_hdl; - } - - } - - - //below for sta mode - if((psta = rtw_get_stainfo(pstapriv, pparm->addr))) - { - cam_id = (u8)rtw_get_camid(psta->mac_id); - } - else - cam_id = 4; - - ctrl = BIT(15) | ((pparm->algorithm) << 2); pmlmeinfo->enc_algo = pparm->algorithm; + cam_id = rtw_camid_alloc(padapter, psta, 0); + if (cam_id < 0) + goto exit; - DBG_871X_LEVEL(_drv_always_, "set pairwise key to hw: alg:%d(WEP40-1 WEP104-5 TKIP-2 AES-4) camid:%d\n", - pparm->algorithm, cam_id); - - write_cam(padapter, cam_id, ctrl, pparm->addr, pparm->key); - -exit_set_stakey_hdl: +write_to_cam: + if(pparm->algorithm == _NO_PRIVACY_) { + while((cam_id = rtw_camid_search(padapter, pparm->addr, -1)) >= 0) { + DBG_871X_LEVEL(_drv_always_, "clear key for addr:"MAC_FMT", camid:%d\n", MAC_ARG(pparm->addr), cam_id); + clear_cam_entry(padapter, cam_id); + rtw_camid_free(padapter,cam_id); + } + } else { + DBG_871X_LEVEL(_drv_always_, "set pairwise key camid:%d, addr:"MAC_FMT", kid:%d, type:%s\n", + cam_id, MAC_ARG(pparm->addr), pparm->keyid, security_type_str(pparm->algorithm)); + ctrl = BIT(15) | ((pparm->algorithm) << 2) | pparm->keyid; + write_cam(padapter, cam_id, ctrl, pparm->addr, pparm->key); + } + ret = H2C_SUCCESS_RSP; +exit: return ret; - } u8 add_ba_hdl(_adapter *padapter, unsigned char *pbuf) @@ -13061,7 +13178,8 @@ u8 chk_bmc_sleepq_hdl(_adapter *padapter, unsigned char *pbuf) pxmitframe->attrib.triggered=1; - pxmitframe->attrib.qsel = 0x11;//HIQ + if (xmitframe_hiq_filter(pxmitframe) == _TRUE) + pxmitframe->attrib.qsel = QSLT_HIGH;//HIQ #if 0 _exit_critical_bh(&psta_bmc->sleep_q.lock, &irqL); @@ -13077,10 +13195,10 @@ u8 chk_bmc_sleepq_hdl(_adapter *padapter, unsigned char *pbuf) //_exit_critical_bh(&psta_bmc->sleep_q.lock, &irqL); _exit_critical_bh(&pxmitpriv->lock, &irqL); - //#if defined(CONFIG_PCI_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) - #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) - rtw_chk_hi_queue_cmd(padapter); - #endif + if (padapter->interface_type != RTW_PCIE) { + /* check hi queue and bmc_sleepq */ + rtw_chk_hi_queue_cmd(padapter); + } } #endif @@ -14261,23 +14379,27 @@ u8 set_ch_hdl(_adapter *padapter, u8 *pbuf) u8 set_chplan_hdl(_adapter *padapter, unsigned char *pbuf) { struct SetChannelPlan_param *setChannelPlan_param; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; + struct mlme_priv *mlme = &padapter->mlmepriv; + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; if(!pbuf) return H2C_PARAMETERS_ERROR; setChannelPlan_param = (struct SetChannelPlan_param *)pbuf; + if(!rtw_is_channel_plan_valid(setChannelPlan_param->channel_plan)) { + return H2C_PARAMETERS_ERROR; + } + + mlme->ChannelPlan = setChannelPlan_param->channel_plan; + pmlmeext->max_chan_nums = init_channel_set(padapter, setChannelPlan_param->channel_plan, pmlmeext->channel_set); init_channel_list(padapter, pmlmeext->channel_set, pmlmeext->max_chan_nums, &pmlmeext->channel_list); + rtw_hal_set_odm_var(padapter,HAL_ODM_REGULATION,NULL,_TRUE); + #ifdef CONFIG_IOCTL_CFG80211 - if ((padapter->rtw_wdev != NULL) && (padapter->rtw_wdev->wiphy)) { - struct regulatory_request request; - request.initiator = NL80211_REGDOM_SET_BY_DRIVER; - rtw_reg_notifier(padapter->rtw_wdev->wiphy, &request); - } + rtw_reg_notify_by_driver(padapter); #endif //CONFIG_IOCTL_CFG80211 return H2C_SUCCESS; @@ -14543,3 +14665,18 @@ u8 tdls_hdl(_adapter *padapter, unsigned char *pbuf) } +u8 run_in_thread_hdl(_adapter *padapter, u8 *pbuf) +{ + struct RunInThread_param *p; + + + if (NULL == pbuf) + return H2C_PARAMETERS_ERROR; + p = (struct RunInThread_param*)pbuf; + + if (p->func) + p->func(p->context); + + return H2C_SUCCESS; +} + diff --git a/core/rtw_mp.c b/core/rtw_mp.c index ab11a3e..c20e608 100644 --- a/core/rtw_mp.c +++ b/core/rtw_mp.c @@ -292,7 +292,7 @@ s32 init_mp_priv(PADAPTER padapter) pmppriv->tx.stop = 1; pmppriv->bSetTxPower=0; //for manually set tx power pmppriv->bTxBufCkFail=_FALSE; - pmppriv->pktInterval=1; + pmppriv->pktInterval=0; mp_init_xmit_attrib(&pmppriv->tx, padapter); @@ -423,7 +423,7 @@ void mpt_InitHWConfig(PADAPTER Adapter) #define PHY_IQCalibrate(_Adapter, b) \ IS_HARDWARE_TYPE_8812(_Adapter) ? PHY_IQCalibrate_8812A(_Adapter, b) : \ - IS_HARDWARE_TYPE_8821(_Adapter) ? PHY_IQCalibrate_8821A(_Adapter, b) : \ + IS_HARDWARE_TYPE_8821(_Adapter) ? PHY_IQCalibrate_8821A(&(GET_HAL_DATA(_Adapter)->odmpriv), b) : \ PHY_IQCalibrate_default(_Adapter, b) #define PHY_LCCalibrate(_Adapter) \ @@ -449,17 +449,13 @@ static void PHY_IQCalibrate(PADAPTER padapter, u8 bReCovery) u8 b2ant; //false:1ant, true:2-ant u8 RF_Path; //0:S1, 1:S0 - pHalData = GET_HAL_DATA(padapter); b2ant = pHalData->EEPROMBluetoothAntNum==Ant_x2?_TRUE:_FALSE; - RF_Path = 0; -#ifdef CONFIG_USB_HCI - RF_Path = 1; -#endif - PHY_IQCalibrate_8723B(padapter, bReCovery, _FALSE, b2ant, RF_Path); + PHY_IQCalibrate_8723B(padapter, bReCovery, _FALSE, b2ant, pHalData->ant_path); } + #define PHY_LCCalibrate(a) PHY_LCCalibrate_8723B(&(GET_HAL_DATA(a)->odmpriv)) #define PHY_SetRFPathSwitch(a,b) PHY_SetRFPathSwitch_8723B(a,b) #endif @@ -568,9 +564,6 @@ MPT_InitializeAdapter( rtw_write16(pAdapter, 0x870, 0x300); rtw_write16(pAdapter, 0x860, 0x110); - if (pAdapter->registrypriv.mp_mode == 1) - pmlmepriv->fw_state = WIFI_MP_STATE; - return rtStatus; } @@ -694,7 +687,6 @@ void MPT_PwrCtlDM(PADAPTER padapter, u32 bstart) PDM_ODM_T pDM_Odm = &pHalData->odmpriv; if (bstart==1){ - ODM_ClearTxPowerTrackingState(pDM_Odm); DBG_871X("in MPT_PwrCtlDM start \n"); Switch_DM_Func(padapter, DYNAMIC_RF_TX_PWR_TRACK, _TRUE); pdmpriv->InitODMFlag |= ODM_RF_TX_PWR_TRACK ; @@ -702,6 +694,9 @@ void MPT_PwrCtlDM(PADAPTER padapter, u32 bstart) pdmpriv->TxPowerTrackControl = _TRUE; pDM_Odm->RFCalibrateInfo.TxPowerTrackControl = _TRUE; padapter->mppriv.mp_dm =1; + odm_TXPowerTrackingInit(pDM_Odm); + ODM_ClearTxPowerTrackingState(pDM_Odm); + }else{ DBG_871X("in MPT_PwrCtlDM stop \n"); disable_dm(padapter); @@ -711,7 +706,7 @@ void MPT_PwrCtlDM(PADAPTER padapter, u32 bstart) padapter->mppriv.mp_dm = 0; { TXPWRTRACK_CFG c; - u1Byte chnl =0 ; + u1Byte chnl =0 ; ConfigureTxpowerTrack(pDM_Odm, &c); ODM_ClearTxPowerTrackingState(pDM_Odm); @@ -735,7 +730,7 @@ u32 mp_join(PADAPTER padapter,u8 mode) struct mp_priv *pmppriv = &padapter->mppriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct wlan_network *tgt_network = &pmlmepriv->cur_network; - + // 1. initialize a new WLAN_BSSID_EX _rtw_memset(&bssid, 0, sizeof(WLAN_BSSID_EX)); DBG_8192C("%s ,pmppriv->network_macaddr=%x %x %x %x %x %x \n",__func__, @@ -766,21 +761,18 @@ u32 mp_join(PADAPTER padapter,u8 mode) _enter_critical_bh(&pmlmepriv->lock, &irqL); - //if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == _TRUE) - // goto end_of_mp_start_test; -#if 0 + if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == _TRUE) + goto end_of_mp_start_test; + //init mp_start_test status if (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) { - rtw_disassoc_cmd(padapter, 0, _TRUE); + rtw_disassoc_cmd(padapter, 500, _TRUE); rtw_indicate_disconnect(padapter); rtw_free_assoc_resources(padapter, 1); } - rtw_msleep_os(500); - pmppriv->prev_fw_state = get_fwstate(pmlmepriv); - if (padapter->registrypriv.mp_mode == 1) - pmlmepriv->fw_state = WIFI_MP_STATE; - + pmlmepriv->fw_state = WIFI_MP_STATE; +#if 0 if (pmppriv->mode == _LOOPBOOK_MODE_) { set_fwstate(pmlmepriv, WIFI_MP_LPBK_STATE); //append txdesc RT_TRACE(_module_mp_, _drv_notice_, ("+start mp in Lookback mode\n")); @@ -788,11 +780,8 @@ u32 mp_join(PADAPTER padapter,u8 mode) RT_TRACE(_module_mp_, _drv_notice_, ("+start mp in normal mode\n")); } #endif - set_fwstate(pmlmepriv, _FW_UNDER_LINKING); - set_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE); - #if 1 //3 2. create a new psta for mp driver //clear psta in the cur_network, if any psta = rtw_get_stainfo(&padapter->stapriv, tgt_network->network.MacAddress); @@ -805,7 +794,7 @@ u32 mp_join(PADAPTER padapter,u8 mode) res = _FAIL; goto end_of_mp_start_test; } - #endif + set_fwstate(pmlmepriv,WIFI_ADHOC_MASTER_STATE); //3 3. join psudo AdHoc tgt_network->join_res = 1; tgt_network->aid = psta->aid = 1; @@ -813,6 +802,7 @@ u32 mp_join(PADAPTER padapter,u8 mode) rtw_indicate_connect(padapter); _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); + set_fwstate(pmlmepriv,_FW_LINKED); end_of_mp_start_test: @@ -822,19 +812,21 @@ end_of_mp_start_test: { // set MSR to WIFI_FW_ADHOC_STATE if( mode==WIFI_FW_ADHOC_STATE ){ + val8 = rtw_read8(padapter, MSR) & 0xFC; // 0x0102 val8 |= WIFI_FW_ADHOC_STATE; rtw_write8(padapter, MSR, val8); // Link in ad hoc network - } + } else { Set_MSR(padapter, WIFI_FW_STATION_STATE); + DBG_8192C("%s , pmppriv->network_macaddr =%x %x %x %x %x %x\n",__func__, pmppriv->network_macaddr[0],pmppriv->network_macaddr[1],pmppriv->network_macaddr[2],pmppriv->network_macaddr[3],pmppriv->network_macaddr[4],pmppriv->network_macaddr[5]); rtw_hal_set_hwreg(padapter, HW_VAR_BSSID, pmppriv->network_macaddr); } } - pmlmepriv->fw_state = WIFI_MP_STATE; + return res; } //This function initializes the DUT to the MP test mode @@ -1273,7 +1265,7 @@ static thread_return mp_xmit_packet_thread(thread_context context) goto exit; } else { - rtw_usleep_os(100); + rtw_usleep_os(10); continue; } } @@ -1362,7 +1354,7 @@ void fill_tx_desc_8188e(PADAPTER padapter) u32 pkt_size = pattrib->last_txcmdsz; s32 bmcast = IS_MCAST(pattrib->ra); // offset 0 -#if !defined(CONFIG_RTL8188E_SDIO) +#if !defined(CONFIG_RTL8188E_SDIO) && !defined(CONFIG_PCI_HCI) desc->txdw0 |= cpu_to_le32(OWN | FSG | LSG); desc->txdw0 |= cpu_to_le32(pkt_size & 0x0000FFFF); // packet size desc->txdw0 |= cpu_to_le32(((TXDESC_SIZE + OFFSET_SZ) << OFFSET_SHT) & 0x00FF0000); //32 bytes for TX Desc @@ -1473,8 +1465,15 @@ void fill_tx_desc_8192e(PADAPTER padapter) offset = TXDESC_SIZE + OFFSET_SZ; + SET_TX_DESC_OFFSET_92E(pDesc, offset); + + #if defined(CONFIG_PCI_HCI) //8192EE + SET_TX_DESC_OFFSET_92E(pDesc, offset+8); //work around + SET_TX_DESC_PKT_OFFSET_92E(pDesc, 0); /* 8192EE pkt_offset is 0 */ + #else //8192EU 8192ES SET_TX_DESC_OFFSET_92E(pDesc, offset); SET_TX_DESC_PKT_OFFSET_92E(pDesc, 1); + #endif if (bmcast) { SET_TX_DESC_BMC_92E(pDesc, 1); @@ -1551,9 +1550,9 @@ static void Rtw_MPSetMacTxEDCA(PADAPTER padapter) PHY_SetMacReg(padapter, 0x458 ,bMaskDWord , 0x0); //DBG_8192C("%s()!!!!! 0x460 = 0x%x\n" ,__func__,PHY_QueryBBReg(padapter, 0x460, bMaskDWord)); PHY_SetMacReg(padapter, 0x460 ,bMaskLWord , 0x0);//fast EDCA queue packet interval & time out vaule - PHY_SetMacReg(padapter, ODM_EDCA_VO_PARAM ,bMaskLWord , 0x431C); - PHY_SetMacReg(padapter, ODM_EDCA_BE_PARAM ,bMaskLWord , 0x431C); - PHY_SetMacReg(padapter, ODM_EDCA_BK_PARAM ,bMaskLWord , 0x431C); + //PHY_SetMacReg(padapter, ODM_EDCA_VO_PARAM ,bMaskLWord , 0x431C); + //PHY_SetMacReg(padapter, ODM_EDCA_BE_PARAM ,bMaskLWord , 0x431C); + //PHY_SetMacReg(padapter, ODM_EDCA_BK_PARAM ,bMaskLWord , 0x431C); DBG_8192C("%s()!!!!! 0x460 = 0x%x\n" ,__func__,PHY_QueryBBReg(padapter, 0x460, bMaskDWord)); } @@ -1670,16 +1669,18 @@ void SetPacketTx(PADAPTER padapter) if(pmp_priv->TXradomBuffer == NULL) { DBG_871X("mp create random buffer fail!\n"); + goto exit; } - else - { - for(i=0;i<4096;i++) - pmp_priv->TXradomBuffer[i] = rtw_random32() %0xFF; - } + + + for(i=0;i<4096;i++) + pmp_priv->TXradomBuffer[i] = rtw_random32() %0xFF; + //startPlace = (u32)(rtw_random32() % 3450); _rtw_memcpy(ptr, pmp_priv->TXradomBuffer,pkt_end - ptr); //_rtw_memset(ptr, payload, pkt_end - ptr); rtw_mfree(pmp_priv->TXradomBuffer,4096); + //3 6. start thread #ifdef PLATFORM_LINUX pmp_priv->tx.PktTxThread = kthread_run(mp_xmit_packet_thread, pmp_priv, "RTW_MP_THREAD"); @@ -1699,7 +1700,8 @@ void SetPacketTx(PADAPTER padapter) #endif Rtw_MPSetMacTxEDCA(padapter); - +exit: + return; } void SetPacketRx(PADAPTER pAdapter, u8 bStartRx) @@ -1886,7 +1888,7 @@ u32 mp_query_psd(PADAPTER pAdapter, u8 *data) } - +#if 0 void _rtw_mp_xmit_priv (struct xmit_priv *pxmitpriv) { int i,res; @@ -1953,7 +1955,7 @@ void _rtw_mp_xmit_priv (struct xmit_priv *pxmitpriv) pxmitbuf->padapter = padapter; pxmitbuf->buf_tag = XMITBUF_MGNT; - if((res=rtw_os_xmit_resource_alloc(padapter, pxmitbuf,max_xmit_extbuf_size + XMITBUF_ALIGN_SZ, _FALSE)) == _FAIL) { + if((res=rtw_os_xmit_resource_alloc(padapter, pxmitbuf,max_xmit_extbuf_size + XMITBUF_ALIGN_SZ, _TRUE)) == _FAIL) { res= _FAIL; goto exit; } @@ -1978,7 +1980,7 @@ void _rtw_mp_xmit_priv (struct xmit_priv *pxmitpriv) exit: ; } - +#endif ULONG getPowerDiffByRate8188E( @@ -2200,8 +2202,7 @@ mpt_ProQueryCalTxPower_8188E( CurrChannel = 1; } - if( pMptCtx->MptRateIndex >= MPT_RATE_1M && - pMptCtx->MptRateIndex <= MPT_RATE_11M ) + if(pMptCtx->MptRateIndex <= MPT_RATE_11M ) { TxPower = pHalData->Index24G_CCK_Base[rf_path][index]; } @@ -2245,8 +2246,7 @@ mpt_ProQueryCalTxPower_8188E( #endif // 2012/11/02 Awk: add power limit mechansim - if( pMptCtx->MptRateIndex >= MPT_RATE_1M && - pMptCtx->MptRateIndex <= MPT_RATE_11M ) + if( pMptCtx->MptRateIndex <= MPT_RATE_11M ) { rate = MGN_1M; } @@ -2277,72 +2277,141 @@ mpt_ProQueryCalTxPower_8188E( return TxPower; } -u8 MptToMgntRate(u32 MptRateIdx) + +u8 +MptToMgntRate( + IN ULONG MptRateIdx + ) { // Mapped to MGN_XXX defined in MgntGen.h switch (MptRateIdx) { /* CCK rate. */ - case MPT_RATE_1M: return 2; - case MPT_RATE_2M: return 4; - case MPT_RATE_55M: return 11; - case MPT_RATE_11M: return 22; - - /* OFDM rate. */ - case MPT_RATE_6M: return 12; - case MPT_RATE_9M: return 18; - case MPT_RATE_12M: return 24; - case MPT_RATE_18M: return 36; - case MPT_RATE_24M: return 48; - case MPT_RATE_36M: return 72; - case MPT_RATE_48M: return 96; - case MPT_RATE_54M: return 108; - - /* HT rate. */ - case MPT_RATE_MCS0: return 0x80; - case MPT_RATE_MCS1: return 0x81; - case MPT_RATE_MCS2: return 0x82; - case MPT_RATE_MCS3: return 0x83; - case MPT_RATE_MCS4: return 0x84; - case MPT_RATE_MCS5: return 0x85; - case MPT_RATE_MCS6: return 0x86; - case MPT_RATE_MCS7: return 0x87; - case MPT_RATE_MCS8: return 0x88; - case MPT_RATE_MCS9: return 0x89; - case MPT_RATE_MCS10: return 0x8A; - case MPT_RATE_MCS11: return 0x8B; - case MPT_RATE_MCS12: return 0x8C; - case MPT_RATE_MCS13: return 0x8D; - case MPT_RATE_MCS14: return 0x8E; - case MPT_RATE_MCS15: return 0x8F; - - /* VHT rate. */ - case MPT_RATE_VHT1SS_MCS0: return 0x90; - case MPT_RATE_VHT1SS_MCS1: return 0x91; - case MPT_RATE_VHT1SS_MCS2: return 0x92; - case MPT_RATE_VHT1SS_MCS3: return 0x93; - case MPT_RATE_VHT1SS_MCS4: return 0x94; - case MPT_RATE_VHT1SS_MCS5: return 0x95; - case MPT_RATE_VHT1SS_MCS6: return 0x96; - case MPT_RATE_VHT1SS_MCS7: return 0x97; - case MPT_RATE_VHT1SS_MCS8: return 0x98; - case MPT_RATE_VHT1SS_MCS9: return 0x99; - case MPT_RATE_VHT2SS_MCS0: return 0x9A; - case MPT_RATE_VHT2SS_MCS1: return 0x9B; - case MPT_RATE_VHT2SS_MCS2: return 0x9C; - case MPT_RATE_VHT2SS_MCS3: return 0x9D; - case MPT_RATE_VHT2SS_MCS4: return 0x9E; - case MPT_RATE_VHT2SS_MCS5: return 0x9F; - case MPT_RATE_VHT2SS_MCS6: return 0xA0; - case MPT_RATE_VHT2SS_MCS7: return 0xA1; - case MPT_RATE_VHT2SS_MCS8: return 0xA2; - case MPT_RATE_VHT2SS_MCS9: return 0xA3; + case MPT_RATE_1M: return MGN_1M; + case MPT_RATE_2M: return MGN_2M; + case MPT_RATE_55M: return MGN_5_5M; + case MPT_RATE_11M: return MGN_11M; + + /* OFDM rate. */ + case MPT_RATE_6M: return MGN_6M; + case MPT_RATE_9M: return MGN_9M; + case MPT_RATE_12M: return MGN_12M; + case MPT_RATE_18M: return MGN_18M; + case MPT_RATE_24M: return MGN_24M; + case MPT_RATE_36M: return MGN_36M; + case MPT_RATE_48M: return MGN_48M; + case MPT_RATE_54M: return MGN_54M; + + /* HT rate. */ + case MPT_RATE_MCS0: return MGN_MCS0; + case MPT_RATE_MCS1: return MGN_MCS1; + case MPT_RATE_MCS2: return MGN_MCS2; + case MPT_RATE_MCS3: return MGN_MCS3; + case MPT_RATE_MCS4: return MGN_MCS4; + case MPT_RATE_MCS5: return MGN_MCS5; + case MPT_RATE_MCS6: return MGN_MCS6; + case MPT_RATE_MCS7: return MGN_MCS7; + case MPT_RATE_MCS8: return MGN_MCS8; + case MPT_RATE_MCS9: return MGN_MCS9; + case MPT_RATE_MCS10: return MGN_MCS10; + case MPT_RATE_MCS11: return MGN_MCS11; + case MPT_RATE_MCS12: return MGN_MCS12; + case MPT_RATE_MCS13: return MGN_MCS13; + case MPT_RATE_MCS14: return MGN_MCS14; + case MPT_RATE_MCS15: return MGN_MCS15; + case MPT_RATE_MCS16: return MGN_MCS16; + case MPT_RATE_MCS17: return MGN_MCS17; + case MPT_RATE_MCS18: return MGN_MCS18; + case MPT_RATE_MCS19: return MGN_MCS19; + case MPT_RATE_MCS20: return MGN_MCS20; + case MPT_RATE_MCS21: return MGN_MCS21; + case MPT_RATE_MCS22: return MGN_MCS22; + case MPT_RATE_MCS23: return MGN_MCS23; + case MPT_RATE_MCS24: return MGN_MCS24; + case MPT_RATE_MCS25: return MGN_MCS25; + case MPT_RATE_MCS26: return MGN_MCS26; + case MPT_RATE_MCS27: return MGN_MCS27; + case MPT_RATE_MCS28: return MGN_MCS28; + case MPT_RATE_MCS29: return MGN_MCS29; + case MPT_RATE_MCS30: return MGN_MCS30; + case MPT_RATE_MCS31: return MGN_MCS31; + + /* VHT rate. */ + case MPT_RATE_VHT1SS_MCS0: return MGN_VHT1SS_MCS0; + case MPT_RATE_VHT1SS_MCS1: return MGN_VHT1SS_MCS1; + case MPT_RATE_VHT1SS_MCS2: return MGN_VHT1SS_MCS2; + case MPT_RATE_VHT1SS_MCS3: return MGN_VHT1SS_MCS3; + case MPT_RATE_VHT1SS_MCS4: return MGN_VHT1SS_MCS4; + case MPT_RATE_VHT1SS_MCS5: return MGN_VHT1SS_MCS5; + case MPT_RATE_VHT1SS_MCS6: return MGN_VHT1SS_MCS6; + case MPT_RATE_VHT1SS_MCS7: return MGN_VHT1SS_MCS7; + case MPT_RATE_VHT1SS_MCS8: return MGN_VHT1SS_MCS8; + case MPT_RATE_VHT1SS_MCS9: return MGN_VHT1SS_MCS9; + case MPT_RATE_VHT2SS_MCS0: return MGN_VHT2SS_MCS0; + case MPT_RATE_VHT2SS_MCS1: return MGN_VHT2SS_MCS1; + case MPT_RATE_VHT2SS_MCS2: return MGN_VHT2SS_MCS2; + case MPT_RATE_VHT2SS_MCS3: return MGN_VHT2SS_MCS3; + case MPT_RATE_VHT2SS_MCS4: return MGN_VHT2SS_MCS4; + case MPT_RATE_VHT2SS_MCS5: return MGN_VHT2SS_MCS5; + case MPT_RATE_VHT2SS_MCS6: return MGN_VHT2SS_MCS6; + case MPT_RATE_VHT2SS_MCS7: return MGN_VHT2SS_MCS7; + case MPT_RATE_VHT2SS_MCS8: return MGN_VHT2SS_MCS8; + case MPT_RATE_VHT2SS_MCS9: return MGN_VHT2SS_MCS9; + case MPT_RATE_VHT3SS_MCS0: return MGN_VHT3SS_MCS0; + case MPT_RATE_VHT3SS_MCS1: return MGN_VHT3SS_MCS1; + case MPT_RATE_VHT3SS_MCS2: return MGN_VHT3SS_MCS2; + case MPT_RATE_VHT3SS_MCS3: return MGN_VHT3SS_MCS3; + case MPT_RATE_VHT3SS_MCS4: return MGN_VHT3SS_MCS4; + case MPT_RATE_VHT3SS_MCS5: return MGN_VHT3SS_MCS5; + case MPT_RATE_VHT3SS_MCS6: return MGN_VHT3SS_MCS6; + case MPT_RATE_VHT3SS_MCS7: return MGN_VHT3SS_MCS7; + case MPT_RATE_VHT3SS_MCS8: return MGN_VHT3SS_MCS8; + case MPT_RATE_VHT3SS_MCS9: return MGN_VHT3SS_MCS9; + case MPT_RATE_VHT4SS_MCS0: return MGN_VHT4SS_MCS0; + case MPT_RATE_VHT4SS_MCS1: return MGN_VHT4SS_MCS1; + case MPT_RATE_VHT4SS_MCS2: return MGN_VHT4SS_MCS2; + case MPT_RATE_VHT4SS_MCS3: return MGN_VHT4SS_MCS3; + case MPT_RATE_VHT4SS_MCS4: return MGN_VHT4SS_MCS4; + case MPT_RATE_VHT4SS_MCS5: return MGN_VHT4SS_MCS5; + case MPT_RATE_VHT4SS_MCS6: return MGN_VHT4SS_MCS6; + case MPT_RATE_VHT4SS_MCS7: return MGN_VHT4SS_MCS7; + case MPT_RATE_VHT4SS_MCS8: return MGN_VHT4SS_MCS8; + case MPT_RATE_VHT4SS_MCS9: return MGN_VHT4SS_MCS9; - case MPT_RATE_LAST:// fully automatic - default: - DBG_8192C("<===MptToMgntRate(), Invalid Rate: %d!!\n", MptRateIdx); - return 0x0; + case MPT_RATE_LAST: // fully automatiMGN_VHT2SS_MCS1; + default: + DBG_871X("<===MptToMgntRate(), Invalid Rate: %d!!\n", MptRateIdx); + return 0x0; + } +} + +u8 rtw_mpRateParseFunc(PADAPTER pAdapter, u8 *targetStr) +{ + u16 i=0; + u8* rateindex_Array[] = { "1M","2M","5.5M","11M","6M","9M","12M","18M","24M","36M","48M","54M", + "HTMCS0","HTMCS1","HTMCS2","HTMCS3","HTMCS4","HTMCS5","HTMCS6","HTMCS7", + "HTMCS8","HTMCS9","HTMCS10","HTMCS11","HTMCS12","HTMCS13","HTMCS14","HTMCS15", + "HTMCS16","HTMCS17","HTMCS18","HTMCS19","HTMCS20","HTMCS21","HTMCS22","HTMCS23", + "HTMCS24","HTMCS25","HTMCS26","HTMCS27","HTMCS28","HTMCS29","HTMCS30","HTMCS31", + "VHT1MCS0","VHT1MCS1","VHT1MCS2","VHT1MCS3","VHT1MCS4","VHT1MCS5","VHT1MCS6","VHT1MCS7","VHT1MCS8","VHT1MCS9", + "VHT2MCS0","VHT2MCS1","VHT2MCS2","VHT2MCS3","VHT2MCS4","VHT2MCS5","VHT2MCS6","VHT2MCS7","VHT2MCS8","VHT2MCS9", + "VHT3MCS0","VHT3MCS1","VHT3MCS2","VHT3MCS3","VHT3MCS4","VHT3MCS5","VHT3MCS6","VHT3MCS7","VHT3MCS8","VHT3MCS9", + "VHT4MCS0","VHT4MCS1","VHT4MCS2","VHT4MCS3","VHT4MCS4","VHT4MCS5","VHT4MCS6","VHT4MCS7","VHT4MCS8","VHT4MCS9"}; + + for(i=0;i<=83;i++){ + if(strcmp(targetStr, rateindex_Array[i]) == 0){ + DBG_871X("%s , index = %d \n",__func__ ,i); + return i; + } } + + printk("%s ,please input a Data RATE String as:",__func__); + for(i=0;i<=83;i++){ + printk("%s ",rateindex_Array[i]); + if(i%10==0) + printk("\n"); + } + return _FAIL; } ULONG mpt_ProQueryCalTxPower( @@ -2447,8 +2516,5 @@ void Hal_ProSetCrystalCap (PADAPTER pAdapter , u32 CrystalCap) PHY_SetBBReg(pAdapter, REG_MAC_PHY_CTRL, 0xFFF000, (CrystalCap | (CrystalCap << 6))); } } - - - #endif diff --git a/core/rtw_mp_ioctl.c b/core/rtw_mp_ioctl.c index b2c5a28..32b7c73 100644 --- a/core/rtw_mp_ioctl.c +++ b/core/rtw_mp_ioctl.c @@ -1990,9 +1990,9 @@ NDIS_STATUS oid_rt_pro_dele_sta_info_hdl(struct oid_par_priv *poid_par_priv) psta = rtw_get_stainfo(&Adapter->stapriv, macaddr); if (psta != NULL) { - _enter_critical(&(Adapter->stapriv.sta_hash_lock), &irqL); + //_enter_critical(&(Adapter->stapriv.sta_hash_lock), &irqL); rtw_free_stainfo(Adapter, psta); - _exit_critical(&(Adapter->stapriv.sta_hash_lock), &irqL); + //_exit_critical(&(Adapter->stapriv.sta_hash_lock), &irqL); } return status; diff --git a/core/rtw_odm.c b/core/rtw_odm.c index 75beea8..05063bf 100644 --- a/core/rtw_odm.c +++ b/core/rtw_odm.c @@ -37,13 +37,13 @@ const char *odm_comp_str[] = { /* BIT12 */"ODM_COMP_DYNAMIC_PRICCA", /* BIT13 */"ODM_COMP_RXHP", /* BIT14 */"ODM_COMP_MP", - /* BIT15 */"ODM_COMP_DYNAMIC_ATC", - /* BIT16 */"ODM_COMP_EDCA_TURBO", - /* BIT17 */"ODM_COMP_EARLY_MODE", + /* BIT15 */"ODM_COMP_CFO_TRACKING", + /* BIT16 */"ODM_COMP_ACS", + /* BIT17 */"PHYDM_COMP_ADAPTIVITY", /* BIT18 */NULL, /* BIT19 */NULL, - /* BIT20 */NULL, - /* BIT21 */NULL, + /* BIT20 */"ODM_COMP_EDCA_TURBO", + /* BIT21 */"ODM_COMP_EARLY_MODE", /* BIT22 */NULL, /* BIT23 */NULL, /* BIT24 */"ODM_COMP_TX_PWR_TRACK", @@ -73,14 +73,14 @@ const char *odm_ability_str[] = { /* BIT11 */"ODM_BB_PSD", /* BIT12 */"ODM_BB_RXHP", /* BIT13 */"ODM_BB_ADAPTIVITY", - /* BIT14 */"ODM_BB_DYNAMIC_ATC", - /* BIT15 */NULL, - /* BIT16 */"ODM_MAC_EDCA_TURBO", - /* BIT17 */"ODM_MAC_EARLY_MODE", + /* BIT14 */"ODM_BB_CFO_TRACKING", + /* BIT15 */"ODM_BB_NHM_CNT", + /* BIT16 */"ODM_BB_PRIMARY_CCA", + /* BIT17 */NULL, /* BIT18 */NULL, /* BIT19 */NULL, - /* BIT20 */NULL, - /* BIT21 */NULL, + /* BIT20 */"ODM_MAC_EDCA_TURBO", + /* BIT21 */"ODM_MAC_EARLY_MODE", /* BIT22 */NULL, /* BIT23 */NULL, /* BIT24 */"ODM_RF_TX_PWR_TRACK", @@ -132,7 +132,7 @@ void rtw_odm_dbg_level_msg(void *sel, _adapter *adapter) int i; rtw_hal_get_def_var(adapter, HW_DEF_ODM_DBG_LEVEL, &dbg_level); - DBG_871X_SEL_NL(sel, "odm.DebugDebugLevel = %u\n", dbg_level); + DBG_871X_SEL_NL(sel, "odm.DebugLevel = %u\n", dbg_level); for (i=0;iregistrypriv; + struct mlme_priv *mlme = &adapter->mlmepriv; + HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter); + DM_ODM_T *odm = &hal_data->odmpriv; + + DBG_871X_SEL_NL(sel, "RTW_ADAPTIVITY_EN_"); + + if (regsty->adaptivity_en == RTW_ADAPTIVITY_EN_DISABLE) { + DBG_871X_SEL(sel, "DISABLE\n"); + } else if (regsty->adaptivity_en == RTW_ADAPTIVITY_EN_ENABLE) { + DBG_871X_SEL(sel, "ENABLE\n"); + } else if (regsty->adaptivity_en == RTW_ADAPTIVITY_EN_AUTO) { + DBG_871X_SEL(sel, "AUTO, chplan:0x%02x, Regulation:%u,%u\n" + , mlme->ChannelPlan, odm->odm_Regulation2_4G, odm->odm_Regulation5G); + } else { + DBG_871X_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; + + DBG_871X_SEL_NL(sel, "RTW_ADAPTIVITY_MODE_"); + + if (regsty->adaptivity_mode == RTW_ADAPTIVITY_MODE_NORMAL) { + DBG_871X_SEL(sel, "NORMAL\n"); + } else if (regsty->adaptivity_mode == RTW_ADAPTIVITY_MODE_CARRIER_SENSE) { + DBG_871X_SEL(sel, "CARRIER_SENSE\n"); + } else { + DBG_871X_SEL(sel, "INVALID\n"); + } +} + +#define RTW_NHM_EN_DISABLE 0 +#define RTW_NHM_EN_ENABLE 1 + +void rtw_odm_nhm_en_msg(void *sel, _adapter *adapter) +{ + struct registry_priv *regsty = &adapter->registrypriv; + + DBG_871X_SEL_NL(sel, "RTW_NHM_EN_"); + + if (regsty->nhm_en == RTW_NHM_EN_DISABLE) { + DBG_871X_SEL(sel, "DISABLE\n"); + } else if (regsty->nhm_en == RTW_NHM_EN_ENABLE) { + DBG_871X_SEL(sel, "ENABLE\n"); + } else { + DBG_871X_SEL(sel, "INVALID\n"); + } +} + +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 + || regsty->adaptivity_en == RTW_ADAPTIVITY_EN_AUTO) + ret = _TRUE; + + if (ret == _TRUE) { + rtw_odm_adaptivity_ver_msg(RTW_DBGDUMP, adapter); + rtw_odm_adaptivity_en_msg(RTW_DBGDUMP, adapter); + rtw_odm_adaptivity_mode_msg(RTW_DBGDUMP, adapter); + rtw_odm_nhm_en_msg(RTW_DBGDUMP, adapter); + } + + 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; + rtw_odm_adaptivity_ver_msg(sel, adapter); + rtw_odm_adaptivity_en_msg(sel, adapter); + rtw_odm_adaptivity_mode_msg(sel, adapter); + rtw_odm_nhm_en_msg(sel, adapter); + DBG_871X_SEL_NL(sel, "%10s %16s %8s %10s %11s %14s\n" , "TH_L2H_ini", "TH_EDCCA_HL_diff", "IGI_Base", "ForceEDCCA", "AdapEn_RSSI", "IGI_LowerBound"); DBG_871X_SEL_NL(sel, "0x%-8x %-16d 0x%-6x %-10d %-11u %-14u\n" @@ -181,6 +272,14 @@ void rtw_odm_adaptivity_parm_msg(void *sel, _adapter *adapter) , odm->AdapEn_RSSI , odm->IGI_LowerBound ); + + DBG_871X_SEL_NL(sel, "%8s %9s\n", "EDCCA_ES","Adap_Flag"); + DBG_871X_SEL_NL(sel, "%-8x %-9x \n" + , odm->EDCCA_enable_state + , odm->adaptivity_flag + ); + + } void rtw_odm_adaptivity_parm_set(_adapter *adapter, s8 TH_L2H_ini, s8 TH_EDCCA_HL_diff, @@ -204,4 +303,36 @@ void rtw_odm_get_perpkt_rssi(void *sel, _adapter *adapter) DBG_871X_SEL_NL(sel,"RxRate = %s, RSSI_A = %d(%%), RSSI_B = %d(%%)\n", HDATA_RATE(odm->RxRate), odm->RSSI_A, odm->RSSI_B); -} \ No newline at end of file +} + + +void rtw_odm_acquirespinlock(_adapter *adapter, RT_SPINLOCK_TYPE type) +{ + PHAL_DATA_TYPE pHalData = GET_HAL_DATA(adapter); + struct dm_priv *pdmpriv = &pHalData->dmpriv; + _irqL irqL; + + switch(type) + { + case RT_IQK_SPINLOCK: + _enter_critical_bh(&pdmpriv->IQKSpinLock, &irqL); + default: + break; + } +} + +void rtw_odm_releasespinlock(_adapter *adapter, RT_SPINLOCK_TYPE type) +{ + PHAL_DATA_TYPE pHalData = GET_HAL_DATA(adapter); + struct dm_priv *pdmpriv = &pHalData->dmpriv; + _irqL irqL; + + switch(type) + { + case RT_IQK_SPINLOCK: + _exit_critical_bh(&pdmpriv->IQKSpinLock, &irqL); + default: + break; + } +} + diff --git a/core/rtw_p2p.c b/core/rtw_p2p.c index f1bed6f..5f2f99c 100644 --- a/core/rtw_p2p.c +++ b/core/rtw_p2p.c @@ -58,6 +58,11 @@ static u32 go_add_group_info_attr(struct wifidirect_info *pwdinfo, u8 *pbuf) pdata_attr = rtw_zmalloc(MAX_P2P_IE_LEN); + if(NULL == pdata_attr){ + DBG_871X("%s pdata_attr malloc failed \n", __FUNCTION__); + goto _exit; + } + pstart = pdata_attr; pcur = pdata_attr; @@ -139,7 +144,8 @@ static u32 go_add_group_info_attr(struct wifidirect_info *pwdinfo, u8 *pbuf) } rtw_mfree(pdata_attr, MAX_P2P_IE_LEN); - + +_exit: return len; } @@ -3455,6 +3461,8 @@ _func_exit_; void p2p_concurrent_handler( _adapter* padapter ) { struct wifidirect_info *pwdinfo = &padapter->wdinfo; + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); //_adapter *pbuddy_adapter = padapter->pbuddy_adapter; //struct wifidirect_info *pbuddy_wdinfo = &pbuddy_adapter->wdinfo; //struct mlme_priv *pbuddy_mlmepriv = &pbuddy_adapter->mlmepriv; @@ -3495,9 +3503,12 @@ _func_enter_; } rtw_p2p_set_state(pwdinfo, P2P_STATE_LISTEN); - val8 = 1; - rtw_hal_set_hwreg(padapter, HW_VAR_MLME_SITESURVEY, (u8 *)(&val8)); - + if(!check_buddy_mlmeinfo_state(padapter, WIFI_FW_AP_STATE) && + !(pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE) + { + val8 = 1; + rtw_hal_set_hwreg(padapter, HW_VAR_MLME_SITESURVEY, (u8 *)(&val8)); + } // Todo: To check the value of pwdinfo->ext_listen_period is equal to 0 or not. _set_timer( &pwdinfo->ap_p2p_switch_timer, pwdinfo->ext_listen_period ); } @@ -3517,8 +3528,11 @@ _func_enter_; if ( pbuddy_mlmeext->cur_channel != pwdinfo->listen_channel ) { set_channel_bwmode(padapter, pbuddy_mlmeext->cur_channel, pbuddy_mlmeext->cur_ch_offset, pbuddy_mlmeext->cur_bwmode); - val8 = 0; - padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_MLME_SITESURVEY, (u8 *)(&val8)); + if(!check_buddy_mlmeinfo_state(padapter, WIFI_FW_AP_STATE) &&!(pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE) + { + val8 = 0; + padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_MLME_SITESURVEY, (u8 *)(&val8)); + } rtw_p2p_set_state(pwdinfo, P2P_STATE_IDLE); issue_nulldata(pbuddy_adapter, NULL, 0, 3, 500); } @@ -3612,6 +3626,9 @@ _func_enter_; pcfg80211_wdinfo->is_ro_ch = _FALSE; pcfg80211_wdinfo->last_ro_ch_time = rtw_get_current_time(); + if (pcfg80211_wdinfo->not_indic_ro_ch_exp == _TRUE) + return; + DBG_871X("cfg80211_remain_on_channel_expired, ch=%d, bw=%d, offset=%d\n", rtw_get_oper_ch(padapter), rtw_get_oper_bw(padapter), rtw_get_oper_choffset(padapter)); @@ -5277,10 +5294,6 @@ int rtw_p2p_enable(_adapter *padapter, enum P2P_ROLE role) adapter_wdev_data(padapter)->p2p_enabled = _FALSE; #endif //CONFIG_IOCTL_CFG80211 - if (_FAIL == rtw_pwr_wakeup(padapter)) { - ret = _FAIL; - goto exit; - } //Disable P2P function if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) @@ -5299,6 +5312,10 @@ int rtw_p2p_enable(_adapter *padapter, enum P2P_ROLE role) rtw_p2p_set_pre_state(pwdinfo, P2P_STATE_NONE); rtw_p2p_set_role(pwdinfo, P2P_ROLE_DISABLE); _rtw_memset(&pwdinfo->rx_prov_disc_info, 0x00, sizeof(struct rx_provdisc_req_info)); + + /* Remove profiles in wifidirect_info structure. */ + _rtw_memset( &pwdinfo->profileinfo[ 0 ], 0x00, sizeof( struct profile_info ) * P2P_MAX_PERSISTENT_GROUP_NUM ); + pwdinfo->profileindex = 0; } rtw_hal_set_odm_var(padapter,HAL_ODM_P2P_STATE,NULL,_FALSE); @@ -5306,6 +5323,11 @@ int rtw_p2p_enable(_adapter *padapter, enum P2P_ROLE role) rtw_hal_set_odm_var(padapter,HAL_ODM_WIFI_DISPLAY_STATE,NULL,_FALSE); #endif + if (_FAIL == rtw_pwr_wakeup(padapter)) { + ret = _FAIL; + goto exit; + } + //Restore to initial setting. update_tx_basic_rate(padapter, padapter->registrypriv.wireless_mode); diff --git a/core/rtw_pwrctrl.c b/core/rtw_pwrctrl.c index b2c24fa..8037d49 100644 --- a/core/rtw_pwrctrl.c +++ b/core/rtw_pwrctrl.c @@ -20,6 +20,7 @@ #define _RTW_PWRCTRL_C_ #include +#include int rtw_fw_ps_state(PADAPTER padapter) @@ -159,6 +160,9 @@ int ips_leave(_adapter * padapter) #endif //DBG_CHECK_FW_PS_STATE _exit_pwrlock(&pwrpriv->lock); + if (_SUCCESS == ret) + ODM_DMReset(&GET_HAL_DATA(padapter)->odmpriv); + #ifdef CONFIG_BT_COEXIST if (_SUCCESS == ret) rtw_btcoex_IpsNotify(padapter, IPS_NONE); @@ -604,7 +608,7 @@ _func_enter_; // polling cpwm do { - rtw_mdelay_os(1); + rtw_msleep_os(1); poll_cnt++; rtw_hal_get_hwreg(padapter, HW_VAR_CPWM, &cpwm_now); if ((cpwm_orig ^ cpwm_now) & 0x80) @@ -1116,7 +1120,7 @@ _func_enter_; ) { //connect - if(pwrpriv->power_mgnt == PS_MODE_ACTIVE) { + if(pwrpriv->pwr_mode == PS_MODE_ACTIVE) { DBG_871X("%s: Driver Already Leave LPS\n",__FUNCTION__); return; } @@ -1201,7 +1205,7 @@ _func_enter_; else #endif { -#if defined(CONFIG_FWLPS_IN_IPS) || defined(CONFIG_SWLPS_IN_IPS) || (defined(CONFIG_PLATFORM_SPRD) && defined(CONFIG_RTL8188E)) +#if defined(CONFIG_FWLPS_IN_IPS) || defined(CONFIG_SWLPS_IN_IPS) || defined(CONFIG_RTL8188E) #ifdef CONFIG_IPS if(_FALSE == ips_leave(pri_padapter)) { @@ -1209,8 +1213,8 @@ _func_enter_; } #endif #endif //CONFIG_SWLPS_IN_IPS || (CONFIG_PLATFORM_SPRD && CONFIG_RTL8188E) - } - } + } + } } _func_exit_; @@ -2146,6 +2150,9 @@ _func_enter_; rtw_init_timer(&pwrctrlpriv->pwr_state_check_timer, padapter, pwr_state_check_handler); + pwrctrlpriv->wowlan_mode = _FALSE; + pwrctrlpriv->wowlan_ap_mode = _FALSE; + #ifdef CONFIG_RESUME_IN_WORKQUEUE _init_workitem(&pwrctrlpriv->resume_work, resume_workitem_callback, NULL); pwrctrlpriv->rtw_workqueue = create_singlethread_workqueue("rtw_workqueue"); @@ -2157,9 +2164,11 @@ _func_enter_; #endif //CONFIG_HAS_EARLYSUSPEND || CONFIG_ANDROID_POWER #ifdef CONFIG_PNO_SUPPORT + pwrctrlpriv->pno_inited = _FALSE; pwrctrlpriv->pnlo_info = NULL; pwrctrlpriv->pscan_info = NULL; pwrctrlpriv->pno_ssid_list = NULL; + pwrctrlpriv->pno_in_resume = _TRUE; #endif _func_exit_; @@ -2221,12 +2230,16 @@ static void resume_workitem_callback(struct work_struct *work) DBG_871X("%s\n",__FUNCTION__); rtw_resume_process(adapter); + + rtw_resume_unlock_suspend(); } void rtw_resume_in_workqueue(struct pwrctrl_priv *pwrpriv) { // accquire system's suspend lock preventing from falliing asleep while resume in workqueue - rtw_lock_suspend(); + //rtw_lock_suspend(); + + rtw_resume_lock_suspend(); #if 1 queue_work(pwrpriv->rtw_workqueue, &pwrpriv->resume_work); diff --git a/core/rtw_recv.c b/core/rtw_recv.c index 186a50e..7857afb 100644 --- a/core/rtw_recv.c +++ b/core/rtw_recv.c @@ -606,8 +606,11 @@ union recv_frame * decryptor(_adapter *padapter,union recv_frame *precv_frame) struct security_priv *psecuritypriv=&padapter->securitypriv; union recv_frame *return_packet=precv_frame; u32 res=_SUCCESS; + _func_enter_; + DBG_COUNTER(padapter->rx_logs.core_rx_post_decrypt); + RT_TRACE(_module_rtl871x_recv_c_,_drv_info_,("prxstat->decrypted=%x prxattrib->encrypt = 0x%03x\n",prxattrib->bdecrypted,prxattrib->encrypt)); if(prxattrib->encrypt>0) @@ -653,16 +656,20 @@ _func_enter_; switch(prxattrib->encrypt){ case _WEP40_: case _WEP104_: + DBG_COUNTER(padapter->rx_logs.core_rx_post_decrypt_wep); rtw_wep_decrypt(padapter, (u8 *)precv_frame); break; case _TKIP_: + DBG_COUNTER(padapter->rx_logs.core_rx_post_decrypt_tkip); res = rtw_tkip_decrypt(padapter, (u8 *)precv_frame); break; case _AES_: + DBG_COUNTER(padapter->rx_logs.core_rx_post_decrypt_aes); res = rtw_aes_decrypt(padapter, (u8 * )precv_frame); break; #ifdef CONFIG_WAPI_SUPPORT case _SMS4_: + DBG_COUNTER(padapter->rx_logs.core_rx_post_decrypt_wapi); rtw_sms4_decrypt(padapter, (u8 * )precv_frame); break; #endif @@ -690,6 +697,8 @@ _func_enter_; else #endif { + DBG_COUNTER(padapter->rx_logs.core_rx_post_decrypt_hw); + psecuritypriv->hw_decrypted=_TRUE; #ifdef DBG_RX_DECRYPTOR DBG_871X("[%s] %d:prxstat->bdecrypted:%d, prxattrib->encrypt:%d, Setting psecuritypriv->hw_decrypted = %d\n", @@ -700,10 +709,10 @@ _func_enter_; psecuritypriv->hw_decrypted); #endif - } } else { + DBG_COUNTER(padapter->rx_logs.core_rx_post_decrypt_unknown); #ifdef DBG_RX_DECRYPTOR DBG_871X("[%s] %d:prxstat->bdecrypted:%d, prxattrib->encrypt:%d, Setting psecuritypriv->hw_decrypted = %d\n", __FUNCTION__, @@ -1488,9 +1497,20 @@ _func_enter_; *psta = rtw_get_stainfo(pstapriv, pattrib->bssid); // get sta_info if (*psta == NULL) { - DBG_871X("issue_deauth to the ap=" MAC_FMT " for the reason(7)\n", MAC_ARG(pattrib->bssid)); - issue_deauth(adapter, pattrib->bssid, WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA); + //for AP multicast issue , modify by yiwei + static u32 send_issue_deauth_time=0; + + //DBG_871X("After send deauth , %u ms has elapsed.\n", rtw_get_passing_time_ms(send_issue_deauth_time)); + + if(rtw_get_passing_time_ms(send_issue_deauth_time) > 10000 || send_issue_deauth_time == 0 ) + { + send_issue_deauth_time = rtw_get_current_time(); + + DBG_871X("issue_deauth to the ap=" MAC_FMT " for the reason(7)\n", MAC_ARG(pattrib->bssid)); + + issue_deauth(adapter, pattrib->bssid, WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA); + } } } @@ -1560,6 +1580,32 @@ _func_enter_; goto exit; } } + else if ((check_fwstate(pmlmepriv, WIFI_MP_STATE) == _TRUE) && + (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) ) + { + DBG_871X("%s ,in WIFI_MP_STATE \n",__func__); + + _rtw_memcpy(pattrib->dst, GetAddr1Ptr(ptr), ETH_ALEN); + _rtw_memcpy(pattrib->src, GetAddr2Ptr(ptr), ETH_ALEN); + _rtw_memcpy(pattrib->bssid, GetAddr3Ptr(ptr), ETH_ALEN); + _rtw_memcpy(pattrib->ra, pattrib->dst, ETH_ALEN); + _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN); + + // + _rtw_memcpy(pattrib->bssid, mybssid, ETH_ALEN); + + + *psta = rtw_get_stainfo(pstapriv, pattrib->bssid); // get sta_info + if (*psta == NULL) { + RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,("can't get psta under MP_MODE ; drop pkt\n")); + #ifdef DBG_RX_DROP_FRAME + DBG_871X("DBG_RX_DROP_FRAME %s can't get psta under WIFI_MP_STATE ; drop pkt\n", __FUNCTION__); + #endif + ret= _FAIL; + goto exit; + } + + } else { u8 *myhwaddr = myid(&adapter->eeprompriv); if (!_rtw_memcmp(pattrib->ra, myhwaddr, ETH_ALEN)) { @@ -2066,7 +2112,7 @@ static sint validate_80211w_mgmt(_adapter *adapter, union recv_frame *precv_fram DBG_871X("%s mgmt allocate fail !!!!!!!!!\n", __FUNCTION__); goto validate_80211w_fail; } - /*//dump the packet content before decrypt + /* //dump the packet content before decrypt { int pp; printk("pattrib->pktlen = %d =>", pattrib->pkt_len); @@ -2083,7 +2129,7 @@ static sint validate_80211w_mgmt(_adapter *adapter, union recv_frame *precv_fram //remove the iv and icv length pattrib->pkt_len = pattrib->pkt_len - pattrib->iv_len - pattrib->icv_len; rtw_mfree(mgmt_DATA, data_len); - /*//print packet content after decryption + /* //print packet content after decryption { int pp; printk("after decryption pattrib->pktlen = %d @@=>", pattrib->pkt_len); @@ -2110,9 +2156,9 @@ static sint validate_80211w_mgmt(_adapter *adapter, union recv_frame *precv_fram } else if(BIP_ret == RTW_RX_HANDLED) { - //DBG_871X("802.11w recv none protected packet\n"); - //issue sa query request - issue_action_SA_Query(adapter, NULL, 0, 0); + DBG_871X("802.11w recv none protected packet\n"); + //drop pkt, don't issue sa query request + //issue_action_SA_Query(adapter, NULL, 0, 0); goto validate_80211w_fail; } }//802.11w protect @@ -2133,9 +2179,14 @@ static sint validate_80211w_mgmt(_adapter *adapter, union recv_frame *precv_fram } else if(subtype == WIFI_DEAUTH || subtype == WIFI_DISASSOC) { - DBG_871X("802.11w recv none protected packet\n"); - //issue sa query request - issue_action_SA_Query(adapter, NULL, 0, 0); + unsigned short reason; + reason = le16_to_cpu(*(unsigned short *)(ptr + WLAN_HDR_A3_LEN)); + DBG_871X("802.11w recv none protected packet, reason=%d\n", reason); + if(reason == 6 || reason == 7) + { + //issue sa query request + issue_action_SA_Query(adapter, NULL, 0, 0); + } goto validate_80211w_fail; } } @@ -2148,6 +2199,17 @@ validate_80211w_fail: } #endif //CONFIG_IEEE80211W +static inline void dump_rx_packet(u8 *ptr) +{ + int i; + + DBG_871X("############################# \n"); + for(i=0; i<64;i=i+8) + DBG_871X("%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:\n", *(ptr+i), + *(ptr+i+1), *(ptr+i+2) ,*(ptr+i+3) ,*(ptr+i+4),*(ptr+i+5), *(ptr+i+6), *(ptr+i+7)); + DBG_871X("############################# \n"); +} + sint validate_recv_frame(_adapter *adapter, union recv_frame *precv_frame); sint validate_recv_frame(_adapter *adapter, union recv_frame *precv_frame) { @@ -2180,7 +2242,6 @@ sint validate_recv_frame(_adapter *adapter, union recv_frame *precv_frame) _func_enter_; - #ifdef CONFIG_FIND_BEST_CHANNEL if (pmlmeext->sitesurvey_res.state == SCAN_PROCESS) { int ch_set_idx = rtw_ch_set_search_ch(pmlmeext->channel_set, rtw_get_oper_ch(adapter)); @@ -2214,6 +2275,7 @@ _func_enter_; if(ver!=0){ RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,("validate_recv_data_frame fail! (ver!=0)\n")); retval= _FAIL; + DBG_COUNTER(adapter->rx_logs.core_rx_pre_ver_err); goto exit; } @@ -2238,46 +2300,23 @@ _func_enter_; { u8 bDumpRxPkt; rtw_hal_get_def_var(adapter, HAL_DEF_DBG_DUMP_RXPKT, &(bDumpRxPkt)); - if(bDumpRxPkt ==1){//dump all rx packets - int i; - DBG_871X("############################# \n"); - - for(i=0; i<64;i=i+8) - DBG_871X("%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:\n", *(ptr+i), - *(ptr+i+1), *(ptr+i+2) ,*(ptr+i+3) ,*(ptr+i+4),*(ptr+i+5), *(ptr+i+6), *(ptr+i+7)); - DBG_871X("############################# \n"); - } - else if(bDumpRxPkt ==2){ - if(type== WIFI_MGT_TYPE){ - int i; - DBG_871X("############################# \n"); - - for(i=0; i<64;i=i+8) - DBG_871X("%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:\n", *(ptr+i), - *(ptr+i+1), *(ptr+i+2) ,*(ptr+i+3) ,*(ptr+i+4),*(ptr+i+5), *(ptr+i+6), *(ptr+i+7)); - DBG_871X("############################# \n"); - } - } - else if(bDumpRxPkt ==3){ - if(type== WIFI_DATA_TYPE){ - int i; - DBG_871X("############################# \n"); - - for(i=0; i<64;i=i+8) - DBG_871X("%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:\n", *(ptr+i), - *(ptr+i+1), *(ptr+i+2) ,*(ptr+i+3) ,*(ptr+i+4),*(ptr+i+5), *(ptr+i+6), *(ptr+i+7)); - DBG_871X("############################# \n"); - } - } + if (bDumpRxPkt == 1) //dump all rx packets + dump_rx_packet(ptr); + else if ((bDumpRxPkt == 2) && (type == WIFI_MGT_TYPE)) + dump_rx_packet(ptr); + else if ((bDumpRxPkt == 3) && (type == WIFI_DATA_TYPE)) + dump_rx_packet(ptr); } #endif switch (type) { case WIFI_MGT_TYPE: //mgnt + DBG_COUNTER(adapter->rx_logs.core_rx_pre_mgmt); #ifdef CONFIG_IEEE80211W if(validate_80211w_mgmt(adapter, precv_frame) == _FAIL) { retval = _FAIL; + DBG_COUNTER(padapter->rx_logs.core_rx_pre_mgmt_err_80211w); break; } #endif //CONFIG_IEEE80211W @@ -2286,18 +2325,22 @@ _func_enter_; if (retval == _FAIL) { RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,("validate_recv_mgnt_frame fail\n")); + DBG_COUNTER(adapter->rx_logs.core_rx_pre_mgmt_err); } retval = _FAIL; // only data frame return _SUCCESS break; case WIFI_CTRL_TYPE: //ctrl + DBG_COUNTER(adapter->rx_logs.core_rx_pre_ctrl); retval = validate_recv_ctrl_frame(adapter, precv_frame); if (retval == _FAIL) { RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,("validate_recv_ctrl_frame fail\n")); + DBG_COUNTER(adapter->rx_logs.core_rx_pre_ctrl_err); } retval = _FAIL; // only data frame return _SUCCESS break; case WIFI_DATA_TYPE: //data + DBG_COUNTER(adapter->rx_logs.core_rx_pre_data); #ifdef CONFIG_WAPI_SUPPORT if(pattrib->qos) external_len = 2; @@ -2316,6 +2359,7 @@ _func_enter_; else { retval = _FAIL; + DBG_COUNTER(adapter->rx_logs.core_rx_pre_data_wapi_seq_err); break; } } @@ -2324,6 +2368,7 @@ _func_enter_; if(rtw_wapi_drop_for_key_absent(adapter,GetAddr2Ptr(ptr))){ retval=_FAIL; WAPI_TRACE(WAPI_RX,"drop for key absent for rx \n"); + DBG_COUNTER(adapter->rx_logs.core_rx_pre_data_wapi_key_err); break; } } @@ -2337,9 +2382,30 @@ _func_enter_; struct recv_priv *precvpriv = &adapter->recvpriv; //RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,("validate_recv_data_frame fail\n")); precvpriv->rx_drop++; + DBG_COUNTER(adapter->rx_logs.core_rx_pre_data_err); + } + else if (retval == _SUCCESS) + { +#ifdef DBG_RX_DUMP_EAP + u8 bDumpRxPkt; + u16 eth_type; + + // dump eapol + rtw_hal_get_def_var(adapter, HAL_DEF_DBG_DUMP_RXPKT, &(bDumpRxPkt)); + // get ether_type + _rtw_memcpy(ð_type, ptr + pattrib->hdrlen + pattrib->iv_len + LLC_HEADER_SIZE, 2); + eth_type = ntohs((unsigned short) eth_type); + if ((bDumpRxPkt == 4) && (eth_type == 0x888e)) + dump_rx_packet(ptr); +#endif + } + else + { + DBG_COUNTER(adapter->rx_logs.core_rx_pre_data_handled); } break; default: + DBG_COUNTER(adapter->rx_logs.core_rx_pre_unknown); RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,("validate_recv_data_frame fail! type=0x%x\n", type)); #ifdef DBG_RX_DROP_FRAME DBG_871X("DBG_RX_DROP_FRAME validate_recv_data_frame fail! type=0x%x\n", type); @@ -2451,21 +2517,32 @@ _func_enter_; eth_type = 0x8712; // append rx status for mp test packets ptr = recvframe_pull(precvframe, (rmv_len-sizeof(struct ethhdr)+2)-24); + if (!ptr) { + ret = _FAIL; + goto exiting; + } _rtw_memcpy(ptr, get_rxmem(precvframe), 24); ptr+=24; } else { ptr = recvframe_pull(precvframe, (rmv_len-sizeof(struct ethhdr)+ (bsnaphdr?2:0))); + if (!ptr) { + ret = _FAIL; + goto exiting; + } } - _rtw_memcpy(ptr, pattrib->dst, ETH_ALEN); - _rtw_memcpy(ptr+ETH_ALEN, pattrib->src, ETH_ALEN); + if (ptr) { + _rtw_memcpy(ptr, pattrib->dst, ETH_ALEN); + _rtw_memcpy(ptr+ETH_ALEN, pattrib->src, ETH_ALEN); - if(!bsnaphdr) { - len = htons(len); - _rtw_memcpy(ptr+12, &len, 2); + if(!bsnaphdr) { + len = htons(len); + _rtw_memcpy(ptr+12, &len, 2); + } } +exiting: _func_exit_; return ret; @@ -3103,10 +3180,11 @@ int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, union rec void recv_indicatepkts_pkt_loss_cnt(struct debug_priv *pdbgpriv, u64 prev_seq, u64 current_seq); void recv_indicatepkts_pkt_loss_cnt(struct debug_priv *pdbgpriv, u64 prev_seq, u64 current_seq) -{ +{ if(current_seq < prev_seq) { - pdbgpriv->dbg_rx_ampdu_loss_count+= (4096 + current_seq - prev_seq); + pdbgpriv->dbg_rx_ampdu_loss_count+= (4096 + current_seq - prev_seq); + } else { @@ -3128,6 +3206,8 @@ int recv_indicatepkts_in_order(_adapter *padapter, struct recv_reorder_ctrl *pre struct dvobj_priv *psdpriv = padapter->dvobj; struct debug_priv *pdbgpriv = &psdpriv->drv_dbg; + DBG_COUNTER(padapter->rx_logs.core_rx_post_indicate_in_oder); + //DbgPrint("+recv_indicatepkts_in_order\n"); //_enter_critical_ex(&ppending_recvframe_queue->lock, &irql); @@ -3299,10 +3379,20 @@ int recv_indicatepkt_reorder(_adapter *padapter, union recv_frame *prframe) struct dvobj_priv *psdpriv = padapter->dvobj; struct debug_priv *pdbgpriv = &psdpriv->drv_dbg; + DBG_COUNTER(padapter->rx_logs.core_rx_post_indicate_reoder); + if(!pattrib->amsdu) { //s1. - wlanhdr_to_ethhdr(prframe); + retval = wlanhdr_to_ethhdr(prframe); + if (retval != _SUCCESS) + { + RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,("wlanhdr_to_ethhdr: drop pkt \n")); + #ifdef DBG_RX_DROP_FRAME + DBG_871X("DBG_RX_DROP_FRAME %s wlanhdr_to_ethhdr error!\n", __FUNCTION__); + #endif + return retval; + } //if ((pattrib->qos!=1) /*|| pattrib->priority!=0 || IS_MCAST(pattrib->ra)*/ // || (pattrib->eth_type==0x0806) || (pattrib->ack_policy!=0)) @@ -3504,6 +3594,8 @@ int process_recv_indicatepkts(_adapter *padapter, union recv_frame *prframe) #ifdef CONFIG_80211N_HT struct ht_priv *phtpriv = &pmlmepriv->htpriv; + + DBG_COUNTER(padapter->rx_logs.core_rx_post_indicate); #ifdef CONFIG_TDLS if( (phtpriv->ht_option==_TRUE) || @@ -3601,19 +3693,98 @@ int validate_mp_recv_frame(_adapter *adapter, union recv_frame *precv_frame) } #endif +static sint MPwlanhdr_to_ethhdr ( union recv_frame *precvframe) +{ + sint rmv_len; + u16 eth_type, len; + u8 bsnaphdr; + u8 *psnap_type; + struct ieee80211_snap_hdr *psnap; + + sint ret=_SUCCESS; + _adapter *adapter =precvframe->u.hdr.adapter; + struct mlme_priv *pmlmepriv = &adapter->mlmepriv; + + u8 *ptr = get_recvframe_data(precvframe) ; // point to frame_ctrl field + struct rx_pkt_attrib *pattrib = & precvframe->u.hdr.attrib; + +_func_enter_; + + if(pattrib->encrypt){ + recvframe_pull_tail(precvframe, pattrib->icv_len); + } + + psnap=(struct ieee80211_snap_hdr *)(ptr+pattrib->hdrlen + pattrib->iv_len); + psnap_type=ptr+pattrib->hdrlen + pattrib->iv_len+SNAP_SIZE; + /* convert hdr + possible LLC headers into Ethernet header */ + //eth_type = (psnap_type[0] << 8) | psnap_type[1]; + if((_rtw_memcmp(psnap, rtw_rfc1042_header, SNAP_SIZE) && + (_rtw_memcmp(psnap_type, SNAP_ETH_TYPE_IPX, 2) == _FALSE) && + (_rtw_memcmp(psnap_type, SNAP_ETH_TYPE_APPLETALK_AARP, 2)==_FALSE) )|| + //eth_type != ETH_P_AARP && eth_type != ETH_P_IPX) || + _rtw_memcmp(psnap, rtw_bridge_tunnel_header, SNAP_SIZE)){ + /* remove RFC1042 or Bridge-Tunnel encapsulation and replace EtherType */ + bsnaphdr = _TRUE; + } + else { + /* Leave Ethernet header part of hdr and full payload */ + bsnaphdr = _FALSE; + } + + rmv_len = pattrib->hdrlen + pattrib->iv_len +(bsnaphdr?SNAP_SIZE:0); + len = precvframe->u.hdr.len - rmv_len; + + RT_TRACE(_module_rtl871x_recv_c_,_drv_info_,("\n===pattrib->hdrlen: %x, pattrib->iv_len:%x ===\n\n", pattrib->hdrlen, pattrib->iv_len)); + + _rtw_memcpy(ð_type, ptr+rmv_len, 2); + eth_type= ntohs((unsigned short )eth_type); //pattrib->ether_type + pattrib->eth_type = eth_type; + + { + ptr = recvframe_pull(precvframe, (rmv_len-sizeof(struct ethhdr)+ (bsnaphdr?2:0))); + } + + _rtw_memcpy(ptr, pattrib->dst, ETH_ALEN); + _rtw_memcpy(ptr+ETH_ALEN, pattrib->src, ETH_ALEN); + + if(!bsnaphdr) { + len = htons(len); + _rtw_memcpy(ptr+12, &len, 2); + } + + if (adapter->registrypriv.mp_mode == 1) + { + len = htons(pattrib->seq_num); + //DBG_871X("wlan seq = %d ,seq_num =%x\n",len,pattrib->seq_num); + _rtw_memcpy(ptr+12,&len, 2); + } +_func_exit_; + return ret; + +} + + int recv_func_prehandle(_adapter *padapter, union recv_frame *rframe) { int ret = _SUCCESS; struct rx_pkt_attrib *pattrib = &rframe->u.hdr.attrib; struct recv_priv *precvpriv = &padapter->recvpriv; _queue *pfree_recv_queue = &padapter->recvpriv.free_recv_queue; - #ifdef CONFIG_MP_INCLUDED struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct mp_priv *pmppriv = &padapter->mppriv; +#endif //CONFIG_MP_INCLUDED + u8 type; + u8 *ptr = rframe->u.hdr.rx_data; + u8 *psa, *pda, *pbssid; + struct sta_info *psta = NULL; + DBG_COUNTER(padapter->rx_logs.core_rx_pre); +#ifdef CONFIG_MP_INCLUDED if (padapter->registrypriv.mp_mode == 1) { - if ((check_fwstate(pmlmepriv, WIFI_MP_STATE) == _TRUE))//&&(padapter->mppriv.check_mp_pkt == 0)) + + if ((check_fwstate(pmlmepriv, WIFI_MP_STATE) == _TRUE) && (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) )//&&(padapter->mppriv.check_mp_pkt == 0)) { if (pattrib->crc_err == 1){ padapter->mppriv.rx_crcerrpktcount++; @@ -3625,15 +3796,125 @@ int recv_func_prehandle(_adapter *padapter, union recv_frame *rframe) padapter->mppriv.rx_pktcount_filter_out++; } - - if (check_fwstate(pmlmepriv, WIFI_MP_LPBK_STATE) == _FALSE) { - //RT_TRACE(_module_rtl871x_recv_c_, _drv_alert_, ("MP - Not in loopback mode , drop pkt \n")); - ret = _FAIL; - rtw_free_recvframe(rframe, pfree_recv_queue);//free this recv_frame - goto exit; + + if(pmppriv->rx_bindicatePkt == _FALSE) + { + //if (check_fwstate(pmlmepriv, WIFI_MP_LPBK_STATE) == _FALSE) { + //RT_TRACE(_module_rtl871x_recv_c_, _drv_alert_, ("MP - Not in loopback mode , drop pkt \n")); + ret = _FAIL; + rtw_free_recvframe(rframe, pfree_recv_queue);//free this recv_frame + goto exit; + } + else { + + type = GetFrameType(ptr); + pattrib->to_fr_ds = get_tofr_ds(ptr); + pattrib->frag_num = GetFragNum(ptr); + pattrib->seq_num = GetSequence(ptr); + pattrib->pw_save = GetPwrMgt(ptr); + pattrib->mfrag = GetMFrag(ptr); + pattrib->mdata = GetMData(ptr); + pattrib->privacy = GetPrivacy(ptr); + pattrib->order = GetOrder(ptr); + + if(type ==WIFI_DATA_TYPE) + { + pda = get_da(ptr); + psa = get_sa(ptr); + pbssid = get_hdr_bssid(ptr); + + _rtw_memcpy(pattrib->dst, pda, ETH_ALEN); + _rtw_memcpy(pattrib->src, psa, ETH_ALEN); + _rtw_memcpy(pattrib->bssid, pbssid, ETH_ALEN); + + switch(pattrib->to_fr_ds) + { + case 0: + _rtw_memcpy(pattrib->ra, pda, ETH_ALEN); + _rtw_memcpy(pattrib->ta, psa, ETH_ALEN); + ret = sta2sta_data_frame(padapter, rframe, &psta); + break; + + case 1: + + _rtw_memcpy(pattrib->ra, pda, ETH_ALEN); + _rtw_memcpy(pattrib->ta, pbssid, ETH_ALEN); + ret = ap2sta_data_frame(padapter, rframe, &psta); + + break; + + case 2: + _rtw_memcpy(pattrib->ra, pbssid, ETH_ALEN); + _rtw_memcpy(pattrib->ta, psa, ETH_ALEN); + ret = sta2ap_data_frame(padapter, rframe, &psta); + break; + + case 3: + _rtw_memcpy(pattrib->ra, GetAddr1Ptr(ptr), ETH_ALEN); + _rtw_memcpy(pattrib->ta, GetAddr2Ptr(ptr), ETH_ALEN); + ret =_FAIL; + RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,(" case 3\n")); + break; + + default: + ret =_FAIL; + break; + } + + ret = MPwlanhdr_to_ethhdr (rframe); + + if (ret != _SUCCESS) + { + RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,("wlanhdr_to_ethhdr: drop pkt \n")); + #ifdef DBG_RX_DROP_FRAME + DBG_871X("DBG_RX_DROP_FRAME %s wlanhdr_to_ethhdr: drop pkt\n", __FUNCTION__); + #endif + rtw_free_recvframe(rframe, pfree_recv_queue);//free this recv_frame + ret = _FAIL; + goto exit; + } + + if ((padapter->bDriverStopped == _FALSE) && (padapter->bSurpriseRemoved == _FALSE)) + { + RT_TRACE(_module_rtl871x_recv_c_, _drv_alert_, ("@@@@ recv_func: recv_func rtw_recv_indicatepkt\n" )); + //indicate this recv_frame + ret = rtw_recv_indicatepkt(padapter, rframe); + if (ret != _SUCCESS) + { + #ifdef DBG_RX_DROP_FRAME + DBG_871X("DBG_RX_DROP_FRAME %s rtw_recv_indicatepkt fail!\n", __FUNCTION__); + #endif + rtw_free_recvframe(rframe, pfree_recv_queue);//free this recv_frame + ret = _FAIL; + + goto exit; + } + } + else + { + RT_TRACE(_module_rtl871x_recv_c_, _drv_alert_, ("@@@@ recv_func: rtw_free_recvframe\n" )); + RT_TRACE(_module_rtl871x_recv_c_, _drv_debug_, ("recv_func:bDriverStopped(%d) OR bSurpriseRemoved(%d)", padapter->bDriverStopped, padapter->bSurpriseRemoved)); + #ifdef DBG_RX_DROP_FRAME + DBG_871X("DBG_RX_DROP_FRAME %s ecv_func:bDriverStopped(%d) OR bSurpriseRemoved(%d)\n", __FUNCTION__, + padapter->bDriverStopped, padapter->bSurpriseRemoved); + #endif + ret = _FAIL; + rtw_free_recvframe(rframe, pfree_recv_queue);//free this recv_frame + goto exit; + } + + } + } + } - } + + RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("recv_func: validate_recv_frame fail! drop pkt\n")); + rtw_free_recvframe(rframe, pfree_recv_queue);//free this recv_frame + ret = _FAIL; + goto exit; + } + #endif //check the frame crtl field and decache @@ -3656,12 +3937,11 @@ int recv_func_posthandle(_adapter *padapter, union recv_frame *prframe) struct rx_pkt_attrib *pattrib = &prframe->u.hdr.attrib; struct recv_priv *precvpriv = &padapter->recvpriv; _queue *pfree_recv_queue = &padapter->recvpriv.free_recv_queue; - - #ifdef CONFIG_TDLS u8 *psnap_type, *pcategory; #endif //CONFIG_TDLS + DBG_COUNTER(padapter->rx_logs.core_rx_post); // DATA FRAME rtw_led_control(padapter, LED_CTL_RX); @@ -3673,6 +3953,7 @@ int recv_func_posthandle(_adapter *padapter, union recv_frame *prframe) DBG_871X("DBG_RX_DROP_FRAME %s decryptor: drop pkt\n", __FUNCTION__); #endif ret = _FAIL; + DBG_COUNTER(padapter->rx_logs.core_rx_post_decrypt_err); goto _recv_data_drop; } @@ -3712,6 +3993,7 @@ int recv_func_posthandle(_adapter *padapter, union recv_frame *prframe) #ifdef DBG_RX_DROP_FRAME DBG_871X("DBG_RX_DROP_FRAME %s recvframe_chk_defrag: drop pkt\n", __FUNCTION__); #endif + DBG_COUNTER(padapter->rx_logs.core_rx_post_defrag_err); goto _recv_data_drop; } @@ -3722,6 +4004,7 @@ int recv_func_posthandle(_adapter *padapter, union recv_frame *prframe) DBG_871X("DBG_RX_DROP_FRAME %s portctrl: drop pkt\n", __FUNCTION__); #endif ret = _FAIL; + DBG_COUNTER(padapter->rx_logs.core_rx_post_portctrl_err); goto _recv_data_drop; } @@ -3740,6 +4023,7 @@ int recv_func_posthandle(_adapter *padapter, union recv_frame *prframe) DBG_871X("DBG_RX_DROP_FRAME %s process_recv_indicatepkts fail!\n", __FUNCTION__); #endif rtw_free_recvframe(orig_prframe, pfree_recv_queue);//free this recv_frame + DBG_COUNTER(padapter->rx_logs.core_rx_post_indicate_err); goto _recv_data_drop; } #else // CONFIG_80211N_HT @@ -3830,6 +4114,7 @@ int recv_func(_adapter *padapter, union recv_frame *rframe) while((pending_frame=rtw_alloc_recvframe(&padapter->recvpriv.uc_swdec_pending_queue))) { cnt++; + DBG_COUNTER(padapter->rx_logs.core_rx_dequeue); recv_func_posthandle(padapter, pending_frame); } @@ -3838,6 +4123,7 @@ int recv_func(_adapter *padapter, union recv_frame *rframe) FUNC_ADPT_ARG(padapter), cnt); } + DBG_COUNTER(padapter->rx_logs.core_rx); ret = recv_func_prehandle(padapter, rframe); if(ret == _SUCCESS) { @@ -3849,6 +4135,7 @@ int recv_func(_adapter *padapter, union recv_frame *rframe) psecuritypriv->ndisauthtype == Ndis802_11AuthModeWPAPSK && !psecuritypriv->busetkipkey) { + DBG_COUNTER(padapter->rx_logs.core_rx_enqueue); rtw_enqueue_recvframe(rframe, &padapter->recvpriv.uc_swdec_pending_queue); //DBG_871X("%s: no key, enqueue uc_swdec_pending_queue\n", __func__); diff --git a/core/rtw_security.c b/core/rtw_security.c index 579fd09..9841568 100644 --- a/core/rtw_security.c +++ b/core/rtw_security.c @@ -44,6 +44,63 @@ const char *security_type_str(u8 value) return NULL; } +#ifdef DBG_SW_SEC_CNT +#define WEP_SW_ENC_CNT_INC(sec, ra) \ + if (is_broadcast_mac_addr(ra)) \ + sec->wep_sw_enc_cnt_bc++; \ + else if (is_multicast_mac_addr(ra)) \ + sec->wep_sw_enc_cnt_mc++; \ + else \ + sec->wep_sw_enc_cnt_uc++; + +#define WEP_SW_DEC_CNT_INC(sec, ra) \ + if (is_broadcast_mac_addr(ra)) \ + sec->wep_sw_dec_cnt_bc++; \ + else if (is_multicast_mac_addr(ra)) \ + sec->wep_sw_dec_cnt_mc++; \ + else \ + sec->wep_sw_dec_cnt_uc++; + +#define TKIP_SW_ENC_CNT_INC(sec, ra) \ + if (is_broadcast_mac_addr(ra)) \ + sec->tkip_sw_enc_cnt_bc++; \ + else if (is_multicast_mac_addr(ra)) \ + sec->tkip_sw_enc_cnt_mc++; \ + else \ + sec->tkip_sw_enc_cnt_uc++; + +#define TKIP_SW_DEC_CNT_INC(sec, ra) \ + if (is_broadcast_mac_addr(ra)) \ + sec->tkip_sw_dec_cnt_bc++; \ + else if (is_multicast_mac_addr(ra)) \ + sec->tkip_sw_dec_cnt_mc++; \ + else \ + sec->tkip_sw_dec_cnt_uc++; + +#define AES_SW_ENC_CNT_INC(sec, ra) \ + if (is_broadcast_mac_addr(ra)) \ + sec->aes_sw_enc_cnt_bc++; \ + else if (is_multicast_mac_addr(ra)) \ + sec->aes_sw_enc_cnt_mc++; \ + else \ + sec->aes_sw_enc_cnt_uc++; + +#define AES_SW_DEC_CNT_INC(sec, ra) \ + if (is_broadcast_mac_addr(ra)) \ + sec->aes_sw_dec_cnt_bc++; \ + else if (is_multicast_mac_addr(ra)) \ + sec->aes_sw_dec_cnt_mc++; \ + else \ + sec->aes_sw_dec_cnt_uc++; +#else +#define WEP_SW_ENC_CNT_INC(sec, ra) +#define WEP_SW_DEC_CNT_INC(sec, ra) +#define TKIP_SW_ENC_CNT_INC(sec, ra) +#define TKIP_SW_DEC_CNT_INC(sec, ra) +#define AES_SW_ENC_CNT_INC(sec, ra) +#define AES_SW_DEC_CNT_INC(sec, ra) +#endif /* DBG_SW_SEC_CNT */ + //=====WEP related===== #define CRC32_POLY 0x04c11db7 @@ -251,7 +308,8 @@ _func_enter_; } } - + + WEP_SW_ENC_CNT_INC(psecuritypriv, pattrib->ra); } _func_exit_; @@ -299,8 +357,9 @@ _func_enter_; { RT_TRACE(_module_rtl871x_security_c_,_drv_err_,("rtw_wep_decrypt:icv error crc[3](%x)!=payload[length-1](%x) || crc[2](%x)!=payload[length-2](%x) || crc[1](%x)!=payload[length-3](%x) || crc[0](%x)!=payload[length-4](%x)\n", crc[3],payload[length-1],crc[2],payload[length-2],crc[1],payload[length-3],crc[0],payload[length-4])); - } - + } + + WEP_SW_DEC_CNT_INC(psecuritypriv, prxattrib->ra); } _func_exit_; @@ -775,7 +834,7 @@ _func_enter_; } } - + TKIP_SW_ENC_CNT_INC(psecuritypriv,pattrib->ra); } /* else{ @@ -867,7 +926,6 @@ _func_enter_; } else { - RT_TRACE(_module_rtl871x_security_c_,_drv_err_,("rtw_tkip_decrypt: stainfo!=NULL!!!\n")); prwskey=&stainfo->dot118021x_UncstKey.skey[0]; prwskeylen=16; } @@ -897,8 +955,8 @@ _func_enter_; crc[3],payload[length-1],crc[2],payload[length-2],crc[1],payload[length-3],crc[0],payload[length-4])); res=_FAIL; } - - + + TKIP_SW_DEC_CNT_INC(psecuritypriv, prxattrib->ra); } else{ RT_TRACE(_module_rtl871x_security_c_,_drv_err_,("rtw_tkip_decrypt: stainfo==NULL!!!\n")); @@ -1706,7 +1764,7 @@ _func_enter_; } } - + AES_SW_ENC_CNT_INC(psecuritypriv, pattrib->ra); } /* else{ @@ -1714,7 +1772,7 @@ _func_enter_; DBG_871X("%s, psta==NUL\n", __func__); res=_FAIL; } -*/ +*/ } @@ -2031,7 +2089,6 @@ _func_enter_; static u32 no_gkey_bc_cnt = 0; static u32 no_gkey_mc_cnt = 0; - //in concurrent we should use sw descrypt in group key, so we remove this message //DBG_871X("rx bc/mc packets, to perform sw rtw_aes_decrypt\n"); //prwskey = psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey; if(psecuritypriv->binstallGrpkey==_FALSE) @@ -2107,10 +2164,10 @@ _func_enter_; res= aes_decipher(prwskey,prxattrib->hdrlen,pframe, length); - + AES_SW_DEC_CNT_INC(psecuritypriv, prxattrib->ra); } else{ - RT_TRACE(_module_rtl871x_security_c_,_drv_err_,("rtw_aes_encrypt: stainfo==NULL!!!\n")); + RT_TRACE(_module_rtl871x_security_c_,_drv_err_,("rtw_aes_decrypt: stainfo==NULL!!!\n")); res=_FAIL; } @@ -3141,9 +3198,9 @@ void rtw_sec_restore_wep_key(_adapter *adapter) for(keyid=0;keyid<4;keyid++){ if(securitypriv->key_mask & BIT(keyid)){ if(keyid == securitypriv->dot11PrivacyKeyIndex) - rtw_set_key(adapter,securitypriv, keyid, 1, _TRUE); + rtw_set_key(adapter,securitypriv, keyid, 1, _FALSE); else - rtw_set_key(adapter,securitypriv, keyid, 0, _TRUE); + rtw_set_key(adapter,securitypriv, keyid, 0, _FALSE); } } } diff --git a/core/rtw_sreset.c b/core/rtw_sreset.c index 108833b..82db59c 100644 --- a/core/rtw_sreset.c +++ b/core/rtw_sreset.c @@ -162,7 +162,7 @@ void sreset_restore_security_station(_adapter *padapter) else { //pairwise key - rtw_setstakey_cmd(padapter, (unsigned char *)psta, _TRUE,_FALSE); + rtw_setstakey_cmd(padapter, psta, _TRUE,_FALSE); //group key rtw_set_key(padapter,&padapter->securitypriv,padapter->securitypriv.dot118021XGrpKeyid, 0,_FALSE); } @@ -331,10 +331,10 @@ void sreset_reset(_adapter *padapter) psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS; - -#ifdef CONFIG_POWER_SAVING + +#ifdef CONFIG_LPS rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, "SRESET"); -#endif +#endif//#ifdef CONFIG_LPS _enter_pwrlock(&pwrpriv->lock); diff --git a/core/rtw_sta_mgt.c b/core/rtw_sta_mgt.c index f03f727..f17b2a2 100644 --- a/core/rtw_sta_mgt.c +++ b/core/rtw_sta_mgt.c @@ -456,13 +456,19 @@ u32 rtw_free_stainfo(_adapter *padapter , struct sta_info *psta) struct xmit_priv *pxmitpriv= &padapter->xmitpriv; struct sta_priv *pstapriv = &padapter->stapriv; struct hw_xmit *phwxmit; - + int pending_qcnt[4]; _func_enter_; if (psta == NULL) goto exit; + _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL0); + rtw_list_delete(&psta->hash_list); + RT_TRACE(_module_rtl871x_sta_mgt_c_,_drv_err_,("\n free number_%d stainfo with hwaddr = 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x \n",pstapriv->asoc_sta_count , psta->hwaddr[0], psta->hwaddr[1], psta->hwaddr[2],psta->hwaddr[3],psta->hwaddr[4],psta->hwaddr[5])); + pstapriv->asoc_sta_count --; + _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL0); + _enter_critical_bh(&psta->lock, &irqL0); psta->state &= ~_FW_LINKED; @@ -488,6 +494,7 @@ _func_enter_; rtw_list_delete(&(pstaxmitpriv->vo_q.tx_pending)); phwxmit = pxmitpriv->hwxmits; phwxmit->accnt -= pstaxmitpriv->vo_q.qcnt; + pending_qcnt[0] = pstaxmitpriv->vo_q.qcnt; pstaxmitpriv->vo_q.qcnt = 0; //_exit_critical_bh(&(pxmitpriv->vo_pending.lock), &irqL0); @@ -497,6 +504,7 @@ _func_enter_; rtw_list_delete(&(pstaxmitpriv->vi_q.tx_pending)); phwxmit = pxmitpriv->hwxmits+1; phwxmit->accnt -= pstaxmitpriv->vi_q.qcnt; + pending_qcnt[1] = pstaxmitpriv->vi_q.qcnt; pstaxmitpriv->vi_q.qcnt = 0; //_exit_critical_bh(&(pxmitpriv->vi_pending.lock), &irqL0); @@ -506,6 +514,7 @@ _func_enter_; rtw_list_delete(&(pstaxmitpriv->be_q.tx_pending)); phwxmit = pxmitpriv->hwxmits+2; phwxmit->accnt -= pstaxmitpriv->be_q.qcnt; + pending_qcnt[2] = pstaxmitpriv->be_q.qcnt; pstaxmitpriv->be_q.qcnt = 0; //_exit_critical_bh(&(pxmitpriv->be_pending.lock), &irqL0); @@ -515,15 +524,14 @@ _func_enter_; rtw_list_delete(&(pstaxmitpriv->bk_q.tx_pending)); phwxmit = pxmitpriv->hwxmits+3; phwxmit->accnt -= pstaxmitpriv->bk_q.qcnt; + pending_qcnt[3] = pstaxmitpriv->bk_q.qcnt; pstaxmitpriv->bk_q.qcnt = 0; //_exit_critical_bh(&(pxmitpriv->bk_pending.lock), &irqL0); - + + rtw_os_wake_queue_at_free_stainfo(padapter, pending_qcnt); + _exit_critical_bh(&pxmitpriv->lock, &irqL0); - rtw_list_delete(&psta->hash_list); - RT_TRACE(_module_rtl871x_sta_mgt_c_,_drv_err_,("\n free number_%d stainfo with hwaddr = 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x \n",pstapriv->asoc_sta_count , psta->hwaddr[0], psta->hwaddr[1], psta->hwaddr[2],psta->hwaddr[3],psta->hwaddr[4],psta->hwaddr[5])); - pstapriv->asoc_sta_count --; - // re-init sta_info; 20061114 // will be init in alloc_stainfo //_rtw_init_sta_xmit_priv(&psta->sta_xmitpriv); @@ -631,7 +639,9 @@ _func_enter_; _rtw_spinlock_free(&psta->lock); //_enter_critical_bh(&(pfree_sta_queue->lock), &irqL0); + _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL0); rtw_list_insert_tail(&psta->list, get_list_head(pfree_sta_queue)); + _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL0); //_exit_critical_bh(&(pfree_sta_queue->lock), &irqL0); exit: @@ -651,6 +661,9 @@ void rtw_free_all_stainfo(_adapter *padapter) struct sta_info *psta = NULL; struct sta_priv *pstapriv = &padapter->stapriv; struct sta_info* pbcmc_stainfo =rtw_get_bcmc_stainfo( padapter); + u8 free_sta_num = 0; + char free_sta_list[NUM_STA]; + int stainfo_offset; _func_enter_; @@ -670,13 +683,27 @@ _func_enter_; plist = get_next(plist); - if(pbcmc_stainfo!=psta) - rtw_free_stainfo(padapter , psta); + if(pbcmc_stainfo!=psta) + { + rtw_list_delete(&psta->hash_list); + //rtw_free_stainfo(padapter , psta); + stainfo_offset = rtw_stainfo_offset(pstapriv, psta); + if (stainfo_offset_valid(stainfo_offset)) { + free_sta_list[free_sta_num++] = stainfo_offset; + } + } } } _exit_critical_bh(&pstapriv->sta_hash_lock, &irqL); + + + for (index = 0; index < free_sta_num; index++) + { + psta = rtw_get_stainfo_by_offset(pstapriv, free_sta_list[index]); + rtw_free_stainfo(padapter , psta); + } exit: @@ -762,9 +789,6 @@ _func_enter_; goto exit; } - // default broadcast & multicast use macid 1 - psta->mac_id = 1; - ptxservq= &(psta->sta_xmitpriv.be_q); /* diff --git a/core/rtw_tdls.c b/core/rtw_tdls.c index a4a9c0a..21f9fcc 100644 --- a/core/rtw_tdls.c +++ b/core/rtw_tdls.c @@ -22,8 +22,6 @@ #include #ifdef CONFIG_TDLS -extern unsigned char MCS_rate_2R[16]; -extern unsigned char MCS_rate_1R[16]; extern void process_wmmps_data(_adapter *padapter, union recv_frame *precv_frame); void rtw_reset_tdls_info(_adapter* padapter) @@ -210,7 +208,7 @@ void free_tdls_sta(_adapter *padapter, struct sta_info *ptdls_sta) } //clear cam - rtw_clearstakey_cmd(padapter, (u8 *)ptdls_sta, (u8)rtw_get_camid(ptdls_sta->mac_id), _TRUE); + rtw_clearstakey_cmd(padapter, ptdls_sta, _TRUE); if(ptdlsinfo->sta_cnt==0){ rtw_tdls_cmd(padapter, myid(&(padapter->eeprompriv)), TDLS_RS_RCR); @@ -230,7 +228,7 @@ void rtw_tdls_set_key(_adapter *padapter, struct rx_pkt_attrib *prx_pkt_attrib, if(prx_pkt_attrib->encrypt) { ptdls_sta->dot118021XPrivacy=_AES_; - rtw_setstakey_cmd(padapter, (u8*)ptdls_sta, _TRUE, _TRUE); + rtw_setstakey_cmd(padapter, ptdls_sta, _TRUE, _TRUE); } } diff --git a/core/rtw_vht.c b/core/rtw_vht.c index 1d75271..ce971d5 100644 --- a/core/rtw_vht.c +++ b/core/rtw_vht.c @@ -281,8 +281,9 @@ void update_sta_vht_info_apmode(_adapter *padapter, PVOID sta) } 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; + + //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) && diff --git a/core/rtw_wlan_util.c b/core/rtw_wlan_util.c index 5b8349c..7d13f9b 100644 --- a/core/rtw_wlan_util.c +++ b/core/rtw_wlan_util.c @@ -40,11 +40,6 @@ unsigned char AIRGOCAP_OUI[] = {0x00, 0x0a, 0xf5}; unsigned char REALTEK_96B_IE[] = {0x00, 0xe0, 0x4c, 0x02, 0x01, 0x20}; -extern unsigned char MCS_rate_2R[16]; -#ifdef CONFIG_DISABLE_MCS13TO15 -extern unsigned char MCS_rate_2R_MCS13TO15_OFF[16]; -#endif //CONFIG_DISABLE_MCS13TO15 -extern unsigned char MCS_rate_1R[16]; extern unsigned char RTW_WPA_OUI[]; extern unsigned char WPA_TKIP_CIPHER[4]; extern unsigned char RSN_TKIP_CIPHER[4]; @@ -55,6 +50,9 @@ extern unsigned char RSN_TKIP_CIPHER[4]; #define WAIT_FOR_BCN_TO_MIN (6000) #define WAIT_FOR_BCN_TO_MAX (20000) +#define DISCONNECT_BY_CHK_BCN_FAIL_OBSERV_PERIOD_IN_MS 1000 +#define DISCONNECT_BY_CHK_BCN_FAIL_THRESHOLD 3 + static u8 rtw_basic_rate_cck[4] = { IEEE80211_CCK_RATE_1MB|IEEE80211_BASIC_RATE_MASK, IEEE80211_CCK_RATE_2MB|IEEE80211_BASIC_RATE_MASK, IEEE80211_CCK_RATE_5MB|IEEE80211_BASIC_RATE_MASK, IEEE80211_CCK_RATE_11MB|IEEE80211_BASIC_RATE_MASK @@ -72,6 +70,7 @@ static u8 rtw_basic_rate_mix[7] = { IEEE80211_OFDM_RATE_24MB|IEEE80211_BASIC_RATE_MASK }; +int new_bcn_max = 3; int cckrates_included(unsigned char *rate, int ratelen) { @@ -393,6 +392,19 @@ void get_rate_set(_adapter *padapter, unsigned char *pbssrate, int *bssrate_len) _rtw_memcpy(pbssrate, supportedrates, *bssrate_len); } +void set_mcs_rate_by_mask(u8 *mcs_set, u32 mask) +{ + u8 mcs_rate_1r = (u8)(mask&0xff); + u8 mcs_rate_2r = (u8)((mask>>8)&0xff); + u8 mcs_rate_3r = (u8)((mask>>16)&0xff); + u8 mcs_rate_4r = (u8)((mask>>24)&0xff); + + mcs_set[0] &= mcs_rate_1r; + mcs_set[1] &= mcs_rate_2r; + mcs_set[2] &= mcs_rate_3r; + mcs_set[3] &= mcs_rate_4r; +} + void UpdateBrateTbl( IN PADAPTER Adapter, IN u8 *mBratesOS @@ -848,7 +860,16 @@ void CAM_empty_entry( void invalidate_cam_all(_adapter *padapter) { + struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); + struct cam_ctl_t *cam_ctl = &dvobj->cam_ctl; + _irqL irqL; + rtw_hal_set_hwreg(padapter, HW_VAR_CAM_INVALID_ALL, 0); + + _enter_critical_bh(&cam_ctl->lock, &irqL); + cam_ctl->bitmap = 0; + _rtw_memset(dvobj->cam_cache, 0, sizeof(struct cam_entry_cache)*TOTAL_CAM_ENTRY); + _exit_critical_bh(&cam_ctl->lock, &irqL); } #if 1 static u32 _ReadCAM(_adapter *padapter ,u32 addr) @@ -938,24 +959,254 @@ inline void clear_cam_entry(_adapter *adapter, u8 id) inline void write_cam_from_cache(_adapter *adapter, u8 id) { struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); + struct cam_ctl_t *cam_ctl = &dvobj->cam_ctl; + _irqL irqL; + struct cam_entry_cache cache; - _write_cam(adapter, id, dvobj->cam_cache[id].ctrl, dvobj->cam_cache[id].mac, dvobj->cam_cache[id].key); + _enter_critical_bh(&cam_ctl->lock, &irqL); + _rtw_memcpy(&cache, &dvobj->cam_cache[id], sizeof(struct cam_entry_cache)); + _exit_critical_bh(&cam_ctl->lock, &irqL); + + _write_cam(adapter, id, cache.ctrl, cache.mac, cache.key); } void write_cam_cache(_adapter *adapter, u8 id, u16 ctrl, u8 *mac, u8 *key) { struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); + struct cam_ctl_t *cam_ctl = &dvobj->cam_ctl; + _irqL irqL; + + _enter_critical_bh(&cam_ctl->lock, &irqL); dvobj->cam_cache[id].ctrl = ctrl; _rtw_memcpy(dvobj->cam_cache[id].mac, mac, ETH_ALEN); _rtw_memcpy(dvobj->cam_cache[id].key, key, 16); + + _exit_critical_bh(&cam_ctl->lock, &irqL); } void clear_cam_cache(_adapter *adapter, u8 id) { struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); + struct cam_ctl_t *cam_ctl = &dvobj->cam_ctl; + _irqL irqL; + + _enter_critical_bh(&cam_ctl->lock, &irqL); _rtw_memset(&(dvobj->cam_cache[id]), 0, sizeof(struct cam_entry_cache)); + + _exit_critical_bh(&cam_ctl->lock, &irqL); +} + +s16 rtw_get_camid(_adapter *adapter, struct sta_info *sta, s16 kid) +{ + u8 macid; + s16 camid; + + //cam_entry: + //0~3 for default key + + //for concurrent mode (ap+sta, sta+sta): + //default key is disable, using sw encrypt/decrypt + //camid 0, 1, 2, 3 is default entry for default key/group key + //macid = 1 is for bc/mc stainfo, no mapping to camid + //macid = 0 mapping to camid 4 + //for macid >=2, camid = macid+3; + + if (sta) { + struct mlme_ext_info *mlmeinfo = &adapter->mlmeextpriv.mlmext_info; + macid = sta->mac_id; + + if((mlmeinfo->state&0x03) == WIFI_FW_AP_STATE) { + if((macid == 1) || (macid>(NUM_STA-4))){ + DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" failed, mac_id=%d\n", FUNC_ADPT_ARG(adapter), macid); + camid = -1; + goto exit; + } + } + + if(macid==0) + camid = 4; + else if(macid >=2) + camid = macid + 3; + else + camid = 4; + } + else { + /* default key is disabled */ + camid = -1; + } + +exit: + return (s16)camid; +} + +bool _rtw_camid_is_gk(_adapter *adapter, u8 cam_id) +{ + struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); + struct cam_ctl_t *cam_ctl = &dvobj->cam_ctl; + bool ret = _FALSE; + + if (cam_id >= TOTAL_CAM_ENTRY) + goto exit; + + if (!(cam_ctl->bitmap & BIT(cam_id))) + goto exit; + + ret = (dvobj->cam_cache[cam_id].ctrl&BIT6)?_TRUE:_FALSE; + +exit: + return ret; +} + +bool rtw_camid_is_gk(_adapter *adapter, u8 cam_id) +{ + struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); + struct cam_ctl_t *cam_ctl = &dvobj->cam_ctl; + _irqL irqL; + bool ret; + + _enter_critical_bh(&cam_ctl->lock, &irqL); + ret = _rtw_camid_is_gk(adapter, cam_id); + _exit_critical_bh(&cam_ctl->lock, &irqL); + + return ret; +} + +s16 _rtw_camid_search(_adapter *adapter, u8 *addr, s16 kid) +{ + struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); + struct cam_ctl_t *cam_ctl = &dvobj->cam_ctl; + int i; + s16 cam_id = -1; + + for (i=0;icam_cache[i].mac, addr, ETH_ALEN) == _FALSE) + continue; + if (kid >= 0 && kid != (dvobj->cam_cache[i].ctrl&0x03)) + continue; + + cam_id = i; + break; + } + + if (0) { + if (addr) + DBG_871X(FUNC_ADPT_FMT" addr:"MAC_FMT" kid:%d, return cam_id:%d\n" + , FUNC_ADPT_ARG(adapter), MAC_ARG(addr), kid, cam_id); + else + DBG_871X(FUNC_ADPT_FMT" addr:%p kid:%d, return cam_id:%d\n" + , FUNC_ADPT_ARG(adapter), addr, kid, cam_id); + } + + return cam_id; +} + +s16 rtw_camid_search(_adapter *adapter, u8 *addr, s16 kid) +{ + struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); + struct cam_ctl_t *cam_ctl = &dvobj->cam_ctl; + _irqL irqL; + s16 cam_id = -1; + + _enter_critical_bh(&cam_ctl->lock, &irqL); + cam_id = _rtw_camid_search(adapter, addr, kid); + _exit_critical_bh(&cam_ctl->lock, &irqL); + + return cam_id; +} + +s16 rtw_camid_alloc(_adapter *adapter, struct sta_info *sta, u8 kid) +{ + struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); + struct cam_ctl_t *cam_ctl = &dvobj->cam_ctl; + _irqL irqL; + s16 cam_id = -1; + + _enter_critical_bh(&cam_ctl->lock, &irqL); + +#ifdef DYNAMIC_CAMID_ALLOC + { + struct mlme_ext_info *mlmeinfo = &adapter->mlmeextpriv.mlmext_info; + + if((((mlmeinfo->state&0x03) == WIFI_FW_AP_STATE) || ((mlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE)) + && !sta) { + /* AP/Ad-hoc mode group key: static alloction to default key by key ID */ + if (kid > 3) { + DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" group key with invalid key id:%u\n" + , FUNC_ADPT_ARG(adapter), kid); + rtw_warn_on(1); + goto bitmap_handle; + } + + cam_id = kid; + } + else { + int i; + u8 *addr = sta?sta->hwaddr:NULL; + + if(!sta) { + if (!(mlmeinfo->state & WIFI_FW_ASSOC_SUCCESS)) { + /* bypass STA mode group key setting before connected(ex:WEP) because bssid is not ready */ + goto bitmap_handle; + } + + addr = get_bssid(&adapter->mlmepriv); + } + + if ((i = _rtw_camid_search(adapter, addr, kid)) >= 0) { + /* Fix issue that pairwise and group key have same key id. Pairwise key first, group key can overwirte group only(ex: rekey) */ + if (sta || _rtw_camid_is_gk(adapter, i) == _TRUE) + cam_id = i; + else + DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" group key id:%u the same key id as pairwise key\n" + , FUNC_ADPT_ARG(adapter), kid); + goto bitmap_handle; + } + + for (i=4;ibitmap & BIT(i))) + break; + + if (i == TOTAL_CAM_ENTRY) { + if (sta) + DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" pairwise key with "MAC_FMT" id:%u no room\n" + , FUNC_ADPT_ARG(adapter), MAC_ARG(sta->hwaddr), kid); + else + DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" group key id:%u no room\n" + , FUNC_ADPT_ARG(adapter), kid); + rtw_warn_on(1); + goto bitmap_handle; + } + + cam_id = i; + } + } +#else + cam_id = rtw_get_camid(adapter, sta, kid); +#endif /* DYNAMIC_CAMID_ALLOC */ + +bitmap_handle: + if (cam_id >= 0) + cam_ctl->bitmap |= BIT(cam_id); + + _exit_critical_bh(&cam_ctl->lock, &irqL); + + return cam_id; +} + +void rtw_camid_free(_adapter *adapter, u8 cam_id) +{ + struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); + struct cam_ctl_t *cam_ctl = &dvobj->cam_ctl; + _irqL irqL; + + _enter_critical_bh(&cam_ctl->lock, &irqL); + + if (cam_id < TOTAL_CAM_ENTRY) + cam_ctl->bitmap &= ~(BIT(cam_id)); + + _exit_critical_bh(&cam_ctl->lock, &irqL); } int allocate_fw_sta_entry(_adapter *padapter) @@ -979,46 +1230,58 @@ int allocate_fw_sta_entry(_adapter *padapter) void flush_all_cam_entry(_adapter *padapter) { - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - -#ifdef CONFIG_CONCURRENT_MODE - + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - //if(check_buddy_mlmeinfo_state(padapter, _HW_STATE_NOLINK_)) - if(check_buddy_fwstate(padapter, _FW_LINKED) == _FALSE) - { - rtw_hal_set_hwreg(padapter, HW_VAR_CAM_INVALID_ALL, 0); - } - else +#ifdef CONFIG_CONCURRENT_MODE + if(check_buddy_fwstate(padapter, _FW_LINKED) == _TRUE) { if(check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { struct sta_priv *pstapriv = &padapter->stapriv; struct sta_info *psta; - u8 cam_id;//cam_entry psta = rtw_get_stainfo(pstapriv, pmlmeinfo->network.MacAddress); if(psta) { if(psta->state & WIFI_AP_STATE) {} //clear cam when ap free per sta_info else { - cam_id = (u8)rtw_get_camid(psta->mac_id); - rtw_clearstakey_cmd(padapter, (u8*)psta, cam_id, _FALSE); - } + rtw_clearstakey_cmd(padapter, psta, _FALSE); + } } } else if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE) { - //clear cam when ap free per sta_info - } + /* clear default key */ + int i, cam_id; + u8 null_addr[ETH_ALEN]= {0,0,0,0,0,0}; + + for (i=0;i<4;i++) { + cam_id = rtw_camid_search(padapter, null_addr, i); + if (cam_id >= 0) { + clear_cam_entry(padapter, cam_id); + rtw_camid_free(padapter, cam_id); + } + } + + /* clear default key related key search setting */ + #ifdef DYNAMIC_CAMID_ALLOC + rtw_hal_set_hwreg(padapter, HW_VAR_SEC_DK_CFG, (u8*)_FALSE); + #endif + + /* leave pairwise key when ap free per sta_info */ + } } -#else //CONFIG_CONCURRENT_MODE - - rtw_hal_set_hwreg(padapter, HW_VAR_CAM_INVALID_ALL, 0); - + else #endif //CONFIG_CONCURRENT_MODE + { + invalidate_cam_all(padapter); + /* clear default key related key search setting */ + #ifdef DYNAMIC_CAMID_ALLOC + rtw_hal_set_hwreg(padapter, HW_VAR_SEC_DK_CFG, (u8*)_FALSE); + #endif + } _rtw_memset((u8 *)(pmlmeinfo->FW_sta_info), 0, sizeof(pmlmeinfo->FW_sta_info)); @@ -1394,7 +1657,9 @@ void HT_caps_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE) } else { - //modify from fw by Thomas 2010/11/17 + /* AMPDU Parameters field */ + + /* Get MIN of MAX AMPDU Length Exp */ if ((pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x3) > (pIE->data[i] & 0x3)) { max_AMPDU_len = (pIE->data[i] & 0x3); @@ -1403,7 +1668,8 @@ void HT_caps_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE) { max_AMPDU_len = (pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x3); } - + + /* Get MAX of MIN MPDU Start Spacing */ if ((pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c) > (pIE->data[i] & 0x1c)) { min_MPDU_spacing = (pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c); @@ -1425,34 +1691,33 @@ void HT_caps_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE) rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); - //update the MCS rates + + //update the MCS set for (i = 0; i < 16; i++) + pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= pmlmeext->default_supported_mcs_set[i]; + + //update the MCS rates + switch(rf_type) { - if((rf_type == RF_1T1R) || (rf_type == RF_1T2R)) - { - pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_1R[i]; - } - else - { - #ifdef CONFIG_DISABLE_MCS13TO15 - if(pmlmeext->cur_bwmode == CHANNEL_WIDTH_40 && (pregistrypriv->wifi_spec!=1)) - pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_2R_MCS13TO15_OFF[i]; + case RF_1T1R: + case RF_1T2R: + set_mcs_rate_by_mask(pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate, MCS_RATE_1R); + break; + case RF_2T2R: + default: +#ifdef CONFIG_DISABLE_MCS13TO15 + if(pmlmeext->cur_bwmode == CHANNEL_WIDTH_40 && pregistrypriv->wifi_spec != 1 ) + set_mcs_rate_by_mask(pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate, MCS_RATE_2R_13TO15_OFF); else - pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_2R[i]; - #else - pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_2R[i]; - #endif //CONFIG_DISABLE_MCS13TO15 - } - #ifdef RTL8192C_RECONFIG_TO_1T1R - { - pmlmeinfo->HT_caps.HT_cap_element.MCS_rate[i] &= MCS_rate_1R[i]; - } - #endif + set_mcs_rate_by_mask(pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate, MCS_RATE_2R); +#else //CONFIG_DISABLE_MCS13TO15 + set_mcs_rate_by_mask(pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate, MCS_RATE_2R); +#endif //CONFIG_DISABLE_MCS13TO15 } if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { // Config STBC setting - if (TEST_FLAG(phtpriv->stbc_cap, STBC_HT_ENABLE_TX) && GET_HT_CAPABILITY_ELE_TX_STBC(pIE->data)) + if (TEST_FLAG(phtpriv->stbc_cap, STBC_HT_ENABLE_TX) && GET_HT_CAP_ELE_TX_STBC(pIE->data)) { SET_FLAG(cur_stbc_cap, STBC_HT_ENABLE_TX); DBG_871X("Enable HT Tx STBC !\n"); @@ -1479,7 +1744,7 @@ void HT_caps_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE) #endif //CONFIG_BEAMFORMING } else { // Config LDPC Coding Capability - if (TEST_FLAG(phtpriv->ldpc_cap, LDPC_HT_ENABLE_TX) && GET_HT_CAPABILITY_ELE_LDPC_CAP(pIE->data)) + if (TEST_FLAG(phtpriv->ldpc_cap, LDPC_HT_ENABLE_TX) && GET_HT_CAP_ELE_LDPC_CAP(pIE->data)) { SET_FLAG(cur_ldpc_cap, (LDPC_HT_ENABLE_TX | LDPC_HT_CAP_TX)); DBG_871X("Enable HT Tx LDPC!\n"); @@ -1487,7 +1752,7 @@ void HT_caps_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE) phtpriv->ldpc_cap = cur_ldpc_cap; // Config STBC setting - if (TEST_FLAG(phtpriv->stbc_cap, STBC_HT_ENABLE_TX) && GET_HT_CAPABILITY_ELE_RX_STBC(pIE->data)) + if (TEST_FLAG(phtpriv->stbc_cap, STBC_HT_ENABLE_TX) && GET_HT_CAP_ELE_RX_STBC(pIE->data)) { SET_FLAG(cur_stbc_cap, (STBC_HT_ENABLE_TX | STBC_HT_CAP_TX) ); DBG_871X("Enable HT Tx STBC!\n"); @@ -1515,7 +1780,6 @@ void HT_caps_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE) } #endif //CONFIG_80211N_HT - return; } void HT_info_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE) @@ -1734,8 +1998,117 @@ int check_ap_tdls_prohibited(u8 *pframe, u8 pkt_len) } #endif //CONFIG_TDLS +/* + * rtw_get_bcn_keys: get beacon keys from recv frame + * + * TODO: + * WLAN_EID_COUNTRY + * WLAN_EID_ERP_INFO + * WLAN_EID_CHANNEL_SWITCH + * WLAN_EID_PWR_CONSTRAINT + */ +int rtw_get_bcn_keys(ADAPTER *Adapter, u8 *pframe, u32 packet_len, + struct beacon_keys *recv_beacon) +{ + int left; + u16 capability; + unsigned char *pos; + struct rtw_ieee802_11_elems elems; + struct rtw_ieee80211_ht_cap *pht_cap = NULL; + struct HT_info_element *pht_info = NULL; + + _rtw_memset(recv_beacon, 0, sizeof(*recv_beacon)); + + /* checking capabilities */ + capability = le16_to_cpu(*(unsigned short *)(pframe + WLAN_HDR_A3_LEN + 10)); + + /* checking IEs */ + left = packet_len - sizeof(struct rtw_ieee80211_hdr_3addr) - _BEACON_IE_OFFSET_; + pos = pframe + sizeof(struct rtw_ieee80211_hdr_3addr) + _BEACON_IE_OFFSET_; + if (rtw_ieee802_11_parse_elems(pos, left, &elems, 1) == ParseFailed) + return _FALSE; + + /* check bw and channel offset */ + if (elems.ht_capabilities) { + if (elems.ht_capabilities_len != sizeof(*pht_cap)) + return _FALSE; + + pht_cap = (struct rtw_ieee80211_ht_cap *) elems.ht_capabilities; + recv_beacon->ht_cap_info = pht_cap->cap_info; + } + + if (elems.ht_operation) { + if (elems.ht_operation_len != sizeof(*pht_info)) + return _FALSE; + + pht_info = (struct HT_info_element *) elems.ht_operation; + recv_beacon->ht_info_infos_0_sco = pht_info->infos[0] & 0x03; + } + + /* Checking for channel */ + if (elems.ds_params && elems.ds_params_len == sizeof(recv_beacon->bcn_channel)) + _rtw_memcpy(&recv_beacon->bcn_channel, elems.ds_params, + sizeof(recv_beacon->bcn_channel)); + else if (pht_info) + /* In 5G, some ap do not have DSSET IE checking HT info for channel */ + recv_beacon->bcn_channel = pht_info->primary_channel; + else { + /* we don't find channel IE, so don't check it */ + //DBG_871X("Oops: %s we don't find channel IE, so don't check it \n", __func__); + recv_beacon->bcn_channel = Adapter->mlmeextpriv.cur_channel; + } + + /* checking SSID */ + if (elems.ssid) { + if (elems.ssid_len > sizeof(recv_beacon->ssid)) + return _FALSE; + + _rtw_memcpy(recv_beacon->ssid, elems.ssid, elems.ssid_len); + recv_beacon->ssid_len = elems.ssid_len; + } else; // means hidden ssid + + /* checking RSN first */ + if (elems.rsn_ie && elems.rsn_ie_len) { + recv_beacon->encryp_protocol = ENCRYP_PROTOCOL_WPA2; + rtw_parse_wpa2_ie(elems.rsn_ie - 2, elems.rsn_ie_len + 2, + &recv_beacon->group_cipher, &recv_beacon->pairwise_cipher, + &recv_beacon->is_8021x); + } + /* checking WPA secon */ + else if (elems.wpa_ie && elems.wpa_ie_len) { + recv_beacon->encryp_protocol = ENCRYP_PROTOCOL_WPA; + rtw_parse_wpa_ie(elems.wpa_ie - 2, elems.wpa_ie_len + 2, + &recv_beacon->group_cipher, &recv_beacon->pairwise_cipher, + &recv_beacon->is_8021x); + } + else if (capability & BIT(4)) { + recv_beacon->encryp_protocol = ENCRYP_PROTOCOL_WEP; + } + + return _TRUE; +} + +void rtw_dump_bcn_keys(struct beacon_keys *recv_beacon) +{ + int i; + char *p; + u8 ssid[IW_ESSID_MAX_SIZE + 1]; + + _rtw_memcpy(ssid, recv_beacon->ssid, recv_beacon->ssid_len); + ssid[recv_beacon->ssid_len] = '\0'; + + DBG_871X("%s: ssid = %s\n", __func__, ssid); + DBG_871X("%s: channel = %x\n", __func__, recv_beacon->bcn_channel); + DBG_871X("%s: ht_cap = %x\n", __func__, recv_beacon->ht_cap_info); + DBG_871X("%s: ht_info_infos_0_sco = %x\n", __func__, recv_beacon->ht_info_infos_0_sco); + DBG_871X("%s: sec=%d, group = %x, pair = %x, 8021X = %x\n", __func__, + recv_beacon->encryp_protocol, recv_beacon->group_cipher, + recv_beacon->pairwise_cipher, recv_beacon->is_8021x); +} + int rtw_check_bcn_info(ADAPTER *Adapter, u8 *pframe, u32 packet_len) { +#if 0 unsigned int len; unsigned char *p; unsigned short val16, subtype; @@ -1755,6 +2128,12 @@ int rtw_check_bcn_info(ADAPTER *Adapter, u8 *pframe, u32 packet_len) u32 bcn_channel; unsigned short ht_cap_info; unsigned char ht_info_infos_0; +#endif + unsigned int len; + u8 *pbssid = GetAddr3Ptr(pframe); + struct mlme_priv *pmlmepriv = &Adapter->mlmepriv; + struct wlan_network *cur_network = &(Adapter->mlmepriv.cur_network); + struct beacon_keys recv_beacon; if (is_client_associated_to_ap(Adapter) == _FALSE) return _TRUE; @@ -1772,12 +2151,90 @@ int rtw_check_bcn_info(ADAPTER *Adapter, u8 *pframe, u32 packet_len) return _TRUE; } + if (rtw_get_bcn_keys(Adapter, pframe, packet_len, &recv_beacon) == _FALSE) + return _TRUE; // parsing failed => broken IE + + // don't care hidden ssid, use current beacon ssid directly + if (recv_beacon.ssid_len == 0) { + _rtw_memcpy(recv_beacon.ssid, pmlmepriv->cur_beacon_keys.ssid, + pmlmepriv->cur_beacon_keys.ssid_len); + recv_beacon.ssid_len = pmlmepriv->cur_beacon_keys.ssid_len; + } + + if (_rtw_memcmp(&recv_beacon, &pmlmepriv->cur_beacon_keys, sizeof(recv_beacon)) == _TRUE) + { + pmlmepriv->new_beacon_cnts = 0; + } + else if ((pmlmepriv->new_beacon_cnts == 0) || + _rtw_memcmp(&recv_beacon, &pmlmepriv->new_beacon_keys, sizeof(recv_beacon)) == _FALSE) + { + DBG_871X_LEVEL(_drv_err_, "%s: start new beacon (seq=%d)\n", __func__, GetSequence(pframe)); + + if (pmlmepriv->new_beacon_cnts == 0) { + DBG_871X_LEVEL(_drv_err_, "%s: cur beacon key\n", __func__); + DBG_871X_EXP(_drv_err_, rtw_dump_bcn_keys(&pmlmepriv->cur_beacon_keys)); + } + + DBG_871X_LEVEL(_drv_err_, "%s: new beacon key\n", __func__); + DBG_871X_EXP(_drv_err_, rtw_dump_bcn_keys(&recv_beacon)); + + memcpy(&pmlmepriv->new_beacon_keys, &recv_beacon, sizeof(recv_beacon)); + pmlmepriv->new_beacon_cnts = 1; + } + else + { + DBG_871X_LEVEL(_drv_err_, "%s: new beacon again (seq=%d)\n", __func__, GetSequence(pframe)); + pmlmepriv->new_beacon_cnts++; + } + + // if counter >= max, it means beacon is changed really + if (pmlmepriv->new_beacon_cnts >= new_bcn_max) + { + DBG_871X_LEVEL(_drv_err_, "%s: new beacon occur!!\n", __func__); + + // check bw mode change only? + pmlmepriv->cur_beacon_keys.ht_cap_info = recv_beacon.ht_cap_info; + pmlmepriv->cur_beacon_keys.ht_info_infos_0_sco = recv_beacon.ht_info_infos_0_sco; + + if (_rtw_memcmp(&recv_beacon, &pmlmepriv->cur_beacon_keys, + sizeof(recv_beacon)) == _FALSE) { + // beacon is changed, have to do disconnect/connect + return _FAIL; + } + + DBG_871X("%s bw mode change\n", __func__); + DBG_871X("%s bcn now: ht_cap_info:%x ht_info_infos_0:%x\n", __func__, + cur_network->BcnInfo.ht_cap_info, + cur_network->BcnInfo.ht_info_infos_0); + + cur_network->BcnInfo.ht_cap_info = recv_beacon.ht_cap_info; + cur_network->BcnInfo.ht_info_infos_0 = + (cur_network->BcnInfo.ht_info_infos_0 & (~0x03)) | + recv_beacon.ht_info_infos_0_sco; + + DBG_871X("%s bcn link: ht_cap_info:%x ht_info_infos_0:%x\n", __func__, + cur_network->BcnInfo.ht_cap_info, + cur_network->BcnInfo.ht_info_infos_0); + + memcpy(&pmlmepriv->cur_beacon_keys, &recv_beacon, sizeof(recv_beacon)); + pmlmepriv->new_beacon_cnts = 0; + } + + return _SUCCESS; + +#if 0 bssid = (WLAN_BSSID_EX *)rtw_zmalloc(sizeof(WLAN_BSSID_EX)); if (bssid == NULL) { DBG_871X("%s rtw_zmalloc fail !!!\n", __func__); return _TRUE; } + if ((pmlmepriv->timeBcnInfoChkStart != 0) && (rtw_get_passing_time_ms(pmlmepriv->timeBcnInfoChkStart) > DISCONNECT_BY_CHK_BCN_FAIL_OBSERV_PERIOD_IN_MS)) + { + pmlmepriv->timeBcnInfoChkStart = 0; + pmlmepriv->NumOfBcnInfoChkFail = 0; + } + subtype = GetFrameSubType(pframe) >> 4; if(subtype==WIFI_BEACON) @@ -1812,7 +2269,7 @@ int rtw_check_bcn_info(ADAPTER *Adapter, u8 *pframe, u32 packet_len) ht_cap_info, ht_info_infos_0); DBG_871X("%s bcn link: ht_cap_info:%x ht_info_infos_0:%x\n", __func__, cur_network->BcnInfo.ht_cap_info, cur_network->BcnInfo.ht_info_infos_0); - DBG_871X("%s bw mode change, disconnect\n", __func__); + DBG_871X("%s bw mode change\n", __func__); { //bcn_info_update cur_network->BcnInfo.ht_cap_info = ht_cap_info; @@ -1865,7 +2322,7 @@ int rtw_check_bcn_info(ADAPTER *Adapter, u8 *pframe, u32 packet_len) if (_rtw_memcmp(bssid->Ssid.Ssid, cur_network->network.Ssid.Ssid, 32) == _FALSE || bssid->Ssid.SsidLength != cur_network->network.Ssid.SsidLength) { if (bssid->Ssid.Ssid[0] != '\0' && bssid->Ssid.SsidLength != 0) { /* not hidden ssid */ - DBG_871X("%s(), SSID is not match return FAIL\n", __func__); + DBG_871X("%s(), SSID is not match\n", __func__); goto _mismatch; } } @@ -1882,7 +2339,7 @@ int rtw_check_bcn_info(ADAPTER *Adapter, u8 *pframe, u32 packet_len) ("%s(): cur_network->network.Privacy is %d, bssid.Privacy is %d\n", __func__, cur_network->network.Privacy,bssid->Privacy)); if (cur_network->network.Privacy != bssid->Privacy) { - DBG_871X("%s(), privacy is not match return FAIL\n",__func__); + DBG_871X("%s(), privacy is not match\n",__func__); goto _mismatch; } @@ -1898,7 +2355,7 @@ int rtw_check_bcn_info(ADAPTER *Adapter, u8 *pframe, u32 packet_len) } if (cur_network->BcnInfo.encryp_protocol != encryp_protocol) { - DBG_871X("%s(): enctyp is not match ,return FAIL\n",__func__); + DBG_871X("%s(): enctyp is not match\n",__func__); goto _mismatch; } @@ -1925,14 +2382,14 @@ int rtw_check_bcn_info(ADAPTER *Adapter, u8 *pframe, u32 packet_len) RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_, ("%s cur_network->group_cipher is %d: %d\n",__func__, cur_network->BcnInfo.group_cipher, group_cipher)); if (pairwise_cipher != cur_network->BcnInfo.pairwise_cipher || group_cipher != cur_network->BcnInfo.group_cipher) { - DBG_871X("%s pairwise_cipher(%x:%x) or group_cipher(%x:%x) is not match ,return FAIL\n",__func__, + DBG_871X("%s pairwise_cipher(%x:%x) or group_cipher(%x:%x) is not match\n",__func__, pairwise_cipher, cur_network->BcnInfo.pairwise_cipher, group_cipher, cur_network->BcnInfo.group_cipher); goto _mismatch; } if (is_8021x != cur_network->BcnInfo.is_8021x) { - DBG_871X("%s authentication is not match ,return FAIL\n", __func__); + DBG_871X("%s authentication is not match\n", __func__); goto _mismatch; } } @@ -1942,7 +2399,27 @@ int rtw_check_bcn_info(ADAPTER *Adapter, u8 *pframe, u32 packet_len) _mismatch: rtw_mfree((u8 *)bssid, sizeof(WLAN_BSSID_EX)); - return _FAIL; + + if (pmlmepriv->NumOfBcnInfoChkFail == 0) + { + pmlmepriv->timeBcnInfoChkStart = rtw_get_current_time(); + } + + pmlmepriv->NumOfBcnInfoChkFail++; + DBG_871X("%s by "ADPT_FMT" - NumOfChkFail = %d (SeqNum of this Beacon frame = %d).\n", __func__, ADPT_ARG(Adapter), pmlmepriv->NumOfBcnInfoChkFail, GetSequence(pframe)); + + if ((pmlmepriv->timeBcnInfoChkStart != 0) && (rtw_get_passing_time_ms(pmlmepriv->timeBcnInfoChkStart) <= DISCONNECT_BY_CHK_BCN_FAIL_OBSERV_PERIOD_IN_MS) + && (pmlmepriv->NumOfBcnInfoChkFail >= DISCONNECT_BY_CHK_BCN_FAIL_THRESHOLD)) + { + DBG_871X("%s by "ADPT_FMT" - NumOfChkFail = %d >= threshold : %d (in %d ms), return FAIL.\n", __func__, ADPT_ARG(Adapter), pmlmepriv->NumOfBcnInfoChkFail, + DISCONNECT_BY_CHK_BCN_FAIL_THRESHOLD, rtw_get_passing_time_ms(pmlmepriv->timeBcnInfoChkStart)); + pmlmepriv->timeBcnInfoChkStart = 0; + pmlmepriv->NumOfBcnInfoChkFail = 0; + return _FAIL; + } + + return _SUCCESS; +#endif } void update_beacon_info(_adapter *padapter, u8 *pframe, uint pkt_len, struct sta_info *psta) @@ -2878,118 +3355,278 @@ void beacon_timing_control(_adapter *padapter) rtw_hal_bcn_related_reg_setting(padapter); } -uint rtw_get_camid(uint macid) +#define CONFIG_SHARED_BMC_MACID + +void dump_macid_map(void *sel, struct macid_bmp *map, u8 max_num) { - uint camid; + DBG_871X_SEL_NL(sel, "0x%08x\n", map->m0); +#if (MACID_NUM_SW_LIMIT > 32) + if (max_num && max_num > 32) + DBG_871X_SEL_NL(sel, "0x%08x\n", map->m1); +#endif +#if (MACID_NUM_SW_LIMIT > 64) + if (max_num && max_num > 64) + DBG_871X_SEL_NL(sel, "0x%08x\n", map->m2); +#endif +#if (MACID_NUM_SW_LIMIT > 96) + if (max_num && max_num > 96) + DBG_871X_SEL_NL(sel, "0x%08x\n", map->m3); +#endif +} - //camid 0, 1, 2, 3 is default entry for default key/group key - //macid = 1 is for bc/mc stainfo, no mapping to camid - //macid = 0 mapping to camid 4 - //for macid >=2, camid = macid+3; - - if(macid==0) - camid = 4; - else if(macid >=2) - camid = macid + 3; +inline bool rtw_macid_is_set(struct macid_bmp *map, u8 id) +{ + if (id < 32) + return (map->m0 & BIT(id)); +#if (MACID_NUM_SW_LIMIT > 32) + else if (id < 64) + return (map->m1 & BIT(id-32)); +#endif +#if (MACID_NUM_SW_LIMIT > 64) + else if (id < 96) + return (map->m2 & BIT(id-64)); +#endif +#if (MACID_NUM_SW_LIMIT > 96) + else if (id < 128) + return (map->m3 & BIT(id-96)); +#endif else - camid = 4; + rtw_warn_on(1); - return camid; + return 0; +} + +inline void rtw_macid_map_set(struct macid_bmp *map, u8 id) +{ + if (id < 32) + map->m0 |= BIT(id); +#if (MACID_NUM_SW_LIMIT > 32) + else if (id < 64) + map->m1 |= BIT(id-32); +#endif +#if (MACID_NUM_SW_LIMIT > 64) + else if (id < 96) + map->m2 |= BIT(id-64); +#endif +#if (MACID_NUM_SW_LIMIT > 96) + else if (id < 128) + map->m3 |= BIT(id-96); +#endif + else + rtw_warn_on(1); +} + +inline void rtw_macid_map_clr(struct macid_bmp *map, u8 id) +{ + if (id < 32) + map->m0 &= ~BIT(id); +#if (MACID_NUM_SW_LIMIT > 32) + else if (id < 64) + map->m1 &= ~BIT(id-32); +#endif +#if (MACID_NUM_SW_LIMIT > 64) + else if (id < 96) + map->m2 &= ~BIT(id-64); +#endif +#if (MACID_NUM_SW_LIMIT > 96) + else if (id < 128) + map->m3 &= ~BIT(id-96); +#endif + else + rtw_warn_on(1); +} + +inline bool rtw_macid_is_used(struct macid_ctl_t *macid_ctl, u8 id) +{ + return rtw_macid_is_set(&macid_ctl->used, id); +} + +inline bool rtw_macid_is_bmc(struct macid_ctl_t *macid_ctl, u8 id) +{ + return rtw_macid_is_set(&macid_ctl->bmc, id); +} + +inline s8 rtw_macid_get_if_g(struct macid_ctl_t *macid_ctl, u8 id) +{ + int i; + +#ifdef CONFIG_SHARED_BMC_MACID + if (rtw_macid_is_bmc(macid_ctl,id)) + return -1; +#endif + + for (i=0;iif_g[i], id)) + return i; + } + return -1; +} + +inline s8 rtw_macid_get_ch_g(struct macid_ctl_t *macid_ctl, u8 id) +{ + int i; + + for (i=0;i<2;i++) { + if (rtw_macid_is_set(&macid_ctl->ch_g[i], id)) + return i; + } + return -1; } void rtw_alloc_macid(_adapter *padapter, struct sta_info *psta) { int i; - _irqL irqL; + _irqL irqL; u8 bc_addr[ETH_ALEN] = {0xff,0xff,0xff,0xff,0xff,0xff}; - struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter); + struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); + struct macid_ctl_t *macid_ctl = dvobj_to_macidctl(dvobj); + struct macid_bmp *used_map = &macid_ctl->used; + //static u8 last_id = 0; /* for testing */ + u8 last_id = 0; - - if(_rtw_memcmp(psta->hwaddr, bc_addr, ETH_ALEN)) - return; - - if(_rtw_memcmp(psta->hwaddr, myid(&padapter->eeprompriv), ETH_ALEN)) - { - psta->mac_id = NUM_STA; + if (_rtw_memcmp(psta->hwaddr, myid(&padapter->eeprompriv), ETH_ALEN)) { + psta->mac_id = macid_ctl->num; return; } - _enter_critical_bh(&pdvobj->lock, &irqL); - for(i=0; imacid[i] == _FALSE) - { - pdvobj->macid[i] = _TRUE; +#ifdef CONFIG_SHARED_BMC_MACID + if(_rtw_memcmp(psta->hwaddr, bc_addr, ETH_ALEN)) { + /* use shared broadcast & multicast macid 1 */ + _enter_critical_bh(&macid_ctl->lock, &irqL); + rtw_macid_map_set(used_map, 1); + rtw_macid_map_set(&macid_ctl->bmc, 1); + for (i=0;iif_g[padapter->iface_id], 1); + /* TODO ch_g? */ + _exit_critical_bh(&macid_ctl->lock, &irqL); + i = 1; + goto assigned; + } +#endif + + _enter_critical_bh(&macid_ctl->lock, &irqL); + + for (i=last_id;inum;i++) { + #ifdef CONFIG_SHARED_BMC_MACID + if (i == 1) + continue; + #endif + if (!rtw_macid_is_used(macid_ctl, i)) break; - } - } - _exit_critical_bh(&pdvobj->lock, &irqL); - - if( i > (NUM_STA-1)) - { - psta->mac_id = NUM_STA; - DBG_871X(" no room for more MACIDs\n"); - } - else - { - psta->mac_id = i; - DBG_871X("%s = %d\n", __FUNCTION__, psta->mac_id); } + if (i < macid_ctl->num) { + + rtw_macid_map_set(used_map, i); + + if(_rtw_memcmp(psta->hwaddr, bc_addr, ETH_ALEN)) + rtw_macid_map_set(&macid_ctl->bmc, i); + + rtw_macid_map_set(&macid_ctl->if_g[padapter->iface_id], i); + + /* TODO ch_g? */ + + last_id++; + last_id %= macid_ctl->num; + } + + _exit_critical_bh(&macid_ctl->lock, &irqL); + + if (i >= macid_ctl->num) { + psta->mac_id = macid_ctl->num; + DBG_871X_LEVEL(_drv_err_, FUNC_ADPT_FMT" if%u, hwaddr:"MAC_FMT" no available macid\n" + , FUNC_ADPT_ARG(padapter), padapter->iface_id+1, MAC_ARG(psta->hwaddr)); + rtw_warn_on(1); + goto exit; + } else { + goto assigned; + } + +assigned: + psta->mac_id = i; + DBG_871X(FUNC_ADPT_FMT" if%u, hwaddr:"MAC_FMT" macid:%u\n" + , FUNC_ADPT_ARG(padapter), padapter->iface_id+1, MAC_ARG(psta->hwaddr), psta->mac_id); + +exit: + return; } void rtw_release_macid(_adapter *padapter, struct sta_info *psta) { - int i; - _irqL irqL; + _irqL irqL; u8 bc_addr[ETH_ALEN] = {0xff,0xff,0xff,0xff,0xff,0xff}; - struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter); + struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); + struct macid_ctl_t *macid_ctl = dvobj_to_macidctl(dvobj); + if(_rtw_memcmp(psta->hwaddr, myid(&padapter->eeprompriv), ETH_ALEN)) + return; +#ifdef CONFIG_SHARED_BMC_MACID if(_rtw_memcmp(psta->hwaddr, bc_addr, ETH_ALEN)) return; - if(_rtw_memcmp(psta->hwaddr, myid(&padapter->eeprompriv), ETH_ALEN)) - { + if (psta->mac_id == 1) { + DBG_871X_LEVEL(_drv_err_, FUNC_ADPT_FMT" if%u, hwaddr:"MAC_FMT" with macid:%u\n" + , FUNC_ADPT_ARG(padapter), padapter->iface_id+1, MAC_ARG(psta->hwaddr), psta->mac_id); + rtw_warn_on(1); return; } +#endif - _enter_critical_bh(&pdvobj->lock, &irqL); - if(psta->mac_idmac_id !=1 ) - { - if(pdvobj->macid[psta->mac_id] == _TRUE) - { - DBG_871X("%s = %d\n", __FUNCTION__, psta->mac_id); - pdvobj->macid[psta->mac_id] = _FALSE; - psta->mac_id = NUM_STA; + _enter_critical_bh(&macid_ctl->lock, &irqL); + + if (psta->mac_id < macid_ctl->num) { + int i; + + if (!rtw_macid_is_used(macid_ctl, psta->mac_id)) { + DBG_871X_LEVEL(_drv_err_, FUNC_ADPT_FMT" if%u, hwaddr:"MAC_FMT" macid:%u not used\n" + , FUNC_ADPT_ARG(padapter), padapter->iface_id+1, MAC_ARG(psta->hwaddr), psta->mac_id); + rtw_warn_on(1); } + rtw_macid_map_clr(&macid_ctl->used, psta->mac_id); + rtw_macid_map_clr(&macid_ctl->bmc, psta->mac_id); + for (i=0;iif_g[i], psta->mac_id); + for (i=0;i<2;i++) + rtw_macid_map_clr(&macid_ctl->ch_g[i], psta->mac_id); } - _exit_critical_bh(&pdvobj->lock, &irqL); + _exit_critical_bh(&macid_ctl->lock, &irqL); + + psta->mac_id = macid_ctl->num; } + //For 8188E RA u8 rtw_search_max_mac_id(_adapter *padapter) { u8 max_mac_id=0; - struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter); + struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); + struct macid_ctl_t *macid_ctl = dvobj_to_macidctl(dvobj); int i; - _irqL irqL; - _enter_critical_bh(&pdvobj->lock, &irqL); - for(i=(NUM_STA-1); i>=0 ; i--) - { - if(pdvobj->macid[i] == _TRUE) - { + _irqL irqL; + + _enter_critical_bh(&macid_ctl->lock, &irqL); + for(i=(macid_ctl->num-1); i>0 ; i--) { + if (!rtw_macid_is_used(macid_ctl, i)) break; - } } + _exit_critical_bh(&macid_ctl->lock, &irqL); max_mac_id = i; - _exit_critical_bh(&pdvobj->lock, &irqL); return max_mac_id; - } +inline void rtw_macid_ctl_init(struct macid_ctl_t *macid_ctl) +{ + _rtw_spinlock_init(&macid_ctl->lock); +} + +inline void rtw_macid_ctl_deinit(struct macid_ctl_t *macid_ctl) +{ + _rtw_spinlock_free(&macid_ctl->lock); +} + #if 0 unsigned int setup_beacon_frame(_adapter *padapter, unsigned char *beacon_frame) { @@ -3164,48 +3801,49 @@ _adapter *dvobj_get_port0_adapter(struct dvobj_priv *dvobj) /* * Description: - * dump_TX_FIFO: This is only used to dump TX_FIFO for debug WoW mode offload - * contant. + * rtw_check_invalid_mac_address: + * This is only used for checking mac address valid or not. * * Input: - * adapter: adapter pointer. - * page_num: The max. page number that user want to dump. - * page_size: page size of each page. eg. 128 bytes, 256 bytes. + * adapter: mac_address pointer. + * + * Output: + * _TRUE: The mac address is invalid. + * _FALSE: The mac address is valid. + * + * Auther: Isaac.Li */ -void dump_TX_FIFO(_adapter* padapter, u8 page_num, u16 page_size){ +u8 rtw_check_invalid_mac_address(u8 *mac_addr) { + u8 null_mac_addr[ETH_ALEN] = {0, 0, 0, 0, 0, 0}; + u8 multi_mac_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + u8 res = _FALSE; - int i; - u8 val = 0; - u8 base = 0; - u32 addr = 0; - u32 count = (page_size / 8); - - if (page_num <= 0) { - DBG_871X("!!%s: incorrect input page_num paramter!\n", __func__); - return; + if (_rtw_memcmp(mac_addr, null_mac_addr, ETH_ALEN)) { + res = _TRUE; + goto func_exit; } - if (page_size < 128 || page_size > 256) { - DBG_871X("!!%s: incorrect input page_size paramter!\n", __func__); - return; + if (_rtw_memcmp(mac_addr, multi_mac_addr, ETH_ALEN)) { + res = _TRUE; + goto func_exit; } - DBG_871X("+%s+\n", __func__); - val = rtw_read8(padapter, 0x106); - rtw_write8(padapter, 0x106, 0x69); - DBG_871X("0x106: 0x%02x\n", val); - base = rtw_read8(padapter, 0x209); - DBG_871X("0x209: 0x%02x\n", base); - - addr = ((base) * page_size)/8; - for (i = 0 ; i < page_num * count ; i+=2) { - rtw_write32(padapter, 0x140, addr + i); - printk(" %08x %08x ", rtw_read32(padapter, 0x144), rtw_read32(padapter, 0x148)); - rtw_write32(padapter, 0x140, addr + i + 1); - printk(" %08x %08x \n", rtw_read32(padapter, 0x144), rtw_read32(padapter, 0x148)); + if (mac_addr[0] & BIT0) { + res = _TRUE; + goto func_exit; } + + if (mac_addr[0] & BIT1) { + res = _TRUE; + goto func_exit; + } + +func_exit: + return res; } + + #if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) void rtw_get_current_ip_address(PADAPTER padapter, u8 *pcurrentip) { @@ -3411,9 +4049,13 @@ int rtw_dev_nlo_info_set(struct pno_nlo_info *nlo_info, pno_ssid_t* ssid, nlo_info->fast_scan_period = pno_time; nlo_info->ssid_num = num & BIT_LEN_MASK_32(8); + nlo_info->hidden_ssid_num = num & BIT_LEN_MASK_32(8); nlo_info->slow_scan_period = (pno_time * 2); nlo_info->fast_scan_iterations = 5; + if (nlo_info->hidden_ssid_num > 8) + nlo_info->hidden_ssid_num = 8; + //TODO: channel list and probe index is all empty. for (i = 0 ; i < num ; i++) { nlo_info->ssid_length[i] @@ -3463,6 +4105,7 @@ int rtw_dev_ssid_list_set(struct pno_ssid_list *pno_ssid_list, for (i = 0 ; i < num ; i++) { _rtw_memcpy(&pno_ssid_list->node[i].SSID, ssid[i].SSID, ssid[i].SSID_len); + pno_ssid_list->node[i].SSID_len = ssid[i].SSID_len; } return 0; } @@ -3529,9 +4172,12 @@ int rtw_dev_pno_set(struct net_device *net, pno_ssid_t* ssid, int num, pwrctl->pscan_info == NULL || pwrctl->pno_ssid_list == NULL){ DBG_871X("%s, ERROR: alloc nlo_info, ssid_list, scan_info fail\n", __func__); - return -1; + goto failing; } + pwrctl->pno_in_resume = _FALSE; + + pwrctl->pno_inited = _TRUE; /* NLO Info */ ret = rtw_dev_nlo_info_set(pwrctl->pnlo_info, ssid, num, pno_time, pno_repeat, pno_freq_expo_max); @@ -3547,6 +4193,22 @@ int rtw_dev_pno_set(struct net_device *net, pno_ssid_t* ssid, int num, __func__, num, pno_time, pno_repeat, pno_freq_expo_max); return 0; + +failing: + if (pwrctl->pnlo_info) { + rtw_mfree((u8 *)pwrctl->pnlo_info, sizeof(pno_nlo_info_t)); + pwrctl->pnlo_info = NULL; + } + if (pwrctl->pno_ssid_list) { + rtw_mfree((u8 *)pwrctl->pno_ssid_list, sizeof(pno_ssid_list_t)); + pwrctl->pno_ssid_list = NULL; + } + if (pwrctl->pscan_info) { + rtw_mfree((u8 *)pwrctl->pscan_info, sizeof(pno_scan_info_t)); + pwrctl->pscan_info = NULL; + } + + return -1; } #ifdef CONFIG_PNO_SET_DEBUG diff --git a/core/rtw_xmit.c b/core/rtw_xmit.c index a501d42..cb9f6ae 100644 --- a/core/rtw_xmit.c +++ b/core/rtw_xmit.c @@ -68,9 +68,7 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, _adapter *padapter) struct xmit_buf *pxmitbuf; struct xmit_frame *pxframe; sint res=_SUCCESS; - u32 max_xmit_extbuf_size = MAX_XMIT_EXTBUF_SZ; - u32 num_xmit_extbuf = NR_XMIT_EXTBUFF; - + _func_enter_; // We don't need to memset padapter->XXX to zero, because adapter is allocated by rtw_zvmalloc(). @@ -201,7 +199,7 @@ _func_enter_; /* init xframe_ext queue, the same count as extbuf */ _rtw_init_queue(&pxmitpriv->free_xframe_ext_queue); - pxmitpriv->xframe_ext_alloc_addr = rtw_zvmalloc(num_xmit_extbuf * sizeof(struct xmit_frame) + 4); + pxmitpriv->xframe_ext_alloc_addr = rtw_zvmalloc(NR_XMIT_EXTBUFF * sizeof(struct xmit_frame) + 4); if (pxmitpriv->xframe_ext_alloc_addr == NULL){ pxmitpriv->xframe_ext = NULL; @@ -212,7 +210,7 @@ _func_enter_; pxmitpriv->xframe_ext = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(pxmitpriv->xframe_ext_alloc_addr), 4); pxframe = (struct xmit_frame*)pxmitpriv->xframe_ext; - for (i = 0; i < num_xmit_extbuf; i++) { + for (i = 0; i < NR_XMIT_EXTBUFF; i++) { _rtw_init_listhead(&(pxframe->list)); pxframe->padapter = padapter; @@ -229,12 +227,12 @@ _func_enter_; pxframe++; } - pxmitpriv->free_xframe_ext_cnt = num_xmit_extbuf; + pxmitpriv->free_xframe_ext_cnt = NR_XMIT_EXTBUFF; // Init xmit extension buff _rtw_init_queue(&pxmitpriv->free_xmit_extbuf_queue); - pxmitpriv->pallocated_xmit_extbuf = rtw_zvmalloc(num_xmit_extbuf * sizeof(struct xmit_buf) + 4); + pxmitpriv->pallocated_xmit_extbuf = rtw_zvmalloc(NR_XMIT_EXTBUFF * sizeof(struct xmit_buf) + 4); if (pxmitpriv->pallocated_xmit_extbuf == NULL){ RT_TRACE(_module_rtl871x_xmit_c_,_drv_err_,("alloc xmit_extbuf fail!\n")); @@ -246,7 +244,7 @@ _func_enter_; pxmitbuf = (struct xmit_buf*)pxmitpriv->pxmit_extbuf; - for (i = 0; i < num_xmit_extbuf; i++) + for (i = 0; i < NR_XMIT_EXTBUFF; i++) { _rtw_init_listhead(&pxmitbuf->list); @@ -254,14 +252,14 @@ _func_enter_; pxmitbuf->padapter = padapter; pxmitbuf->buf_tag = XMITBUF_MGNT; - if((res=rtw_os_xmit_resource_alloc(padapter, pxmitbuf,max_xmit_extbuf_size + XMITBUF_ALIGN_SZ, _TRUE)) == _FAIL) { + if((res=rtw_os_xmit_resource_alloc(padapter, pxmitbuf,MAX_XMIT_EXTBUF_SZ + XMITBUF_ALIGN_SZ, _TRUE)) == _FAIL) { res= _FAIL; goto exit; } #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) pxmitbuf->phead = pxmitbuf->pbuf; - pxmitbuf->pend = pxmitbuf->pbuf + max_xmit_extbuf_size; + pxmitbuf->pend = pxmitbuf->pbuf + MAX_XMIT_EXTBUF_SZ; pxmitbuf->len = 0; pxmitbuf->pdata = pxmitbuf->ptail = pxmitbuf->phead; #endif @@ -274,29 +272,30 @@ _func_enter_; } - pxmitpriv->free_xmit_extbuf_cnt = num_xmit_extbuf; + pxmitpriv->free_xmit_extbuf_cnt = NR_XMIT_EXTBUFF; + for (i = 0; ipcmd_xmitbuf[i]; + if (pxmitbuf) { + _rtw_init_listhead(&pxmitbuf->list); - pxmitbuf = &pxmitpriv->pcmd_xmitbuf; - if (pxmitbuf) { - _rtw_init_listhead(&pxmitbuf->list); + pxmitbuf->priv_data = NULL; + pxmitbuf->padapter = padapter; + pxmitbuf->buf_tag = XMITBUF_CMD; - pxmitbuf->priv_data = NULL; - pxmitbuf->padapter = padapter; - pxmitbuf->buf_tag = XMITBUF_CMD; - - if((res=rtw_os_xmit_resource_alloc(padapter, pxmitbuf, MAX_CMDBUF_SZ+XMITBUF_ALIGN_SZ, _TRUE)) == _FAIL) { - res= _FAIL; - goto exit; - } + if((res=rtw_os_xmit_resource_alloc(padapter, pxmitbuf, MAX_CMDBUF_SZ+XMITBUF_ALIGN_SZ, _TRUE)) == _FAIL) { + res= _FAIL; + goto exit; + } #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) - pxmitbuf->phead = pxmitbuf->pbuf; - pxmitbuf->pend = pxmitbuf->pbuf + MAX_CMDBUF_SZ; - pxmitbuf->len = 0; - pxmitbuf->pdata = pxmitbuf->ptail = pxmitbuf->phead; + pxmitbuf->phead = pxmitbuf->pbuf; + pxmitbuf->pend = pxmitbuf->pbuf + MAX_CMDBUF_SZ; + pxmitbuf->len = 0; + pxmitbuf->pdata = pxmitbuf->ptail = pxmitbuf->phead; #endif - pxmitbuf->alloc_sz = MAX_CMDBUF_SZ+XMITBUF_ALIGN_SZ; + pxmitbuf->alloc_sz = MAX_CMDBUF_SZ+XMITBUF_ALIGN_SZ; + } } rtw_alloc_hwxmits(padapter); @@ -363,15 +362,7 @@ void _rtw_free_xmit_priv (struct xmit_priv *pxmitpriv) _adapter *padapter = pxmitpriv->adapter; struct xmit_frame *pxmitframe = (struct xmit_frame*) pxmitpriv->pxmit_frame_buf; struct xmit_buf *pxmitbuf = (struct xmit_buf *)pxmitpriv->pxmitbuf; - u32 max_xmit_extbuf_size = MAX_XMIT_EXTBUF_SZ; - u32 num_xmit_extbuf = NR_XMIT_EXTBUFF; -#if defined(CONFIG_MP_INCLUDED) && (defined(CONFIG_RTL8723A) ||defined(CONFIG_RTL8723B)) - if (padapter->registrypriv.mp_mode) { - max_xmit_extbuf_size = 20000; - num_xmit_extbuf = 1; - } -#endif - + _func_enter_; rtw_hal_free_xmit_priv(padapter); @@ -406,33 +397,35 @@ void _rtw_free_xmit_priv (struct xmit_priv *pxmitpriv) /* free xframe_ext queue, the same count as extbuf */ if ((pxmitframe = (struct xmit_frame*)pxmitpriv->xframe_ext)) { - for (i=0; ixframe_ext_alloc_addr) - rtw_vmfree(pxmitpriv->xframe_ext_alloc_addr, num_xmit_extbuf * sizeof(struct xmit_frame) + 4); + rtw_vmfree(pxmitpriv->xframe_ext_alloc_addr, NR_XMIT_EXTBUFF * sizeof(struct xmit_frame) + 4); _rtw_spinlock_free(&pxmitpriv->free_xframe_ext_queue.lock); // free xmit extension buff _rtw_spinlock_free(&pxmitpriv->free_xmit_extbuf_queue.lock); pxmitbuf = (struct xmit_buf *)pxmitpriv->pxmit_extbuf; - for(i=0; ipallocated_xmit_extbuf) { - rtw_vmfree(pxmitpriv->pallocated_xmit_extbuf, num_xmit_extbuf * sizeof(struct xmit_buf) + 4); + rtw_vmfree(pxmitpriv->pallocated_xmit_extbuf, NR_XMIT_EXTBUFF * sizeof(struct xmit_buf) + 4); } - pxmitbuf = &pxmitpriv->pcmd_xmitbuf; - if(pxmitbuf!=NULL) - rtw_os_xmit_resource_free(padapter, pxmitbuf, MAX_CMDBUF_SZ+XMITBUF_ALIGN_SZ , _TRUE); + for (i=0; ipcmd_xmitbuf[i]; + if(pxmitbuf!=NULL) + rtw_os_xmit_resource_free(padapter, pxmitbuf, MAX_CMDBUF_SZ+XMITBUF_ALIGN_SZ , _TRUE); + } rtw_free_hwxmits(padapter); @@ -455,7 +448,6 @@ u8 query_ra_short_GI(struct sta_info *psta) if (psta->vhtpriv.vht_option) { sgi_80m= psta->vhtpriv.sgi_80m; } - else #endif //CONFIG_80211AC_VHT { sgi_20m = psta->htpriv.sgi_20m; @@ -612,23 +604,38 @@ static void update_attrib_vcs_info(_adapter *padapter, struct xmit_frame *pxmitf break; } } + + //for debug : force driver control vrtl_carrier_sense. + if(padapter->driver_vcs_en==1) + { + //u8 driver_vcs_en; //Enable=1, Disable=0 driver control vrtl_carrier_sense. + //u8 driver_vcs_type;//force 0:disable VCS, 1:RTS-CTS, 2:CTS-to-self when vcs_en=1. + pattrib->vcs_mode = padapter->driver_vcs_type; + } + } -static void update_attrib_phy_info(struct pkt_attrib *pattrib, struct sta_info *psta) +static void update_attrib_phy_info(_adapter *padapter, struct pkt_attrib *pattrib, struct sta_info *psta) { + struct mlme_ext_priv *mlmeext = &padapter->mlmeextpriv; + pattrib->rtsen = psta->rtsen; pattrib->cts2self = psta->cts2self; pattrib->mdata = 0; pattrib->eosp = 0; pattrib->triggered=0; + pattrib->ampdu_spacing = 0; //qos_en, ht_en, init rate, ,bw, ch_offset, sgi pattrib->qos_en = psta->qos_option; pattrib->raid = psta->raid; - pattrib->bwmode = psta->bw_mode; + if (mlmeext->cur_bwmode < psta->bw_mode) + pattrib->bwmode = mlmeext->cur_bwmode; + else + pattrib->bwmode = psta->bw_mode; pattrib->sgi = query_ra_short_GI(psta); @@ -639,6 +646,11 @@ static void update_attrib_phy_info(struct pkt_attrib *pattrib, struct sta_info * pattrib->ht_en = psta->htpriv.ht_option; pattrib->ch_offset = psta->htpriv.ch_offset; pattrib->ampdu_en = _FALSE; + + if(padapter->driver_ampdu_spacing != 0xFF) //driver control AMPDU Density for peer sta's rx + pattrib->ampdu_spacing = padapter->driver_ampdu_spacing; + else + pattrib->ampdu_spacing = psta->htpriv.rx_ampdu_min_spacing; #endif //CONFIG_80211N_HT //if(pattrib->ht_en && psta->htpriv.ampdu_enable) //{ @@ -792,7 +804,7 @@ static s32 update_attrib_sec_info(_adapter *padapter, struct pkt_attrib *pattrib RT_TRACE(_module_rtl871x_xmit_c_,_drv_info_,("update_attrib: bswenc=_FALSE\n")); } -#ifdef CONFIG_CONCURRENT_MODE +#if defined(CONFIG_CONCURRENT_MODE) && !defined(DYNAMIC_CAMID_ALLOC) if((pattrib->encrypt && bmcast) || (pattrib->encrypt ==_WEP40_) || (pattrib->encrypt ==_WEP104_)) { pattrib->bswenc = _TRUE;//force using sw enc. @@ -941,7 +953,7 @@ s32 update_tdls_attrib(_adapter *padapter, struct pkt_attrib *pattrib) goto exit; } - update_attrib_phy_info(pattrib, psta); + update_attrib_phy_info(padapter, pattrib, psta); exit: @@ -967,6 +979,8 @@ static s32 update_attrib(_adapter *padapter, _pkt *pkt, struct pkt_attrib *pattr _func_enter_; + DBG_COUNTER(padapter->tx_logs.core_tx_upd_attrib); + _rtw_open_pktfile(pkt, &pktfile); i = _rtw_pktfile_read(&pktfile, (u8*)ðerhdr, ETH_HLEN); @@ -980,16 +994,21 @@ static s32 update_attrib(_adapter *padapter, _pkt *pkt, struct pkt_attrib *pattr if ((check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == _TRUE) || (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == _TRUE)) { _rtw_memcpy(pattrib->ra, pattrib->dst, ETH_ALEN); - _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN); + _rtw_memcpy(pattrib->ta, myid(&padapter->eeprompriv), ETH_ALEN); + DBG_COUNTER(padapter->tx_logs.core_tx_upd_attrib_adhoc); } else if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { _rtw_memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN); - _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN); + _rtw_memcpy(pattrib->ta, myid(&padapter->eeprompriv), ETH_ALEN); + DBG_COUNTER(padapter->tx_logs.core_tx_upd_attrib_sta); } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { _rtw_memcpy(pattrib->ra, pattrib->dst, ETH_ALEN); _rtw_memcpy(pattrib->ta, get_bssid(pmlmepriv), ETH_ALEN); - } + DBG_COUNTER(padapter->tx_logs.core_tx_upd_attrib_ap); + } + else + DBG_COUNTER(padapter->tx_logs.core_tx_upd_attrib_unknown); #ifdef CONFIG_TDLS rtw_check_tdls_established(padapter, pattrib); @@ -1024,6 +1043,7 @@ static s32 update_attrib(_adapter *padapter, _pkt *pkt, struct pkt_attrib *pattr // pTcb->DataRate = Adapter->MgntInfo.LowestBasicRate; //RTPRINT(FDM, WA_IOT, ("DHCP TranslateHeader(), pTcb->DataRate = 0x%x\n", pTcb->DataRate)); pattrib->dhcp_pkt = 1; + DBG_COUNTER(padapter->tx_logs.core_tx_upd_attrib_dhcp); } } } @@ -1034,7 +1054,10 @@ static s32 update_attrib(_adapter *padapter, _pkt *pkt, struct pkt_attrib *pattr pattrib->icmp_pkt = 0; if(piphdr->protocol == 0x1) // protocol type in ip header 0x1 is ICMP + { pattrib->icmp_pkt = 1; + DBG_COUNTER(padapter->tx_logs.core_tx_upd_attrib_icmp); + } } @@ -1064,6 +1087,7 @@ static s32 update_attrib(_adapter *padapter, _pkt *pkt, struct pkt_attrib *pattr #endif #endif { + DBG_COUNTER(padapter->tx_logs.core_tx_upd_attrib_active); rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SPECIAL_PACKET, 1); } #endif //CONFIG_LPS @@ -1075,7 +1099,8 @@ static s32 update_attrib(_adapter *padapter, _pkt *pkt, struct pkt_attrib *pattr psta = rtw_get_bcmc_stainfo(padapter); } else { psta = rtw_get_stainfo(pstapriv, pattrib->ra); - if (psta == NULL) { // if we cannot get psta => drrp the pkt + if (psta == NULL) { // if we cannot get psta => drop the pkt + DBG_COUNTER(padapter->tx_logs.core_tx_upd_attrib_err_ucast_sta); RT_TRACE(_module_rtl871x_xmit_c_, _drv_alert_, ("\nupdate_attrib => get sta_info fail, ra:" MAC_FMT"\n", MAC_ARG(pattrib->ra))); #ifdef DBG_TX_DROP_FRAME DBG_871X("DBG_TX_DROP_FRAME %s get sta_info fail, ra:" MAC_FMT"\n", __FUNCTION__, MAC_ARG(pattrib->ra)); @@ -1085,6 +1110,7 @@ static s32 update_attrib(_adapter *padapter, _pkt *pkt, struct pkt_attrib *pattr } else if((check_fwstate(pmlmepriv, WIFI_AP_STATE)==_TRUE)&&(!(psta->state & _FW_LINKED))) { + DBG_COUNTER(padapter->tx_logs.core_tx_upd_attrib_err_ucast_ap_link); res =_FAIL; goto exit; } @@ -1092,6 +1118,7 @@ static s32 update_attrib(_adapter *padapter, _pkt *pkt, struct pkt_attrib *pattr if(psta == NULL) { // if we cannot get psta => drop the pkt + DBG_COUNTER(padapter->tx_logs.core_tx_upd_attrib_err_sta); RT_TRACE(_module_rtl871x_xmit_c_, _drv_alert_, ("\nupdate_attrib => get sta_info fail, ra:" MAC_FMT "\n", MAC_ARG(pattrib->ra))); #ifdef DBG_TX_DROP_FRAME DBG_871X("DBG_TX_DROP_FRAME %s get sta_info fail, ra:" MAC_FMT"\n", __FUNCTION__, MAC_ARG(pattrib->ra)); @@ -1102,6 +1129,7 @@ static s32 update_attrib(_adapter *padapter, _pkt *pkt, struct pkt_attrib *pattr if(!(psta->state &_FW_LINKED)) { + DBG_COUNTER(padapter->tx_logs.core_tx_upd_attrib_err_link); DBG_871X("%s, psta("MAC_FMT")->state(0x%x) != _FW_LINKED\n", __func__, MAC_ARG(psta->hwaddr), psta->state); return _FAIL; } @@ -1111,11 +1139,12 @@ static s32 update_attrib(_adapter *padapter, _pkt *pkt, struct pkt_attrib *pattr //TODO:_lock if(update_attrib_sec_info(padapter, pattrib, psta) == _FAIL) { + DBG_COUNTER(padapter->tx_logs.core_tx_upd_attrib_err_sec); res = _FAIL; goto exit; } - update_attrib_phy_info(pattrib, psta); + update_attrib_phy_info(padapter, pattrib, psta); //DBG_8192C("%s ==> mac_id(%d)\n",__FUNCTION__,pattrib->mac_id ); @@ -1404,8 +1433,6 @@ _func_enter_; if (pattrib->subtype & WIFI_DATA_TYPE) { if ((check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _TRUE)) { - //to_ds = 1, fr_ds = 0; - #ifdef CONFIG_TDLS if(pattrib->direct_link == _TRUE){ //TDLS data transfer, ToDS=0, FrDs=0 @@ -1416,11 +1443,12 @@ _func_enter_; else #endif //CONFIG_TDLS { + //to_ds = 1, fr_ds = 0; // 1.Data transfer to AP // 2.Arp pkt will relayed by AP SetToDs(fctrl); _rtw_memcpy(pwlanhdr->addr1, get_bssid(pmlmepriv), ETH_ALEN); - _rtw_memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN); + _rtw_memcpy(pwlanhdr->addr2, pattrib->ta, ETH_ALEN); _rtw_memcpy(pwlanhdr->addr3, pattrib->dst, ETH_ALEN); } @@ -1441,7 +1469,7 @@ _func_enter_; else if ((check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == _TRUE) || (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == _TRUE)) { _rtw_memcpy(pwlanhdr->addr1, pattrib->dst, ETH_ALEN); - _rtw_memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN); + _rtw_memcpy(pwlanhdr->addr2, pattrib->ta, ETH_ALEN); _rtw_memcpy(pwlanhdr->addr3, get_bssid(pmlmepriv), ETH_ALEN); if(pattrib->qos_en) @@ -2213,7 +2241,7 @@ _func_enter_; int frame_body_len; u8 mic[16]; - _rtw_memset(MME, 0, 18); + _rtw_memset(MME, 0, _MME_IE_LENGTH_); //other types doesn't need the BIP if(GetFrameSubType(pframe) != WIFI_DEAUTH && GetFrameSubType(pframe) != WIFI_DISASSOC) @@ -2525,13 +2553,14 @@ void rtw_count_tx_stats(PADAPTER padapter, struct xmit_frame *pxmitframe, int sz } } -struct xmit_buf *rtw_alloc_cmd_xmitbuf(struct xmit_priv *pxmitpriv) +static struct xmit_buf *__rtw_alloc_cmd_xmitbuf(struct xmit_priv *pxmitpriv, + enum cmdbuf_type buf_type) { struct xmit_buf *pxmitbuf = NULL; _func_enter_; - pxmitbuf = &pxmitpriv->pcmd_xmitbuf; + pxmitbuf = &pxmitpriv->pcmd_xmitbuf[buf_type]; if (pxmitbuf != NULL) { pxmitbuf->priv_data = NULL; @@ -2543,6 +2572,7 @@ _func_enter_; #endif #ifdef CONFIG_PCI_HCI pxmitbuf->len = 0; + pxmitbuf->desc = NULL; #endif if (pxmitbuf->sctx) { @@ -2560,27 +2590,8 @@ _func_exit_; return pxmitbuf; } -s32 rtw_free_cmd_xmitbuf(struct xmit_priv *pxmitpriv) -{ - struct xmit_buf *pxmitbuf = NULL; - -_func_enter_; - - pxmitbuf = &pxmitpriv->pcmd_xmitbuf; - if (pxmitbuf==NULL) { - DBG_871X("%s fail, no xmitbuf available !!!\n", __func__); - return _FAIL; - } else { - rtw_os_xmit_resource_free(pxmitbuf->padapter, pxmitbuf, pxmitbuf->alloc_sz, _FALSE); - pxmitbuf->pallocated_buf = NULL; - } - -_func_exit_; - - return _SUCCESS; -} - -struct xmit_frame *rtw_alloc_cmdxmitframe(struct xmit_priv *pxmitpriv) +struct xmit_frame *__rtw_alloc_cmdxmitframe(struct xmit_priv *pxmitpriv, + enum cmdbuf_type buf_type) { struct xmit_frame *pcmdframe; struct xmit_buf *pxmitbuf; @@ -2591,7 +2602,7 @@ struct xmit_frame *rtw_alloc_cmdxmitframe(struct xmit_priv *pxmitpriv) return NULL; } - if ((pxmitbuf = rtw_alloc_cmd_xmitbuf(pxmitpriv)) == NULL) { + if ((pxmitbuf = __rtw_alloc_cmd_xmitbuf(pxmitpriv, buf_type)) == NULL) { DBG_871X("%s, alloc xmitbuf fail\n", __FUNCTION__); rtw_free_xmitframe(pxmitpriv, pcmdframe); return NULL; @@ -2650,6 +2661,7 @@ _func_enter_; #endif #ifdef CONFIG_PCI_HCI pxmitbuf->len = 0; + pxmitbuf->desc = NULL; #endif if (pxmitbuf->sctx) { @@ -2739,6 +2751,7 @@ _func_enter_; #endif #ifdef CONFIG_PCI_HCI pxmitbuf->len = 0; + pxmitbuf->desc = NULL; #endif if (pxmitbuf->sctx) { @@ -2987,7 +3000,7 @@ _func_enter_; else if(pxmitframe->ext_tag == 1) queue = &pxmitpriv->free_xframe_ext_queue; else - {} + rtw_warn_on(1); _enter_critical_bh(&queue->lock, &irqL); @@ -3046,6 +3059,7 @@ _func_exit_; s32 rtw_xmitframe_enqueue(_adapter *padapter, struct xmit_frame *pxmitframe) { + DBG_COUNTER(padapter->tx_logs.core_tx_enqueue); if (rtw_xmit_classifier(padapter, pxmitframe) == _FAIL) { RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, @@ -3093,7 +3107,7 @@ static struct xmit_frame *dequeue_one_xmitframe(struct xmit_priv *pxmitpriv, str break; - pxmitframe = NULL; + //pxmitframe = NULL; } @@ -3312,6 +3326,8 @@ s32 rtw_xmit_classifier(_adapter *padapter, struct xmit_frame *pxmitframe) _func_enter_; + DBG_COUNTER(padapter->tx_logs.core_tx_enqueue_class); + /* if (pattrib->psta) { psta = pattrib->psta; @@ -3324,11 +3340,13 @@ _func_enter_; psta = rtw_get_stainfo(&padapter->stapriv, pattrib->ra); if(pattrib->psta != psta) { + DBG_COUNTER(padapter->tx_logs.core_tx_enqueue_class_err_sta); DBG_871X("%s, pattrib->psta(%p) != psta(%p)\n", __func__, pattrib->psta, psta); return _FAIL; } if (psta == NULL) { + DBG_COUNTER(padapter->tx_logs.core_tx_enqueue_class_err_nosta); res = _FAIL; DBG_8192C("rtw_xmit_classifier: psta == NULL\n"); RT_TRACE(_module_rtl871x_xmit_c_,_drv_err_,("rtw_xmit_classifier: psta == NULL\n")); @@ -3337,6 +3355,7 @@ _func_enter_; if(!(psta->state &_FW_LINKED)) { + DBG_COUNTER(padapter->tx_logs.core_tx_enqueue_class_err_fwlink); DBG_871X("%s, psta->state(0x%x) != _FW_LINKED\n", __func__, psta->state); return _FAIL; } @@ -3722,6 +3741,8 @@ s32 rtw_xmit(_adapter *padapter, _pkt **ppkt) s32 res; + DBG_COUNTER(padapter->tx_logs.core_tx); + if (start == 0) start = rtw_get_current_time(); @@ -3737,6 +3758,7 @@ s32 rtw_xmit(_adapter *padapter, _pkt **ppkt) if (pxmitframe == NULL) { drop_cnt ++; RT_TRACE(_module_xmit_osdep_c_, _drv_err_, ("rtw_xmit: no more pxmitframe\n")); + DBG_COUNTER(padapter->tx_logs.core_tx_err_pxmitframe); return -1; } @@ -3756,6 +3778,7 @@ s32 rtw_xmit(_adapter *padapter, _pkt **ppkt) if (res == -1) { rtw_free_xmitframe(pxmitpriv, pxmitframe); + DBG_COUNTER(padapter->tx_logs.core_tx_err_brtx); return -1; } } @@ -3793,11 +3816,13 @@ s32 rtw_xmit(_adapter *padapter, _pkt **ppkt) if(xmitframe_enqueue_for_sleeping_sta(padapter, pxmitframe) == _TRUE) { _exit_critical_bh(&pxmitpriv->lock, &irqL0); + DBG_COUNTER(padapter->tx_logs.core_tx_ap_enqueue); return 1; } _exit_critical_bh(&pxmitpriv->lock, &irqL0); #endif + //pre_xmitframe if (rtw_hal_xmit(padapter, pxmitframe) == _FALSE) return 1; @@ -3879,6 +3904,47 @@ sint xmitframe_enqueue_for_tdls_sleeping_sta(_adapter *padapter, struct xmit_fra } #endif //CONFIG_TDLS +#define RTW_HIQ_FILTER_ALLOW_ALL 0 +#define RTW_HIQ_FILTER_ALLOW_SPECIAL 1 +#define RTW_HIQ_FILTER_DENY_ALL 2 + +inline bool xmitframe_hiq_filter(struct xmit_frame *xmitframe) +{ + bool allow = _FALSE; + _adapter *adapter = xmitframe->padapter; + struct registry_priv *registry = &adapter->registrypriv; + +if (adapter->interface_type != RTW_PCIE) { + + if (registry->hiq_filter == RTW_HIQ_FILTER_ALLOW_SPECIAL) { + + struct pkt_attrib *attrib = &xmitframe->attrib; + + if (attrib->ether_type == 0x0806 + || attrib->ether_type == 0x888e + #ifdef CONFIG_WAPI_SUPPORT + || attrib->ether_type == 0x88B4 + #endif + || attrib->dhcp_pkt + ) { + if (0) + DBG_871X(FUNC_ADPT_FMT" ether_type:0x%04x%s\n", FUNC_ADPT_ARG(xmitframe->padapter) + , attrib->ether_type, attrib->dhcp_pkt?" DHCP":""); + allow = _TRUE; + } + } + else if (registry->hiq_filter == RTW_HIQ_FILTER_ALLOW_ALL) { + allow = _TRUE; + } + else if (registry->hiq_filter == RTW_HIQ_FILTER_DENY_ALL) { + } + else { + rtw_warn_on(1); + } +} + return allow; +} + #if defined(CONFIG_AP_MODE) || defined(CONFIG_TDLS) sint xmitframe_enqueue_for_sleeping_sta(_adapter *padapter, struct xmit_frame *pxmitframe) @@ -3900,7 +3966,10 @@ sint xmitframe_enqueue_for_sleeping_sta(_adapter *padapter, struct xmit_frame *p #endif //CONFIG_TDLS if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == _FALSE) + { + DBG_COUNTER(padapter->tx_logs.core_tx_ap_enqueue_warn_fwstate); return ret; + } /* if(pattrib->psta) { @@ -3915,31 +3984,33 @@ sint xmitframe_enqueue_for_sleeping_sta(_adapter *padapter, struct xmit_frame *p psta = rtw_get_stainfo(&padapter->stapriv, pattrib->ra); if(pattrib->psta != psta) { + DBG_COUNTER(padapter->tx_logs.core_tx_ap_enqueue_warn_sta); DBG_871X("%s, pattrib->psta(%p) != psta(%p)\n", __func__, pattrib->psta, psta); return _FALSE; } if(psta==NULL) { + DBG_COUNTER(padapter->tx_logs.core_tx_ap_enqueue_warn_nosta); DBG_871X("%s, psta==NUL\n", __func__); return _FALSE; } if(!(psta->state &_FW_LINKED)) { + DBG_COUNTER(padapter->tx_logs.core_tx_ap_enqueue_warn_link); DBG_871X("%s, psta->state(0x%x) != _FW_LINKED\n", __func__, psta->state); return _FALSE; } if(pattrib->triggered==1) { + DBG_COUNTER(padapter->tx_logs.core_tx_ap_enqueue_warn_trigger); //DBG_871X("directly xmit pspoll_triggered packet\n"); //pattrib->triggered=0; - - if(bmcst) - pattrib->qsel = 0x11;//HIQ - + if (bmcst && xmitframe_hiq_filter(pxmitframe) == _TRUE) + pattrib->qsel = QSLT_HIGH;//HIQ return ret; } @@ -3951,7 +4022,7 @@ sint xmitframe_enqueue_for_sleeping_sta(_adapter *padapter, struct xmit_frame *p if(pstapriv->sta_dz_bitmap)//if anyone sta is in ps mode { - //pattrib->qsel = 0x11;//HIQ + //pattrib->qsel = QSLT_HIGH;//HIQ rtw_list_delete(&pxmitframe->list); @@ -3970,7 +4041,10 @@ sint xmitframe_enqueue_for_sleeping_sta(_adapter *padapter, struct xmit_frame *p //DBG_871X("enqueue, sq_len=%d, tim=%x\n", psta->sleepq_len, pstapriv->tim_bitmap); if (update_tim == _TRUE) { - update_beacon(padapter, _TIM_IE_, NULL, _TRUE); + if (is_broadcast_mac_addr(pattrib->ra)) + _update_beacon(padapter, _TIM_IE_, NULL, _TRUE, "buffer BC"); + else + _update_beacon(padapter, _TIM_IE_, NULL, _TRUE, "buffer MC"); } else { chk_bmc_sleepq_cmd(padapter); } @@ -3978,6 +4052,8 @@ sint xmitframe_enqueue_for_sleeping_sta(_adapter *padapter, struct xmit_frame *p //_exit_critical_bh(&psta->sleep_q.lock, &irqL); ret = _TRUE; + + DBG_COUNTER(padapter->tx_logs.core_tx_ap_enqueue_mcast); } @@ -4041,7 +4117,7 @@ sint xmitframe_enqueue_for_sleeping_sta(_adapter *padapter, struct xmit_frame *p { //DBG_871X("sleepq_len==1, update BCNTIM\n"); //upate BCN for TIM IE - update_beacon(padapter, _TIM_IE_, NULL, _TRUE); + _update_beacon(padapter, _TIM_IE_, NULL, _TRUE, "buffer UC"); } } @@ -4054,6 +4130,7 @@ sint xmitframe_enqueue_for_sleeping_sta(_adapter *padapter, struct xmit_frame *p ret = _TRUE; + DBG_COUNTER(padapter->tx_logs.core_tx_ap_enqueue_ucast); } } @@ -4081,14 +4158,16 @@ static void dequeue_xmitframes_to_sleeping_queue(_adapter *padapter, struct sta_ { pxmitframe = LIST_CONTAINOR(plist, struct xmit_frame, list); - plist = get_next(plist); + plist = get_next(plist); + pattrib = &pxmitframe->attrib; + + pattrib->triggered = 0; + ret = xmitframe_enqueue_for_sleeping_sta(padapter, pxmitframe); if(_TRUE == ret) { - pattrib = &pxmitframe->attrib; - ptxservq = rtw_get_sta_pending(padapter, psta, pattrib->priority, (u8 *)(&ac_index)); ptxservq->qcnt--; @@ -4250,6 +4329,41 @@ void wakeup_sta_to_xmit(_adapter *padapter, struct sta_info *psta) } + if(psta->sleepq_len==0) + { +#ifdef CONFIG_TDLS + if( psta->tdls_sta_state & TDLS_LINKED_STATE ) + { + if(psta->state&WIFI_SLEEP_STATE) + psta->state ^= WIFI_SLEEP_STATE; + + _exit_critical_bh(&pxmitpriv->lock, &irqL); + return; + } +#endif //CONFIG_TDLS + + if (pstapriv->tim_bitmap & BIT(psta->aid)) { + //DBG_871X("wakeup to xmit, qlen==0, update_BCNTIM, tim=%x\n", pstapriv->tim_bitmap); + //upate BCN for TIM IE + //update_BCNTIM(padapter); + update_mask = BIT(0); + } + + pstapriv->tim_bitmap &= ~BIT(psta->aid); + + if(psta->state&WIFI_SLEEP_STATE) + psta->state ^= WIFI_SLEEP_STATE; + + if(psta->state & WIFI_STA_ALIVE_CHK_STATE) + { + DBG_871X("%s alive check\n", __func__); + psta->expire_to = pstapriv->expire_to; + psta->state ^= WIFI_STA_ALIVE_CHK_STATE; + } + + pstapriv->sta_dz_bitmap &= ~BIT(psta->aid); + } + //for BC/MC Frames if(!psta_bmc) goto _exit; @@ -4302,41 +4416,6 @@ void wakeup_sta_to_xmit(_adapter *padapter, struct sta_info *psta) } - if(psta->sleepq_len==0) - { -#ifdef CONFIG_TDLS - if( psta->tdls_sta_state & TDLS_LINKED_STATE ) - { - if(psta->state&WIFI_SLEEP_STATE) - psta->state ^= WIFI_SLEEP_STATE; - - _exit_critical_bh(&pxmitpriv->lock, &irqL); - return; - } -#endif //CONFIG_TDLS - - if (pstapriv->tim_bitmap & BIT(psta->aid)) { - //DBG_871X("wakeup to xmit, qlen==0, update_BCNTIM, tim=%x\n", pstapriv->tim_bitmap); - //upate BCN for TIM IE - //update_BCNTIM(padapter); - update_mask = BIT(0); - } - - pstapriv->tim_bitmap &= ~BIT(psta->aid); - - if(psta->state&WIFI_SLEEP_STATE) - psta->state ^= WIFI_SLEEP_STATE; - - if(psta->state & WIFI_STA_ALIVE_CHK_STATE) - { - DBG_871X("%s alive check\n", __func__); - psta->expire_to = pstapriv->expire_to; - psta->state ^= WIFI_STA_ALIVE_CHK_STATE; - } - - pstapriv->sta_dz_bitmap &= ~BIT(psta->aid); - } - _exit: //_exit_critical_bh(&psta_bmc->sleep_q.lock, &irqL); @@ -4345,8 +4424,12 @@ _exit: if(update_mask) { //update_BCNTIM(padapter); - //printk("%s => call update_beacon\n",__FUNCTION__); - update_beacon(padapter, _TIM_IE_, NULL, _TRUE); + if ((update_mask & (BIT(0)|BIT(1))) == (BIT(0)|BIT(1))) + _update_beacon(padapter, _TIM_IE_, NULL, _TRUE, "clear UC&BMC"); + else if ((update_mask & BIT(1)) == BIT(1)) + _update_beacon(padapter, _TIM_IE_, NULL, _TRUE, "clear BMC"); + else + _update_beacon(padapter, _TIM_IE_, NULL, _TRUE, "clear UC"); } } diff --git a/hal/HalPwrSeqCmd.c b/hal/HalPwrSeqCmd.c index 425fbef..972a3d8 100644 --- a/hal/HalPwrSeqCmd.c +++ b/hal/HalPwrSeqCmd.c @@ -147,7 +147,7 @@ u8 HalPwrSeqCmdParsing( rtw_udelay_os(10); if (pollingCount++ > maxPollingCnt) { - DBG_871X("Fail to polling Offset[%#x]=%02x\n", offset, value); + DBG_871X_LEVEL(_drv_always_, "HalPwrSeqCmdParsing: Fail to polling Offset[%#x]=%02x\n", offset, value); return _FALSE; } } while (!bPollingBit); diff --git a/hal/OUTSRC-BTCoexist/HalBtc8188c2Ant.c b/hal/OUTSRC-BTCoexist/HalBtc8188c2Ant.c index 8e12ef2..9f69141 100644 --- a/hal/OUTSRC-BTCoexist/HalBtc8188c2Ant.c +++ b/hal/OUTSRC-BTCoexist/HalBtc8188c2Ant.c @@ -1723,6 +1723,13 @@ halbtc8188c2ant_ActionPanA2dp( //============================================================ // extern function start with EXhalbtc8188c2ant_ //============================================================ +VOID +EXhalbtc8188c2ant_PowerOnSetting( + IN PBTC_COEXIST pBtCoexist + ) +{ +} + VOID EXhalbtc8188c2ant_InitHwConfig( IN PBTC_COEXIST pBtCoexist, @@ -1776,13 +1783,6 @@ EXhalbtc8188c2ant_DisplayCoexInfo( CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[BT Coexist info]============"); CL_PRINTF(cliBuf); - if(!pBoardInfo->bBtExist) - { - CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n BT not exists !!!"); - CL_PRINTF(cliBuf); - return; - } - CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d ", "Ant PG number/ Ant mechanism:", \ pBoardInfo->pgAntNum, pBoardInfo->btdmAntNum); CL_PRINTF(cliBuf); diff --git a/hal/OUTSRC-BTCoexist/HalBtc8188c2Ant.h b/hal/OUTSRC-BTCoexist/HalBtc8188c2Ant.h index 22e7e33..ce7ec56 100644 --- a/hal/OUTSRC-BTCoexist/HalBtc8188c2Ant.h +++ b/hal/OUTSRC-BTCoexist/HalBtc8188c2Ant.h @@ -87,6 +87,10 @@ typedef struct _COEX_STA_8188C_2ANT{ // The following is interface which will notify coex module. //=========================================== VOID +EXhalbtc8188c2ant_PowerOnSetting( + IN PBTC_COEXIST pBtCoexist + ); +VOID EXhalbtc8188c2ant_InitHwConfig( IN PBTC_COEXIST pBtCoexist, IN BOOLEAN bWifiOnly diff --git a/hal/OUTSRC-BTCoexist/HalBtc8192d2Ant.c b/hal/OUTSRC-BTCoexist/HalBtc8192d2Ant.c index 4267a75..239da74 100644 --- a/hal/OUTSRC-BTCoexist/HalBtc8192d2Ant.c +++ b/hal/OUTSRC-BTCoexist/HalBtc8192d2Ant.c @@ -1712,6 +1712,13 @@ halbtc8192d2ant_IsBtCoexistEnter( //============================================================ // extern function start with EXhalbtc8192d2ant_ //============================================================ +VOID +EXhalbtc8192d2ant_PowerOnSetting( + IN PBTC_COEXIST pBtCoexist + ) +{ +} + VOID EXhalbtc8192d2ant_InitHwConfig( IN PBTC_COEXIST pBtCoexist, @@ -1782,13 +1789,6 @@ EXhalbtc8192d2ant_DisplayCoexInfo( CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[BT Coexist info]============"); CL_PRINTF(cliBuf); - if(!pBoardInfo->bBtExist) - { - CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n BT not exists !!!"); - CL_PRINTF(cliBuf); - return; - } - CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d ", "Ant PG number/ Ant mechanism:", \ pBoardInfo->pgAntNum, pBoardInfo->btdmAntNum); CL_PRINTF(cliBuf); diff --git a/hal/OUTSRC-BTCoexist/HalBtc8192d2Ant.h b/hal/OUTSRC-BTCoexist/HalBtc8192d2Ant.h index 24b2513..85fd674 100644 --- a/hal/OUTSRC-BTCoexist/HalBtc8192d2Ant.h +++ b/hal/OUTSRC-BTCoexist/HalBtc8192d2Ant.h @@ -108,6 +108,10 @@ typedef struct _COEX_STA_8192D_2ANT{ // The following is interface which will notify coex module. //=========================================== VOID +EXhalbtc8192d2ant_PowerOnSetting( + IN PBTC_COEXIST pBtCoexist + ); +VOID EXhalbtc8192d2ant_InitHwConfig( IN PBTC_COEXIST pBtCoexist, IN BOOLEAN bWifiOnly diff --git a/hal/OUTSRC-BTCoexist/HalBtc8192e1Ant.c b/hal/OUTSRC-BTCoexist/HalBtc8192e1Ant.c index cecf085..36a48d0 100644 --- a/hal/OUTSRC-BTCoexist/HalBtc8192e1Ant.c +++ b/hal/OUTSRC-BTCoexist/HalBtc8192e1Ant.c @@ -2436,6 +2436,13 @@ halbtc8192e1ant_InitCoexDm( //============================================================ // extern function start with EXhalbtc8192e1ant_ //============================================================ +VOID +EXhalbtc8192e1ant_PowerOnSetting( + IN PBTC_COEXIST pBtCoexist + ) +{ +} + VOID EXhalbtc8192e1ant_InitHwConfig( IN PBTC_COEXIST pBtCoexist, @@ -2537,13 +2544,6 @@ EXhalbtc8192e1ant_DisplayCoexInfo( CL_PRINTF(cliBuf); } - if(!pBoardInfo->bBtExist) - { - CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n BT not exists !!!"); - CL_PRINTF(cliBuf); - return; - } - CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d ", "Ant PG number/ Ant mechanism:", \ pBoardInfo->pgAntNum, pBoardInfo->btdmAntNum); CL_PRINTF(cliBuf); diff --git a/hal/OUTSRC-BTCoexist/HalBtc8192e1Ant.h b/hal/OUTSRC-BTCoexist/HalBtc8192e1Ant.h index 54add81..8792ec8 100644 --- a/hal/OUTSRC-BTCoexist/HalBtc8192e1Ant.h +++ b/hal/OUTSRC-BTCoexist/HalBtc8192e1Ant.h @@ -140,6 +140,10 @@ typedef struct _COEX_STA_8192E_1ANT{ // The following is interface which will notify coex module. //=========================================== VOID +EXhalbtc8192e1ant_PowerOnSetting( + IN PBTC_COEXIST pBtCoexist + ); +VOID EXhalbtc8192e1ant_InitHwConfig( IN PBTC_COEXIST pBtCoexist, IN BOOLEAN bWifiOnly diff --git a/hal/OUTSRC-BTCoexist/HalBtc8192e2Ant.c b/hal/OUTSRC-BTCoexist/HalBtc8192e2Ant.c index b8c7a0f..bf378d0 100644 --- a/hal/OUTSRC-BTCoexist/HalBtc8192e2Ant.c +++ b/hal/OUTSRC-BTCoexist/HalBtc8192e2Ant.c @@ -1697,7 +1697,8 @@ halbtc8192e2ant_SetSwitchSsType( pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xd04, 0x1); pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x90c, 0x81111111); // switch cck patch - pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xe77, 0x4, 0x1); + //Jenyu suggest to remove 0xe77 this line for tx issue + //pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xe77, 0x4, 0x1); //pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xa07, 0x81); mimoPs=BTC_MIMO_PS_STATIC; } @@ -1707,7 +1708,8 @@ halbtc8192e2ant_SetSwitchSsType( pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xc04, 0x33); pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xd04, 0x3); pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x90c, 0x81121313); - pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xe77, 0x4, 0x0); + //Jenyu suggest to remove 0xe77 this line for tx issue + //pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xe77, 0x4, 0x0); //pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xa07, 0x41); mimoPs=BTC_MIMO_PS_DYNAMIC; } @@ -3790,6 +3792,13 @@ halbtc8192e2ant_InitHwConfig( //============================================================ // extern function start with EXhalbtc8192e2ant_ //============================================================ +VOID +EXhalbtc8192e2ant_PowerOnSetting( + IN PBTC_COEXIST pBtCoexist + ) +{ +} + VOID EXhalbtc8192e2ant_InitHwConfig( IN PBTC_COEXIST pBtCoexist, @@ -3838,13 +3847,6 @@ EXhalbtc8192e2ant_DisplayCoexInfo( CL_PRINTF(cliBuf); } - if(!pBoardInfo->bBtExist) - { - CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n BT not exists !!!"); - CL_PRINTF(cliBuf); - return; - } - CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d ", "Ant PG number/ Ant mechanism:", \ pBoardInfo->pgAntNum, pBoardInfo->btdmAntNum); CL_PRINTF(cliBuf); diff --git a/hal/OUTSRC-BTCoexist/HalBtc8192e2Ant.h b/hal/OUTSRC-BTCoexist/HalBtc8192e2Ant.h index c83df8b..58cddce 100644 --- a/hal/OUTSRC-BTCoexist/HalBtc8192e2Ant.h +++ b/hal/OUTSRC-BTCoexist/HalBtc8192e2Ant.h @@ -143,6 +143,10 @@ typedef struct _COEX_STA_8192E_2ANT{ // The following is interface which will notify coex module. //=========================================== VOID +EXhalbtc8192e2ant_PowerOnSetting( + IN PBTC_COEXIST pBtCoexist + ); +VOID EXhalbtc8192e2ant_InitHwConfig( IN PBTC_COEXIST pBtCoexist, IN BOOLEAN bWifiOnly diff --git a/hal/OUTSRC-BTCoexist/HalBtc8723a1Ant.c b/hal/OUTSRC-BTCoexist/HalBtc8723a1Ant.c index d2476cd..8cd3d15 100644 --- a/hal/OUTSRC-BTCoexist/HalBtc8723a1Ant.c +++ b/hal/OUTSRC-BTCoexist/HalBtc8723a1Ant.c @@ -1077,13 +1077,6 @@ EXhalbtc8723a1ant_DisplayCoexInfo( CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[BT Coexist info]============"); CL_PRINTF(cliBuf); - if(!pBoardInfo->bBtExist) - { - CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n BT not exists !!!"); - CL_PRINTF(cliBuf); - return; - } - CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d ", "Ant PG number/ Ant mechanism:", \ pBoardInfo->pgAntNum, pBoardInfo->btdmAntNum); CL_PRINTF(cliBuf); diff --git a/hal/OUTSRC-BTCoexist/HalBtc8723a2Ant.c b/hal/OUTSRC-BTCoexist/HalBtc8723a2Ant.c index 458ab33..3e11586 100644 --- a/hal/OUTSRC-BTCoexist/HalBtc8723a2Ant.c +++ b/hal/OUTSRC-BTCoexist/HalBtc8723a2Ant.c @@ -3381,6 +3381,13 @@ wa_halbtc8723a2ant_MonitorC2h( //============================================================ // extern function start with EXhalbtc8723a2ant_ //============================================================ +VOID +EXhalbtc8723a2ant_PowerOnSetting( + IN PBTC_COEXIST pBtCoexist + ) +{ +} + VOID EXhalbtc8723a2ant_InitHwConfig( IN PBTC_COEXIST pBtCoexist, @@ -3431,13 +3438,6 @@ EXhalbtc8723a2ant_DisplayCoexInfo( CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[BT Coexist info]============"); CL_PRINTF(cliBuf); - if(!pBoardInfo->bBtExist) - { - CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n BT not exists !!!"); - CL_PRINTF(cliBuf); - return; - } - CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d ", "Ant PG number/ Ant mechanism:", \ pBoardInfo->pgAntNum, pBoardInfo->btdmAntNum); CL_PRINTF(cliBuf); diff --git a/hal/OUTSRC-BTCoexist/HalBtc8723a2Ant.h b/hal/OUTSRC-BTCoexist/HalBtc8723a2Ant.h index b2903f8..f0cc8b5 100644 --- a/hal/OUTSRC-BTCoexist/HalBtc8723a2Ant.h +++ b/hal/OUTSRC-BTCoexist/HalBtc8723a2Ant.h @@ -116,6 +116,10 @@ typedef struct _COEX_STA_8723A_2ANT{ // The following is interface which will notify coex module. //=========================================== VOID +EXhalbtc8723a2ant_PowerOnSetting( + IN PBTC_COEXIST pBtCoexist + ); +VOID EXhalbtc8723a2ant_InitHwConfig( IN PBTC_COEXIST pBtCoexist, IN BOOLEAN bWifiOnly diff --git a/hal/OUTSRC-BTCoexist/HalBtc8723b1Ant.c b/hal/OUTSRC-BTCoexist/HalBtc8723b1Ant.c index 348699a..f00411c 100644 --- a/hal/OUTSRC-BTCoexist/HalBtc8723b1Ant.c +++ b/hal/OUTSRC-BTCoexist/HalBtc8723b1Ant.c @@ -27,8 +27,8 @@ const char *const GLBtInfoSrc8723b1Ant[]={ "BT Info[bt auto report]", }; -u4Byte GLCoexVerDate8723b1Ant=20140123; -u4Byte GLCoexVer8723b1Ant=0x4a; +u4Byte GLCoexVerDate8723b1Ant=20140708; +u4Byte GLCoexVer8723b1Ant=0x52; //============================================================ // local function proto type if needed @@ -411,6 +411,23 @@ halbtc8723b1ant_LimitedRx( } +VOID +halbtc8723b1ant_QueryBtInfo( + IN PBTC_COEXIST pBtCoexist + ) +{ + u1Byte H2C_Parameter[1] ={0}; + + pCoexSta->bC2hBtInfoReqSent = TRUE; + + H2C_Parameter[0] |= BIT0; // trigger + + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], Query Bt Info, FW write 0x61=0x%x\n", + H2C_Parameter[0])); + + pBtCoexist->fBtcFillH2c(pBtCoexist, 0x61, 1, H2C_Parameter); +} + VOID halbtc8723b1ant_MonitorBtCtr( IN PBTC_COEXIST pBtCoexist @@ -420,29 +437,20 @@ halbtc8723b1ant_MonitorBtCtr( u4Byte regHPTx=0, regHPRx=0, regLPTx=0, regLPRx=0; u1Byte u1Tmp, u1Tmp1; s4Byte wifiRssi; + static u1Byte NumOfBtCounterChk = 0; -/* - if (pCoexSta->bFinishInitHW == FALSE) //to avoid 0x76e[3] = 1 (WLAN_Act control by PTA) during IPS - { - pCoexSta->highPriorityTx = 65535; - pCoexSta->highPriorityRx = 65535; - pCoexSta->lowPriorityTx = 65535; - pCoexSta->lowPriorityRx = 65535; - return; - } -*/ - //to avoid 0x76e[3] = 1 (WLAN_Act control by PTA) during IPS - if (! (pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x76e) & 0x8) ) + //if (! (pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x76e) & 0x8) ) + + if (pCoexSta->bUnderIps) { - pCoexSta->highPriorityTx = 65535; - pCoexSta->highPriorityRx = 65535; - pCoexSta->lowPriorityTx = 65535; - pCoexSta->lowPriorityRx = 65535; - return; + //pCoexSta->highPriorityTx = 65535; + //pCoexSta->highPriorityRx = 65535; + //pCoexSta->lowPriorityTx = 65535; + //pCoexSta->lowPriorityRx = 65535; + //return; } - regHPTxRx = 0x770; regLPTxRx = 0x774; @@ -459,25 +467,122 @@ halbtc8723b1ant_MonitorBtCtr( pCoexSta->lowPriorityTx = regLPTx; pCoexSta->lowPriorityRx = regLPRx; + if( (pCoexSta->lowPriorityTx > 1150) && (!pCoexSta->bC2hBtInquiryPage)) + pCoexSta->popEventCnt++; + + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Hi-Pri Rx/Tx: %d/%d, Lo-Pri Rx/Tx: %d/%d\n", + regHPRx, regHPTx, regLPRx, regLPTx)); + // reset counter pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0xc); + + if ((regHPTx == 0) && (regHPRx ==0) && (regLPTx == 0) && (regLPRx == 0)) + { + NumOfBtCounterChk++; + if (NumOfBtCounterChk >= 3) +{ + halbtc8723b1ant_QueryBtInfo(pBtCoexist); + NumOfBtCounterChk = 0; + } + } } + VOID -halbtc8723b1ant_QueryBtInfo( +halbtc8723b1ant_MonitorWiFiCtr( IN PBTC_COEXIST pBtCoexist ) { - u1Byte H2C_Parameter[1] ={0}; + u4Byte u4Tmp; + u2Byte u2Tmp[3]; + s4Byte wifiRssi=0; + BOOLEAN bWifiBusy = FALSE, bWifiUnderBMode = FALSE; + static u1Byte nCCKLockCounter = 0; - pCoexSta->bC2hBtInfoReqSent = TRUE; + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_S4_WIFI_RSSI, &wifiRssi); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_UNDER_B_MODE, &bWifiUnderBMode); - H2C_Parameter[0] |= BIT0; // trigger + if (pCoexSta->bUnderIps) + { + pCoexSta->nCRCOK_CCK = 0; + pCoexSta->nCRCOK_11g = 0; + pCoexSta->nCRCOK_11n = 0; + pCoexSta->nCRCOK_11nAgg = 0; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], Query Bt Info, FW write 0x61=0x%x\n", - H2C_Parameter[0])); + pCoexSta->nCRCErr_CCK = 0; + pCoexSta->nCRCErr_11g = 0; + pCoexSta->nCRCErr_11n = 0; + pCoexSta->nCRCErr_11nAgg = 0; + } + else + { + pCoexSta->nCRCOK_CCK = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xf88); + pCoexSta->nCRCOK_11g = pBtCoexist->fBtcRead2Byte(pBtCoexist, 0xf94); + pCoexSta->nCRCOK_11n = pBtCoexist->fBtcRead2Byte(pBtCoexist, 0xf90); + pCoexSta->nCRCOK_11nAgg= pBtCoexist->fBtcRead2Byte(pBtCoexist, 0xfb8); + + pCoexSta->nCRCErr_CCK = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xf84); + pCoexSta->nCRCErr_11g = pBtCoexist->fBtcRead2Byte(pBtCoexist, 0xf96); + pCoexSta->nCRCErr_11n = pBtCoexist->fBtcRead2Byte(pBtCoexist, 0xf92); + pCoexSta->nCRCErr_11nAgg = pBtCoexist->fBtcRead2Byte(pBtCoexist, 0xfba); + } + + + //reset counter + pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xf16, 0x1, 0x1); + pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xf16, 0x1, 0x0); + + if ( (bWifiBusy) && (wifiRssi >= 30) && (!bWifiUnderBMode)) + { + if ( (pCoexDm->btStatus == BT_8723B_1ANT_BT_STATUS_ACL_BUSY) || + (pCoexDm->btStatus == BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY) || + (pCoexDm->btStatus == BT_8723B_1ANT_BT_STATUS_SCO_BUSY) ) + { + if (pCoexSta->nCRCOK_CCK >(pCoexSta->nCRCOK_11g + pCoexSta->nCRCOK_11n + + pCoexSta->nCRCOK_11nAgg) ) + { + if (nCCKLockCounter < 5) + nCCKLockCounter++; + } + else + { + if (nCCKLockCounter > 0) + nCCKLockCounter--; + } + + } + else + { + if (nCCKLockCounter > 0) + nCCKLockCounter--; + } + } + else + { + if (nCCKLockCounter > 0) + nCCKLockCounter--; + } + + if (!pCoexSta->bPreCCKLock) + { + + if (nCCKLockCounter >= 5) + pCoexSta->bCCKLock = TRUE; + else + pCoexSta->bCCKLock = FALSE; + } + else + { + if (nCCKLockCounter == 0) + pCoexSta->bCCKLock = FALSE; + else + pCoexSta->bCCKLock = TRUE; + } + + pCoexSta->bPreCCKLock = pCoexSta->bCCKLock; + - pBtCoexist->fBtcFillH2c(pBtCoexist, 0x61, 1, H2C_Parameter); } BOOLEAN @@ -944,6 +1049,8 @@ halbtc8723b1ant_CoexTableWithType( { BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], ********** CoexTable(%d) **********\n", type)); + pCoexSta->nCoexTableType = type; + switch(type) { case 0: @@ -956,16 +1063,16 @@ halbtc8723b1ant_CoexTableWithType( halbtc8723b1ant_CoexTable(pBtCoexist, bForceExec, 0x5a5a5a5a, 0x5a5a5a5a, 0xffffff, 0x3); break; case 3: - halbtc8723b1ant_CoexTable(pBtCoexist, bForceExec, 0x5a5a5a5a, 0xaaaaaaaa, 0xffffff, 0x3); + halbtc8723b1ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0x5a5a5a5a, 0xffffff, 0x3); break; case 4: - halbtc8723b1ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0xaaaaaaaa, 0xffffff, 0x3); + halbtc8723b1ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0xaaaa5a5a, 0xffffff, 0x3); break; case 5: - halbtc8723b1ant_CoexTable(pBtCoexist, bForceExec, 0x5a5a5a5a, 0xaaaa5a5a, 0xffffff, 0x3); + halbtc8723b1ant_CoexTable(pBtCoexist, bForceExec, 0x5a5a5a5a, 0xaa5a5a5a, 0xffffff, 0x3); break; case 6: - halbtc8723b1ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0xaaaa5a5a, 0xffffff, 0x3); + halbtc8723b1ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0xaaaaaaaa, 0xffffff, 0x3); break; case 7: halbtc8723b1ant_CoexTable(pBtCoexist, bForceExec, 0xaaaaaaaa, 0xaaaaaaaa, 0xffffff, 0x3); @@ -1018,54 +1125,6 @@ halbtc8723b1ant_IgnoreWlanAct( pCoexDm->bPreIgnoreWlanAct = pCoexDm->bCurIgnoreWlanAct; } -VOID -halbtc8723b1ant_SetFwPstdma( - IN PBTC_COEXIST pBtCoexist, - IN u1Byte byte1, - IN u1Byte byte2, - IN u1Byte byte3, - IN u1Byte byte4, - IN u1Byte byte5 - ) -{ - u1Byte H2C_Parameter[5] ={0}; - u1Byte realByte1=byte1, realByte5=byte5; - BOOLEAN bApEnable=FALSE; - - pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_AP_MODE_ENABLE, &bApEnable); - - if(bApEnable) - { - if(byte1&BIT4 && !(byte1&BIT5)) - { - BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], FW for 1Ant AP mode\n")); - realByte1 &= ~BIT4; - realByte1 |= BIT5; - - realByte5 |= BIT5; - realByte5 &= ~BIT6; - } - } - - H2C_Parameter[0] = realByte1; - H2C_Parameter[1] = byte2; - H2C_Parameter[2] = byte3; - H2C_Parameter[3] = byte4; - H2C_Parameter[4] = realByte5; - - pCoexDm->psTdmaPara[0] = realByte1; - pCoexDm->psTdmaPara[1] = byte2; - pCoexDm->psTdmaPara[2] = byte3; - pCoexDm->psTdmaPara[3] = byte4; - pCoexDm->psTdmaPara[4] = realByte5; - - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], PS-TDMA H2C cmd =0x%x%08x\n", - H2C_Parameter[0], - H2C_Parameter[1]<<24|H2C_Parameter[2]<<16|H2C_Parameter[3]<<8|H2C_Parameter[4])); - - pBtCoexist->fBtcFillH2c(pBtCoexist, 0x60, 5, H2C_Parameter); -} - VOID halbtc8723b1ant_SetLpsRpwm( IN PBTC_COEXIST pBtCoexist, @@ -1131,6 +1190,7 @@ VOID halbtc8723b1ant_SetAntPath( IN PBTC_COEXIST pBtCoexist, IN u1Byte antPosType, + IN BOOLEAN bForceExec, IN BOOLEAN bInitHwCfg, IN BOOLEAN bWifiOff ) @@ -1141,12 +1201,13 @@ halbtc8723b1ant_SetAntPath( BOOLEAN bUseExtSwitch=FALSE; BOOLEAN bIsInMpMode = FALSE; u1Byte H2C_Parameter[2] ={0}, u1Tmp = 0; - PADAPTER padapter=pBtCoexist->Adapter; + + pCoexDm->curAntPosType = antPosType; + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_EXT_SWITCH, &bPgExtSwitch); pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_FW_VER, &fwVer); // [31:16]=fw ver, [15:0]=fw sub ver - - if((fwVer<0xc0000) || bPgExtSwitch) + if((fwVer>0 && fwVer<0xc0000) || bPgExtSwitch) bUseExtSwitch = TRUE; if(bInitHwCfg) @@ -1154,30 +1215,19 @@ halbtc8723b1ant_SetAntPath( pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x780); //WiFi TRx Mask on pBtCoexist->fBtcSetBtReg(pBtCoexist, BTC_BT_REG_RF, 0x3c, 0x15); //BT TRx Mask on - // BT calibration check - while(cntBtCalChk <= 20) + if(fwVer >= 0x180000) { - delay_ms(50); - - u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x49d); - cntBtCalChk++; - if(u1Tmp & BIT0) - { - BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], ########### BT is calibrating (wait cnt=%d) ###########\n", cntBtCalChk)); - } - else - { - BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], ********** BT is NOT calibrating (wait cnt=%d)**********\n", cntBtCalChk)); - break; - } - } - - /* Use H2C to set GNT_BT to LOW */ - H2C_Parameter[0] = 0; + /* Use H2C to set GNT_BT to HIGH */ + H2C_Parameter[0] = 1; pBtCoexist->fBtcFillH2c(pBtCoexist, 0x6E, 1, H2C_Parameter); - + } + else + { + // set grant_bt to high + pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x765, 0x18); + } //set wlan_act control by PTA - pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0xc); + pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0x4); pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x67, 0x20, 0x1); //BT select s0/s1 is controlled by WiFi @@ -1188,15 +1238,22 @@ halbtc8723b1ant_SetAntPath( } else if(bWifiOff) { + if(fwVer >= 0x180000) + { /* Use H2C to set GNT_BT to HIGH */ H2C_Parameter[0] = 1; pBtCoexist->fBtcFillH2c(pBtCoexist, 0x6E, 1, H2C_Parameter); - + } + else + { + // set grant_bt to high + pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x765, 0x18); + } //set wlan_act to always low pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0x4); pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_IS_IN_MP_MODE, &bIsInMpMode); - if (bIsInMpMode == FALSE) + if(!bIsInMpMode) pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x67, 0x20, 0x0); //BT select s0/s1 is controlled by BT else pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x67, 0x20, 0x1); //BT select s0/s1 is controlled by WiFi @@ -1207,6 +1264,46 @@ halbtc8723b1ant_SetAntPath( u4Tmp &= ~BIT24; pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x4c, u4Tmp); } + else + { + /* Use H2C to set GNT_BT to LOW */ + if(fwVer >= 0x180000) + { + if (pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x765) != 0) + { + H2C_Parameter[0] = 0; + pBtCoexist->fBtcFillH2c(pBtCoexist, 0x6E, 1, H2C_Parameter); + } + } + else + { + // BT calibration check + while(cntBtCalChk <= 20) + { + u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x49d); + cntBtCalChk++; + if(u1Tmp & BIT0) + { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], ########### BT is calibrating (wait cnt=%d) ###########\n", cntBtCalChk)); + delay_ms(50); + } + else + { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], ********** BT is NOT calibrating (wait cnt=%d)**********\n", cntBtCalChk)); + break; + } + } + + // set grant_bt to PTA + pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x765, 0x0); + } + + if (pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x76e) != 0xc) + { + //set wlan_act control by PTA + pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0xc); + } + } if(bUseExtSwitch) { @@ -1222,8 +1319,6 @@ halbtc8723b1ant_SetAntPath( if(pBoardInfo->btdmAntPos == BTC_ANTENNA_AT_MAIN_PORT) { - //pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x64, 0x1, 0x1); //Main Ant to BT for IPS case 0x4c[23]=1 - //tell firmware "no antenna inverse" H2C_Parameter[0] = 0; H2C_Parameter[1] = 1; //ext switch type @@ -1231,8 +1326,6 @@ halbtc8723b1ant_SetAntPath( } else { - //pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x64, 0x1, 0x0); //Aux Ant to BT for IPS case 0x4c[23]=1 - //tell firmware "antenna inverse" H2C_Parameter[0] = 1; H2C_Parameter[1] = 1; //ext switch type @@ -1240,38 +1333,32 @@ halbtc8723b1ant_SetAntPath( } } -#if 0 - // fixed internal switch first - if(pBoardInfo->btdmAntPos == BTC_ANTENNA_AT_MAIN_PORT) - pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, 0x0); // fixed internal switch S1->WiFi, S0->BT - else - pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, 0x280); // fixed internal switch S0->WiFi, S1->BT -#endif - - // ext switch setting - switch(antPosType) + if(bForceExec || (pCoexDm->curAntPosType != pCoexDm->preAntPosType)) { - case BTC_ANT_PATH_WIFI: - if(pBoardInfo->btdmAntPos == BTC_ANTENNA_AT_MAIN_PORT) - pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x92c, 0x3, 0x1); - else - pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x92c, 0x3, 0x2); - break; - case BTC_ANT_PATH_BT: - if(pBoardInfo->btdmAntPos == BTC_ANTENNA_AT_MAIN_PORT) - pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x92c, 0x3, 0x2); - else - pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x92c, 0x3, 0x1); - break; - default: - case BTC_ANT_PATH_PTA: - if(pBoardInfo->btdmAntPos == BTC_ANTENNA_AT_MAIN_PORT) - pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x92c, 0x3, 0x1); - else - pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x92c, 0x3, 0x2); - break; + // ext switch setting + switch(antPosType) + { + case BTC_ANT_PATH_WIFI: + if(pBoardInfo->btdmAntPos == BTC_ANTENNA_AT_MAIN_PORT) + pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x92c, 0x3, 0x1); + else + pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x92c, 0x3, 0x2); + break; + case BTC_ANT_PATH_BT: + if(pBoardInfo->btdmAntPos == BTC_ANTENNA_AT_MAIN_PORT) + pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x92c, 0x3, 0x2); + else + pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x92c, 0x3, 0x1); + break; + default: + case BTC_ANT_PATH_PTA: + if(pBoardInfo->btdmAntPos == BTC_ANTENNA_AT_MAIN_PORT) + pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x92c, 0x3, 0x1); + else + pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x92c, 0x3, 0x2); + break; + } } - } else { @@ -1283,11 +1370,11 @@ halbtc8723b1ant_SetAntPath( u4Tmp &=~BIT24; pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x4c, u4Tmp); - pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x64, 0x1, 0x0);//fixed external switch S1->Main, S0->Aux + //Fix Ext switch Main->S1, Aux->S0 + pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x64, 0x1, 0x0); if(pBoardInfo->btdmAntPos == BTC_ANTENNA_AT_MAIN_PORT) { - //pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x64, 0x1, 0x0); //Main Ant to WiFi for IPS case 0x4c[23]=1 //tell firmware "no antenna inverse" H2C_Parameter[0] = 0; @@ -1296,7 +1383,6 @@ halbtc8723b1ant_SetAntPath( } else { - //pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x64, 0x1, 0x1); //Aux Ant to BT for IPS case 0x4c[23]=1 //tell firmware "antenna inverse" H2C_Parameter[0] = 1; @@ -1305,39 +1391,35 @@ halbtc8723b1ant_SetAntPath( } } -#if 0 - // fixed external switch first - if(pBoardInfo->btdmAntPos == BTC_ANTENNA_AT_MAIN_PORT) - pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x92c, 0x3, 0x1); //Main->WiFi, Aux->BT - else - pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x92c, 0x3, 0x2); //Main->BT, Aux->WiFi -#endif - - // internal switch setting - switch(antPosType) + if(bForceExec || (pCoexDm->curAntPosType != pCoexDm->preAntPosType)) { - case BTC_ANT_PATH_WIFI: - if(pBoardInfo->btdmAntPos == BTC_ANTENNA_AT_MAIN_PORT) - pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, 0x0); - else - pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, 0x280); - break; - case BTC_ANT_PATH_BT: - if(pBoardInfo->btdmAntPos == BTC_ANTENNA_AT_MAIN_PORT) - pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, 0x280); - else - pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, 0x0); - break; - default: - case BTC_ANT_PATH_PTA: - if(pBoardInfo->btdmAntPos == BTC_ANTENNA_AT_MAIN_PORT) - pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, 0x200); - else - pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, 0x80); - break; + // internal switch setting + switch(antPosType) + { + case BTC_ANT_PATH_WIFI: + if(pBoardInfo->btdmAntPos == BTC_ANTENNA_AT_MAIN_PORT) + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, 0x0); + else + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, 0x280); + break; + case BTC_ANT_PATH_BT: + if(pBoardInfo->btdmAntPos == BTC_ANTENNA_AT_MAIN_PORT) + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, 0x280); + else + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, 0x0); + break; + default: + case BTC_ANT_PATH_PTA: + if(pBoardInfo->btdmAntPos == BTC_ANTENNA_AT_MAIN_PORT) + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, 0x200); + else + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, 0x80); + break; + } } } - + + pCoexDm->preAntPosType = pCoexDm->curAntPosType; } VOID @@ -1356,7 +1438,6 @@ halbtc8723b1ant_SetAntPathDCut( BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], set BT Ant, bAntennaAux/bExtSwitch/bTwoAntenna/antennaPos/wifiState=%d/%d/%d/%d/%d\n", bAntennaAux, bExtSwitch, bTwoAntenna, antennaPos, wifiState)); - buf[0] = dataLen; if(bAntennaAux) @@ -1373,9 +1454,57 @@ halbtc8723b1ant_SetAntPathDCut( buf[5] = wifiState; pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_CTRL_8723B_ANT, (PVOID)&buf[0]); - } +VOID +halbtc8723b1ant_SetFwPstdma( + IN PBTC_COEXIST pBtCoexist, + IN u1Byte byte1, + IN u1Byte byte2, + IN u1Byte byte3, + IN u1Byte byte4, + IN u1Byte byte5 + ) +{ + u1Byte H2C_Parameter[5] ={0}; + u1Byte realByte1=byte1, realByte5=byte5; + BOOLEAN bApEnable=FALSE; + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_AP_MODE_ENABLE, &bApEnable); + + if(bApEnable) + { + if(byte1&BIT4 && !(byte1&BIT5)) + { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], FW for 1Ant AP mode\n")); + realByte1 &= ~BIT4; + realByte1 |= BIT5; + + realByte5 |= BIT5; + realByte5 &= ~BIT6; + } + } + + H2C_Parameter[0] = realByte1; + H2C_Parameter[1] = byte2; + H2C_Parameter[2] = byte3; + H2C_Parameter[3] = byte4; + H2C_Parameter[4] = realByte5; + + pCoexDm->psTdmaPara[0] = realByte1; + pCoexDm->psTdmaPara[1] = byte2; + pCoexDm->psTdmaPara[2] = byte3; + pCoexDm->psTdmaPara[3] = byte4; + pCoexDm->psTdmaPara[4] = realByte5; + + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], PS-TDMA H2C cmd =0x%x%08x\n", + H2C_Parameter[0], + H2C_Parameter[1]<<24|H2C_Parameter[2]<<16|H2C_Parameter[3]<<8|H2C_Parameter[4])); + + pBtCoexist->fBtcFillH2c(pBtCoexist, 0x60, 5, H2C_Parameter); +} + + VOID halbtc8723b1ant_PsTdma( IN PBTC_COEXIST pBtCoexist, @@ -1385,9 +1514,12 @@ halbtc8723b1ant_PsTdma( ) { PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo; - BOOLEAN bTurnOnByCnt=FALSE, bWifiBusy=FALSE; + PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo; + BOOLEAN bTurnOnByCnt=FALSE, bWifiBusy=FALSE, bWiFiNoisy=FALSE; u1Byte psTdmaTypeByCnt=0, rssiAdjustVal=0; - //u4Byte fwVer=0; + u1Byte psTdmaByte4Val = 0x50, psTdmaByte0Val = 0x51, psTdmaByte3Val = 0x10; + s1Byte nWiFiDurationAdjust = 0x0; + static BOOLEAN bPreWifiBusy=FALSE; //BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s turn %s PS TDMA, type=%d\n", // (bForceExec? "force to":""), (bTurnOn? "ON":"OFF"), type)); @@ -1396,6 +1528,12 @@ halbtc8723b1ant_PsTdma( pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy); + if (bWifiBusy != bPreWifiBusy) + { + bForceExec = TRUE; + bPreWifiBusy = bWifiBusy; + } + if (pCoexDm->bCurPsTdmaOn) { BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], ********** TDMA(on, %d) **********\n", @@ -1413,40 +1551,56 @@ halbtc8723b1ant_PsTdma( (pCoexDm->prePsTdma == pCoexDm->curPsTdma) ) return; } - if(bTurnOn) + + if (pCoexSta->nScanAPNum <= 5) + nWiFiDurationAdjust = 2; + else if (pCoexSta->nScanAPNum >= 40) + nWiFiDurationAdjust = -15; + else if (pCoexSta->nScanAPNum >= 20) + nWiFiDurationAdjust = -10; + + if (!pCoexSta->bForceLpsOn) //only for A2DP-only case 1/2/9/11 while wifi noisy threshold > 30 { + psTdmaByte0Val = 0x61; //no null-pkt + psTdmaByte3Val = 0x11; // no tx-pause at BT-slot + psTdmaByte4Val = 0x10; // 0x778 = d/1 toggle + } + + if ( (type == 3) || (type == 13) || (type == 14) ) + { + psTdmaByte4Val = psTdmaByte4Val & 0xbf; //no dynamic slot for multi-profile + + if (!bWifiBusy) + psTdmaByte4Val = psTdmaByte4Val | 0x1; //0x778 = 0x1 at wifi slot (no blocking BT Low-Pri pkts) + } + + if (pBtLinkInfo->bSlaveRole == TRUE) + psTdmaByte4Val = psTdmaByte4Val | 0x1; //0x778 = 0x1 at wifi slot (no blocking BT Low-Pri pkts) + + if(bTurnOn) + { switch(type) { default: - halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x1a, 0x1a, 0x0, 0x50); + halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x1a, 0x1a, 0x0, psTdmaByte4Val); break; case 1: - //if(bWifiBusy) - halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x3a, 0x03, 0x10, 0x50); - //else - // halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x3a, 0x03, 0x10, 0x51); - - rssiAdjustVal = 11; + halbtc8723b1ant_SetFwPstdma(pBtCoexist, psTdmaByte0Val, 0x3a+nWiFiDurationAdjust, 0x03, psTdmaByte3Val, psTdmaByte4Val); break; case 2: - //if(bWifiBusy) - halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x2b, 0x03, 0x10, 0x50); - //else - // halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x2b, 0x03, 0x10, 0x51); - rssiAdjustVal = 14; + halbtc8723b1ant_SetFwPstdma(pBtCoexist, psTdmaByte0Val, 0x2d+nWiFiDurationAdjust, 0x03, psTdmaByte3Val, psTdmaByte4Val); break; case 3: - halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x1d, 0x1d, 0x0, 0x52); + halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x1d, 0x1d, 0x0, psTdmaByte4Val); break; case 4: halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x93, 0x15, 0x3, 0x14, 0x0); - rssiAdjustVal = 17; break; case 5: - halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x61, 0x15, 0x3, 0x11, 0x10); + halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x61, 0x15, 0x3, 0x11, 0x11); break; case 6: - halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x61, 0x20, 0x3, 0x11, 0x13); + halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x61, 0x20, 0x3, 0x11, 0x11); break; case 7: halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x13, 0xc, 0x5, 0x0, 0x0); @@ -1455,38 +1609,34 @@ halbtc8723b1ant_PsTdma( halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x93, 0x25, 0x3, 0x10, 0x0); break; case 9: - halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x21, 0x3, 0x10, 0x50); - rssiAdjustVal = 18; + halbtc8723b1ant_SetFwPstdma(pBtCoexist, psTdmaByte0Val, 0x21, 0x3, psTdmaByte3Val, psTdmaByte4Val); break; case 10: halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x13, 0xa, 0xa, 0x0, 0x40); break; case 11: - halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x15, 0x03, 0x10, 0x50); - rssiAdjustVal = 20; + halbtc8723b1ant_SetFwPstdma(pBtCoexist, psTdmaByte0Val, 0x21, 0x03, psTdmaByte3Val, psTdmaByte4Val); break; case 12: halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x0a, 0x0a, 0x0, 0x50); break; case 13: - halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x12, 0x12, 0x0, 0x50); + halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x12, 0x12, 0x0, psTdmaByte4Val); break; case 14: - halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x21, 0x3, 0x10, 0x52); + halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51, 0x21, 0x3, 0x10, psTdmaByte4Val); break; case 15: halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x13, 0xa, 0x3, 0x8, 0x0); break; case 16: halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x93, 0x15, 0x3, 0x10, 0x0); - rssiAdjustVal = 18; break; case 18: halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x93, 0x25, 0x3, 0x10, 0x0); - rssiAdjustVal = 14; break; case 20: - halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x61, 0x35, 0x03, 0x11, 0x10); + halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x61, 0x3f, 0x03, 0x11, 0x10); break; case 21: halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x61, 0x25, 0x03, 0x11, 0x11); @@ -1496,23 +1646,18 @@ halbtc8723b1ant_PsTdma( break; case 23: halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x3, 0x31, 0x18); - rssiAdjustVal = 22; break; case 24: halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0xe3, 0x15, 0x3, 0x31, 0x18); - rssiAdjustVal = 22; break; case 25: halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0x3, 0x31, 0x18); - rssiAdjustVal = 22; break; case 26: halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0x3, 0x31, 0x18); - rssiAdjustVal = 22; break; case 27: halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x3, 0x31, 0x98); - rssiAdjustVal = 22; break; case 28: halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x69, 0x25, 0x3, 0x31, 0x0); @@ -1556,29 +1701,35 @@ halbtc8723b1ant_PsTdma( case 8: //PTA Control halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x8, 0x0, 0x0, 0x0, 0x0); //halbtc8723b1ant_SetAntPathDCut(pBtCoexist, FALSE, FALSE, FALSE, BTC_ANT_PATH_PTA, BTC_WIFI_STAT_NORMAL); - halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_PTA, FALSE, FALSE); + //halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_PTA, FALSE, FALSE); break; case 0: default: //Software control, Antenna at BT side halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x0, 0x0); //halbtc8723b1ant_SetAntPathDCut(pBtCoexist, FALSE, FALSE, FALSE, BTC_ANT_PATH_BT, BTC_WIFI_STAT_NORMAL); - halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, FALSE); + //halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, FALSE); break; +#if 0 case 9: //Software control, Antenna at WiFi side halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x0, 0x0); //halbtc8723b1ant_SetAntPathDCut(pBtCoexist, FALSE, FALSE, FALSE, BTC_ANT_PATH_WIFI, BTC_WIFI_STAT_NORMAL); halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_WIFI, FALSE, FALSE); break; +#endif } } rssiAdjustVal =0; pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_RSSI_ADJ_VAL_FOR_1ANT_COEX_TYPE, &rssiAdjustVal); + + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("############# [BTCoex], 0x948=0x%x, 0x765=0x%x, 0x67=0x%x\n", + pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x948), pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x765), pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x67))); + // update pre state pCoexDm->bPrePsTdmaOn = pCoexDm->bCurPsTdmaOn; pCoexDm->prePsTdma = pCoexDm->curPsTdma; } - +#if 0 VOID halbtc8723b1ant_CoexAllOff( IN PBTC_COEXIST pBtCoexist @@ -1588,9 +1739,9 @@ halbtc8723b1ant_CoexAllOff( halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE); // hw all off - halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0); + halbtc8723b1ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 0); } - +#endif BOOLEAN halbtc8723b1ant_IsCommonAction( IN PBTC_COEXIST pBtCoexist @@ -1606,7 +1757,7 @@ halbtc8723b1ant_IsCommonAction( { BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non connected-idle + BT non connected-idle!!\n")); - halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE); + //halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE); bCommon = TRUE; } @@ -1615,7 +1766,7 @@ halbtc8723b1ant_IsCommonAction( { BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi connected + BT non connected-idle!!\n")); - halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE); + //halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE); bCommon = TRUE; } @@ -1624,7 +1775,7 @@ halbtc8723b1ant_IsCommonAction( { BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non connected-idle + BT connected-idle!!\n")); - halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE); + //halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE); bCommon = TRUE; } @@ -1633,7 +1784,7 @@ halbtc8723b1ant_IsCommonAction( { BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi connected + BT connected-idle!!\n")); - halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE); + //halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE); bCommon = TRUE; } @@ -1642,7 +1793,7 @@ halbtc8723b1ant_IsCommonAction( { BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non connected-idle + BT Busy!!\n")); - halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE); + //halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE); bCommon = TRUE; } @@ -1728,6 +1879,10 @@ halbtc8723b1ant_TdmaDurationAdjustForAcl( //BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], retryCount = %d\n", retryCount)); //BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], up=%d, dn=%d, m=%d, n=%d, WaitCount=%d\n", // up, dn, m, n, WaitCount)); + + if ( (pCoexSta->lowPriorityTx) > 1150 || (pCoexSta->lowPriorityRx) > 1250 ) + retryCount++; + result = 0; WaitCount++; @@ -1885,7 +2040,7 @@ halbtc8723b1ant_PsTdmaCheckForPowerSaveState( else { // will leave LPS state, turn off psTdma first - halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0); + halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8); } } else // NO PS state @@ -1893,7 +2048,7 @@ halbtc8723b1ant_PsTdmaCheckForPowerSaveState( if(bNewPsState) { // will enter LPS state, turn off psTdma first - halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0); + halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8); } else { @@ -1919,6 +2074,7 @@ halbtc8723b1ant_PowerSaveState( bLowPwrDisable = FALSE; pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable); pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_NORMAL_LPS, NULL); + pCoexSta->bForceLpsOn = FALSE; break; case BTC_PS_LPS_ON: halbtc8723b1ant_PsTdmaCheckForPowerSaveState(pBtCoexist, TRUE); @@ -1928,10 +2084,12 @@ halbtc8723b1ant_PowerSaveState( pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable); // power save must executed before psTdma. pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_ENTER_LPS, NULL); + pCoexSta->bForceLpsOn = TRUE; break; case BTC_PS_LPS_OFF: halbtc8723b1ant_PsTdmaCheckForPowerSaveState(pBtCoexist, FALSE); pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_LEAVE_LPS, NULL); + pCoexSta->bForceLpsOn = FALSE; break; default: break; @@ -1943,8 +2101,9 @@ halbtc8723b1ant_ActionWifiOnly( IN PBTC_COEXIST pBtCoexist ) { - halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0); - halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 9); + halbtc8723b1ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 0); + halbtc8723b1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 8); + halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_PTA, FORCE_EXEC, FALSE, FALSE); } VOID @@ -2016,6 +2175,8 @@ halbtc8723b1ant_MonitorBtEnableDisable( //============================================= // SCO only or SCO+PAN(HS) + +/* VOID halbtc8723b1ant_ActionSco( IN PBTC_COEXIST pBtCoexist @@ -2101,6 +2262,8 @@ halbtc8723b1ant_ActionHidA2dp( halbtc8723b1ant_SwMechanism(pBtCoexist, TRUE); } +*/ + //============================================= // // Non-Software Coex Mechanism start @@ -2114,6 +2277,7 @@ halbtc8723b1ant_ActionWifiMultiPort( halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8); + halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_PTA, NORMAL_EXEC, FALSE, FALSE); halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2); } @@ -2143,19 +2307,18 @@ halbtc8723b1ant_ActionBtInquiry( { halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8); - + halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_PTA, NORMAL_EXEC, FALSE, FALSE); halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0); } - else if( (pBtLinkInfo->bScoExist) || - (pBtLinkInfo->bHidExist) ) + else if( (pBtLinkInfo->bScoExist) || (pBtLinkInfo->bHidExist) || (pBtLinkInfo->bA2dpExist) ) { - // SCO/HID-only busy + // SCO/HID/A2DP busy halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 32); halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4); } - else if ( (pBtLinkInfo->bA2dpExist) || (pBtLinkInfo->bPanExist) || (bWifiBusy) ) + else if ( (pBtLinkInfo->bPanExist) || (bWifiBusy) ) { halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20); @@ -2166,7 +2329,7 @@ halbtc8723b1ant_ActionBtInquiry( { halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8); - + halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_PTA, NORMAL_EXEC, FALSE, FALSE); halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7); } } @@ -2188,35 +2351,13 @@ halbtc8723b1ant_ActionBtScoHidOnlyBusy( if(pBtLinkInfo->bScoExist) { halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5); - halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2); + halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 5); } else //HID { halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6); halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 5); } -/* - if(pBtLinkInfo->bScoExist || pBtLinkInfo->bHidExist) - { - if(bWifiConnected) - { - wifiRssiState = halbtc8723b1ant_WifiRssiState(pBtCoexist, 0, 2, 30, 0); - if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || - (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) - { - halbtc8723b1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 2, 1, 1, 1); - } - else - { - halbtc8723b1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 1, 1, 1, 1); - } - } - else - { - halbtc8723b1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0); - } - } -*/ } VOID @@ -2230,6 +2371,15 @@ halbtc8723b1ant_ActionWifiConnectedBtAclBusy( PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo; btRssiState = halbtc8723b1ant_BtRssiState(2, 28, 0); + if ( (pCoexSta->lowPriorityRx >= 950) && (!pCoexSta->bUnderIps) ) + { + pBtLinkInfo->bSlaveRole = TRUE; + } + else + { + pBtLinkInfo->bSlaveRole = FALSE; + } + if(pBtLinkInfo->bHidOnly) //HID { halbtc8723b1ant_ActionBtScoHidOnlyBusy(pBtCoexist, wifiStatus); @@ -2240,58 +2390,42 @@ halbtc8723b1ant_ActionWifiConnectedBtAclBusy( { if(BT_8723B_1ANT_WIFI_STATUS_CONNECTED_IDLE == wifiStatus) { - //halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8); - //halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2); halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 32); - halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1); + halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4); pCoexDm->bAutoTdmaAdjust = FALSE; } - else if( (btRssiState == BTC_RSSI_STATE_HIGH) || - (btRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + else { halbtc8723b1ant_TdmaDurationAdjustForAcl(pBtCoexist, wifiStatus); - halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1); + halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4); + pCoexDm->bAutoTdmaAdjust = TRUE; } - else //for low BT RSSI - { - halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11); - halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1); - pCoexDm->bAutoTdmaAdjust = FALSE; - } - } - else if(pBtLinkInfo->bHidExist&&pBtLinkInfo->bA2dpExist) //HID+A2DP - { - if( (btRssiState == BTC_RSSI_STATE_HIGH) || - (btRssiState == BTC_RSSI_STATE_STAY_HIGH) ) - { - halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14); - pCoexDm->bAutoTdmaAdjust = FALSE; - } - else //for low BT RSSI - { - halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14); - pCoexDm->bAutoTdmaAdjust = FALSE; - } - - halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 6); - } - else if( (pBtLinkInfo->bPanOnly) || (pBtLinkInfo->bHidExist&&pBtLinkInfo->bPanExist) ) //PAN(OPP,FTP), HID+PAN(OPP,FTP) - { - halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3); - halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 6); - pCoexDm->bAutoTdmaAdjust = FALSE; } else if ( ((pBtLinkInfo->bA2dpExist) && (pBtLinkInfo->bPanExist)) || (pBtLinkInfo->bHidExist&&pBtLinkInfo->bA2dpExist&&pBtLinkInfo->bPanExist) ) //A2DP+PAN(OPP,FTP), HID+A2DP+PAN(OPP,FTP) { halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13); - halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1); + halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4); + pCoexDm->bAutoTdmaAdjust = FALSE; + } + else if(pBtLinkInfo->bHidExist&&pBtLinkInfo->bA2dpExist) //HID+A2DP + { + halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14); + pCoexDm->bAutoTdmaAdjust = FALSE; + + halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 3); + } + else if( (pBtLinkInfo->bPanOnly) || (pBtLinkInfo->bHidExist&&pBtLinkInfo->bPanExist) ) //PAN(OPP,FTP), HID+PAN(OPP,FTP) + { + halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3); + halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4); pCoexDm->bAutoTdmaAdjust = FALSE; } else { - halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11); - halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1); + //BT no-profile busy (0x9) + halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 32); + halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4); pCoexDm->bAutoTdmaAdjust = FALSE; } } @@ -2306,6 +2440,7 @@ halbtc8723b1ant_ActionWifiNotConnected( // tdma and coex table halbtc8723b1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 8); + halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_PTA, NORMAL_EXEC, FALSE, FALSE); halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0); } @@ -2317,16 +2452,20 @@ halbtc8723b1ant_ActionWifiNotConnectedScan( PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo; halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); - halbtc8723b1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 8); //Force antenna setup for no scan result issue // tdma and coex table if(BT_8723B_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) { - if(pBtLinkInfo->bA2dpExist && pBtLinkInfo->bPanExist) - { + if (pBtLinkInfo->bA2dpExist) + { + halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 32); + halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4); + } + else if (pBtLinkInfo->bA2dpExist && pBtLinkInfo->bPanExist) + { halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 22); halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4); - } + } else { halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20); @@ -2341,11 +2480,9 @@ halbtc8723b1ant_ActionWifiNotConnectedScan( } else { - //halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20); - //halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1); - //Bryant Add halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8); + halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_PTA, NORMAL_EXEC, FALSE, FALSE); halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2); } } @@ -2360,20 +2497,21 @@ halbtc8723b1ant_ActionWifiNotConnectedAssoAuth( halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); // tdma and coex table - if( (pBtLinkInfo->bScoExist) || (pBtLinkInfo->bHidExist) ) + if( (pBtLinkInfo->bScoExist) || (pBtLinkInfo->bHidExist) || (pBtLinkInfo->bA2dpExist) ) { halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 32); - halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4); + halbtc8723b1ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 4); } - else if( (pBtLinkInfo->bA2dpExist) || (pBtLinkInfo->bPanExist) ) + else if (pBtLinkInfo->bPanExist) { halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20); - halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4); + halbtc8723b1ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 4); } else { halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8); - halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2); + halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_PTA, NORMAL_EXEC, FALSE, FALSE); + halbtc8723b1ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 2); } } @@ -2389,11 +2527,16 @@ halbtc8723b1ant_ActionWifiConnectedScan( // tdma and coex table if(BT_8723B_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) { - if(pBtLinkInfo->bA2dpExist && pBtLinkInfo->bPanExist) - { + if (pBtLinkInfo->bA2dpExist) + { + halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 32); + halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4); + } + else if (pBtLinkInfo->bA2dpExist && pBtLinkInfo->bPanExist) + { halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 22); halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4); - } + } else { halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20); @@ -2408,11 +2551,9 @@ halbtc8723b1ant_ActionWifiConnectedScan( } else { - //halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20); - //halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1); - //Bryant Add halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8); + halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_PTA, NORMAL_EXEC, FALSE, FALSE); halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2); } } @@ -2427,12 +2568,12 @@ halbtc8723b1ant_ActionWifiConnectedSpecialPacket( halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); // tdma and coex table - if( (pBtLinkInfo->bScoExist) || (pBtLinkInfo->bHidExist) ) + if( (pBtLinkInfo->bScoExist) || (pBtLinkInfo->bHidExist) || (pBtLinkInfo->bA2dpExist) ) { halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 32); halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4); } - else if( (pBtLinkInfo->bA2dpExist) || (pBtLinkInfo->bPanExist) ) + else if(pBtLinkInfo->bPanExist) { halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20); halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4); @@ -2440,6 +2581,7 @@ halbtc8723b1ant_ActionWifiConnectedSpecialPacket( else { halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8); + halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_PTA, NORMAL_EXEC, FALSE, FALSE); halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2); } } @@ -2479,11 +2621,28 @@ halbtc8723b1ant_ActionWifiConnected( pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_AP_MODE_ENABLE, &bApEnable); pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy); + // power save state if(!bApEnable && BT_8723B_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus && !pBtCoexist->btLinkInfo.bHidOnly) { - if(!bWifiBusy && pBtCoexist->btLinkInfo.bA2dpOnly) //A2DP + if(pBtCoexist->btLinkInfo.bA2dpOnly) //A2DP + { + if(!bWifiBusy) + halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); + else //busy + { + if (pCoexSta->nScanAPNum >= BT_8723B_1ANT_WIFI_NOISY_THRESH) //no force LPS, no PS-TDMA, use pure TDMA + { halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); + } + else + { + halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x4); + } + } + } + else if ((pCoexSta->bPanExist == FALSE) && (pCoexSta->bA2dpExist == FALSE) && (pCoexSta->bHidExist == FALSE)) + halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); else halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x4); } @@ -2507,7 +2666,11 @@ halbtc8723b1ant_ActionWifiConnected( else { halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8); + halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_PTA, NORMAL_EXEC, FALSE, FALSE); + if ( (pCoexSta->highPriorityTx) + (pCoexSta->highPriorityRx) <= 60 ) halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2); + else + halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7); } } else @@ -2526,7 +2689,11 @@ halbtc8723b1ant_ActionWifiConnected( else { halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8); + halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_PTA, NORMAL_EXEC, FALSE, FALSE); + if ( (pCoexSta->highPriorityTx) + (pCoexSta->highPriorityRx) <= 60 ) halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2); + else + halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7); } } } @@ -2551,43 +2718,43 @@ halbtc8723b1ant_RunSwCoexistMechanism( { case BT_8723B_1ANT_COEX_ALGO_SCO: BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = SCO.\n")); - halbtc8723b1ant_ActionSco(pBtCoexist); + //halbtc8723b1ant_ActionSco(pBtCoexist); break; case BT_8723B_1ANT_COEX_ALGO_HID: BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = HID.\n")); - halbtc8723b1ant_ActionHid(pBtCoexist); + //halbtc8723b1ant_ActionHid(pBtCoexist); break; case BT_8723B_1ANT_COEX_ALGO_A2DP: BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = A2DP.\n")); - halbtc8723b1ant_ActionA2dp(pBtCoexist); + //halbtc8723b1ant_ActionA2dp(pBtCoexist); break; case BT_8723B_1ANT_COEX_ALGO_A2DP_PANHS: BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = A2DP+PAN(HS).\n")); - halbtc8723b1ant_ActionA2dpPanHs(pBtCoexist); + //halbtc8723b1ant_ActionA2dpPanHs(pBtCoexist); break; case BT_8723B_1ANT_COEX_ALGO_PANEDR: BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = PAN(EDR).\n")); - halbtc8723b1ant_ActionPanEdr(pBtCoexist); + //halbtc8723b1ant_ActionPanEdr(pBtCoexist); break; case BT_8723B_1ANT_COEX_ALGO_PANHS: BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = HS mode.\n")); - halbtc8723b1ant_ActionPanHs(pBtCoexist); + //halbtc8723b1ant_ActionPanHs(pBtCoexist); break; case BT_8723B_1ANT_COEX_ALGO_PANEDR_A2DP: BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = PAN+A2DP.\n")); - halbtc8723b1ant_ActionPanEdrA2dp(pBtCoexist); + //halbtc8723b1ant_ActionPanEdrA2dp(pBtCoexist); break; case BT_8723B_1ANT_COEX_ALGO_PANEDR_HID: BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = PAN(EDR)+HID.\n")); - halbtc8723b1ant_ActionPanEdrHid(pBtCoexist); + //halbtc8723b1ant_ActionPanEdrHid(pBtCoexist); break; case BT_8723B_1ANT_COEX_ALGO_HID_A2DP_PANEDR: BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = HID+A2DP+PAN.\n")); - halbtc8723b1ant_ActionHidA2dpPanEdr(pBtCoexist); + //halbtc8723b1ant_ActionHidA2dpPanEdr(pBtCoexist); break; case BT_8723B_1ANT_COEX_ALGO_HID_A2DP: BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = HID+A2DP.\n")); - halbtc8723b1ant_ActionHidA2dp(pBtCoexist); + //halbtc8723b1ant_ActionHidA2dp(pBtCoexist); break; default: BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = coexist All Off!!\n")); @@ -2607,10 +2774,11 @@ halbtc8723b1ant_RunCoexistMechanism( BOOLEAN bWifiConnected=FALSE, bBtHsOn=FALSE; BOOLEAN bIncreaseScanDevNum=FALSE; BOOLEAN bBtCtrlAggBufSize=FALSE; + BOOLEAN bMiracastPlusBt=FALSE; u1Byte aggBufSize=5; u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH; u4Byte wifiLinkStatus=0; - u4Byte numOfWifiLink=0; + u4Byte numOfWifiLink=0, wifiBw; BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism()===>\n")); @@ -2644,62 +2812,73 @@ halbtc8723b1ant_RunCoexistMechanism( pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_LINK_STATUS, &wifiLinkStatus); numOfWifiLink = wifiLinkStatus>>16; - if(numOfWifiLink >= 2) + + if((numOfWifiLink>=2) || (wifiLinkStatus&WIFI_P2P_GO_CONNECTED)) { - halbtc8723b1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0); - halbtc8723b1ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, bBtCtrlAggBufSize, aggBufSize); - halbtc8723b1ant_ActionWifiMultiPort(pBtCoexist); - return; - } + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("############# [BTCoex], Multi-Port numOfWifiLink = %d, wifiLinkStatus = 0x%x\n", numOfWifiLink,wifiLinkStatus) ); - if(!pBtLinkInfo->bScoExist && !pBtLinkInfo->bHidExist) - { - halbtc8723b1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0); - } - else - { - if(bWifiConnected) + if(pBtLinkInfo->bBtLinkExist) { - wifiRssiState = halbtc8723b1ant_WifiRssiState(pBtCoexist, 1, 2, 30, 0); - if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || - (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) - { - halbtc8723b1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 1, 1, 1, 1); - } - else - { - halbtc8723b1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 1, 1, 1, 1); - } + halbtc8723b1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 1, 1, 0, 1); + bMiracastPlusBt = TRUE; } else { - halbtc8723b1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0); + halbtc8723b1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0); + bMiracastPlusBt = FALSE; + } + pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_MIRACAST_PLUS_BT, &bMiracastPlusBt); + halbtc8723b1ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, bBtCtrlAggBufSize, aggBufSize); + + if ( (pBtLinkInfo->bA2dpExist) && (pCoexSta->bC2hBtInquiryPage) ) + { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("############# [BTCoex], BT Is Inquirying \n") ); + halbtc8723b1ant_ActionBtInquiry(pBtCoexist); + } + else + halbtc8723b1ant_ActionWifiMultiPort(pBtCoexist); + + return; + } + else + { + bMiracastPlusBt = FALSE; + pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_MIRACAST_PLUS_BT, &bMiracastPlusBt); + } + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); + + if ( (pBtLinkInfo->bBtLinkExist) && (bWifiConnected) ) + { + halbtc8723b1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 1, 1, 0, 1); + + if(pBtLinkInfo->bScoExist) + halbtc8723b1ant_LimitedRx(pBtCoexist, NORMAL_EXEC, TRUE, FALSE, 0x5); + else + { + if (BTC_WIFI_BW_HT40==wifiBw) + halbtc8723b1ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, TRUE, 0x10); + else + halbtc8723b1ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, TRUE, 0x8); } + halbtc8723b1ant_SwMechanism(pBtCoexist, TRUE); + halbtc8723b1ant_RunSwCoexistMechanism(pBtCoexist); //just print debug message } + else + { + halbtc8723b1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0); - if(pBtLinkInfo->bScoExist) - { - bBtCtrlAggBufSize = TRUE; - aggBufSize = 0x3; - } - else if(pBtLinkInfo->bHidExist) - { - bBtCtrlAggBufSize = TRUE; - aggBufSize = 0x5; - } - else if(pBtLinkInfo->bA2dpExist || pBtLinkInfo->bPanExist) - { - bBtCtrlAggBufSize = TRUE; - aggBufSize = 0x8; - } - halbtc8723b1ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, bBtCtrlAggBufSize, aggBufSize); + halbtc8723b1ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, FALSE, 0x5); - halbtc8723b1ant_RunSwCoexistMechanism(pBtCoexist); + halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE); + halbtc8723b1ant_RunSwCoexistMechanism(pBtCoexist); ////just print debug message + } pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn); if(pCoexSta->bC2hBtInquiryPage) { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("############# [BTCoex], BT Is Inquirying \n") ); halbtc8723b1ant_ActionBtInquiry(pBtCoexist); return; } @@ -2747,7 +2926,9 @@ halbtc8723b1ant_InitCoexDm( halbtc8723b1ant_SwMechanism(pBtCoexist, FALSE); //halbtc8723b1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 8); - halbtc8723b1ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 0); + //halbtc8723b1ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 0); + + pCoexSta->popEventCnt = 0; } VOID @@ -2764,7 +2945,7 @@ halbtc8723b1ant_InitHwConfig( u1Byte H2C_Parameter[2] ={0}; BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], 1Ant Init HW Config!!\n")); - +#if 0//move to BTC_MEDIA_CONNECT if(bBackUp) { pCoexDm->backupArfrCnt1 = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x430); @@ -2772,7 +2953,7 @@ halbtc8723b1ant_InitHwConfig( pCoexDm->backupRetryLimit = pBtCoexist->fBtcRead2Byte(pBtCoexist, 0x42a); pCoexDm->backupAmpduMaxTime = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x456); } - +#endif pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x550, 0x8, 0x1); //enable TBTT nterrupt // 0x790[5:0]=0x5 @@ -2786,23 +2967,19 @@ halbtc8723b1ant_InitHwConfig( //pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x67, 0x20, 0x1); //BT select s0/s1 is controlled by WiFi + halbtc8723b1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 8); + //Antenna config -#if 1 if(bWifiOnly) - { - halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_WIFI, TRUE, FALSE); - halbtc8723b1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 9); - } + halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_WIFI, FORCE_EXEC, TRUE, FALSE); else - halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, TRUE, FALSE); -#endif - + halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FORCE_EXEC, TRUE, FALSE); #if 0 if(bWifiOnly) { halbtc8723b1ant_SetAntPathDCut(pBtCoexist, FALSE, FALSE, FALSE, BTC_ANT_PATH_WIFI, BTC_WIFI_STAT_INIT); - halbtc8723b1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 9); + halbtc8723b1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 8); } else halbtc8723b1ant_SetAntPathDCut(pBtCoexist, FALSE, FALSE, FALSE, BTC_ANT_PATH_BT, BTC_WIFI_STAT_INIT); @@ -2819,10 +2996,9 @@ halbtc8723b1ant_InitHwConfig( BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("############# [BTCoex], 0x948=0x%x, 0x765=0x%x, 0x67=0x%x\n", u4Tmp, u1Tmpa, u1Tmpb)); - - pCoexSta->bFinishInitHW = TRUE; } +/* VOID halbtc8723b1ant_WifiOffHwCfg( IN PBTC_COEXIST pBtCoexist @@ -2831,6 +3007,7 @@ halbtc8723b1ant_WifiOffHwCfg( // set wlan_act to low //pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0x4); } +*/ //============================================================ // work around function start with wa_halbtc8723b1ant_ @@ -2838,6 +3015,80 @@ halbtc8723b1ant_WifiOffHwCfg( //============================================================ // extern function start with EXhalbtc8723b1ant_ //============================================================ +VOID +EXhalbtc8723b1ant_PowerOnSetting( + IN PBTC_COEXIST pBtCoexist + ) +{ + PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo; + u1Byte u1Tmp=0x0; + u2Byte u2Tmp=0x0; + + pBtCoexist->bStopCoexDm = TRUE; + + pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x67, 0x20); + + // enable BB, REG_SYS_FUNC_EN such that we can write 0x948 correctly. + u2Tmp = pBtCoexist->fBtcRead2Byte(pBtCoexist, 0x2); + pBtCoexist->fBtcWrite2Byte(pBtCoexist, 0x2, u2Tmp|BIT0|BIT1); + + // set GRAN_BT = 1 + pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x765, 0x18); + // set WLAN_ACT = 0 + pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0x4); + + // + // S0 or S1 setting and Local register setting(By the setting fw can get ant number, S0/S1, ... info) + // Local setting bit define + // BIT0: "0" for no antenna inverse; "1" for antenna inverse + // BIT1: "0" for internal switch; "1" for external switch + // BIT2: "0" for one antenna; "1" for two antenna + // NOTE: here default all internal switch and 1-antenna ==> BIT1=0 and BIT2=0 + if(pBtCoexist->chipInterface == BTC_INTF_USB) + { + // fixed at S0 for USB interface + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, 0x0); + + u1Tmp |= 0x1; // antenna inverse + pBtCoexist->fBtcWriteLocalReg1Byte(pBtCoexist, 0xfe08, u1Tmp); + + pBoardInfo->btdmAntPos = BTC_ANTENNA_AT_AUX_PORT; + } + else + { + // for PCIE and SDIO interface, we check efuse 0xc3[6] + if(pBoardInfo->singleAntPath == 0) + { + // set to S1 + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, 0x280); + pBoardInfo->btdmAntPos = BTC_ANTENNA_AT_MAIN_PORT; + } + else if(pBoardInfo->singleAntPath == 1) + { + // set to S0 + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, 0x0); + u1Tmp |= 0x1; // antenna inverse + pBoardInfo->btdmAntPos = BTC_ANTENNA_AT_AUX_PORT; + } + + if(pBtCoexist->chipInterface == BTC_INTF_PCI) + { + pBtCoexist->fBtcWriteLocalReg1Byte(pBtCoexist, 0x384, u1Tmp); + } + else if(pBtCoexist->chipInterface == BTC_INTF_SDIO) + { + pBtCoexist->fBtcWriteLocalReg1Byte(pBtCoexist, 0x60, u1Tmp); + } + } +} + +VOID +EXhalbtc8723b1ant_PreLoadFirmware( + IN PBTC_COEXIST pBtCoexist + ) +{ +} + VOID EXhalbtc8723b1ant_InitHwConfig( IN PBTC_COEXIST pBtCoexist, @@ -2845,6 +3096,7 @@ EXhalbtc8723b1ant_InitHwConfig( ) { halbtc8723b1ant_InitHwConfig(pBtCoexist, TRUE, bWifiOnly); + pBtCoexist->bStopCoexDm = FALSE; } VOID @@ -2873,12 +3125,13 @@ EXhalbtc8723b1ant_DisplayCoexInfo( u1Byte u1Tmp[4], i, btInfoExt, psTdmaCase=0; u2Byte u2Tmp[4]; u4Byte u4Tmp[4]; - BOOLEAN bRoam=FALSE, bScan=FALSE, bLink=FALSE, bWifiUnder5G=FALSE; + BOOLEAN bRoam=FALSE, bScan=FALSE, bLink=FALSE, bWifiUnder5G=FALSE, bWifiUnderBMode = FALSE; BOOLEAN bBtHsOn=FALSE, bWifiBusy=FALSE; s4Byte wifiRssi=0, btHsRssi=0; u4Byte wifiBw, wifiTrafficDir, faOfdm, faCck, wifiLinkStatus; - u1Byte wifiDot11Chnl, wifiHsChnl; + u1Byte wifiDot11Chnl, wifiHsChnl, apNum; u4Byte fwVer=0, btPatchVer=0; + static u1Byte PopReportIn10s = 0; CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[BT Coexist info]============"); CL_PRINTF(cliBuf); @@ -2898,13 +3151,6 @@ EXhalbtc8723b1ant_DisplayCoexInfo( CL_PRINTF(cliBuf); } - if(!pBoardInfo->bBtExist) - { - CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n BT not exists !!!"); - CL_PRINTF(cliBuf); - return; - } - CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d/ %d", "Ant PG Num/ Ant Mech/ Ant Pos:", \ pBoardInfo->pgAntNum, pBoardInfo->btdmAntNum, pBoardInfo->btdmAntPos); CL_PRINTF(cliBuf); @@ -2934,24 +3180,26 @@ EXhalbtc8723b1ant_DisplayCoexInfo( pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_S4_WIFI_RSSI, &wifiRssi); pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_S4_HS_RSSI, &btHsRssi); CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "Wifi rssi/ HS rssi", \ - wifiRssi, btHsRssi); + wifiRssi-100, btHsRssi-100); CL_PRINTF(cliBuf); pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_SCAN, &bScan); pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_LINK, &bLink); pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_ROAM, &bRoam); - CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d/ %d ", "Wifi bLink/ bRoam/ bScan", \ - bLink, bRoam, bScan); + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d/ %d/ %s", "Wifi bLink/ bRoam/ bScan/ bHi-Pri", \ + bLink, bRoam, bScan,((pCoexSta->bWiFiIsHighPriTask)? "1":"0")); CL_PRINTF(cliBuf); pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_UNDER_5G, &bWifiUnder5G); pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy); pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_TRAFFIC_DIRECTION, &wifiTrafficDir); - CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s / %s/ %s ", "Wifi status", \ + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_UNDER_B_MODE, &bWifiUnderBMode); + + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s / %s/ %s/ AP=%d/ %s ", "Wifi status", \ (bWifiUnder5G? "5G":"2.4G"), - ((BTC_WIFI_BW_LEGACY==wifiBw)? "Legacy": (((BTC_WIFI_BW_HT40==wifiBw)? "HT40":"HT20"))), - ((!bWifiBusy)? "idle": ((BTC_WIFI_TRAFFIC_TX==wifiTrafficDir)? "uplink":"downlink"))); + ((bWifiUnderBMode)? "11b": ((BTC_WIFI_BW_LEGACY==wifiBw)? "11bg": (((BTC_WIFI_BW_HT40==wifiBw)? "HT40":"HT20")))), + ((!bWifiBusy)? "idle": ((BTC_WIFI_TRAFFIC_TX==wifiTrafficDir)? "uplink":"downlink")), pCoexSta->nScanAPNum,( pCoexSta->bCCKLock)? "Lock":"noLock"); CL_PRINTF(cliBuf); pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_LINK_STATUS, &wifiLinkStatus); @@ -2961,17 +3209,36 @@ EXhalbtc8723b1ant_DisplayCoexInfo( ((wifiLinkStatus&WIFI_P2P_GC_CONNECTED)? 1:0) ); CL_PRINTF(cliBuf); - CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = [%s/ %d/ %d] ", "BT [status/ rssi/ retryCnt]", \ + + PopReportIn10s++; + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = [%s/ %d/ %d/ %d] ", "BT [status/ rssi/ retryCnt/ popCnt]", \ ((pBtCoexist->btInfo.bBtDisabled)? ("disabled"): ((pCoexSta->bC2hBtInquiryPage)?("inquiry/page scan"):((BT_8723B_1ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)? "non-connected idle": ( (BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus)? "connected-idle":"busy")))), - pCoexSta->btRssi, pCoexSta->btRetryCnt); + pCoexSta->btRssi, pCoexSta->btRetryCnt, pCoexSta->popEventCnt); CL_PRINTF(cliBuf); + if (PopReportIn10s >= 5) + { + pCoexSta->popEventCnt = 0; + PopReportIn10s = 0; + } + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d / %d / %d / %d", "SCO/HID/PAN/A2DP", \ pBtLinkInfo->bScoExist, pBtLinkInfo->bHidExist, pBtLinkInfo->bPanExist, pBtLinkInfo->bA2dpExist); CL_PRINTF(cliBuf); + + if (pStackInfo->bProfileNotified) + { pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_BT_LINK_INFO); + } + else + { + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s", "BT Role", \ + (pBtLinkInfo->bSlaveRole )? "Slave":"Master"); + CL_PRINTF(cliBuf); + } + btInfoExt = pCoexSta->btInfoExt; CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s", "BT Info A2DP rate", \ @@ -3027,13 +3294,19 @@ EXhalbtc8723b1ant_DisplayCoexInfo( pCoexDm->psTdmaPara[4], psTdmaCase, pCoexDm->bAutoTdmaAdjust); CL_PRINTF(cliBuf); + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d", "Coex Table Type", \ + pCoexSta->nCoexTableType); + CL_PRINTF(cliBuf); + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d", "IgnWlanAct", \ pCoexDm->bCurIgnoreWlanAct); CL_PRINTF(cliBuf); + /* CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x ", "Latest error condition(should be 0)", \ pCoexDm->errorCondition); CL_PRINTF(cliBuf); + */ } // Hw setting @@ -3061,9 +3334,10 @@ EXhalbtc8723b1ant_DisplayCoexInfo( u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x948); u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x67); - u1Tmp[1] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x765); - CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0x948/ 0x67[5] / 0x765", \ - u4Tmp[0], ((u1Tmp[0]&0x20)>> 5), u1Tmp[1]); + u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x764); + u1Tmp[1] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x76e); + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x/ 0x%x", "0x948/ 0x67[5] / 0x764 / 0x76e", \ + u4Tmp[0], ((u1Tmp[0]&0x20)>> 5), (u4Tmp[1] & 0xffff), u1Tmp[1]); CL_PRINTF(cliBuf); u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x92c); @@ -3109,6 +3383,15 @@ EXhalbtc8723b1ant_DisplayCoexInfo( u4Tmp[0]&0xffff, faOfdm, faCck); CL_PRINTF(cliBuf); + + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d/ %d/ %d", "CRC_OK CCK/11g/11n/11n-Agg", \ + pCoexSta->nCRCOK_CCK, pCoexSta->nCRCOK_11g, pCoexSta->nCRCOK_11n, pCoexSta->nCRCOK_11nAgg); + CL_PRINTF(cliBuf); + + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d/ %d/ %d", "CRC_Err CCK/11g/11n/11n-Agg", \ + pCoexSta->nCRCErr_CCK, pCoexSta->nCRCErr_11g, pCoexSta->nCRCErr_11n, pCoexSta->nCRCErr_11nAgg); + CL_PRINTF(cliBuf); + u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x6c0); u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x6c4); u4Tmp[2] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x6c8); @@ -3123,7 +3406,7 @@ EXhalbtc8723b1ant_DisplayCoexInfo( pCoexSta->lowPriorityRx, pCoexSta->lowPriorityTx); CL_PRINTF(cliBuf); #if(BT_AUTO_REPORT_ONLY_8723B_1ANT == 1) - halbtc8723b1ant_MonitorBtCtr(pBtCoexist); + //halbtc8723b1ant_MonitorBtCtr(pBtCoexist); #endif pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_COEX_STATISTICS); } @@ -3146,20 +3429,19 @@ EXhalbtc8723b1ant_IpsNotify( pCoexSta->bUnderIps = TRUE; halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0); + halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FORCE_EXEC, FALSE, TRUE); halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0); - halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, TRUE); //halbtc8723b1ant_SetAntPathDCut(pBtCoexist, FALSE, FALSE, FALSE, BTC_ANT_PATH_BT, BTC_WIFI_STAT_NORMAL_OFF); - - pCoexSta->bFinishInitHW = FALSE; } else if(BTC_IPS_LEAVE == type) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS LEAVE notify\n")); - pCoexSta->bUnderIps = FALSE; halbtc8723b1ant_InitHwConfig(pBtCoexist, FALSE, FALSE); halbtc8723b1ant_InitCoexDm(pBtCoexist); halbtc8723b1ant_QueryBtInfo(pBtCoexist); + + pCoexSta->bUnderIps = FALSE; } } @@ -3200,18 +3482,16 @@ EXhalbtc8723b1ant_ScanNotify( u4Byte u4Tmp; if(pBtCoexist->bManualControl || - pBtCoexist->bStopCoexDm || - pBtCoexist->btInfo.bBtDisabled ) + pBtCoexist->bStopCoexDm ) return; - pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn); - pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected); - if(BTC_SCAN_START == type) { pCoexSta->bWiFiIsHighPriTask = TRUE; BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN START notify\n")); + halbtc8723b1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 8); //Force antenna setup for no scan result issue + halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_PTA, FORCE_EXEC, FALSE, FALSE); u4Tmp = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x948); u1Tmpa = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x765); u1Tmpb = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x67); @@ -3224,8 +3504,16 @@ EXhalbtc8723b1ant_ScanNotify( { pCoexSta->bWiFiIsHighPriTask = FALSE; BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN FINISH notify\n")); + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_AP_NUM, &pCoexSta->nScanAPNum); } + if(pBtCoexist->btInfo.bBtDisabled) + return; + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected); + halbtc8723b1ant_QueryBtInfo(pBtCoexist); pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_LINK_STATUS, &wifiLinkStatus); @@ -3295,12 +3583,16 @@ EXhalbtc8723b1ant_ConnectNotify( if(BTC_ASSOCIATE_START == type) { pCoexSta->bWiFiIsHighPriTask = TRUE; + halbtc8723b1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 8); //Force antenna setup for no scan result issue + halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_PTA, FORCE_EXEC, FALSE, FALSE); BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], CONNECT START notify\n")); + pCoexDm->nArpCnt = 0; } else { pCoexSta->bWiFiIsHighPriTask = FALSE; BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], CONNECT FINISH notify\n")); + //pCoexDm->nArpCnt = 0; } pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_LINK_STATUS, &wifiLinkStatus); @@ -3355,6 +3647,7 @@ EXhalbtc8723b1ant_MediaStatusNotify( u1Byte H2C_Parameter[3] ={0}; u4Byte wifiBw; u1Byte wifiCentralChnl; + BOOLEAN bWifiUnderBMode = FALSE; if(pBtCoexist->bManualControl || pBtCoexist->bStopCoexDm || @@ -3364,10 +3657,34 @@ EXhalbtc8723b1ant_MediaStatusNotify( if(BTC_MEDIA_CONNECT == type) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], MEDIA connect notify\n")); + halbtc8723b1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 8); //Force antenna setup for no scan result issue + halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_PTA, FORCE_EXEC, FALSE, FALSE); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_UNDER_B_MODE, &bWifiUnderBMode); + + //Set CCK Tx/Rx high Pri except 11b mode + if (bWifiUnderBMode) + { + pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x6cd, 0x00); //CCK Tx + pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x6cf, 0x00); //CCK Rx + } + else + { + pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x6cd, 0x10); //CCK Tx + pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x6cf, 0x10); //CCK Rx + } + + pCoexDm->backupArfrCnt1 = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x430); + pCoexDm->backupArfrCnt2 = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x434); + pCoexDm->backupRetryLimit = pBtCoexist->fBtcRead2Byte(pBtCoexist, 0x42a); + pCoexDm->backupAmpduMaxTime = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x456); } else { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], MEDIA disconnect notify\n")); + pCoexDm->nArpCnt = 0; + + pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x6cd, 0x0); //CCK Tx + pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x6cf, 0x0); //CCK Rx } // only 2.4G we need to inform bt the chnl mask @@ -3416,14 +3733,25 @@ EXhalbtc8723b1ant_SpecialPacketNotify( BTC_PACKET_EAPOL == type || BTC_PACKET_ARP == type ) { - pCoexSta->bWiFiIsHighPriTask = TRUE; - if (BTC_PACKET_ARP == type) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], special Packet ARP notify\n")); + + pCoexDm->nArpCnt++; + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], ARP Packet Count = %d\n", pCoexDm->nArpCnt)); + + if(pCoexDm->nArpCnt >= 10) // if APR PKT > 10 after connect, do not go to ActionWifiConnectedSpecialPacket(pBtCoexist) + { + pCoexSta->bWiFiIsHighPriTask = FALSE; + } + else + { + pCoexSta->bWiFiIsHighPriTask = TRUE; + } } else { + pCoexSta->bWiFiIsHighPriTask = TRUE; BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], special Packet DHCP or EAPOL notify\n")); } } @@ -3459,9 +3787,8 @@ EXhalbtc8723b1ant_SpecialPacketNotify( if( BTC_PACKET_DHCP == type || BTC_PACKET_EAPOL == type || - BTC_PACKET_ARP == type ) - { - //BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], special Packet(%d) notify\n", type)); + ( (BTC_PACKET_ARP == type ) && (pCoexSta->bWiFiIsHighPriTask) ) ) + { halbtc8723b1ant_ActionWifiConnectedSpecialPacket(pBtCoexist); } } @@ -3492,7 +3819,6 @@ EXhalbtc8723b1ant_BtInfoNotify( pCoexSta->btInfoC2h[rspSource][i] = tmpBuf[i]; if(i == 1) btInfo = tmpBuf[i]; - if(i == length-1) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("0x%02x]\n", tmpBuf[i])); @@ -3501,7 +3827,6 @@ EXhalbtc8723b1ant_BtInfoNotify( { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("0x%02x, ", tmpBuf[i])); } - } if(BT_INFO_SRC_8723B_1ANT_WIFI_FW != rspSource) @@ -3509,13 +3834,17 @@ EXhalbtc8723b1ant_BtInfoNotify( pCoexSta->btRetryCnt = // [3:0] pCoexSta->btInfoC2h[rspSource][2]&0xf; + if (pCoexSta->btRetryCnt >= 1) + pCoexSta->popEventCnt++; + if (pCoexSta->btInfoC2h[rspSource][2]&0x20) pCoexSta->bC2hBtPage = TRUE; else pCoexSta->bC2hBtPage = FALSE; pCoexSta->btRssi = - pCoexSta->btInfoC2h[rspSource][3]*2+10; + pCoexSta->btInfoC2h[rspSource][3]*2-90; + //pCoexSta->btInfoC2h[rspSource][3]*2+10; pCoexSta->btInfoExt = pCoexSta->btInfoC2h[rspSource][4]; @@ -3649,6 +3978,46 @@ EXhalbtc8723b1ant_BtInfoNotify( halbtc8723b1ant_RunCoexistMechanism(pBtCoexist); } +VOID +EXhalbtc8723b1ant_RfStatusNotify( + IN PBTC_COEXIST pBtCoexist, + IN u1Byte type + ) +{ + u4Byte u4Tmp; + u1Byte u1Tmpa,u1Tmpb, u1Tmpc; + + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], RF Status notify\n")); + + if(BTC_RF_ON == type) + { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], RF is turned ON!!\n")); + pBtCoexist->bStopCoexDm = FALSE; + } + else if(BTC_RF_OFF == type) + { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], RF is turned OFF!!\n")); + + halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); + halbtc8723b1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 0); + halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FORCE_EXEC, FALSE, TRUE); + //halbtc8723b1ant_SetAntPathDCut(pBtCoexist, FALSE, FALSE, FALSE, BTC_ANT_PATH_BT, BTC_WIFI_STAT_NORMAL_OFF); + + halbtc8723b1ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE); + pBtCoexist->bStopCoexDm = TRUE; + + u4Tmp = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x948); + u1Tmpa = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x765); + u1Tmpb = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x67); + u1Tmpc = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x76e); + + + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("############# [BTCoex], 0x948=0x%x, 0x765=0x%x, 0x67=0x%x, 0x76e=0x%x\n", + u4Tmp, u1Tmpa, u1Tmpb, u1Tmpc)); + + } +} + VOID EXhalbtc8723b1ant_HaltNotify( IN PBTC_COEXIST pBtCoexist @@ -3660,7 +4029,7 @@ EXhalbtc8723b1ant_HaltNotify( halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); halbtc8723b1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 0); - halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, TRUE); + halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FORCE_EXEC, FALSE, TRUE); //halbtc8723b1ant_SetAntPathDCut(pBtCoexist, FALSE, FALSE, FALSE, BTC_ANT_PATH_BT, BTC_WIFI_STAT_NORMAL_OFF); halbtc8723b1ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE); @@ -3668,8 +4037,6 @@ EXhalbtc8723b1ant_HaltNotify( EXhalbtc8723b1ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT); pBtCoexist->bStopCoexDm = TRUE; - - pCoexSta->bFinishInitHW = FALSE; } VOID @@ -3686,12 +4053,11 @@ EXhalbtc8723b1ant_PnpNotify( halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0); + halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FORCE_EXEC, FALSE, TRUE); halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2); - halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, TRUE); //halbtc8723b1ant_SetAntPathDCut(pBtCoexist, FALSE, FALSE, FALSE, BTC_ANT_PATH_BT, BTC_WIFI_STAT_NORMAL_OFF); pBtCoexist->bStopCoexDm = TRUE; - pCoexSta->bFinishInitHW = FALSE; } else if(BTC_WIFI_PNP_WAKE_UP == pnpState) { @@ -3745,16 +4111,16 @@ EXhalbtc8723b1ant_Periodical( #if(BT_AUTO_REPORT_ONLY_8723B_1ANT == 0) halbtc8723b1ant_QueryBtInfo(pBtCoexist); - halbtc8723b1ant_MonitorBtCtr(pBtCoexist); halbtc8723b1ant_MonitorBtEnableDisable(pBtCoexist); #else + halbtc8723b1ant_MonitorBtCtr(pBtCoexist); + halbtc8723b1ant_MonitorWiFiCtr(pBtCoexist); + if( halbtc8723b1ant_IsWifiStatusChanged(pBtCoexist) || pCoexDm->bAutoTdmaAdjust ) { - //if(pCoexSta->specialPktPeriodCnt > 2) - //{ - halbtc8723b1ant_RunCoexistMechanism(pBtCoexist); - //} + + halbtc8723b1ant_RunCoexistMechanism(pBtCoexist); } pCoexSta->specialPktPeriodCnt++; diff --git a/hal/OUTSRC-BTCoexist/HalBtc8723b1Ant.h b/hal/OUTSRC-BTCoexist/HalBtc8723b1Ant.h index 102c686..2e1e13c 100644 --- a/hal/OUTSRC-BTCoexist/HalBtc8723b1Ant.h +++ b/hal/OUTSRC-BTCoexist/HalBtc8723b1Ant.h @@ -17,6 +17,8 @@ #define BTC_RSSI_COEX_THRESH_TOL_8723B_1ANT 2 +#define BT_8723B_1ANT_WIFI_NOISY_THRESH 30 //max: 255 + typedef enum _BT_INFO_SRC_8723B_1ANT{ BT_INFO_SRC_8723B_1ANT_WIFI_FW = 0x0, BT_INFO_SRC_8723B_1ANT_BT_RSP = 0x1, @@ -60,6 +62,9 @@ typedef enum _BT_8723B_1ANT_COEX_ALGO{ }BT_8723B_1ANT_COEX_ALGO,*PBT_8723B_1ANT_COEX_ALGO; typedef struct _COEX_DM_8723B_1ANT{ + // hw setting + u1Byte preAntPosType; + u1Byte curAntPosType; // fw mechanism BOOLEAN bCurIgnoreWlanAct; BOOLEAN bPreIgnoreWlanAct; @@ -109,6 +114,7 @@ typedef struct _COEX_DM_8723B_1ANT{ u1Byte curRetryLimitType; u1Byte preAmpduTimeType; u1Byte curAmpduTimeType; + u4Byte nArpCnt; u1Byte errorCondition; } COEX_DM_8723B_1ANT, *PCOEX_DM_8723B_1ANT; @@ -122,13 +128,12 @@ typedef struct _COEX_STA_8723B_1ANT{ BOOLEAN bUnderLps; BOOLEAN bUnderIps; - BOOLEAN bFinishInitHW; u4Byte specialPktPeriodCnt; u4Byte highPriorityTx; u4Byte highPriorityRx; u4Byte lowPriorityTx; u4Byte lowPriorityRx; - u1Byte btRssi; + s1Byte btRssi; BOOLEAN bBtTxRxMask; u1Byte preBtRssiState; u1Byte preWifiRssiState[4]; @@ -140,12 +145,38 @@ typedef struct _COEX_STA_8723B_1ANT{ BOOLEAN bWiFiIsHighPriTask; //Add for win8.1 page out issue u1Byte btRetryCnt; u1Byte btInfoExt; + u4Byte popEventCnt; + u1Byte nScanAPNum; + + u4Byte nCRCOK_CCK; + u4Byte nCRCOK_11g; + u4Byte nCRCOK_11n; + u4Byte nCRCOK_11nAgg; + + u4Byte nCRCErr_CCK; + u4Byte nCRCErr_11g; + u4Byte nCRCErr_11n; + u4Byte nCRCErr_11nAgg; + + BOOLEAN bCCKLock; + BOOLEAN bPreCCKLock; + u1Byte nCoexTableType; + + BOOLEAN bForceLpsOn; }COEX_STA_8723B_1ANT, *PCOEX_STA_8723B_1ANT; //=========================================== // The following is interface which will notify coex module. //=========================================== VOID +EXhalbtc8723b1ant_PowerOnSetting( + IN PBTC_COEXIST pBtCoexist + ); +VOID +EXhalbtc8723b1ant_PreLoadFirmware( + IN PBTC_COEXIST pBtCoexist + ); +VOID EXhalbtc8723b1ant_InitHwConfig( IN PBTC_COEXIST pBtCoexist, IN BOOLEAN bWifiOnly @@ -191,6 +222,11 @@ EXhalbtc8723b1ant_BtInfoNotify( IN u1Byte length ); VOID +EXhalbtc8723b1ant_RfStatusNotify( + IN PBTC_COEXIST pBtCoexist, + IN u1Byte type + ); +VOID EXhalbtc8723b1ant_HaltNotify( IN PBTC_COEXIST pBtCoexist ); diff --git a/hal/OUTSRC-BTCoexist/HalBtc8723b2Ant.c b/hal/OUTSRC-BTCoexist/HalBtc8723b2Ant.c index 72dfe4d..4577b2a 100644 --- a/hal/OUTSRC-BTCoexist/HalBtc8723b2Ant.c +++ b/hal/OUTSRC-BTCoexist/HalBtc8723b2Ant.c @@ -1377,7 +1377,7 @@ halbtc8723b2ant_SetAntPath( pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_EXT_SWITCH, &bPgExtSwitch); pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_FW_VER, &fwVer); // [31:16]=fw ver, [15:0]=fw sub ver - if((fwVer<0xc0000) || bPgExtSwitch) + if((fwVer>0 && fwVer<0xc0000) || bPgExtSwitch) bUseExtSwitch = TRUE; if(bInitHwCfg) @@ -1388,9 +1388,17 @@ halbtc8723b2ant_SetAntPath( pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x930, 0x77); pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x67, 0x20, 0x1); + if(fwVer >= 0x180000) + { /* Use H2C to set GNT_BT to LOW */ H2C_Parameter[0] = 0; pBtCoexist->fBtcFillH2c(pBtCoexist, 0x6E, 1, H2C_Parameter); + } + else + { + pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x765, 0x0); + } + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, 0x0); pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); //WiFi TRx Mask off @@ -1420,7 +1428,6 @@ halbtc8723b2ant_SetAntPath( pBtCoexist->fBtcFillH2c(pBtCoexist, 0x65, 2, H2C_Parameter); } - // ext switch setting if(bUseExtSwitch) { @@ -3516,20 +3523,27 @@ halbtc8723b2ant_WifiOffHwCfg( ) { BOOLEAN bIsInMpMode = FALSE; - PADAPTER padapter=pBtCoexist->Adapter; u1Byte H2C_Parameter[2] ={0}; + u4Byte fwVer=0; // set wlan_act to low pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0x4); pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x780); //WiFi goto standby while GNT_BT 0-->1 - + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_FW_VER, &fwVer); + if(fwVer >= 0x180000) + { /* Use H2C to set GNT_BT to HIGH */ H2C_Parameter[0] = 1; pBtCoexist->fBtcFillH2c(pBtCoexist, 0x6E, 1, H2C_Parameter); + } + else + { + pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x765, 0x18); + } pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_IS_IN_MP_MODE, &bIsInMpMode); - if (bIsInMpMode == FALSE) + if(!bIsInMpMode) pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x67, 0x20, 0x0); //BT select s0/s1 is controlled by BT else pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x67, 0x20, 0x1); //BT select s0/s1 is controlled by WiFi @@ -3578,6 +3592,87 @@ halbtc8723b2ant_InitHwConfig( //============================================================ // extern function start with EXhalbtc8723b2ant_ //============================================================ +VOID +EXhalbtc8723b2ant_PowerOnSetting( + IN PBTC_COEXIST pBtCoexist + ) +{ + PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo; + u2Byte u2Tmp=0x0; + + pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x67, 0x20); + + // enable BB, REG_SYS_FUNC_EN such that we can write 0x948 correctly. + u2Tmp = pBtCoexist->fBtcRead2Byte(pBtCoexist, 0x2); + pBtCoexist->fBtcWrite2Byte(pBtCoexist, 0x2, u2Tmp|BIT0|BIT1); + + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, 0x0); + + if(pBtCoexist->chipInterface == BTC_INTF_USB) + { + // fixed at S0 for USB interface + pBoardInfo->btdmAntPos = BTC_ANTENNA_AT_AUX_PORT; + } + else + { + // for PCIE and SDIO interface, we check efuse 0xc3[6] + if(pBoardInfo->singleAntPath == 0) + { + // set to S1 + pBoardInfo->btdmAntPos = BTC_ANTENNA_AT_MAIN_PORT; + } + else if(pBoardInfo->singleAntPath == 1) + { + // set to S0 + pBoardInfo->btdmAntPos = BTC_ANTENNA_AT_AUX_PORT; + } + } +} + +VOID +EXhalbtc8723b2ant_PreLoadFirmware( + IN PBTC_COEXIST pBtCoexist + ) +{ + PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo; + u1Byte u1Tmp=0x4; /* Set BIT2 by default since it's 2ant case */ + + // + // S0 or S1 setting and Local register setting(By the setting fw can get ant number, S0/S1, ... info) + // Local setting bit define + // BIT0: "0" for no antenna inverse; "1" for antenna inverse + // BIT1: "0" for internal switch; "1" for external switch + // BIT2: "0" for one antenna; "1" for two antenna + // NOTE: here default all internal switch and 1-antenna ==> BIT1=0 and BIT2=0 + if(pBtCoexist->chipInterface == BTC_INTF_USB) + { + // fixed at S0 for USB interface + u1Tmp |= 0x1; // antenna inverse + pBtCoexist->fBtcWriteLocalReg1Byte(pBtCoexist, 0xfe08, u1Tmp); + } + else + { + // for PCIE and SDIO interface, we check efuse 0xc3[6] + if(pBoardInfo->singleAntPath == 0) + { + } + else if(pBoardInfo->singleAntPath == 1) + { + // set to S0 + u1Tmp |= 0x1; // antenna inverse + } + + if(pBtCoexist->chipInterface == BTC_INTF_PCI) + { + pBtCoexist->fBtcWriteLocalReg1Byte(pBtCoexist, 0x384, u1Tmp); + } + else if(pBtCoexist->chipInterface == BTC_INTF_SDIO) + { + pBtCoexist->fBtcWriteLocalReg1Byte(pBtCoexist, 0x60, u1Tmp); + } + } +} + VOID EXhalbtc8723b2ant_InitHwConfig( IN PBTC_COEXIST pBtCoexist, @@ -3627,13 +3722,6 @@ EXhalbtc8723b2ant_DisplayCoexInfo( CL_PRINTF(cliBuf); } - if(!pBoardInfo->bBtExist) - { - CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n BT not exists !!!"); - CL_PRINTF(cliBuf); - return; - } - CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d ", "Ant PG number/ Ant mechanism:", \ pBoardInfo->pgAntNum, pBoardInfo->btdmAntNum); CL_PRINTF(cliBuf); diff --git a/hal/OUTSRC-BTCoexist/HalBtc8723b2Ant.h b/hal/OUTSRC-BTCoexist/HalBtc8723b2Ant.h index 54558aa..29f53cb 100644 --- a/hal/OUTSRC-BTCoexist/HalBtc8723b2Ant.h +++ b/hal/OUTSRC-BTCoexist/HalBtc8723b2Ant.h @@ -129,6 +129,14 @@ typedef struct _COEX_STA_8723B_2ANT{ // The following is interface which will notify coex module. //=========================================== VOID +EXhalbtc8723b2ant_PowerOnSetting( + IN PBTC_COEXIST pBtCoexist + ); +VOID +EXhalbtc8723b2ant_PreLoadFirmware( + IN PBTC_COEXIST pBtCoexist + ); +VOID EXhalbtc8723b2ant_InitHwConfig( IN PBTC_COEXIST pBtCoexist, IN BOOLEAN bWifiOnly diff --git a/hal/OUTSRC-BTCoexist/HalBtc8812a1Ant.c b/hal/OUTSRC-BTCoexist/HalBtc8812a1Ant.c index 4ae158b..d705431 100644 --- a/hal/OUTSRC-BTCoexist/HalBtc8812a1Ant.c +++ b/hal/OUTSRC-BTCoexist/HalBtc8812a1Ant.c @@ -2091,6 +2091,13 @@ halbtc8812a1ant_InitCoexDm( //============================================================ // extern function start with EXhalbtc8812a1ant_ //============================================================ +VOID +EXhalbtc8812a1ant_PowerOnSetting( + IN PBTC_COEXIST pBtCoexist + ) +{ +} + VOID EXhalbtc8812a1ant_InitHwConfig( IN PBTC_COEXIST pBtCoexist, @@ -2186,13 +2193,6 @@ EXhalbtc8812a1ant_DisplayCoexInfo( CL_PRINTF(cliBuf); } - if(!pBoardInfo->bBtExist) - { - CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n BT not exists !!!"); - CL_PRINTF(cliBuf); - return; - } - CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d ", "Ant PG number/ Ant mechanism:", \ pBoardInfo->pgAntNum, pBoardInfo->btdmAntNum); CL_PRINTF(cliBuf); diff --git a/hal/OUTSRC-BTCoexist/HalBtc8812a1Ant.h b/hal/OUTSRC-BTCoexist/HalBtc8812a1Ant.h index 3c7cd73..4f2df7a 100644 --- a/hal/OUTSRC-BTCoexist/HalBtc8812a1Ant.h +++ b/hal/OUTSRC-BTCoexist/HalBtc8812a1Ant.h @@ -132,6 +132,10 @@ typedef struct _COEX_STA_8812A_1ANT{ // The following is interface which will notify coex module. //=========================================== VOID +EXhalbtc8812a1ant_PowerOnSetting( + IN PBTC_COEXIST pBtCoexist + ); +VOID EXhalbtc8812a1ant_InitHwConfig( IN PBTC_COEXIST pBtCoexist, IN BOOLEAN bWifiOnly diff --git a/hal/OUTSRC-BTCoexist/HalBtc8812a2Ant.c b/hal/OUTSRC-BTCoexist/HalBtc8812a2Ant.c index c1c6072..e073709 100644 --- a/hal/OUTSRC-BTCoexist/HalBtc8812a2Ant.c +++ b/hal/OUTSRC-BTCoexist/HalBtc8812a2Ant.c @@ -4125,6 +4125,13 @@ halbtc8812a2ant_InitHwConfig( //============================================================ // extern function start with EXhalbtc8812a2ant_ //============================================================ +VOID +EXhalbtc8812a2ant_PowerOnSetting( + IN PBTC_COEXIST pBtCoexist + ) +{ +} + VOID EXhalbtc8812a2ant_InitHwConfig( IN PBTC_COEXIST pBtCoexist, @@ -4174,13 +4181,6 @@ EXhalbtc8812a2ant_DisplayCoexInfo( CL_PRINTF(cliBuf); } - if(!pBoardInfo->bBtExist) - { - CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n BT not exists !!!"); - CL_PRINTF(cliBuf); - return; - } - CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d ", "Ant PG number/ Ant mechanism:", \ pBoardInfo->pgAntNum, pBoardInfo->btdmAntNum); CL_PRINTF(cliBuf); diff --git a/hal/OUTSRC-BTCoexist/HalBtc8812a2Ant.h b/hal/OUTSRC-BTCoexist/HalBtc8812a2Ant.h index af55c16..4f6f5d1 100644 --- a/hal/OUTSRC-BTCoexist/HalBtc8812a2Ant.h +++ b/hal/OUTSRC-BTCoexist/HalBtc8812a2Ant.h @@ -148,6 +148,10 @@ typedef struct _COEX_STA_8812A_2ANT{ // The following is interface which will notify coex module. //=========================================== VOID +EXhalbtc8812a2ant_PowerOnSetting( + IN PBTC_COEXIST pBtCoexist + ); +VOID EXhalbtc8812a2ant_InitHwConfig( IN PBTC_COEXIST pBtCoexist, IN BOOLEAN bWifiOnly diff --git a/hal/OUTSRC-BTCoexist/HalBtc8821a1Ant.c b/hal/OUTSRC-BTCoexist/HalBtc8821a1Ant.c index bb7990f..130566a 100644 --- a/hal/OUTSRC-BTCoexist/HalBtc8821a1Ant.c +++ b/hal/OUTSRC-BTCoexist/HalBtc8821a1Ant.c @@ -1,7 +1,7 @@ //============================================================ // Description: // -// This file is for RTL8821A Co-exist mechanism +// This file is for 8821A_1ANT Co-exist mechanism // // History // 2012/11/15 Cosa first check in. @@ -27,8 +27,8 @@ const char *const GLBtInfoSrc8821a1Ant[]={ "BT Info[bt auto report]", }; -u4Byte GLCoexVerDate8821a1Ant=20130816; -u4Byte GLCoexVer8821a1Ant=0x41; +u4Byte GLCoexVerDate8821a1Ant=20140306; +u4Byte GLCoexVer8821a1Ant=0x4b; //============================================================ // local function proto type if needed @@ -420,7 +420,17 @@ halbtc8821a1ant_MonitorBtCtr( u4Byte regHPTx=0, regHPRx=0, regLPTx=0, regLPRx=0; u1Byte u1Tmp, u1Tmp1; s4Byte wifiRssi; - +#if 0 + //to avoid 0x76e[3] = 1 (WLAN_Act control by PTA) during IPS + if (! (pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x76e) & 0x8) ) + { + pCoexSta->highPriorityTx = 65535; + pCoexSta->highPriorityRx = 65535; + pCoexSta->lowPriorityTx = 65535; + pCoexSta->lowPriorityRx = 65535; + return; + } +#endif regHPTxRx = 0x770; regLPTxRx = 0x774; @@ -915,6 +925,8 @@ halbtc8821a1ant_CoexTableWithType( IN u1Byte type ) { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], ********** CoexTable(%d) **********\n", type)); + switch(type) { case 0: @@ -927,19 +939,19 @@ halbtc8821a1ant_CoexTableWithType( halbtc8821a1ant_CoexTable(pBtCoexist, bForceExec, 0x5a5a5a5a, 0x5a5a5a5a, 0xffffff, 0x3); break; case 3: - halbtc8821a1ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0xaaaaaaaa, 0xffffff, 0x3); + halbtc8821a1ant_CoexTable(pBtCoexist, bForceExec, 0x5a5a5a5a, 0xaaaaaaaa, 0xffffff, 0x3); break; case 4: - halbtc8821a1ant_CoexTable(pBtCoexist, bForceExec, 0xffffffff, 0xffffffff, 0xffffff, 0x3); + halbtc8821a1ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0xaaaaaaaa, 0xffffff, 0x3); break; case 5: - halbtc8821a1ant_CoexTable(pBtCoexist, bForceExec, 0x5fff5fff, 0x5fff5fff, 0xffffff, 0x3); + halbtc8821a1ant_CoexTable(pBtCoexist, bForceExec, 0x5a5a5a5a, 0xaaaa5a5a, 0xffffff, 0x3); break; case 6: - halbtc8821a1ant_CoexTable(pBtCoexist, bForceExec, 0x55ff55ff, 0x5a5a5a5a, 0xffffff, 0x3); + halbtc8821a1ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0xaaaa5a5a, 0xffffff, 0x3); break; case 7: - halbtc8821a1ant_CoexTable(pBtCoexist, bForceExec, 0x5afa5afa, 0x5afa5afa, 0xffffff, 0x3); + halbtc8821a1ant_CoexTable(pBtCoexist, bForceExec, 0xaaaaaaaa, 0xaaaaaaaa, 0xffffff, 0x3); break; default: break; @@ -1000,18 +1012,35 @@ halbtc8821a1ant_SetFwPstdma( ) { u1Byte H2C_Parameter[5] ={0}; + u1Byte realByte1=byte1, realByte5=byte5; + BOOLEAN bApEnable=FALSE; - H2C_Parameter[0] = byte1; + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_AP_MODE_ENABLE, &bApEnable); + + if(bApEnable) + { + if(byte1&BIT4 && !(byte1&BIT5)) + { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], FW for 1Ant AP mode\n")); + realByte1 &= ~BIT4; + realByte1 |= BIT5; + + realByte5 |= BIT5; + realByte5 &= ~BIT6; + } + } + + H2C_Parameter[0] = realByte1; H2C_Parameter[1] = byte2; H2C_Parameter[2] = byte3; H2C_Parameter[3] = byte4; - H2C_Parameter[4] = byte5; + H2C_Parameter[4] = realByte5; - pCoexDm->psTdmaPara[0] = byte1; + pCoexDm->psTdmaPara[0] = realByte1; pCoexDm->psTdmaPara[1] = byte2; pCoexDm->psTdmaPara[2] = byte3; pCoexDm->psTdmaPara[3] = byte4; - pCoexDm->psTdmaPara[4] = byte5; + pCoexDm->psTdmaPara[4] = realByte5; BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], PS-TDMA H2C cmd =0x%x%08x\n", H2C_Parameter[0], @@ -1075,7 +1104,8 @@ halbtc8821a1ant_SwMechanism( IN BOOLEAN bLowPenaltyRA ) { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], SM[LpRA] = %d \n", bLowPenaltyRA)); + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], SM[LpRA] = %d\n", + bLowPenaltyRA)); halbtc8821a1ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, bLowPenaltyRA); } @@ -1100,8 +1130,8 @@ halbtc8821a1ant_SetAntPath( u4Tmp |= BIT24; pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x4c, u4Tmp); - pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x975, 0x3, 0x3); - pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xcb4, 0x77); + //0x765 = 0x18 + pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x765, 0x18, 0x3); if(pBoardInfo->btdmAntPos == BTC_ANTENNA_AT_MAIN_PORT) { @@ -1110,7 +1140,7 @@ halbtc8821a1ant_SetAntPath( H2C_Parameter[1] = 1; pBtCoexist->fBtcFillH2c(pBtCoexist, 0x65, 2, H2C_Parameter); - pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x64, 0x1, 0x1); //Main Ant to BT for IPS case 0x4c[23]=1 + //pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x64, 0x1, 0x1); //Main Ant to BT for IPS case 0x4c[23]=1 } else { @@ -1119,7 +1149,7 @@ halbtc8821a1ant_SetAntPath( H2C_Parameter[1] = 1; pBtCoexist->fBtcFillH2c(pBtCoexist, 0x65, 2, H2C_Parameter); - pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x64, 0x1, 0x0); //Aux Ant to BT for IPS case 0x4c[23]=1 + //pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x64, 0x1, 0x0); //Aux Ant to BT for IPS case 0x4c[23]=1 } } else if(bWifiOff) @@ -1129,18 +1159,28 @@ halbtc8821a1ant_SetAntPath( u4Tmp &= ~BIT23; u4Tmp &= ~BIT24; pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x4c, u4Tmp); + + //0x765 = 0x18 + pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x765, 0x18, 0x3); + } + else + { + //0x765 = 0x0 + pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x765, 0x18, 0x0); } // ext switch setting switch(antPosType) { case BTC_ANT_PATH_WIFI: + pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xcb4, 0x77); if(pBoardInfo->btdmAntPos == BTC_ANTENNA_AT_MAIN_PORT) pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xcb7, 0x30, 0x1); else pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xcb7, 0x30, 0x2); break; case BTC_ANT_PATH_BT: + pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xcb4, 0x77); if(pBoardInfo->btdmAntPos == BTC_ANTENNA_AT_MAIN_PORT) pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xcb7, 0x30, 0x2); else @@ -1148,6 +1188,7 @@ halbtc8821a1ant_SetAntPath( break; default: case BTC_ANT_PATH_PTA: + pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xcb4, 0x66); if(pBoardInfo->btdmAntPos == BTC_ANTENNA_AT_MAIN_PORT) pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xcb7, 0x30, 0x1); else @@ -1167,25 +1208,24 @@ halbtc8821a1ant_PsTdma( PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo; BOOLEAN bTurnOnByCnt=FALSE; u1Byte psTdmaTypeByCnt=0, rssiAdjustVal=0; - u4Byte fwVer=0; + //u4Byte fwVer=0; pCoexDm->bCurPsTdmaOn = bTurnOn; pCoexDm->curPsTdma = type; + if (pCoexDm->bCurPsTdmaOn) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], ********** TDMA(on, %d) **********\n", + pCoexDm->curPsTdma)); + } + else + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], ********** TDMA(off, %d) **********\n", + pCoexDm->curPsTdma)); + } + if(!bForceExec) { - if (pCoexDm->bCurPsTdmaOn) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], ********** TDMA(on, %d) **********\n", - pCoexDm->curPsTdma)); - } - else - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], ********** TDMA(off, %d) **********\n", - pCoexDm->curPsTdma)); - } - - if( (pCoexDm->bPrePsTdmaOn == pCoexDm->bCurPsTdmaOn) && (pCoexDm->prePsTdma == pCoexDm->curPsTdma) ) return; @@ -1206,7 +1246,7 @@ halbtc8821a1ant_PsTdma( rssiAdjustVal = 14; break; case 3: - halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x51, 0x1d, 0x1d, 0x0, 0x10); + halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x51, 0x1d, 0x1d, 0x0, 0x52); break; case 4: halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x93, 0x15, 0x3, 0x14, 0x0); @@ -1216,7 +1256,7 @@ halbtc8821a1ant_PsTdma( halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x61, 0x15, 0x3, 0x11, 0x10); break; case 6: - halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x13, 0xa, 0x3, 0x0, 0x0); + halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x61, 0x20, 0x3, 0x11, 0x13); break; case 7: halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x13, 0xc, 0x5, 0x0, 0x0); @@ -1232,17 +1272,17 @@ halbtc8821a1ant_PsTdma( halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x13, 0xa, 0xa, 0x0, 0x40); break; case 11: - halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x51, 0x14, 0x03, 0x10, 0x10); + halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x51, 0x15, 0x03, 0x10, 0x50); rssiAdjustVal = 20; break; case 12: halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x51, 0x0a, 0x0a, 0x0, 0x50); break; case 13: - halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x51, 0x18, 0x18, 0x0, 0x10); + halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x51, 0x12, 0x12, 0x0, 0x50); break; case 14: - halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x51, 0x21, 0x3, 0x10, 0x10); + halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x51, 0x21, 0x3, 0x10, 0x52); break; case 15: halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x13, 0xa, 0x3, 0x8, 0x0); @@ -1259,7 +1299,7 @@ halbtc8821a1ant_PsTdma( halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x61, 0x35, 0x03, 0x11, 0x10); break; case 21: - halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x61, 0x15, 0x03, 0x11, 0x10); + halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x61, 0x25, 0x03, 0x11, 0x11); break; case 22: halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x61, 0x25, 0x03, 0x11, 0x10); @@ -1291,13 +1331,13 @@ halbtc8821a1ant_PsTdma( halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0xab, 0x1a, 0x1a, 0x1, 0x10); break; case 30: - halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x51, 0x14, 0x3, 0x10, 0x50); + halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x51, 0x30, 0x3, 0x10, 0x10); break; case 31: halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0xd3, 0x1a, 0x1a, 0, 0x58); break; case 32: - halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x61, 0xa, 0x3, 0x10, 0x0); + halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x61, 0x35, 0x3, 0x11, 0x11); break; case 33: halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0xa3, 0x25, 0x3, 0x30, 0x90); @@ -1311,6 +1351,10 @@ halbtc8821a1ant_PsTdma( case 36: halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0xd3, 0x12, 0x3, 0x14, 0x50); break; + case 40: // SoftAP only with no sta associated,BT disable ,TDMA mode for power saving + /* here softap mode screen off will cost 70-80mA for phone */ + halbtc8821a1ant_SetFwPstdma(pBtCoexist, 0x23, 0x18, 0x00, 0x10, 0x24); + break; } } else @@ -1869,6 +1913,16 @@ halbtc8821a1ant_ActionHidA2dp( // Non-Software Coex Mechanism start // //============================================= +VOID +halbtc8821a1ant_ActionWifiMultiPort( + IN PBTC_COEXIST pBtCoexist + ) +{ + halbtc8821a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); + + halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8); + halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2); +} VOID halbtc8821a1ant_ActionHs( @@ -1876,38 +1930,50 @@ halbtc8821a1ant_ActionHs( ) { halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5); - halbtc8821a1ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 2); + halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2); } VOID halbtc8821a1ant_ActionBtInquiry( IN PBTC_COEXIST pBtCoexist ) -{ +{ PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo; - BOOLEAN bWifiConnected=FALSE; - - pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected); + BOOLEAN bWifiConnected=FALSE, bApEnable=FALSE, bWifiBusy=FALSE, bBtBusy=FALSE; - if(!bWifiConnected) + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_AP_MODE_ENABLE, &bApEnable); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy); + pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_TRAFFIC_BUSY, &bBtBusy); + + if((!bWifiConnected) && (!pCoexSta->bWiFiIsHighPriTask)) { halbtc8821a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); - halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5); - halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1); + halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8); + + halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0); } - else if( (pBtLinkInfo->bScoExist) || - (pBtLinkInfo->bHidOnly) ) + else if((pBtLinkInfo->bScoExist) || (pBtLinkInfo->bHidExist) || (pBtLinkInfo->bA2dpExist)) { - // SCO/HID-only busy + // SCO/HID/A2DP busy halbtc8821a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 32); - halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1); + + halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4); + } + else if ((pBtLinkInfo->bPanExist) || (bWifiBusy)) + { + halbtc8821a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); + halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20); + + halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4); } else { - halbtc8821a1ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x4); - halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 30); - halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1); + halbtc8821a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); + halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8); + + halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7); } } @@ -1917,13 +1983,24 @@ halbtc8821a1ant_ActionBtScoHidOnlyBusy( IN u1Byte wifiStatus ) { - // tdma and coex table - halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5); + PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo; + BOOLEAN bWifiConnected=FALSE; + u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH; - if(BT_8821A_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN == wifiStatus) - halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1); - else - halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected); + + // tdma and coex table + + if(pBtLinkInfo->bScoExist) + { + halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5); + halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2); + } + else //HID + { + halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6); + halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 5); + } } VOID @@ -1945,18 +2022,26 @@ halbtc8821a1ant_ActionWifiConnectedBtAclBusy( } else if(pBtLinkInfo->bA2dpOnly) //A2DP { - if( (btRssiState == BTC_RSSI_STATE_HIGH) || + if(BT_8821A_1ANT_WIFI_STATUS_CONNECTED_IDLE == wifiStatus) + { + //halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8); + //halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2); + halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 32); + halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1); + pCoexDm->bAutoTdmaAdjust = FALSE; + } + else if( (btRssiState == BTC_RSSI_STATE_HIGH) || (btRssiState == BTC_RSSI_STATE_STAY_HIGH) ) { - halbtc8821a1ant_TdmaDurationAdjustForAcl(pBtCoexist, wifiStatus); + halbtc8821a1ant_TdmaDurationAdjustForAcl(pBtCoexist, wifiStatus); + halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1); } else //for low BT RSSI { halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11); + halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1); pCoexDm->bAutoTdmaAdjust = FALSE; - } - - halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1); + } } else if(pBtLinkInfo->bHidExist&&pBtLinkInfo->bA2dpExist) //HID+A2DP { @@ -1968,16 +2053,16 @@ halbtc8821a1ant_ActionWifiConnectedBtAclBusy( } else //for low BT RSSI { - halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11); + halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14); pCoexDm->bAutoTdmaAdjust = FALSE; } - halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1); + halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 6); } else if( (pBtLinkInfo->bPanOnly) || (pBtLinkInfo->bHidExist&&pBtLinkInfo->bPanExist) ) //PAN(OPP,FTP), HID+PAN(OPP,FTP) { halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3); - halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1); + halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 6); pCoexDm->bAutoTdmaAdjust = FALSE; } else if ( ((pBtLinkInfo->bA2dpExist) && (pBtLinkInfo->bPanExist)) || @@ -2004,45 +2089,37 @@ halbtc8821a1ant_ActionWifiNotConnected( halbtc8821a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); // tdma and coex table - halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8); + halbtc8821a1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 8); halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0); } VOID -halbtc8821a1ant_ActionWifiNotConnectedAssoAuthScan( - IN PBTC_COEXIST pBtCoexist - ) -{ - halbtc8821a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); - - - halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 22); - halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1); -} - -VOID -halbtc8821a1ant_ActionWifiConnectedScan( +halbtc8821a1ant_ActionWifiNotConnectedScan( IN PBTC_COEXIST pBtCoexist ) { PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo; - // power save state halbtc8821a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); - + // tdma and coex table if(BT_8821A_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) { - if(pBtLinkInfo->bA2dpExist && pBtLinkInfo->bPanExist) - { + if (pBtLinkInfo->bA2dpExist) + { + halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 32); + halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4); + } + else if (pBtLinkInfo->bA2dpExist && pBtLinkInfo->bPanExist) + { halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 22); - halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1); + halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4); } else { - halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20); - halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1); - } + halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20); + halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4); + } } else if( (BT_8821A_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) || (BT_8821A_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) ) @@ -2051,9 +2128,85 @@ halbtc8821a1ant_ActionWifiConnectedScan( BT_8821A_1ANT_WIFI_STATUS_CONNECTED_SCAN); } else + { + //halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20); + //halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1); + + //Bryant Add + halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8); + halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2); + } +} + +VOID +halbtc8821a1ant_ActionWifiNotConnectedAssoAuth( + IN PBTC_COEXIST pBtCoexist + ) +{ + PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo; + + halbtc8821a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); + + // tdma and coex table + if( (pBtLinkInfo->bScoExist) || (pBtLinkInfo->bHidExist) ) + { + halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 32); + halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4); + } + else if( (pBtLinkInfo->bA2dpExist) || (pBtLinkInfo->bPanExist) ) { halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20); - halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1); + halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4); + } + else + { + halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8); + halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2); + } +} + +VOID +halbtc8821a1ant_ActionWifiConnectedScan( + IN PBTC_COEXIST pBtCoexist + ) +{ + PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo; + + halbtc8821a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); + + // tdma and coex table + if(BT_8821A_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) + { + if (pBtLinkInfo->bA2dpExist) + { + halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 32); + halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4); + } + else if (pBtLinkInfo->bA2dpExist && pBtLinkInfo->bPanExist) + { + halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 22); + halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4); + } + else + { + halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20); + halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4); + } + } + else if( (BT_8821A_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) || + (BT_8821A_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) ) + { + halbtc8821a1ant_ActionBtScoHidOnlyBusy(pBtCoexist, + BT_8821A_1ANT_WIFI_STATUS_CONNECTED_SCAN); + } + else + { + //halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20); + //halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1); + + //Bryant Add + halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8); + halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2); } } @@ -2062,31 +2215,25 @@ halbtc8821a1ant_ActionWifiConnectedSpecialPacket( IN PBTC_COEXIST pBtCoexist ) { - BOOLEAN bHsConnecting=FALSE; PBTC_BT_LINK_INFO pBtLinkInfo=&pBtCoexist->btLinkInfo; - pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_CONNECTING, &bHsConnecting); - halbtc8821a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); // tdma and coex table - if(BT_8821A_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) + if((pBtLinkInfo->bScoExist) || (pBtLinkInfo->bHidExist) || (pBtLinkInfo->bA2dpExist)) { - if(pBtLinkInfo->bA2dpExist && pBtLinkInfo->bPanExist) - { - halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 22); - halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1); - } - else - { - halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20); - halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1); - } + halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 32); + halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4); } - else + else if(pBtLinkInfo->bPanExist) { halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 20); - halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 1); + halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4); + } + else + { + halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8); + halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2); } } @@ -2097,7 +2244,7 @@ halbtc8821a1ant_ActionWifiConnected( { BOOLEAN bWifiBusy=FALSE; BOOLEAN bScan=FALSE, bLink=FALSE, bRoam=FALSE; - BOOLEAN bUnder4way=FALSE; + BOOLEAN bUnder4way=FALSE, bApEnable=FALSE; u4Byte wifiBw; BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], CoexForWifiConnect()===>\n")); @@ -2115,19 +2262,28 @@ halbtc8821a1ant_ActionWifiConnected( pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_ROAM, &bRoam); if(bScan || bLink || bRoam) { - halbtc8821a1ant_ActionWifiConnectedScan(pBtCoexist); + if(bScan) + halbtc8821a1ant_ActionWifiConnectedScan(pBtCoexist); + else + halbtc8821a1ant_ActionWifiConnectedSpecialPacket(pBtCoexist); BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], CoexForWifiConnect(), return for wifi is under scan<===\n")); return; } + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_AP_MODE_ENABLE, &bApEnable); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy); // power save state - if(BT_8821A_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus && !pBtCoexist->btLinkInfo.bHidOnly) - halbtc8821a1ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x4); + if(!bApEnable && BT_8821A_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus && !pBtCoexist->btLinkInfo.bHidOnly) + { + if(!bWifiBusy && pBtCoexist->btLinkInfo.bA2dpOnly) //A2DP + halbtc8821a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); + else + halbtc8821a1ant_PowerSaveState(pBtCoexist, BTC_PS_LPS_ON, 0x50, 0x4); + } else halbtc8821a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); // tdma and coex table - pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy); if(!bWifiBusy) { if(BT_8821A_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) @@ -2143,7 +2299,7 @@ halbtc8821a1ant_ActionWifiConnected( } else { - halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5); + halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8); halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2); } } @@ -2162,7 +2318,7 @@ halbtc8821a1ant_ActionWifiConnected( } else { - halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5); + halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8); halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2); } } @@ -2246,6 +2402,8 @@ halbtc8821a1ant_RunCoexistMechanism( BOOLEAN bBtCtrlAggBufSize=FALSE; u1Byte aggBufSize=5; u1Byte wifiRssiState=BTC_RSSI_STATE_HIGH; + u4Byte wifiLinkStatus=0; + u4Byte numOfWifiLink=0; BOOLEAN bWifiUnder5G=FALSE; BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism()===>\n")); @@ -2284,9 +2442,18 @@ halbtc8821a1ant_RunCoexistMechanism( } pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_INC_SCAN_DEV_NUM, &bIncreaseScanDevNum); - pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_LINK_STATUS, &wifiLinkStatus); + numOfWifiLink = wifiLinkStatus>>16; + if((numOfWifiLink>=2) || (wifiLinkStatus&WIFI_P2P_GO_CONNECTED)) + { + halbtc8821a1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0); + halbtc8821a1ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, bBtCtrlAggBufSize, aggBufSize); + halbtc8821a1ant_ActionWifiMultiPort(pBtCoexist); + return; + } + if(!pBtLinkInfo->bScoExist && !pBtLinkInfo->bHidExist) { halbtc8821a1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0); @@ -2356,7 +2523,12 @@ halbtc8821a1ant_RunCoexistMechanism( pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_ROAM, &bRoam); if(bScan || bLink || bRoam) - halbtc8821a1ant_ActionWifiNotConnectedAssoAuthScan(pBtCoexist); + { + if (bScan) + halbtc8821a1ant_ActionWifiNotConnectedScan(pBtCoexist); + else + halbtc8821a1ant_ActionWifiNotConnectedAssoAuth(pBtCoexist); + } else halbtc8821a1ant_ActionWifiNotConnected(pBtCoexist); } @@ -2375,14 +2547,15 @@ halbtc8821a1ant_InitCoexDm( // sw all off halbtc8821a1ant_SwMechanism(pBtCoexist, FALSE); - halbtc8821a1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 8); + //halbtc8821a1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 8); halbtc8821a1ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 0); } VOID halbtc8821a1ant_InitHwConfig( IN PBTC_COEXIST pBtCoexist, - IN BOOLEAN bBackUp + IN BOOLEAN bBackUp, + IN BOOLEAN bWifiOnly ) { PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo; @@ -2392,9 +2565,12 @@ halbtc8821a1ant_InitHwConfig( u1Byte H2C_Parameter[2] ={0}; BOOLEAN bWifiUnder5G=FALSE; - + BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], 1Ant Init HW Config!!\n")); + if(bWifiOnly) + return; + if(bBackUp) { pCoexDm->backupArfrCnt1 = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x430); @@ -2416,6 +2592,7 @@ halbtc8821a1ant_InitHwConfig( halbtc8821a1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, TRUE, FALSE); else halbtc8821a1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_PTA, TRUE, FALSE); + // PTA parameter halbtc8821a1ant_CoexTableWithType(pBtCoexist, FORCE_EXEC, 0); @@ -2431,13 +2608,20 @@ halbtc8821a1ant_InitHwConfig( //============================================================ // extern function start with EXhalbtc8821a1ant_ //============================================================ +VOID +EXhalbtc8821a1ant_PowerOnSetting( + IN PBTC_COEXIST pBtCoexist + ) +{ +} + VOID EXhalbtc8821a1ant_InitHwConfig( IN PBTC_COEXIST pBtCoexist, IN BOOLEAN bWifiOnly ) { - halbtc8821a1ant_InitHwConfig(pBtCoexist, TRUE); + halbtc8821a1ant_InitHwConfig(pBtCoexist, TRUE, bWifiOnly); } VOID @@ -2469,7 +2653,7 @@ EXhalbtc8821a1ant_DisplayCoexInfo( BOOLEAN bRoam=FALSE, bScan=FALSE, bLink=FALSE, bWifiUnder5G=FALSE; BOOLEAN bBtHsOn=FALSE, bWifiBusy=FALSE; s4Byte wifiRssi=0, btHsRssi=0; - u4Byte wifiBw, wifiTrafficDir; + u4Byte wifiBw, wifiTrafficDir, faOfdm, faCck, wifiLinkStatus; u1Byte wifiDot11Chnl, wifiHsChnl; u4Byte fwVer=0, btPatchVer=0; @@ -2491,13 +2675,6 @@ EXhalbtc8821a1ant_DisplayCoexInfo( CL_PRINTF(cliBuf); } - if(!pBoardInfo->bBtExist) - { - CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n BT not exists !!!"); - CL_PRINTF(cliBuf); - return; - } - CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d/ %d", "Ant PG Num/ Ant Mech/ Ant Pos:", \ pBoardInfo->pgAntNum, pBoardInfo->btdmAntNum, pBoardInfo->btdmAntPos); CL_PRINTF(cliBuf); @@ -2546,6 +2723,14 @@ EXhalbtc8821a1ant_DisplayCoexInfo( ((BTC_WIFI_BW_LEGACY==wifiBw)? "Legacy": (((BTC_WIFI_BW_HT40==wifiBw)? "HT40":"HT20"))), ((!bWifiBusy)? "idle": ((BTC_WIFI_TRAFFIC_TX==wifiTrafficDir)? "uplink":"downlink"))); CL_PRINTF(cliBuf); + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_LINK_STATUS, &wifiLinkStatus); + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d/ %d/ %d/ %d", "sta/vwifi/hs/p2pGo/p2pGc", \ + ((wifiLinkStatus&WIFI_STA_CONNECTED)? 1:0), ((wifiLinkStatus&WIFI_AP_CONNECTED)? 1:0), + ((wifiLinkStatus&WIFI_HS_CONNECTED)? 1:0), ((wifiLinkStatus&WIFI_P2P_GO_CONNECTED)? 1:0), + ((wifiLinkStatus&WIFI_P2P_GC_CONNECTED)? 1:0) ); + CL_PRINTF(cliBuf); + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = [%s/ %d/ %d] ", "BT [status/ rssi/ retryCnt]", \ ((pBtCoexist->btInfo.bBtDisabled)? ("disabled"): ((pCoexSta->bC2hBtInquiryPage)?("inquiry/page scan"):((BT_8821A_1ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)? "non-connected idle": ( (BT_8821A_1ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus)? "connected-idle":"busy")))), @@ -2611,13 +2796,13 @@ EXhalbtc8821a1ant_DisplayCoexInfo( pCoexDm->psTdmaPara[4], psTdmaCase, pCoexDm->bAutoTdmaAdjust); CL_PRINTF(cliBuf); - CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x ", "Latest error condition(should be 0)", \ - pCoexDm->errorCondition); - CL_PRINTF(cliBuf); - CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d ", "IgnWlanAct", \ pCoexDm->bCurIgnoreWlanAct); CL_PRINTF(cliBuf); + + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x ", "Latest error condition(should be 0)", \ + pCoexDm->errorCondition); + CL_PRINTF(cliBuf); } // Hw setting @@ -2682,9 +2867,8 @@ EXhalbtc8821a1ant_DisplayCoexInfo( u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x6c0); u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x6c4); u4Tmp[2] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x6c8); - u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x6cc); - CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x/ 0x%x", "0x6c0/0x6c4/0x6c8/0x6cc(coexTable)", \ - u4Tmp[0], u4Tmp[1], u4Tmp[2], u1Tmp[0]); + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0x6c0/0x6c4/0x6c8(coexTable)", \ + u4Tmp[0], u4Tmp[1], u4Tmp[2]); CL_PRINTF(cliBuf); CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x770(high-pri rx/tx)", \ @@ -2715,17 +2899,20 @@ EXhalbtc8821a1ant_IpsNotify( { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS ENTER notify\n")); pCoexSta->bUnderIps = TRUE; - halbtc8821a1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, TRUE); - //set PTA control - halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 8); + + halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0); halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0); + halbtc8821a1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, TRUE); + //halbtc8821a1ant_SetAntPathDCut(pBtCoexist, FALSE, FALSE, FALSE, BTC_ANT_PATH_BT, BTC_WIFI_STAT_NORMAL_OFF); } else if(BTC_IPS_LEAVE == type) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS LEAVE notify\n")); pCoexSta->bUnderIps = FALSE; - halbtc8821a1ant_RunCoexistMechanism(pBtCoexist); + halbtc8821a1ant_InitHwConfig(pBtCoexist, FALSE, FALSE); + halbtc8821a1ant_InitCoexDm(pBtCoexist); + halbtc8821a1ant_QueryBtInfo(pBtCoexist); } } @@ -2757,10 +2944,29 @@ EXhalbtc8821a1ant_ScanNotify( ) { BOOLEAN bWifiConnected=FALSE, bBtHsOn=FALSE; + u4Byte wifiLinkStatus=0; + u4Byte numOfWifiLink=0; + BOOLEAN bBtCtrlAggBufSize=FALSE; + u1Byte aggBufSize=5; if(pBtCoexist->bManualControl || - pBtCoexist->bStopCoexDm || - pBtCoexist->btInfo.bBtDisabled ) + pBtCoexist->bStopCoexDm ) + return; + + if(BTC_SCAN_START == type) + { + pCoexSta->bWiFiIsHighPriTask = TRUE; + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN START notify\n")); + + halbtc8821a1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 8); //Force antenna setup for no scan result issue + } + else + { + pCoexSta->bWiFiIsHighPriTask = FALSE; + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN FINISH notify\n")); + } + + if(pBtCoexist->btInfo.bBtDisabled) return; pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn); @@ -2768,6 +2974,16 @@ EXhalbtc8821a1ant_ScanNotify( halbtc8821a1ant_QueryBtInfo(pBtCoexist); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_LINK_STATUS, &wifiLinkStatus); + numOfWifiLink = wifiLinkStatus>>16; + if(numOfWifiLink >= 2) + { + halbtc8821a1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0); + halbtc8821a1ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, bBtCtrlAggBufSize, aggBufSize); + halbtc8821a1ant_ActionWifiMultiPort(pBtCoexist); + return; + } + if(pCoexSta->bC2hBtInquiryPage) { halbtc8821a1ant_ActionBtInquiry(pBtCoexist); @@ -2781,10 +2997,10 @@ EXhalbtc8821a1ant_ScanNotify( if(BTC_SCAN_START == type) { - BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN START notify\n")); + //BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN START notify\n")); if(!bWifiConnected) // non-connected scan { - halbtc8821a1ant_ActionWifiNotConnectedAssoAuthScan(pBtCoexist); + halbtc8821a1ant_ActionWifiNotConnectedScan(pBtCoexist); } else // wifi is connected { @@ -2793,7 +3009,7 @@ EXhalbtc8821a1ant_ScanNotify( } else if(BTC_SCAN_FINISH == type) { - BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN FINISH notify\n")); + //BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN FINISH notify\n")); if(!bWifiConnected) // non-connected scan { halbtc8821a1ant_ActionWifiNotConnected(pBtCoexist); @@ -2812,12 +3028,39 @@ EXhalbtc8821a1ant_ConnectNotify( ) { BOOLEAN bWifiConnected=FALSE, bBtHsOn=FALSE; + u4Byte wifiLinkStatus=0; + u4Byte numOfWifiLink=0; + BOOLEAN bBtCtrlAggBufSize=FALSE; + u1Byte aggBufSize=5; if(pBtCoexist->bManualControl || pBtCoexist->bStopCoexDm || pBtCoexist->btInfo.bBtDisabled ) return; + if(BTC_ASSOCIATE_START == type) + { + pCoexSta->bWiFiIsHighPriTask = TRUE; + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], CONNECT START notify\n")); + pCoexDm->nArpCnt = 0; + } + else + { + pCoexSta->bWiFiIsHighPriTask = FALSE; + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], CONNECT FINISH notify\n")); + pCoexDm->nArpCnt = 0; + } + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_LINK_STATUS, &wifiLinkStatus); + numOfWifiLink = wifiLinkStatus>>16; + if(numOfWifiLink >= 2) + { + halbtc8821a1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0); + halbtc8821a1ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, bBtCtrlAggBufSize, aggBufSize); + halbtc8821a1ant_ActionWifiMultiPort(pBtCoexist); + return; + } + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn); if(pCoexSta->bC2hBtInquiryPage) { @@ -2832,12 +3075,12 @@ EXhalbtc8821a1ant_ConnectNotify( if(BTC_ASSOCIATE_START == type) { - BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], CONNECT START notify\n")); - halbtc8821a1ant_ActionWifiNotConnectedAssoAuthScan(pBtCoexist); + //BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], CONNECT START notify\n")); + halbtc8821a1ant_ActionWifiNotConnectedAssoAuth(pBtCoexist); } else if(BTC_ASSOCIATE_FINISH == type) { - BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], CONNECT FINISH notify\n")); + //BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], CONNECT FINISH notify\n")); pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected); if(!bWifiConnected) // non-connected scan @@ -2873,6 +3116,7 @@ EXhalbtc8821a1ant_MediaStatusNotify( else { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], MEDIA disconnect notify\n")); + pCoexDm->nArpCnt = 0; } // only 2.4G we need to inform bt the chnl mask @@ -2907,14 +3151,49 @@ EXhalbtc8821a1ant_SpecialPacketNotify( ) { BOOLEAN bBtHsOn=FALSE; + u4Byte wifiLinkStatus=0; + u4Byte numOfWifiLink=0; + BOOLEAN bBtCtrlAggBufSize=FALSE; + u1Byte aggBufSize=5; if(pBtCoexist->bManualControl || pBtCoexist->bStopCoexDm || pBtCoexist->btInfo.bBtDisabled ) return; + if( BTC_PACKET_DHCP == type || + BTC_PACKET_EAPOL == type || + BTC_PACKET_ARP == type ) + { + pCoexSta->bWiFiIsHighPriTask = TRUE; + + if(BTC_PACKET_ARP == type) + { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], special Packet ARP notify\n")); + } + else + { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], special Packet DHCP or EAPOL notify\n")); + } + } + else + { + pCoexSta->bWiFiIsHighPriTask = FALSE; + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], special Packet [Type = %d] notify\n", type)); + } + pCoexSta->specialPktPeriodCnt = 0; + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_LINK_STATUS, &wifiLinkStatus); + numOfWifiLink = wifiLinkStatus>>16; + if(numOfWifiLink >= 2) + { + halbtc8821a1ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0); + halbtc8821a1ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, bBtCtrlAggBufSize, aggBufSize); + halbtc8821a1ant_ActionWifiMultiPort(pBtCoexist); + return; + } + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn); if(pCoexSta->bC2hBtInquiryPage) { @@ -2928,9 +3207,18 @@ EXhalbtc8821a1ant_SpecialPacketNotify( } if( BTC_PACKET_DHCP == type || - BTC_PACKET_EAPOL == type ) + BTC_PACKET_EAPOL == type || + BTC_PACKET_ARP == type ) { - BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], special Packet(%d) notify\n", type)); + //BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], special Packet(%d) notify\n", type)); + if(BTC_PACKET_ARP == type) + { + pCoexDm->nArpCnt++; + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], ARP Packet Count = %d\n", pCoexDm->nArpCnt)); + if(pCoexDm->nArpCnt >= 10) // if APR PKT > 10 after connect, do not go to ActionWifiConnectedSpecialPacket(pBtCoexist) + return; + } + halbtc8821a1ant_ActionWifiConnectedSpecialPacket(pBtCoexist); } } @@ -2979,12 +3267,26 @@ EXhalbtc8821a1ant_BtInfoNotify( pCoexSta->btRetryCnt = // [3:0] pCoexSta->btInfoC2h[rspSource][2]&0xf; + if (pCoexSta->btInfoC2h[rspSource][2]&0x20) + pCoexSta->bC2hBtPage = TRUE; + else + pCoexSta->bC2hBtPage = FALSE; + pCoexSta->btRssi = pCoexSta->btInfoC2h[rspSource][3]*2+10; pCoexSta->btInfoExt = pCoexSta->btInfoC2h[rspSource][4]; + pCoexSta->bBtTxRxMask = (pCoexSta->btInfoC2h[rspSource][2]&0x40); + pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_TX_RX_MASK, &pCoexSta->bBtTxRxMask); + if(!pCoexSta->bBtTxRxMask) + { + /* BT into is responded by BT FW and BT RF REG 0x3C != 0x15 => Need to switch BT TRx Mask */ + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Switch BT TRx Mask since BT RF REG 0x3C != 0x15\n")); + pBtCoexist->fBtcSetBtReg(pBtCoexist, BTC_BT_REG_RF, 0x3c, 0x15); + } + // Here we need to resend some wifi info to BT // because bt is reset and loss of the info. if(pCoexSta->btInfoExt & BIT1) @@ -3020,7 +3322,6 @@ EXhalbtc8821a1ant_BtInfoNotify( } else { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit4 check, set BT to enable Auto Report!!\n")); halbtc8821a1ant_BtAutoReport(pBtCoexist, FORCE_EXEC, TRUE); } #endif @@ -3064,6 +3365,8 @@ EXhalbtc8821a1ant_BtInfoNotify( halbtc8821a1ant_UpdateBtLinkInfo(pBtCoexist); + btInfo = btInfo & 0x1f; //mask profile bit for connect-ilde identification ( for CSR case: A2DP idle --> 0x41) + if(!(btInfo&BT_INFO_8821A_1ANT_B_CONNECTION)) { pCoexDm->btStatus = BT_8821A_1ANT_BT_STATUS_NON_CONNECTED_IDLE; @@ -3113,15 +3416,16 @@ EXhalbtc8821a1ant_HaltNotify( BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Halt notify\n")); - pBtCoexist->bStopCoexDm = TRUE; - - halbtc8821a1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, TRUE); - halbtc8821a1ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE); - halbtc8821a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); halbtc8821a1ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 0); + halbtc8821a1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, TRUE); + //halbtc8821a1ant_SetAntPathDCut(pBtCoexist, FALSE, FALSE, FALSE, BTC_ANT_PATH_BT, BTC_WIFI_STAT_NORMAL_OFF); + + halbtc8821a1ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE); EXhalbtc8821a1ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT); + + pBtCoexist->bStopCoexDm = TRUE; } VOID @@ -3135,16 +3439,20 @@ EXhalbtc8821a1ant_PnpNotify( if(BTC_WIFI_PNP_SLEEP == pnpState) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Pnp notify to SLEEP\n")); - pBtCoexist->bStopCoexDm = TRUE; - halbtc8821a1ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE); + halbtc8821a1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); - halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 9); + halbtc8821a1ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0); + halbtc8821a1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2); + halbtc8821a1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, FALSE, TRUE); + //halbtc8821a1ant_SetAntPathDCut(pBtCoexist, FALSE, FALSE, FALSE, BTC_ANT_PATH_BT, BTC_WIFI_STAT_NORMAL_OFF); + + pBtCoexist->bStopCoexDm = TRUE; } else if(BTC_WIFI_PNP_WAKE_UP == pnpState) { BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Pnp notify to WAKE UP\n")); pBtCoexist->bStopCoexDm = FALSE; - halbtc8821a1ant_InitHwConfig(pBtCoexist, FALSE); + halbtc8821a1ant_InitHwConfig(pBtCoexist, FALSE, FALSE); halbtc8821a1ant_InitCoexDm(pBtCoexist); halbtc8821a1ant_QueryBtInfo(pBtCoexist); } @@ -3185,10 +3493,10 @@ EXhalbtc8821a1ant_Periodical( if( halbtc8821a1ant_IsWifiStatusChanged(pBtCoexist) || pCoexDm->bAutoTdmaAdjust ) { - if(pCoexSta->specialPktPeriodCnt > 2) - { + //if(pCoexSta->specialPktPeriodCnt > 2) + //{ halbtc8821a1ant_RunCoexistMechanism(pBtCoexist); - } + //} } pCoexSta->specialPktPeriodCnt++; diff --git a/hal/OUTSRC-BTCoexist/HalBtc8821a1Ant.h b/hal/OUTSRC-BTCoexist/HalBtc8821a1Ant.h index 4d7f220..4c7469e 100644 --- a/hal/OUTSRC-BTCoexist/HalBtc8821a1Ant.h +++ b/hal/OUTSRC-BTCoexist/HalBtc8821a1Ant.h @@ -1,7 +1,7 @@ //=========================================== // The following is for 8821A 1ANT BT Co-exist definition //=========================================== -#define BT_AUTO_REPORT_ONLY_8821A_1ANT 0 +#define BT_AUTO_REPORT_ONLY_8821A_1ANT 1 #define BT_INFO_8821A_1ANT_B_FTP BIT7 #define BT_INFO_8821A_1ANT_B_A2DP BIT6 @@ -108,6 +108,7 @@ typedef struct _COEX_DM_8821A_1ANT{ u1Byte curRetryLimitType; u1Byte preAmpduTimeType; u1Byte curAmpduTimeType; + u4Byte nArpCnt; u1Byte errorCondition; } COEX_DM_8821A_1ANT, *PCOEX_DM_8821A_1ANT; @@ -127,12 +128,15 @@ typedef struct _COEX_STA_8821A_1ANT{ u4Byte lowPriorityTx; u4Byte lowPriorityRx; u1Byte btRssi; + BOOLEAN bBtTxRxMask; u1Byte preBtRssiState; u1Byte preWifiRssiState[4]; BOOLEAN bC2hBtInfoReqSent; u1Byte btInfoC2h[BT_INFO_SRC_8821A_1ANT_MAX][10]; u4Byte btInfoC2hCnt[BT_INFO_SRC_8821A_1ANT_MAX]; BOOLEAN bC2hBtInquiryPage; + BOOLEAN bC2hBtPage; //Add for win8.1 page out issue + BOOLEAN bWiFiIsHighPriTask; //Add for win8.1 page out issue u1Byte btRetryCnt; u1Byte btInfoExt; }COEX_STA_8821A_1ANT, *PCOEX_STA_8821A_1ANT; @@ -141,6 +145,10 @@ typedef struct _COEX_STA_8821A_1ANT{ // The following is interface which will notify coex module. //=========================================== VOID +EXhalbtc8821a1ant_PowerOnSetting( + IN PBTC_COEXIST pBtCoexist + ); +VOID EXhalbtc8821a1ant_InitHwConfig( IN PBTC_COEXIST pBtCoexist, IN BOOLEAN bWifiOnly @@ -202,10 +210,4 @@ VOID EXhalbtc8821a1ant_DisplayCoexInfo( IN PBTC_COEXIST pBtCoexist ); -VOID -EXhalbtc8821a1ant_DbgControl( - IN PBTC_COEXIST pBtCoexist, - IN u1Byte opCode, - IN u1Byte opLen, - IN pu1Byte pData - ); + diff --git a/hal/OUTSRC-BTCoexist/HalBtc8821a2Ant.c b/hal/OUTSRC-BTCoexist/HalBtc8821a2Ant.c index e55fc81..520c769 100644 --- a/hal/OUTSRC-BTCoexist/HalBtc8821a2Ant.c +++ b/hal/OUTSRC-BTCoexist/HalBtc8821a2Ant.c @@ -3508,6 +3508,13 @@ halbtc8821a2ant_RunCoexistMechanism( //============================================================ // extern function start with EXhalbtc8821a2ant_ //============================================================ +VOID +EXhalbtc8821a2ant_PowerOnSetting( + IN PBTC_COEXIST pBtCoexist + ) +{ +} + VOID EXhalbtc8821a2ant_InitHwConfig( IN PBTC_COEXIST pBtCoexist, @@ -3575,13 +3582,6 @@ EXhalbtc8821a2ant_DisplayCoexInfo( CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[BT Coexist info]============"); CL_PRINTF(cliBuf); - if(!pBoardInfo->bBtExist) - { - CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n BT not exists !!!"); - CL_PRINTF(cliBuf); - return; - } - CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d ", "Ant PG number/ Ant mechanism:", \ pBoardInfo->pgAntNum, pBoardInfo->btdmAntNum); CL_PRINTF(cliBuf); diff --git a/hal/OUTSRC-BTCoexist/HalBtc8821a2Ant.h b/hal/OUTSRC-BTCoexist/HalBtc8821a2Ant.h index 51950be..3da5517 100644 --- a/hal/OUTSRC-BTCoexist/HalBtc8821a2Ant.h +++ b/hal/OUTSRC-BTCoexist/HalBtc8821a2Ant.h @@ -118,6 +118,10 @@ typedef struct _COEX_STA_8821A_2ANT{ // The following is interface which will notify coex module. //=========================================== VOID +EXhalbtc8821a2ant_PowerOnSetting( + IN PBTC_COEXIST pBtCoexist + ); +VOID EXhalbtc8821a2ant_InitHwConfig( IN PBTC_COEXIST pBtCoexist, IN BOOLEAN bWifiOnly diff --git a/hal/OUTSRC-BTCoexist/HalBtc8821aCsr2Ant.c b/hal/OUTSRC-BTCoexist/HalBtc8821aCsr2Ant.c new file mode 100644 index 0000000..45cc4f1 --- /dev/null +++ b/hal/OUTSRC-BTCoexist/HalBtc8821aCsr2Ant.c @@ -0,0 +1,4437 @@ +//============================================================ +// Description: +// +// This file is for RTL8821A_CSR Co-exist mechanism +// +// History +// 2012/08/22 Cosa first check in. +// 2012/11/14 Cosa Revise for 8821A_CSR 2Ant out sourcing. +// +//============================================================ + +//============================================================ +// include files +//============================================================ +#include "Mp_Precomp.h" + +#define _BTCOEX_CSR 1 + +#ifndef rtw_warn_on + #define rtw_warn_on(condition) do {} while (0) +#endif + +#if(BT_30_SUPPORT == 1) +//============================================================ +// Global variables, these are static variables +//============================================================ +static COEX_DM_8821A_CSR_2ANT GLCoexDm8821aCsr2Ant; +static PCOEX_DM_8821A_CSR_2ANT pCoexDm=&GLCoexDm8821aCsr2Ant; +static COEX_STA_8821A_CSR_2ANT GLCoexSta8821aCsr2Ant; +static PCOEX_STA_8821A_CSR_2ANT pCoexSta=&GLCoexSta8821aCsr2Ant; + +const char *const GLBtInfoSrc8821aCsr2Ant[]={ + "BT Info[wifi fw]", + "BT Info[bt rsp]", + "BT Info[bt auto report]", +}; + +u4Byte GLCoexVerDate8821aCsr2Ant=20130618; +u4Byte GLCoexVer8821aCsr2Ant=0x5050; + +//============================================================ +// local function proto type if needed +//============================================================ +//============================================================ +// local function start with halbtc8821aCsr2ant_ +//============================================================ +u1Byte +halbtc8821aCsr2ant_BtRssiState( + u1Byte levelNum, + u1Byte rssiThresh, + u1Byte rssiThresh1 + ) +{ + s4Byte btRssi=0; + u1Byte btRssiState=pCoexSta->preBtRssiState; + + btRssi = pCoexSta->btRssi; + + if(levelNum == 2) + { + if( (pCoexSta->preBtRssiState == BTC_RSSI_STATE_LOW) || + (pCoexSta->preBtRssiState == BTC_RSSI_STATE_STAY_LOW)) + { + if(btRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8821A_CSR_2ANT)) + { + btRssiState = BTC_RSSI_STATE_HIGH; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state switch to High\n")); + } + else + { + btRssiState = BTC_RSSI_STATE_STAY_LOW; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state stay at Low\n")); + } + } + else + { + if(btRssi < rssiThresh) + { + btRssiState = BTC_RSSI_STATE_LOW; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state switch to Low\n")); + } + else + { + btRssiState = BTC_RSSI_STATE_STAY_HIGH; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state stay at High\n")); + } + } + } + else if(levelNum == 3) + { + if(rssiThresh > rssiThresh1) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi thresh error!!\n")); + return pCoexSta->preBtRssiState; + } + + if( (pCoexSta->preBtRssiState == BTC_RSSI_STATE_LOW) || + (pCoexSta->preBtRssiState == BTC_RSSI_STATE_STAY_LOW)) + { + if(btRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8821A_CSR_2ANT)) + { + btRssiState = BTC_RSSI_STATE_MEDIUM; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state switch to Medium\n")); + } + else + { + btRssiState = BTC_RSSI_STATE_STAY_LOW; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state stay at Low\n")); + } + } + else if( (pCoexSta->preBtRssiState == BTC_RSSI_STATE_MEDIUM) || + (pCoexSta->preBtRssiState == BTC_RSSI_STATE_STAY_MEDIUM)) + { + if(btRssi >= (rssiThresh1+BTC_RSSI_COEX_THRESH_TOL_8821A_CSR_2ANT)) + { + btRssiState = BTC_RSSI_STATE_HIGH; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state switch to High\n")); + } + else if(btRssi < rssiThresh) + { + btRssiState = BTC_RSSI_STATE_LOW; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state switch to Low\n")); + } + else + { + btRssiState = BTC_RSSI_STATE_STAY_MEDIUM; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state stay at Medium\n")); + } + } + else + { + if(btRssi < rssiThresh1) + { + btRssiState = BTC_RSSI_STATE_MEDIUM; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state switch to Medium\n")); + } + else + { + btRssiState = BTC_RSSI_STATE_STAY_HIGH; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state stay at High\n")); + } + } + } + + pCoexSta->preBtRssiState = btRssiState; + + return btRssiState; +} + +u1Byte +halbtc8821aCsr2ant_WifiRssiState( + IN PBTC_COEXIST pBtCoexist, + IN u1Byte index, + IN u1Byte levelNum, + IN u1Byte rssiThresh, + IN u1Byte rssiThresh1 + ) +{ + s4Byte wifiRssi=0; + u1Byte wifiRssiState=pCoexSta->preWifiRssiState[index]; + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_S4_WIFI_RSSI, &wifiRssi); + + if(levelNum == 2) + { + if( (pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_LOW) || + (pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_STAY_LOW)) + { + if(wifiRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8821A_CSR_2ANT)) + { + wifiRssiState = BTC_RSSI_STATE_HIGH; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state switch to High\n")); + } + else + { + wifiRssiState = BTC_RSSI_STATE_STAY_LOW; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state stay at Low\n")); + } + } + else + { + if(wifiRssi < rssiThresh) + { + wifiRssiState = BTC_RSSI_STATE_LOW; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state switch to Low\n")); + } + else + { + wifiRssiState = BTC_RSSI_STATE_STAY_HIGH; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state stay at High\n")); + } + } + } + else if(levelNum == 3) + { + if(rssiThresh > rssiThresh1) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI thresh error!!\n")); + return pCoexSta->preWifiRssiState[index]; + } + + if( (pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_LOW) || + (pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_STAY_LOW)) + { + if(wifiRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8821A_CSR_2ANT)) + { + wifiRssiState = BTC_RSSI_STATE_MEDIUM; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state switch to Medium\n")); + } + else + { + wifiRssiState = BTC_RSSI_STATE_STAY_LOW; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state stay at Low\n")); + } + } + else if( (pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_MEDIUM) || + (pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_STAY_MEDIUM)) + { + if(wifiRssi >= (rssiThresh1+BTC_RSSI_COEX_THRESH_TOL_8821A_CSR_2ANT)) + { + wifiRssiState = BTC_RSSI_STATE_HIGH; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state switch to High\n")); + } + else if(wifiRssi < rssiThresh) + { + wifiRssiState = BTC_RSSI_STATE_LOW; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state switch to Low\n")); + } + else + { + wifiRssiState = BTC_RSSI_STATE_STAY_MEDIUM; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state stay at Medium\n")); + } + } + else + { + if(wifiRssi < rssiThresh1) + { + wifiRssiState = BTC_RSSI_STATE_MEDIUM; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state switch to Medium\n")); + } + else + { + wifiRssiState = BTC_RSSI_STATE_STAY_HIGH; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state stay at High\n")); + } + } + } + + pCoexSta->preWifiRssiState[index] = wifiRssiState; + + return wifiRssiState; +} + +VOID +halbtc8821aCsr2ant_MonitorBtEnableDisable( + IN PBTC_COEXIST pBtCoexist + ) +{ + static BOOLEAN bPreBtDisabled=FALSE; + static u4Byte btDisableCnt=0; + BOOLEAN bBtActive=TRUE, bBtDisabled=FALSE; + + // This function check if bt is disabled + + if( pCoexSta->highPriorityTx == 0 && + pCoexSta->highPriorityRx == 0 && + pCoexSta->lowPriorityTx == 0 && + pCoexSta->lowPriorityRx == 0) + { + bBtActive = FALSE; + } + if( pCoexSta->highPriorityTx == 0xffff && + pCoexSta->highPriorityRx == 0xffff && + pCoexSta->lowPriorityTx == 0xffff && + pCoexSta->lowPriorityRx == 0xffff) + { + bBtActive = FALSE; + } + if(bBtActive) + { + btDisableCnt = 0; + bBtDisabled = FALSE; + pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_DISABLE, &bBtDisabled); + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], BT is enabled !!\n")); + } + else + { + btDisableCnt++; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], bt all counters=0, %d times!!\n", + btDisableCnt)); + if(btDisableCnt >= 2) + { + bBtDisabled = TRUE; + pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_DISABLE, &bBtDisabled); + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], BT is disabled !!\n")); + } + } + if(bPreBtDisabled != bBtDisabled) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], BT is from %s to %s!!\n", + (bPreBtDisabled ? "disabled":"enabled"), + (bBtDisabled ? "disabled":"enabled"))); + bPreBtDisabled = bBtDisabled; + if(!bBtDisabled) + { + } + else + { + } + } +} + +VOID +halbtc8821aCsr2ant_MonitorBtCtr( + IN PBTC_COEXIST pBtCoexist + ) +{ + u4Byte regHPTxRx, regLPTxRx, u4Tmp; + u4Byte regHPTx=0, regHPRx=0, regLPTx=0, regLPRx=0; + u1Byte u1Tmp; + + regHPTxRx = 0x770; + regLPTxRx = 0x774; + + u4Tmp = pBtCoexist->fBtcRead4Byte(pBtCoexist, regHPTxRx); + regHPTx = u4Tmp & bMaskLWord; + regHPRx = (u4Tmp & bMaskHWord)>>16; + + u4Tmp = pBtCoexist->fBtcRead4Byte(pBtCoexist, regLPTxRx); + regLPTx = u4Tmp & bMaskLWord; + regLPRx = (u4Tmp & bMaskHWord)>>16; + + pCoexSta->highPriorityTx = regHPTx; + pCoexSta->highPriorityRx = regHPRx; + pCoexSta->lowPriorityTx = regLPTx; + pCoexSta->lowPriorityRx = regLPRx; + + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], High Priority Tx/Rx (reg 0x%x)=0x%x(%d)/0x%x(%d)\n", + regHPTxRx, regHPTx, regHPTx, regHPRx, regHPRx)); + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], Low Priority Tx/Rx (reg 0x%x)=0x%x(%d)/0x%x(%d)\n", + regLPTxRx, regLPTx, regLPTx, regLPRx, regLPRx)); + + // reset counter + pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0x5d); +} + +VOID +halbtc8821aCsr2ant_UpdateRaMask( + IN PBTC_COEXIST pBtCoexist, + IN BOOLEAN bForceExec, + IN u4Byte disRateMask + ) +{ + pCoexDm->curRaMask = disRateMask; + + if( bForceExec || (pCoexDm->preRaMask != pCoexDm->curRaMask)) + { + pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_UPDATE_RAMASK, &pCoexDm->curRaMask); + } + pCoexDm->preRaMask = pCoexDm->curRaMask; +} + +VOID +halbtc8821aCsr2ant_AutoRateFallbackRetry( + IN PBTC_COEXIST pBtCoexist, + IN BOOLEAN bForceExec, + IN u1Byte type + ) +{ + BOOLEAN bWifiUnderBMode=FALSE; + + pCoexDm->curArfrType = type; + + if( bForceExec || (pCoexDm->preArfrType != pCoexDm->curArfrType)) + { + switch(pCoexDm->curArfrType) + { + case 0: // normal mode + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x430, pCoexDm->backupArfrCnt1); + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x434, pCoexDm->backupArfrCnt2); + break; + case 1: + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_UNDER_B_MODE, &bWifiUnderBMode); + if(bWifiUnderBMode) + { + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x430, 0x0); + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x434, 0x01010101); + } + else + { + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x430, 0x0); + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x434, 0x04030201); + } + break; + default: + break; + } + } + + pCoexDm->preArfrType = pCoexDm->curArfrType; +} + +VOID +halbtc8821aCsr2ant_RetryLimit( + IN PBTC_COEXIST pBtCoexist, + IN BOOLEAN bForceExec, + IN u1Byte type + ) +{ + pCoexDm->curRetryLimitType = type; + + if( bForceExec || (pCoexDm->preRetryLimitType != pCoexDm->curRetryLimitType)) + { + switch(pCoexDm->curRetryLimitType) + { + case 0: // normal mode + pBtCoexist->fBtcWrite2Byte(pBtCoexist, 0x42a, pCoexDm->backupRetryLimit); + break; + case 1: // retry limit=8 + pBtCoexist->fBtcWrite2Byte(pBtCoexist, 0x42a, 0x0808); + break; + default: + break; + } + } + + pCoexDm->preRetryLimitType = pCoexDm->curRetryLimitType; +} + +VOID +halbtc8821aCsr2ant_AmpduMaxTime( + IN PBTC_COEXIST pBtCoexist, + IN BOOLEAN bForceExec, + IN u1Byte type + ) +{ + pCoexDm->curAmpduTimeType = type; + + if( bForceExec || (pCoexDm->preAmpduTimeType != pCoexDm->curAmpduTimeType)) + { + switch(pCoexDm->curAmpduTimeType) + { + case 0: // normal mode + pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x456, pCoexDm->backupAmpduMaxTime); + break; + case 1: // AMPDU timw = 0x38 * 32us + pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x456, 0x38); + break; + case 2: + pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x456, 0x17); + break; + default: + break; + } + } + + pCoexDm->preAmpduTimeType = pCoexDm->curAmpduTimeType; +} + +VOID +halbtc8821aCsr2Ant_AmpduMaxNum( + IN PBTC_COEXIST pBtCoexist, + IN BOOLEAN bForceExec, + IN u1Byte type + ) +{ + pCoexDm->curAmpduNumType = type; + + if( bForceExec || (pCoexDm->preAmpduNumType != pCoexDm->curAmpduNumType)) + { + switch(pCoexDm->curAmpduNumType) + { + case 0: // normal mode + pBtCoexist->fBtcWrite2Byte(pBtCoexist, 0x4ca, pCoexDm->backupAmpduMaxNum); + break; + case 1: + pBtCoexist->fBtcWrite2Byte(pBtCoexist, 0x4ca, 0x0808); + break; + case 2: + pBtCoexist->fBtcWrite2Byte(pBtCoexist, 0x4ca, 0x1f1f); + break; + default: + break; + } + } + + pCoexDm->preAmpduNumType = pCoexDm->curAmpduNumType; + +} + +VOID +halbtc8821aCsr2ant_LimitedTx( + IN PBTC_COEXIST pBtCoexist, + IN BOOLEAN bForceExec, + IN u1Byte raMaskType, + IN u1Byte arfrType, + IN u1Byte retryLimitType, + IN u1Byte ampduTimeType, + IN u1Byte ampduNumType + ) +{ + switch(raMaskType) + { + case 0: // normal mode + halbtc8821aCsr2ant_UpdateRaMask(pBtCoexist, bForceExec, 0x0); + break; + case 1: // disable cck 1/2 + halbtc8821aCsr2ant_UpdateRaMask(pBtCoexist, bForceExec, 0x00000003); + break; + case 2: // disable cck 1/2/5.5, ofdm 6/9/12/18/24, mcs 0/1/2/3/4 + halbtc8821aCsr2ant_UpdateRaMask(pBtCoexist, bForceExec, 0x0001f1f7); + break; + default: + break; + } + + halbtc8821aCsr2ant_AutoRateFallbackRetry(pBtCoexist, bForceExec, arfrType); + halbtc8821aCsr2ant_RetryLimit(pBtCoexist, bForceExec, retryLimitType); + halbtc8821aCsr2ant_AmpduMaxTime(pBtCoexist, bForceExec, ampduTimeType); + halbtc8821aCsr2Ant_AmpduMaxNum(pBtCoexist, bForceExec, ampduNumType); +} + + + +VOID +halbtc8821aCsr2ant_LimitedRx( + IN PBTC_COEXIST pBtCoexist, + IN BOOLEAN bForceExec, + IN BOOLEAN bRejApAggPkt, + IN BOOLEAN bBtCtrlAggBufSize, + IN u1Byte aggBufSize + ) +{ + BOOLEAN bRejectRxAgg=bRejApAggPkt; + BOOLEAN bBtCtrlRxAggSize=bBtCtrlAggBufSize; + u1Byte rxAggSize=aggBufSize; + + //============================================ + // Rx Aggregation related setting + //============================================ + pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_TO_REJ_AP_AGG_PKT, &bRejectRxAgg); + // decide BT control aggregation buf size or not + pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_CTRL_AGG_SIZE, &bBtCtrlRxAggSize); + // aggregation buf size, only work when BT control Rx aggregation size. + pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_AGG_BUF_SIZE, &rxAggSize); + // real update aggregation setting + pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_AGGREGATE_CTRL, NULL); +} + +VOID +halbtc8821aCsr2ant_QueryBtInfo( + IN PBTC_COEXIST pBtCoexist + ) +{ + u1Byte H2C_Parameter[1] ={0}; + + pCoexSta->bC2hBtInfoReqSent = TRUE; + + H2C_Parameter[0] |= BIT0; // trigger + + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], Query Bt Info, FW write 0x61=0x%x\n", + H2C_Parameter[0])); + + rtw_warn_on(_BTCOEX_CSR); + pBtCoexist->fBtcFillH2c(pBtCoexist, 0x61, 1, H2C_Parameter); +} + +u1Byte +halbtc8821aCsr2ant_ActionAlgorithm( + IN PBTC_COEXIST pBtCoexist + ) +{ + PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo; + BOOLEAN bBtHsOn=FALSE; + u1Byte algorithm=BT_8821A_CSR_2ANT_COEX_ALGO_UNDEFINED; + u1Byte numOfDiffProfile=0; + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn); + + //sync StackInfo with BT firmware and stack + pStackInfo->bHidExist = pCoexSta->bHidExist; + pStackInfo->bBtLinkExist = pCoexSta->bBtLinkExist; + pStackInfo->bScoExist = pCoexSta->bScoExist; + pStackInfo->bPanExist = pCoexSta->bPanExist; + pStackInfo->bA2dpExist = pCoexSta->bA2dpExist; + + if(!pStackInfo->bBtLinkExist) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], No profile exists!!!\n")); + return algorithm; + } + + if(pStackInfo->bScoExist) + numOfDiffProfile++; + if(pStackInfo->bHidExist) + numOfDiffProfile++; + if(pStackInfo->bPanExist) + numOfDiffProfile++; + if(pStackInfo->bA2dpExist) + numOfDiffProfile++; + + if(numOfDiffProfile == 1) + { + if(pStackInfo->bScoExist) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO only\n")); + algorithm = BT_8821A_CSR_2ANT_COEX_ALGO_SCO; + } + else + { + if(pStackInfo->bHidExist) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID only\n")); + algorithm = BT_8821A_CSR_2ANT_COEX_ALGO_HID; + } + else if(pStackInfo->bA2dpExist) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP only\n")); + algorithm = BT_8821A_CSR_2ANT_COEX_ALGO_A2DP; + } + else if(pStackInfo->bPanExist) + { + if(bBtHsOn) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(HS) only\n")); + algorithm = BT_8821A_CSR_2ANT_COEX_ALGO_PANHS; + } + else + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(EDR) only\n")); + algorithm = BT_8821A_CSR_2ANT_COEX_ALGO_PANEDR; + } + } + } + } + else if(numOfDiffProfile == 2) + { + if(pStackInfo->bScoExist) + { + if(pStackInfo->bHidExist) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID\n")); + algorithm = BT_8821A_CSR_2ANT_COEX_ALGO_PANEDR_HID; + } + else if(pStackInfo->bA2dpExist) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP ==> SCO\n")); + algorithm = BT_8821A_CSR_2ANT_COEX_ALGO_PANEDR_HID; + } + else if(pStackInfo->bPanExist) + { + if(bBtHsOn) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(HS)\n")); + algorithm = BT_8821A_CSR_2ANT_COEX_ALGO_SCO; + } + else + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(EDR)\n")); + algorithm = BT_8821A_CSR_2ANT_COEX_ALGO_PANEDR_HID; + } + } + } + else + { + if( pStackInfo->bHidExist && + pStackInfo->bA2dpExist ) + { + if(pStackInfo->numOfHid >= 2) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID*2 + A2DP\n")); + algorithm = BT_8821A_CSR_2ANT_COEX_ALGO_HID_A2DP_PANEDR; + } + else + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP\n")); + algorithm = BT_8821A_CSR_2ANT_COEX_ALGO_HID_A2DP; + } + } + else if( pStackInfo->bHidExist && + pStackInfo->bPanExist ) + { + if(bBtHsOn) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN(HS)\n")); + algorithm = BT_8821A_CSR_2ANT_COEX_ALGO_HID; + } + else + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN(EDR)\n")); + algorithm = BT_8821A_CSR_2ANT_COEX_ALGO_PANEDR_HID; + } + } + else if( pStackInfo->bPanExist && + pStackInfo->bA2dpExist ) + { + if(bBtHsOn) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP + PAN(HS)\n")); + algorithm = BT_8821A_CSR_2ANT_COEX_ALGO_A2DP_PANHS; + } + else + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP + PAN(EDR)\n")); + algorithm = BT_8821A_CSR_2ANT_COEX_ALGO_PANEDR_A2DP; + } + } + } + } + else if(numOfDiffProfile == 3) + { + if(pStackInfo->bScoExist) + { + if( pStackInfo->bHidExist && + pStackInfo->bA2dpExist ) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + A2DP ==> HID\n")); + algorithm = BT_8821A_CSR_2ANT_COEX_ALGO_PANEDR_HID; + } + else if( pStackInfo->bHidExist && + pStackInfo->bPanExist ) + { + if(bBtHsOn) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(HS)\n")); + algorithm = BT_8821A_CSR_2ANT_COEX_ALGO_PANEDR_HID; + } + else + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(EDR)\n")); + algorithm = BT_8821A_CSR_2ANT_COEX_ALGO_PANEDR_HID; + } + } + else if( pStackInfo->bPanExist && + pStackInfo->bA2dpExist ) + { + if(bBtHsOn) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP + PAN(HS)\n")); + algorithm = BT_8821A_CSR_2ANT_COEX_ALGO_PANEDR_HID; + } + else + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP + PAN(EDR) ==> HID\n")); + algorithm = BT_8821A_CSR_2ANT_COEX_ALGO_PANEDR_HID; + } + } + } + else + { + if( pStackInfo->bHidExist && + pStackInfo->bPanExist && + pStackInfo->bA2dpExist ) + { + if(bBtHsOn) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP + PAN(HS)\n")); + algorithm = BT_8821A_CSR_2ANT_COEX_ALGO_HID_A2DP; + } + else + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP + PAN(EDR)\n")); + algorithm = BT_8821A_CSR_2ANT_COEX_ALGO_HID_A2DP_PANEDR; + } + } + } + } + else if(numOfDiffProfile >= 3) + { + if(pStackInfo->bScoExist) + { + if( pStackInfo->bHidExist && + pStackInfo->bPanExist && + pStackInfo->bA2dpExist ) + { + if(bBtHsOn) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Error!!! SCO + HID + A2DP + PAN(HS)\n")); + + } + else + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + A2DP + PAN(EDR)==>PAN(EDR)+HID\n")); + algorithm = BT_8821A_CSR_2ANT_COEX_ALGO_PANEDR_HID; + } + } + } + } + + return algorithm; +} + +BOOLEAN +halbtc8821aCsr2ant_NeedToDecBtPwr( + IN PBTC_COEXIST pBtCoexist + ) +{ + BOOLEAN bRet=FALSE; + BOOLEAN bBtHsOn=FALSE, bWifiConnected=FALSE; + s4Byte btHsRssi=0; + u1Byte btRssiState; + + if(!pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn)) + return FALSE; + if(!pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected)) + return FALSE; + if(!pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_S4_HS_RSSI, &btHsRssi)) + return FALSE; + + btRssiState = halbtc8821aCsr2ant_BtRssiState(2, 35, 0); + + if(bWifiConnected) + { + if(bBtHsOn) + { + if(btHsRssi > 37) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], Need to decrease bt power for HS mode!!\n")); + bRet = TRUE; + } + } + else + { + if( (btRssiState == BTC_RSSI_STATE_HIGH) || + (btRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], Need to decrease bt power for Wifi is connected!!\n")); + bRet = TRUE; + } + } + } + + return bRet; +} + +VOID +halbtc8821aCsr2ant_SetFwDacSwingLevel( + IN PBTC_COEXIST pBtCoexist, + IN u1Byte dacSwingLvl + ) +{ + u1Byte H2C_Parameter[1] ={0}; + + // There are several type of dacswing + // 0x18/ 0x10/ 0xc/ 0x8/ 0x4/ 0x6 + H2C_Parameter[0] = dacSwingLvl; + + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], Set Dac Swing Level=0x%x\n", dacSwingLvl)); + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], FW write 0x64=0x%x\n", H2C_Parameter[0])); + + pBtCoexist->fBtcFillH2c(pBtCoexist, 0x64, 1, H2C_Parameter); +} + +VOID +halbtc8821aCsr2ant_SetFwDecBtPwr( + IN PBTC_COEXIST pBtCoexist, + IN BOOLEAN bDecBtPwr + ) +{ + u1Byte H2C_Parameter[1] ={0}; + + H2C_Parameter[0] = 0; + + if(bDecBtPwr) + { + H2C_Parameter[0] |= BIT1; + } + + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], decrease Bt Power : %s, FW write 0x62=0x%x\n", + (bDecBtPwr? "Yes!!":"No!!"), H2C_Parameter[0])); + + rtw_warn_on(_BTCOEX_CSR); + pBtCoexist->fBtcFillH2c(pBtCoexist, 0x62, 1, H2C_Parameter); +} + +VOID +halbtc8821aCsr2ant_DecBtPwr( + IN PBTC_COEXIST pBtCoexist, + IN BOOLEAN bForceExec, + IN BOOLEAN bDecBtPwr + ) +{ + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s Dec BT power = %s\n", + (bForceExec? "force to":""), ((bDecBtPwr)? "ON":"OFF"))); + pCoexDm->bCurDecBtPwr = bDecBtPwr; + + if(!bForceExec) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], bPreDecBtPwr=%d, bCurDecBtPwr=%d\n", + pCoexDm->bPreDecBtPwr, pCoexDm->bCurDecBtPwr)); + + if(pCoexDm->bPreDecBtPwr == pCoexDm->bCurDecBtPwr) + return; + } + + /* TODO: may CSR consider to decrease BT power? */ + //halbtc8821aCsr2ant_SetFwDecBtPwr(pBtCoexist, pCoexDm->bCurDecBtPwr); + + pCoexDm->bPreDecBtPwr = pCoexDm->bCurDecBtPwr; +} + +VOID +halbtc8821aCsr2ant_SetBtAutoReport( + IN PBTC_COEXIST pBtCoexist, + IN BOOLEAN bEnableAutoReport + ) +{ + u1Byte H2C_Parameter[1] ={0}; + + H2C_Parameter[0] = 0; + + if(bEnableAutoReport) + { + H2C_Parameter[0] |= BIT0; + } + + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], BT FW auto report : %s, FW write 0x68=0x%x\n", + (bEnableAutoReport? "Enabled!!":"Disabled!!"), H2C_Parameter[0])); + + rtw_warn_on(_BTCOEX_CSR); + pBtCoexist->fBtcFillH2c(pBtCoexist, 0x68, 1, H2C_Parameter); +} + +VOID +halbtc8821aCsr2ant_BtAutoReport( + IN PBTC_COEXIST pBtCoexist, + IN BOOLEAN bForceExec, + IN BOOLEAN bEnableAutoReport + ) +{ + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s BT Auto report = %s\n", + (bForceExec? "force to":""), ((bEnableAutoReport)? "Enabled":"Disabled"))); + pCoexDm->bCurBtAutoReport = bEnableAutoReport; + + if(!bForceExec) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], bPreBtAutoReport=%d, bCurBtAutoReport=%d\n", + pCoexDm->bPreBtAutoReport, pCoexDm->bCurBtAutoReport)); + + if(pCoexDm->bPreBtAutoReport == pCoexDm->bCurBtAutoReport) + return; + } + //halbtc8821aCsr2ant_SetBtAutoReport(pBtCoexist, pCoexDm->bCurBtAutoReport); + + pCoexDm->bPreBtAutoReport = pCoexDm->bCurBtAutoReport; +} + +VOID +halbtc8821aCsr2ant_FwDacSwingLvl( + IN PBTC_COEXIST pBtCoexist, + IN BOOLEAN bForceExec, + IN u1Byte fwDacSwingLvl + ) +{ + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s set FW Dac Swing level = %d\n", + (bForceExec? "force to":""), fwDacSwingLvl)); + pCoexDm->curFwDacSwingLvl = fwDacSwingLvl; + + if(!bForceExec) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], preFwDacSwingLvl=%d, curFwDacSwingLvl=%d\n", + pCoexDm->preFwDacSwingLvl, pCoexDm->curFwDacSwingLvl)); + + if(pCoexDm->preFwDacSwingLvl == pCoexDm->curFwDacSwingLvl) + return; + } + + halbtc8821aCsr2ant_SetFwDacSwingLevel(pBtCoexist, pCoexDm->curFwDacSwingLvl); + + pCoexDm->preFwDacSwingLvl = pCoexDm->curFwDacSwingLvl; +} + +VOID +halbtc8821aCsr2ant_SetSwRfRxLpfCorner( + IN PBTC_COEXIST pBtCoexist, + IN BOOLEAN bRxRfShrinkOn + ) +{ + if(bRxRfShrinkOn) + { + //Shrink RF Rx LPF corner + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Shrink RF Rx LPF corner!!\n")); + pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1e, 0xfffff, 0xffffc); + } + else + { + //Resume RF Rx LPF corner + // After initialized, we can use pCoexDm->btRf0x1eBackup + if(pBtCoexist->bInitilized) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Resume RF Rx LPF corner!!\n")); + pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1e, 0xfffff, pCoexDm->btRf0x1eBackup); + } + } +} + +VOID +halbtc8821aCsr2ant_RfShrink( + IN PBTC_COEXIST pBtCoexist, + IN BOOLEAN bForceExec, + IN BOOLEAN bRxRfShrinkOn + ) +{ + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s turn Rx RF Shrink = %s\n", + (bForceExec? "force to":""), ((bRxRfShrinkOn)? "ON":"OFF"))); + pCoexDm->bCurRfRxLpfShrink = bRxRfShrinkOn; + + if(!bForceExec) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], bPreRfRxLpfShrink=%d, bCurRfRxLpfShrink=%d\n", + pCoexDm->bPreRfRxLpfShrink, pCoexDm->bCurRfRxLpfShrink)); + + if(pCoexDm->bPreRfRxLpfShrink == pCoexDm->bCurRfRxLpfShrink) + return; + } + halbtc8821aCsr2ant_SetSwRfRxLpfCorner(pBtCoexist, pCoexDm->bCurRfRxLpfShrink); + + pCoexDm->bPreRfRxLpfShrink = pCoexDm->bCurRfRxLpfShrink; +} + +VOID +halbtc8821aCsr2ant_SetSwPenaltyTxRateAdaptive( + IN PBTC_COEXIST pBtCoexist, + IN BOOLEAN bLowPenaltyRa + ) +{ + u1Byte H2C_Parameter[6] ={0}; + + H2C_Parameter[0] = 0x6; // opCode, 0x6= Retry_Penalty + + if(bLowPenaltyRa) + { + H2C_Parameter[1] |= BIT0; + H2C_Parameter[2] = 0x00; //normal rate except MCS7/6/5, OFDM54/48/36 + H2C_Parameter[3] = 0xf7; //MCS7 or OFDM54 + H2C_Parameter[4] = 0xf8; //MCS6 or OFDM48 + H2C_Parameter[5] = 0xf9; //MCS5 or OFDM36 + } + + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], set WiFi Low-Penalty Retry: %s", + (bLowPenaltyRa? "ON!!":"OFF!!") )); + + pBtCoexist->fBtcFillH2c(pBtCoexist, 0x69, 6, H2C_Parameter); +} + +VOID +halbtc8821aCsr2ant_LowPenaltyRa( + IN PBTC_COEXIST pBtCoexist, + IN BOOLEAN bForceExec, + IN BOOLEAN bLowPenaltyRa + ) +{ + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s turn LowPenaltyRA = %s\n", + (bForceExec? "force to":""), ((bLowPenaltyRa)? "ON":"OFF"))); + pCoexDm->bCurLowPenaltyRa = bLowPenaltyRa; + + if(!bForceExec) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], bPreLowPenaltyRa=%d, bCurLowPenaltyRa=%d\n", + pCoexDm->bPreLowPenaltyRa, pCoexDm->bCurLowPenaltyRa)); + + if(pCoexDm->bPreLowPenaltyRa == pCoexDm->bCurLowPenaltyRa) + return; + } + halbtc8821aCsr2ant_SetSwPenaltyTxRateAdaptive(pBtCoexist, pCoexDm->bCurLowPenaltyRa); + + pCoexDm->bPreLowPenaltyRa = pCoexDm->bCurLowPenaltyRa; +} + +VOID +halbtc8821aCsr2ant_SetDacSwingReg( + IN PBTC_COEXIST pBtCoexist, + IN u4Byte level + ) +{ + u1Byte val=(u1Byte)level; + + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Write SwDacSwing = 0x%x\n", level)); + pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xc5b, 0x3e, val); +} + +VOID +halbtc8821aCsr2ant_SetSwFullTimeDacSwing( + IN PBTC_COEXIST pBtCoexist, + IN BOOLEAN bSwDacSwingOn, + IN u4Byte swDacSwingLvl + ) +{ + if(bSwDacSwingOn) + { + halbtc8821aCsr2ant_SetDacSwingReg(pBtCoexist, swDacSwingLvl); + } + else + { + halbtc8821aCsr2ant_SetDacSwingReg(pBtCoexist, 0x18); + } +} + + +VOID +halbtc8821aCsr2ant_DacSwing( + IN PBTC_COEXIST pBtCoexist, + IN BOOLEAN bForceExec, + IN BOOLEAN bDacSwingOn, + IN u4Byte dacSwingLvl + ) +{ + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s turn DacSwing=%s, dacSwingLvl=0x%x\n", + (bForceExec? "force to":""), ((bDacSwingOn)? "ON":"OFF"), dacSwingLvl)); + pCoexDm->bCurDacSwingOn = bDacSwingOn; + pCoexDm->curDacSwingLvl = dacSwingLvl; + + if(!bForceExec) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], bPreDacSwingOn=%d, preDacSwingLvl=0x%x, bCurDacSwingOn=%d, curDacSwingLvl=0x%x\n", + pCoexDm->bPreDacSwingOn, pCoexDm->preDacSwingLvl, + pCoexDm->bCurDacSwingOn, pCoexDm->curDacSwingLvl)); + + if( (pCoexDm->bPreDacSwingOn == pCoexDm->bCurDacSwingOn) && + (pCoexDm->preDacSwingLvl == pCoexDm->curDacSwingLvl) ) + return; + } + delay_ms(30); + halbtc8821aCsr2ant_SetSwFullTimeDacSwing(pBtCoexist, bDacSwingOn, dacSwingLvl); + + pCoexDm->bPreDacSwingOn = pCoexDm->bCurDacSwingOn; + pCoexDm->preDacSwingLvl = pCoexDm->curDacSwingLvl; +} + +VOID +halbtc8821aCsr2ant_SetAdcBackOff( + IN PBTC_COEXIST pBtCoexist, + IN BOOLEAN bAdcBackOff + ) +{ + if(bAdcBackOff) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], BB BackOff Level On!\n")); + pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x8db, 0x60, 0x3); + } + else + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], BB BackOff Level Off!\n")); + pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x8db, 0x60, 0x1); + } +} + +VOID +halbtc8821aCsr2ant_AdcBackOff( + IN PBTC_COEXIST pBtCoexist, + IN BOOLEAN bForceExec, + IN BOOLEAN bAdcBackOff + ) +{ + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s turn AdcBackOff = %s\n", + (bForceExec? "force to":""), ((bAdcBackOff)? "ON":"OFF"))); + pCoexDm->bCurAdcBackOff = bAdcBackOff; + + if(!bForceExec) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], bPreAdcBackOff=%d, bCurAdcBackOff=%d\n", + pCoexDm->bPreAdcBackOff, pCoexDm->bCurAdcBackOff)); + + if(pCoexDm->bPreAdcBackOff == pCoexDm->bCurAdcBackOff) + return; + } + halbtc8821aCsr2ant_SetAdcBackOff(pBtCoexist, pCoexDm->bCurAdcBackOff); + + pCoexDm->bPreAdcBackOff = pCoexDm->bCurAdcBackOff; +} + +VOID +halbtc8821aCsr2ant_SetAgcTable( + IN PBTC_COEXIST pBtCoexist, + IN BOOLEAN bAgcTableEn + ) +{ + u1Byte rssiAdjustVal=0; + + pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0xef, 0xfffff, 0x02000); + if(bAgcTableEn) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table On!\n")); + pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x3b, 0xfffff, 0x28F4B); + pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x3b, 0xfffff, 0x10AB2); + rssiAdjustVal = 8; + } + else + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table Off!\n")); + pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x3b, 0xfffff, 0x2884B); + pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x3b, 0xfffff, 0x104B2); + } + pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0xef, 0xfffff, 0x0); + + // set rssiAdjustVal for wifi module. + pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_RSSI_ADJ_VAL_FOR_AGC_TABLE_ON, &rssiAdjustVal); +} + +VOID +halbtc8821aCsr2ant_AgcTable( + IN PBTC_COEXIST pBtCoexist, + IN BOOLEAN bForceExec, + IN BOOLEAN bAgcTableEn + ) +{ + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s %s Agc Table\n", + (bForceExec? "force to":""), ((bAgcTableEn)? "Enable":"Disable"))); + pCoexDm->bCurAgcTableEn = bAgcTableEn; + + if(!bForceExec) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], bPreAgcTableEn=%d, bCurAgcTableEn=%d\n", + pCoexDm->bPreAgcTableEn, pCoexDm->bCurAgcTableEn)); + + if(pCoexDm->bPreAgcTableEn == pCoexDm->bCurAgcTableEn) + return; + } + halbtc8821aCsr2ant_SetAgcTable(pBtCoexist, bAgcTableEn); + + pCoexDm->bPreAgcTableEn = pCoexDm->bCurAgcTableEn; +} + +VOID +halbtc8821aCsr2ant_SetCoexTable( + IN PBTC_COEXIST pBtCoexist, + IN u4Byte val0x6c0, + IN u4Byte val0x6c4, + IN u4Byte val0x6c8, + IN u1Byte val0x6cc + ) +{ + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], set coex table, set 0x6c0=0x%x\n", val0x6c0)); + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x6c0, val0x6c0); + + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], set coex table, set 0x6c4=0x%x\n", val0x6c4)); + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x6c4, val0x6c4); + + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], set coex table, set 0x6c8=0x%x\n", val0x6c8)); + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x6c8, val0x6c8); + + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], set coex table, set 0x6cc=0x%x\n", val0x6cc)); + pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x6cc, val0x6cc); +} + +VOID +halbtc8821aCsr2ant_CoexTable( + IN PBTC_COEXIST pBtCoexist, + IN BOOLEAN bForceExec, + IN u4Byte val0x6c0, + IN u4Byte val0x6c4, + IN u4Byte val0x6c8, + IN u1Byte val0x6cc + ) +{ + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s write Coex Table 0x6c0=0x%x, 0x6c4=0x%x, 0x6c8=0x%x, 0x6cc=0x%x\n", + (bForceExec? "force to":""), val0x6c0, val0x6c4, val0x6c8, val0x6cc)); + pCoexDm->curVal0x6c0 = val0x6c0; + pCoexDm->curVal0x6c4 = val0x6c4; + pCoexDm->curVal0x6c8 = val0x6c8; + pCoexDm->curVal0x6cc = val0x6cc; + + if(!bForceExec) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], preVal0x6c0=0x%x, preVal0x6c4=0x%x, preVal0x6c8=0x%x, preVal0x6cc=0x%x !!\n", + pCoexDm->preVal0x6c0, pCoexDm->preVal0x6c4, pCoexDm->preVal0x6c8, pCoexDm->preVal0x6cc)); + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], curVal0x6c0=0x%x, curVal0x6c4=0x%x, curVal0x6c8=0x%x, curVal0x6cc=0x%x !!\n", + pCoexDm->curVal0x6c0, pCoexDm->curVal0x6c4, pCoexDm->curVal0x6c8, pCoexDm->curVal0x6cc)); + + if( (pCoexDm->preVal0x6c0 == pCoexDm->curVal0x6c0) && + (pCoexDm->preVal0x6c4 == pCoexDm->curVal0x6c4) && + (pCoexDm->preVal0x6c8 == pCoexDm->curVal0x6c8) && + (pCoexDm->preVal0x6cc == pCoexDm->curVal0x6cc) ) + return; + } + halbtc8821aCsr2ant_SetCoexTable(pBtCoexist, val0x6c0, val0x6c4, val0x6c8, val0x6cc); + + pCoexDm->preVal0x6c0 = pCoexDm->curVal0x6c0; + pCoexDm->preVal0x6c4 = pCoexDm->curVal0x6c4; + pCoexDm->preVal0x6c8 = pCoexDm->curVal0x6c8; + pCoexDm->preVal0x6cc = pCoexDm->curVal0x6cc; +} + +VOID +halbtc8821aCsr2ant_SetFwIgnoreWlanAct( + IN PBTC_COEXIST pBtCoexist, + IN BOOLEAN bEnable + ) +{ + u1Byte H2C_Parameter[1] ={0}; + + if(bEnable) + { + H2C_Parameter[0] |= BIT0; // function enable + } + + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], set FW for BT Ignore Wlan_Act, FW write 0x63=0x%x\n", + H2C_Parameter[0])); + + rtw_warn_on(_BTCOEX_CSR); + pBtCoexist->fBtcFillH2c(pBtCoexist, 0x63, 1, H2C_Parameter); +} + +VOID +halbtc8821aCsr2ant_IgnoreWlanAct( + IN PBTC_COEXIST pBtCoexist, + IN BOOLEAN bForceExec, + IN BOOLEAN bEnable + ) +{ + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s turn Ignore WlanAct %s\n", + (bForceExec? "force to":""), (bEnable? "ON":"OFF"))); + pCoexDm->bCurIgnoreWlanAct = bEnable; + + if(!bForceExec) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], bPreIgnoreWlanAct = %d, bCurIgnoreWlanAct = %d!!\n", + pCoexDm->bPreIgnoreWlanAct, pCoexDm->bCurIgnoreWlanAct)); + + if(pCoexDm->bPreIgnoreWlanAct == pCoexDm->bCurIgnoreWlanAct) + return; + } + //halbtc8821aCsr2ant_SetFwIgnoreWlanAct(pBtCoexist, bEnable); + + pCoexDm->bPreIgnoreWlanAct = pCoexDm->bCurIgnoreWlanAct; +} + +VOID +halbtc8821aCsr2ant_SetFwPstdma( + IN PBTC_COEXIST pBtCoexist, + IN u1Byte byte1, + IN u1Byte byte2, + IN u1Byte byte3, + IN u1Byte byte4, + IN u1Byte byte5 + ) +{ + u1Byte H2C_Parameter[6] ={0}; + + H2C_Parameter[0] = byte1; + H2C_Parameter[1] = byte2; + H2C_Parameter[2] = byte3; + H2C_Parameter[3] = byte4; + H2C_Parameter[4] = byte5; + H2C_Parameter[5] = 0x01; + + pCoexDm->psTdmaPara[0] = byte1; + pCoexDm->psTdmaPara[1] = byte2; + pCoexDm->psTdmaPara[2] = byte3; + pCoexDm->psTdmaPara[3] = byte4; + pCoexDm->psTdmaPara[4] = byte5; + pCoexDm->psTdmaPara[5] = 0x01; + + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], FW write 0x60(6bytes)=0x%x%08x%02x\n", + H2C_Parameter[0], + H2C_Parameter[1]<<24|H2C_Parameter[2]<<16|H2C_Parameter[3]<<8|H2C_Parameter[4], H2C_Parameter[5])); + + pBtCoexist->fBtcFillH2c(pBtCoexist, 0x60, 6, H2C_Parameter); +} + +VOID +halbtc8821aCsr2ant_SwMechanism1( + IN PBTC_COEXIST pBtCoexist, + IN BOOLEAN bShrinkRxLPF, + IN BOOLEAN bLowPenaltyRA, + IN BOOLEAN bLimitedDIG, + IN BOOLEAN bBTLNAConstrain + ) +{ + u4Byte wifiBw; + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); + + if(BTC_WIFI_BW_HT40 != wifiBw) //only shrink RF Rx LPF for HT40 + { + if (bShrinkRxLPF) + bShrinkRxLPF = FALSE; + } + + halbtc8821aCsr2ant_RfShrink(pBtCoexist, NORMAL_EXEC, bShrinkRxLPF); + halbtc8821aCsr2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, bLowPenaltyRA); + + //no limited DIG + //halbtc8821aCsr2ant_SetBtLnaConstrain(pBtCoexist, NORMAL_EXEC, bBTLNAConstrain); +} + +VOID +halbtc8821aCsr2ant_SwMechanism2( + IN PBTC_COEXIST pBtCoexist, + IN BOOLEAN bAGCTableShift, + IN BOOLEAN bADCBackOff, + IN BOOLEAN bSWDACSwing, + IN u4Byte dacSwingLvl + ) +{ + //halbtc8821aCsr2ant_AgcTable(pBtCoexist, NORMAL_EXEC, bAGCTableShift); + halbtc8821aCsr2ant_AdcBackOff(pBtCoexist, NORMAL_EXEC, bADCBackOff); + halbtc8821aCsr2ant_DacSwing(pBtCoexist, NORMAL_EXEC, bSWDACSwing, dacSwingLvl); +} + +VOID +halbtc8821aCsr2ant_SetAntPath( + IN PBTC_COEXIST pBtCoexist, + IN u1Byte antPosType, + IN BOOLEAN bInitHwCfg, + IN BOOLEAN bWifiOff + ) +{ + PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo; + u4Byte u4Tmp=0; + u1Byte H2C_Parameter[2] ={0}; + + if(bInitHwCfg) + { + // 0x4c[23]=0, 0x4c[24]=1 Antenna control by WL/BT + u4Tmp = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x4c); + u4Tmp &=~BIT23; + u4Tmp |= BIT24; + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x4c, u4Tmp); + + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x974, 0x3ff); + pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0xcb4, 0x77); + + if(pBoardInfo->btdmAntPos == BTC_ANTENNA_AT_MAIN_PORT) + { + //tell firmware "antenna inverse" ==> WRONG firmware antenna control code.==>need fw to fix + H2C_Parameter[0] = 1; + H2C_Parameter[1] = 1; + pBtCoexist->fBtcFillH2c(pBtCoexist, 0x65, 2, H2C_Parameter); + } + else + { + //tell firmware "no antenna inverse" ==> WRONG firmware antenna control code.==>need fw to fix + H2C_Parameter[0] = 0; + H2C_Parameter[1] = 1; + pBtCoexist->fBtcFillH2c(pBtCoexist, 0x65, 2, H2C_Parameter); + } + } + + // ext switch setting + switch(antPosType) + { + case BTC_ANT_WIFI_AT_MAIN: + pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xcb7, 0x30, 0x1); + break; + case BTC_ANT_WIFI_AT_AUX: + pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0xcb7, 0x30, 0x2); + break; + } +} + +VOID +halbtc8821aCsr2ant_PsTdma( + IN PBTC_COEXIST pBtCoexist, + IN BOOLEAN bForceExec, + IN BOOLEAN bTurnOn, + IN u1Byte type + ) +{ + BOOLEAN bTurnOnByCnt=FALSE; + u1Byte psTdmaTypeByCnt=0; + + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s turn %s PS TDMA, type=%d\n", + (bForceExec? "force to":""), (bTurnOn? "ON":"OFF"), type)); + pCoexDm->bCurPsTdmaOn = bTurnOn; + pCoexDm->curPsTdma = type; + + if(!bForceExec) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], bPrePsTdmaOn = %d, bCurPsTdmaOn = %d!!\n", + pCoexDm->bPrePsTdmaOn, pCoexDm->bCurPsTdmaOn)); + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], prePsTdma = %d, curPsTdma = %d!!\n", + pCoexDm->prePsTdma, pCoexDm->curPsTdma)); + + if( (pCoexDm->bPrePsTdmaOn == pCoexDm->bCurPsTdmaOn) && + (pCoexDm->prePsTdma == pCoexDm->curPsTdma) ) + return; + } + if(bTurnOn) + { + switch(type) + { + case 1: + default: + halbtc8821aCsr2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x90); + break; + case 2: + halbtc8821aCsr2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xe1, 0x90); + break; + case 3: + halbtc8821aCsr2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1c, 0x3, 0xf1, 0x90); + break; + case 4: + halbtc8821aCsr2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x10, 0x03, 0xf1, 0x90); + break; + case 5: + halbtc8821aCsr2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0x60, 0x90); + break; + case 6: + halbtc8821aCsr2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0x60, 0x90); + break; + case 7: + halbtc8821aCsr2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1c, 0x3, 0x70, 0x90); + break; + case 8: + halbtc8821aCsr2ant_SetFwPstdma(pBtCoexist, 0xa3, 0x10, 0x3, 0x70, 0x90); + break; + case 9: + halbtc8821aCsr2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x90); + break; + case 10: + halbtc8821aCsr2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xe1, 0x90); + break; + case 11: + halbtc8821aCsr2ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0xa, 0xe1, 0x90); + break; + case 12: + halbtc8821aCsr2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0xe1, 0x90); + break; + case 13: + halbtc8821aCsr2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0x60, 0x90); + break; + case 14: + halbtc8821aCsr2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0x60, 0x90); + break; + case 15: + halbtc8821aCsr2ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0xa, 0x60, 0x90); + break; + case 16: + halbtc8821aCsr2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0x60, 0x90); + break; + case 17: + halbtc8821aCsr2ant_SetFwPstdma(pBtCoexist, 0xa3, 0x2f, 0x2f, 0x60, 0x90); + break; + case 18: + halbtc8821aCsr2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0xe1, 0x90); + break; + case 19: + halbtc8821aCsr2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x25, 0xe1, 0x90); + break; + case 20: + halbtc8821aCsr2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x25, 0x60, 0x90); + break; + case 21: + halbtc8821aCsr2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x15, 0x03, 0x70, 0x90); + break; + case 22: //ad2dp master + halbtc8821aCsr2ant_SetFwPstdma(pBtCoexist, 0xeb, 0x11, 0x11, 0x21, 0x10); + break; + case 23: //a2dp slave + halbtc8821aCsr2ant_SetFwPstdma(pBtCoexist, 0xeb, 0x12, 0x12, 0x20, 0x10); + break; + case 71: + halbtc8821aCsr2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x90); + break; + } + } + else + { + // disable PS tdma + switch(type) + { + case 0: + halbtc8821aCsr2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x40, 0x0); + break; + case 1: + halbtc8821aCsr2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x48, 0x0); + break; + default: + halbtc8821aCsr2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x40, 0x0); + break; + } + } + + // update pre state + pCoexDm->bPrePsTdmaOn = pCoexDm->bCurPsTdmaOn; + pCoexDm->prePsTdma = pCoexDm->curPsTdma; +} + +VOID +halbtc8821aCsr2ant_CoexAllOff( + IN PBTC_COEXIST pBtCoexist + ) +{ + // fw all off + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1); + halbtc8821aCsr2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6); + halbtc8821aCsr2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE); + + // sw all off + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); + + // hw all off + halbtc8821aCsr2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0x55555555, 0xffff, 0x3); +} + +VOID +halbtc8821aCsr2ant_CoexUnder5G( + IN PBTC_COEXIST pBtCoexist + ) +{ + halbtc8821aCsr2ant_CoexAllOff(pBtCoexist); + + halbtc8821aCsr2ant_IgnoreWlanAct(pBtCoexist, NORMAL_EXEC, TRUE); +} + +VOID +halbtc8821aCsr2ant_InitCoexDm( + IN PBTC_COEXIST pBtCoexist + ) +{ + // force to reset coex mechanism + halbtc8821aCsr2ant_CoexTable(pBtCoexist, FORCE_EXEC, 0x55555555, 0x55555555, 0xffff, 0x3); + + halbtc8821aCsr2ant_PsTdma(pBtCoexist, FORCE_EXEC, FALSE, 1); + halbtc8821aCsr2ant_FwDacSwingLvl(pBtCoexist, FORCE_EXEC, 6); + halbtc8821aCsr2ant_DecBtPwr(pBtCoexist, FORCE_EXEC, FALSE); + + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); +} + +VOID +halbtc8821aCsr2ant_BtInquiryPage( + IN PBTC_COEXIST pBtCoexist + ) +{ + BOOLEAN bLowPwrDisable=TRUE; + + pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable); + + halbtc8821aCsr2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5afa5afa, 0xffff, 0x3); + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3); +} +BOOLEAN +halbtc8821aCsr2ant_IsCommonAction( + IN PBTC_COEXIST pBtCoexist + ) +{ + BOOLEAN bCommon=FALSE, bWifiConnected=FALSE, bWifiBusy=FALSE; + BOOLEAN bLowPwrDisable=FALSE; + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy); + + if(!bWifiConnected && + BT_8821A_CSR_2ANT_BT_STATUS_IDLE == pCoexDm->btStatus) + { + bLowPwrDisable = FALSE; + pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable); + + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi IPS + BT IPS!!\n")); + + + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1); + halbtc8821aCsr2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6); + halbtc8821aCsr2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE); + + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); + halbtc8821aCsr2ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0, 0); + halbtc8821aCsr2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, 0, 0, 0); + + bCommon = TRUE; + } + else if(bWifiConnected && + (BT_8821A_CSR_2ANT_BT_STATUS_IDLE == pCoexDm->btStatus) ) + { + bLowPwrDisable = FALSE; + pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable); + + if(bWifiBusy) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi Busy + BT IPS!!\n")); + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1); + } + else + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi LPS + BT IPS!!\n")); + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1); + } + + halbtc8821aCsr2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6); + halbtc8821aCsr2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE); + + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); + halbtc8821aCsr2ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0, 0); + halbtc8821aCsr2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, 0, 0, 0); + + bCommon = TRUE; + } + else if(!bWifiConnected && + (BT_8821A_CSR_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) ) + { + bLowPwrDisable = TRUE; + pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable); + + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi IPS + BT LPS!!\n")); + + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1); + halbtc8821aCsr2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6); + halbtc8821aCsr2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE); + + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); + halbtc8821aCsr2ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0, 0); + halbtc8821aCsr2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, 0, 0, 0); + + bCommon = TRUE; + } + else if(bWifiConnected && + (BT_8821A_CSR_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) ) + { + bLowPwrDisable = TRUE; + pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable); + + if(bWifiBusy) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi Busy + BT LPS!!\n")); + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1); + } + else + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi LPS + BT LPS!!\n")); + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1); + } + + halbtc8821aCsr2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6); + halbtc8821aCsr2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE); + + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,TRUE,TRUE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); + halbtc8821aCsr2ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0, 0); + halbtc8821aCsr2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, 0, 0, 0); + + bCommon = TRUE; + } + else if(!bWifiConnected && + (BT_8821A_CSR_2ANT_BT_STATUS_NON_IDLE == pCoexDm->btStatus) ) + { + bLowPwrDisable = FALSE; + pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable); + + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi IPS + BT Busy!!\n")); + + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1); + halbtc8821aCsr2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6); + halbtc8821aCsr2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE); + + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); + halbtc8821aCsr2ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0, 0); + halbtc8821aCsr2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, 0, 0, 0); + + bCommon = TRUE; + } + else + { + bLowPwrDisable = TRUE; + pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable); + + if(bWifiBusy) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi Busy + BT Busy!!\n")); + bCommon = FALSE; + } + else + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi LPS + BT Busy!!\n")); + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 21); + + if(halbtc8821aCsr2ant_NeedToDecBtPwr(pBtCoexist)) + halbtc8821aCsr2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE); + else + halbtc8821aCsr2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE); + + bCommon = TRUE; + } + + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,TRUE,TRUE); + } + + if (bCommon == TRUE) + halbtc8821aCsr2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5afa5afa, 0xffff, 0x3); + + return bCommon; +} +VOID +halbtc8821aCsr2ant_TdmaDurationAdjust( + IN PBTC_COEXIST pBtCoexist, + IN BOOLEAN bScoHid, + IN BOOLEAN bTxPause, + IN u1Byte maxInterval + ) +{ + static s4Byte up,dn,m,n,WaitCount; + s4Byte result; //0: no change, +1: increase WiFi duration, -1: decrease WiFi duration + u1Byte retryCount=0; + + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], TdmaDurationAdjust()\n")); + + if(pCoexDm->bResetTdmaAdjust) + { + pCoexDm->bResetTdmaAdjust = FALSE; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], first run TdmaDurationAdjust()!!\n")); + { + if(bScoHid) + { + if(bTxPause) + { + if(maxInterval == 1) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13); + pCoexDm->psTdmaDuAdjType = 13; + } + else if(maxInterval == 2) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14); + pCoexDm->psTdmaDuAdjType = 14; + } + else if(maxInterval == 3) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15); + pCoexDm->psTdmaDuAdjType = 15; + } + else + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15); + pCoexDm->psTdmaDuAdjType = 15; + } + } + else + { + if(maxInterval == 1) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9); + pCoexDm->psTdmaDuAdjType = 9; + } + else if(maxInterval == 2) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10); + pCoexDm->psTdmaDuAdjType = 10; + } + else if(maxInterval == 3) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11); + pCoexDm->psTdmaDuAdjType = 11; + } + else + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11); + pCoexDm->psTdmaDuAdjType = 11; + } + } + } + else + { + if(bTxPause) + { + if(maxInterval == 1) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5); + pCoexDm->psTdmaDuAdjType = 5; + } + else if(maxInterval == 2) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6); + pCoexDm->psTdmaDuAdjType = 6; + } + else if(maxInterval == 3) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7); + pCoexDm->psTdmaDuAdjType = 7; + } + else + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7); + pCoexDm->psTdmaDuAdjType = 7; + } + } + else + { + if(maxInterval == 1) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1); + pCoexDm->psTdmaDuAdjType = 1; + } + else if(maxInterval == 2) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2); + pCoexDm->psTdmaDuAdjType = 2; + } + else if(maxInterval == 3) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3); + pCoexDm->psTdmaDuAdjType = 3; + } + else + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3); + pCoexDm->psTdmaDuAdjType = 3; + } + } + } + } + //============ + up = 0; + dn = 0; + m = 1; + n= 3; + result = 0; + WaitCount = 0; + } + else + { + //accquire the BT TRx retry count from BT_Info byte2 + retryCount = pCoexSta->btRetryCnt; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], retryCount = %d\n", retryCount)); + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], up=%d, dn=%d, m=%d, n=%d, WaitCount=%d\n", + up, dn, m, n, WaitCount)); + result = 0; + WaitCount++; + + if(retryCount == 0) // no retry in the last 2-second duration + { + up++; + dn--; + + if (dn <= 0) + dn = 0; + + if(up >= n) // if ³sÄò n ­Ó2¬í retry count¬°0, «h½Õ¼eWiFi duration + { + WaitCount = 0; + n = 3; + up = 0; + dn = 0; + result = 1; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], Increase wifi duration!!\n")); + } + } + else if (retryCount <= 3) // <=3 retry in the last 2-second duration + { + up--; + dn++; + + if (up <= 0) + up = 0; + + if (dn == 2) // if ³sÄò 2 ­Ó2¬í retry count< 3, «h½Õ¯¶WiFi duration + { + if (WaitCount <= 2) + m++; // ÁקK¤@ª½¦b¨â­Ólevel¤¤¨Ó¦^ + else + m = 1; + + if ( m >= 20) //m ³Ì¤j­È = 20 ' ³Ì¤j120¬í recheck¬O§_½Õ¾ã WiFi duration. + m = 20; + + n = 3*m; + up = 0; + dn = 0; + WaitCount = 0; + result = -1; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], Decrease wifi duration for retryCounter<3!!\n")); + } + } + else //retry count > 3, ¥u­n1¦¸ retry count > 3, «h½Õ¯¶WiFi duration + { + if (WaitCount == 1) + m++; // ÁקK¤@ª½¦b¨â­Ólevel¤¤¨Ó¦^ + else + m = 1; + + if ( m >= 20) //m ³Ì¤j­È = 20 ' ³Ì¤j120¬í recheck¬O§_½Õ¾ã WiFi duration. + m = 20; + + n = 3*m; + up = 0; + dn = 0; + WaitCount = 0; + result = -1; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], Decrease wifi duration for retryCounter>3!!\n")); + } + + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], max Interval = %d\n", maxInterval)); + if(maxInterval == 1) + { + if(bTxPause) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], TxPause = 1\n")); + + if(pCoexDm->curPsTdma == 71) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5); + pCoexDm->psTdmaDuAdjType = 5; + } + else if(pCoexDm->curPsTdma == 1) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5); + pCoexDm->psTdmaDuAdjType = 5; + } + else if(pCoexDm->curPsTdma == 2) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6); + pCoexDm->psTdmaDuAdjType = 6; + } + else if(pCoexDm->curPsTdma == 3) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7); + pCoexDm->psTdmaDuAdjType = 7; + } + else if(pCoexDm->curPsTdma == 4) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8); + pCoexDm->psTdmaDuAdjType = 8; + } + if(pCoexDm->curPsTdma == 9) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13); + pCoexDm->psTdmaDuAdjType = 13; + } + else if(pCoexDm->curPsTdma == 10) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14); + pCoexDm->psTdmaDuAdjType = 14; + } + else if(pCoexDm->curPsTdma == 11) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15); + pCoexDm->psTdmaDuAdjType = 15; + } + else if(pCoexDm->curPsTdma == 12) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16); + pCoexDm->psTdmaDuAdjType = 16; + } + + if(result == -1) + { + if(pCoexDm->curPsTdma == 5) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6); + pCoexDm->psTdmaDuAdjType = 6; + } + else if(pCoexDm->curPsTdma == 6) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7); + pCoexDm->psTdmaDuAdjType = 7; + } + else if(pCoexDm->curPsTdma == 7) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8); + pCoexDm->psTdmaDuAdjType = 8; + } + else if(pCoexDm->curPsTdma == 13) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14); + pCoexDm->psTdmaDuAdjType = 14; + } + else if(pCoexDm->curPsTdma == 14) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15); + pCoexDm->psTdmaDuAdjType = 15; + } + else if(pCoexDm->curPsTdma == 15) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16); + pCoexDm->psTdmaDuAdjType = 16; + } + } + else if (result == 1) + { + if(pCoexDm->curPsTdma == 8) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7); + pCoexDm->psTdmaDuAdjType = 7; + } + else if(pCoexDm->curPsTdma == 7) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6); + pCoexDm->psTdmaDuAdjType = 6; + } + else if(pCoexDm->curPsTdma == 6) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5); + pCoexDm->psTdmaDuAdjType = 5; + } + else if(pCoexDm->curPsTdma == 16) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15); + pCoexDm->psTdmaDuAdjType = 15; + } + else if(pCoexDm->curPsTdma == 15) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14); + pCoexDm->psTdmaDuAdjType = 14; + } + else if(pCoexDm->curPsTdma == 14) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13); + pCoexDm->psTdmaDuAdjType = 13; + } + } + } + else + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], TxPause = 0\n")); + if(pCoexDm->curPsTdma == 5) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 71); + pCoexDm->psTdmaDuAdjType = 71; + } + else if(pCoexDm->curPsTdma == 6) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2); + pCoexDm->psTdmaDuAdjType = 2; + } + else if(pCoexDm->curPsTdma == 7) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3); + pCoexDm->psTdmaDuAdjType = 3; + } + else if(pCoexDm->curPsTdma == 8) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4); + pCoexDm->psTdmaDuAdjType = 4; + } + if(pCoexDm->curPsTdma == 13) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9); + pCoexDm->psTdmaDuAdjType = 9; + } + else if(pCoexDm->curPsTdma == 14) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10); + pCoexDm->psTdmaDuAdjType = 10; + } + else if(pCoexDm->curPsTdma == 15) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11); + pCoexDm->psTdmaDuAdjType = 11; + } + else if(pCoexDm->curPsTdma == 16) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12); + pCoexDm->psTdmaDuAdjType = 12; + } + + if(result == -1) + { + if(pCoexDm->curPsTdma == 71) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1); + pCoexDm->psTdmaDuAdjType = 1; + } + else if(pCoexDm->curPsTdma == 1) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2); + pCoexDm->psTdmaDuAdjType = 2; + } + else if(pCoexDm->curPsTdma == 2) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3); + pCoexDm->psTdmaDuAdjType = 3; + } + else if(pCoexDm->curPsTdma == 3) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4); + pCoexDm->psTdmaDuAdjType = 4; + } + else if(pCoexDm->curPsTdma == 9) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10); + pCoexDm->psTdmaDuAdjType = 10; + } + else if(pCoexDm->curPsTdma == 10) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11); + pCoexDm->psTdmaDuAdjType = 11; + } + else if(pCoexDm->curPsTdma == 11) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12); + pCoexDm->psTdmaDuAdjType = 12; + } + } + else if (result == 1) + { + if(pCoexDm->curPsTdma == 4) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3); + pCoexDm->psTdmaDuAdjType = 3; + } + else if(pCoexDm->curPsTdma == 3) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2); + pCoexDm->psTdmaDuAdjType = 2; + } + else if(pCoexDm->curPsTdma == 2) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1); + pCoexDm->psTdmaDuAdjType = 1; + } + else if(pCoexDm->curPsTdma == 1) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 71); + pCoexDm->psTdmaDuAdjType = 71; + } + else if(pCoexDm->curPsTdma == 12) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11); + pCoexDm->psTdmaDuAdjType = 11; + } + else if(pCoexDm->curPsTdma == 11) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10); + pCoexDm->psTdmaDuAdjType = 10; + } + else if(pCoexDm->curPsTdma == 10) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9); + pCoexDm->psTdmaDuAdjType = 9; + } + } + } + } + else if(maxInterval == 2) + { + if(bTxPause) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], TxPause = 1\n")); + if(pCoexDm->curPsTdma == 1) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6); + pCoexDm->psTdmaDuAdjType = 6; + } + else if(pCoexDm->curPsTdma == 2) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6); + pCoexDm->psTdmaDuAdjType = 6; + } + else if(pCoexDm->curPsTdma == 3) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7); + pCoexDm->psTdmaDuAdjType = 7; + } + else if(pCoexDm->curPsTdma == 4) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8); + pCoexDm->psTdmaDuAdjType = 8; + } + if(pCoexDm->curPsTdma == 9) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14); + pCoexDm->psTdmaDuAdjType = 14; + } + else if(pCoexDm->curPsTdma == 10) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14); + pCoexDm->psTdmaDuAdjType = 14; + } + else if(pCoexDm->curPsTdma == 11) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15); + pCoexDm->psTdmaDuAdjType = 15; + } + else if(pCoexDm->curPsTdma == 12) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16); + pCoexDm->psTdmaDuAdjType = 16; + } + if(result == -1) + { + if(pCoexDm->curPsTdma == 5) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6); + pCoexDm->psTdmaDuAdjType = 6; + } + else if(pCoexDm->curPsTdma == 6) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7); + pCoexDm->psTdmaDuAdjType = 7; + } + else if(pCoexDm->curPsTdma == 7) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8); + pCoexDm->psTdmaDuAdjType = 8; + } + else if(pCoexDm->curPsTdma == 13) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14); + pCoexDm->psTdmaDuAdjType = 14; + } + else if(pCoexDm->curPsTdma == 14) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15); + pCoexDm->psTdmaDuAdjType = 15; + } + else if(pCoexDm->curPsTdma == 15) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16); + pCoexDm->psTdmaDuAdjType = 16; + } + } + else if (result == 1) + { + if(pCoexDm->curPsTdma == 8) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7); + pCoexDm->psTdmaDuAdjType = 7; + } + else if(pCoexDm->curPsTdma == 7) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6); + pCoexDm->psTdmaDuAdjType = 6; + } + else if(pCoexDm->curPsTdma == 6) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 6); + pCoexDm->psTdmaDuAdjType = 6; + } + else if(pCoexDm->curPsTdma == 16) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15); + pCoexDm->psTdmaDuAdjType = 15; + } + else if(pCoexDm->curPsTdma == 15) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14); + pCoexDm->psTdmaDuAdjType = 14; + } + else if(pCoexDm->curPsTdma == 14) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14); + pCoexDm->psTdmaDuAdjType = 14; + } + } + } + else + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], TxPause = 0\n")); + if(pCoexDm->curPsTdma == 5) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2); + pCoexDm->psTdmaDuAdjType = 2; + } + else if(pCoexDm->curPsTdma == 6) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2); + pCoexDm->psTdmaDuAdjType = 2; + } + else if(pCoexDm->curPsTdma == 7) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3); + pCoexDm->psTdmaDuAdjType = 3; + } + else if(pCoexDm->curPsTdma == 8) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4); + pCoexDm->psTdmaDuAdjType = 4; + } + if(pCoexDm->curPsTdma == 13) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10); + pCoexDm->psTdmaDuAdjType = 10; + } + else if(pCoexDm->curPsTdma == 14) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10); + pCoexDm->psTdmaDuAdjType = 10; + } + else if(pCoexDm->curPsTdma == 15) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11); + pCoexDm->psTdmaDuAdjType = 11; + } + else if(pCoexDm->curPsTdma == 16) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12); + pCoexDm->psTdmaDuAdjType = 12; + } + if(result == -1) + { + if(pCoexDm->curPsTdma == 1) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2); + pCoexDm->psTdmaDuAdjType = 2; + } + else if(pCoexDm->curPsTdma == 2) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3); + pCoexDm->psTdmaDuAdjType = 3; + } + else if(pCoexDm->curPsTdma == 3) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4); + pCoexDm->psTdmaDuAdjType = 4; + } + else if(pCoexDm->curPsTdma == 9) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10); + pCoexDm->psTdmaDuAdjType = 10; + } + else if(pCoexDm->curPsTdma == 10) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11); + pCoexDm->psTdmaDuAdjType = 11; + } + else if(pCoexDm->curPsTdma == 11) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12); + pCoexDm->psTdmaDuAdjType = 12; + } + } + else if (result == 1) + { + if(pCoexDm->curPsTdma == 4) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3); + pCoexDm->psTdmaDuAdjType = 3; + } + else if(pCoexDm->curPsTdma == 3) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2); + pCoexDm->psTdmaDuAdjType = 2; + } + else if(pCoexDm->curPsTdma == 2) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 2); + pCoexDm->psTdmaDuAdjType = 2; + } + else if(pCoexDm->curPsTdma == 12) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11); + pCoexDm->psTdmaDuAdjType = 11; + } + else if(pCoexDm->curPsTdma == 11) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10); + pCoexDm->psTdmaDuAdjType = 10; + } + else if(pCoexDm->curPsTdma == 10) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10); + pCoexDm->psTdmaDuAdjType = 10; + } + } + } + } + else if(maxInterval == 3) + { + if(bTxPause) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], TxPause = 1\n")); + if(pCoexDm->curPsTdma == 1) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7); + pCoexDm->psTdmaDuAdjType = 7; + } + else if(pCoexDm->curPsTdma == 2) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7); + pCoexDm->psTdmaDuAdjType = 7; + } + else if(pCoexDm->curPsTdma == 3) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7); + pCoexDm->psTdmaDuAdjType = 7; + } + else if(pCoexDm->curPsTdma == 4) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8); + pCoexDm->psTdmaDuAdjType = 8; + } + if(pCoexDm->curPsTdma == 9) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15); + pCoexDm->psTdmaDuAdjType = 15; + } + else if(pCoexDm->curPsTdma == 10) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15); + pCoexDm->psTdmaDuAdjType = 15; + } + else if(pCoexDm->curPsTdma == 11) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15); + pCoexDm->psTdmaDuAdjType = 15; + } + else if(pCoexDm->curPsTdma == 12) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16); + pCoexDm->psTdmaDuAdjType = 16; + } + if(result == -1) + { + if(pCoexDm->curPsTdma == 5) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7); + pCoexDm->psTdmaDuAdjType = 7; + } + else if(pCoexDm->curPsTdma == 6) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7); + pCoexDm->psTdmaDuAdjType = 7; + } + else if(pCoexDm->curPsTdma == 7) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 8); + pCoexDm->psTdmaDuAdjType = 8; + } + else if(pCoexDm->curPsTdma == 13) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15); + pCoexDm->psTdmaDuAdjType = 15; + } + else if(pCoexDm->curPsTdma == 14) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15); + pCoexDm->psTdmaDuAdjType = 15; + } + else if(pCoexDm->curPsTdma == 15) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 16); + pCoexDm->psTdmaDuAdjType = 16; + } + } + else if (result == 1) + { + if(pCoexDm->curPsTdma == 8) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7); + pCoexDm->psTdmaDuAdjType = 7; + } + else if(pCoexDm->curPsTdma == 7) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7); + pCoexDm->psTdmaDuAdjType = 7; + } + else if(pCoexDm->curPsTdma == 6) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 7); + pCoexDm->psTdmaDuAdjType = 7; + } + else if(pCoexDm->curPsTdma == 16) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15); + pCoexDm->psTdmaDuAdjType = 15; + } + else if(pCoexDm->curPsTdma == 15) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15); + pCoexDm->psTdmaDuAdjType = 15; + } + else if(pCoexDm->curPsTdma == 14) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 15); + pCoexDm->psTdmaDuAdjType = 15; + } + } + } + else + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], TxPause = 0\n")); + if(pCoexDm->curPsTdma == 5) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3); + pCoexDm->psTdmaDuAdjType = 3; + } + else if(pCoexDm->curPsTdma == 6) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3); + pCoexDm->psTdmaDuAdjType = 3; + } + else if(pCoexDm->curPsTdma == 7) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3); + pCoexDm->psTdmaDuAdjType = 3; + } + else if(pCoexDm->curPsTdma == 8) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4); + pCoexDm->psTdmaDuAdjType = 4; + } + if(pCoexDm->curPsTdma == 13) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11); + pCoexDm->psTdmaDuAdjType = 11; + } + else if(pCoexDm->curPsTdma == 14) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11); + pCoexDm->psTdmaDuAdjType = 11; + } + else if(pCoexDm->curPsTdma == 15) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11); + pCoexDm->psTdmaDuAdjType = 11; + } + else if(pCoexDm->curPsTdma == 16) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12); + pCoexDm->psTdmaDuAdjType = 12; + } + if(result == -1) + { + if(pCoexDm->curPsTdma == 1) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3); + pCoexDm->psTdmaDuAdjType = 3; + } + else if(pCoexDm->curPsTdma == 2) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3); + pCoexDm->psTdmaDuAdjType = 3; + } + else if(pCoexDm->curPsTdma == 3) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 4); + pCoexDm->psTdmaDuAdjType = 4; + } + else if(pCoexDm->curPsTdma == 9) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11); + pCoexDm->psTdmaDuAdjType = 11; + } + else if(pCoexDm->curPsTdma == 10) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11); + pCoexDm->psTdmaDuAdjType = 11; + } + else if(pCoexDm->curPsTdma == 11) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 12); + pCoexDm->psTdmaDuAdjType = 12; + } + } + else if (result == 1) + { + if(pCoexDm->curPsTdma == 4) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3); + pCoexDm->psTdmaDuAdjType = 3; + } + else if(pCoexDm->curPsTdma == 3) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3); + pCoexDm->psTdmaDuAdjType = 3; + } + else if(pCoexDm->curPsTdma == 2) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 3); + pCoexDm->psTdmaDuAdjType = 3; + } + else if(pCoexDm->curPsTdma == 12) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11); + pCoexDm->psTdmaDuAdjType = 11; + } + else if(pCoexDm->curPsTdma == 11) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11); + pCoexDm->psTdmaDuAdjType = 11; + } + else if(pCoexDm->curPsTdma == 10) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 11); + pCoexDm->psTdmaDuAdjType = 11; + } + } + } + } + } + + // if current PsTdma not match with the recorded one (when scan, dhcp...), + // then we have to adjust it back to the previous record one. + if(pCoexDm->curPsTdma != pCoexDm->psTdmaDuAdjType) + { + BOOLEAN bScan=FALSE, bLink=FALSE, bRoam=FALSE; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], PsTdma type dismatch!!!, curPsTdma=%d, recordPsTdma=%d\n", + pCoexDm->curPsTdma, pCoexDm->psTdmaDuAdjType)); + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_SCAN, &bScan); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_LINK, &bLink); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_ROAM, &bRoam); + + if( !bScan && !bLink && !bRoam) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, pCoexDm->psTdmaDuAdjType); + } + else + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], roaming/link/scan is under progress, will adjust next time!!!\n")); + } + } + + // when halbtc8821aCsr2ant_TdmaDurationAdjust() is called, fw dac swing is included in the function. + //if(pCoexDm->psTdmaDuAdjType == 71) + // halbtc8821aCsr2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0xc); //Skip because A2DP get worse at HT40 + //else + halbtc8821aCsr2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0x6); +} + +// SCO only or SCO+PAN(HS) +VOID +halbtc8821aCsr2ant_ActionSco( + IN PBTC_COEXIST pBtCoexist + ) +{ + u1Byte wifiRssiState,btRssiState; + u4Byte wifiBw; + + halbtc8821aCsr2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55555555, 0x55555555, 0xffffff, 0x3); + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0); + + halbtc8821aCsr2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, TRUE); + + halbtc8821aCsr2ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 1, 0, 2, 0); + + if(pCoexSta->bSlave == FALSE) + halbtc8821aCsr2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, TRUE, 0x4); + else + halbtc8821aCsr2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, TRUE, 0x2); + +/* + wifiRssiState = halbtc8821aCsr2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0); + btRssiState = halbtc8821aCsr2ant_BtRssiState(2, 35, 0); + + halbtc8821aCsr2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 4); + + if(halbtc8821aCsr2ant_NeedToDecBtPwr(pBtCoexist)) + halbtc8821aCsr2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE); + else + halbtc8821aCsr2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE); + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); + + if (BTC_WIFI_BW_LEGACY == wifiBw) //for SCO quality at 11b/g mode + { + halbtc8821aCsr2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x5a5a5a5a, 0x5a5a5a5a, 0xffff, 0x3); + } + else //for SCO quality & wifi performance balance at 11n mode + { + halbtc8821aCsr2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x5aea5aea, 0x5aea5aea, 0xffff, 0x3); + } + + if(BTC_WIFI_BW_HT40 == wifiBw) + { + + // fw mechanism + //halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5); + + if( (btRssiState == BTC_RSSI_STATE_HIGH) || + (btRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0); //for voice quality + } + else + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0); //for voice quality + } + + // sw mechanism + if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || + (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18); + } + else + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); + } + } + else + { + // fw mechanism + //halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5); + + if( (btRssiState == BTC_RSSI_STATE_HIGH) || + (btRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0); //for voice quality + } + else + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 0); //for voice quality + } + + // sw mechanism + if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || + (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18); + } + else + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); + } + } +*/ +} + + +VOID +halbtc8821aCsr2ant_ActionHid( + IN PBTC_COEXIST pBtCoexist + ) +{ + u1Byte wifiRssiState, btRssiState; + u4Byte wifiBw; + + wifiRssiState = halbtc8821aCsr2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0); + btRssiState = halbtc8821aCsr2ant_BtRssiState(2, 35, 0); + + halbtc8821aCsr2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6); + + if(halbtc8821aCsr2ant_NeedToDecBtPwr(pBtCoexist)) + halbtc8821aCsr2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE); + else + halbtc8821aCsr2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE); + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); + + if (BTC_WIFI_BW_LEGACY == wifiBw) //for HID at 11b/g mode + { + halbtc8821aCsr2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5a5a5a5a, 0xffff, 0x3); + } + else //for HID quality & wifi performance balance at 11n mode + { + halbtc8821aCsr2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5aea5aea, 0xffff, 0x3); + } + + if(BTC_WIFI_BW_HT40 == wifiBw) + { + // fw mechanism + if( (btRssiState == BTC_RSSI_STATE_HIGH) || + (btRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9); + } + else + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13); + } + + // sw mechanism + if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || + (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18); + } + else + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); + } + } + else + { + // fw mechanism + if( (btRssiState == BTC_RSSI_STATE_HIGH) || + (btRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 9); + } + else + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 13); + } + + // sw mechanism + if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || + (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18); + } + else + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); + } + } +} + +//A2DP only / PAN(EDR) only/ A2DP+PAN(HS) +VOID +halbtc8821aCsr2ant_ActionA2dp( + IN PBTC_COEXIST pBtCoexist + ) +{ + u1Byte wifiRssiState, btRssiState; + u4Byte wifiBw; + + halbtc8821aCsr2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, FALSE, TRUE, 0x8); + + if(pCoexSta->bSlave == FALSE) + { + halbtc8821aCsr2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0xfdfdfdfd, 0xdfdadfda, 0xffffff, 0x3); + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 22); + halbtc8821aCsr2ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0, 1); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,TRUE,0x0c); + } + else + { + halbtc8821aCsr2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0xfdfdfdfd, 0xdfdadfda, 0xffffff, 0x3); + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 23); + halbtc8821aCsr2ant_LimitedTx(pBtCoexist, NORMAL_EXEC, 0, 0, 0, 0, 2); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,TRUE,0x18); + } + +/* + wifiRssiState = halbtc8821aCsr2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0); + btRssiState = halbtc8821aCsr2ant_BtRssiState(2, 35, 0); + + //fw dac swing is called in halbtc8821aCsr2ant_TdmaDurationAdjust() + //halbtc8821aCsr2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6); + + + if(halbtc8821aCsr2ant_NeedToDecBtPwr(pBtCoexist)) + halbtc8821aCsr2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE); + else + halbtc8821aCsr2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE); + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); + + if(BTC_WIFI_BW_HT40 == wifiBw) + { + // fw mechanism + if( (btRssiState == BTC_RSSI_STATE_HIGH) || + (btRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + halbtc8821aCsr2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 1); + } + else + { + halbtc8821aCsr2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 1); + } + + // sw mechanism + if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || + (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18); + } + else + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); + } + } + else + { + // fw mechanism + if( (btRssiState == BTC_RSSI_STATE_HIGH) || + (btRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + halbtc8821aCsr2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 1); + } + else + { + halbtc8821aCsr2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 1); + } + + // sw mechanism + if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || + (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18); + } + else + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); + } + } +*/ +} + +VOID +halbtc8821aCsr2ant_ActionA2dpPanHs( + IN PBTC_COEXIST pBtCoexist + ) +{ + u1Byte wifiRssiState, btRssiState, btInfoExt; + u4Byte wifiBw; + + btInfoExt = pCoexSta->btInfoExt; + wifiRssiState = halbtc8821aCsr2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0); + btRssiState = halbtc8821aCsr2ant_BtRssiState(2,35, 0); + + //fw dac swing is called in halbtc8821aCsr2ant_TdmaDurationAdjust() + //halbtc8821aCsr2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6); + + + if(halbtc8821aCsr2ant_NeedToDecBtPwr(pBtCoexist)) + halbtc8821aCsr2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE); + else + halbtc8821aCsr2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE); + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); + + if(BTC_WIFI_BW_HT40 == wifiBw) + { + // fw mechanism + if(btInfoExt&BIT0) //a2dp basic rate + { + halbtc8821aCsr2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 2); + } + else //a2dp edr rate + { + halbtc8821aCsr2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 1); + } + + // sw mechanism + if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || + (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18); + } + else + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); + } + } + else + { + // fw mechanism + if(btInfoExt&BIT0) //a2dp basic rate + { + halbtc8821aCsr2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 2); + } + else //a2dp edr rate + { + halbtc8821aCsr2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 1); + } + + // sw mechanism + if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || + (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18); + } + else + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); + } + } +} + +VOID +halbtc8821aCsr2ant_ActionPanEdr( + IN PBTC_COEXIST pBtCoexist + ) +{ + u1Byte wifiRssiState, btRssiState; + u4Byte wifiBw; + + wifiRssiState = halbtc8821aCsr2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0); + btRssiState = halbtc8821aCsr2ant_BtRssiState(2, 35, 0); + + halbtc8821aCsr2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6); + + if(halbtc8821aCsr2ant_NeedToDecBtPwr(pBtCoexist)) + halbtc8821aCsr2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE); + else + halbtc8821aCsr2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE); + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); + + if (BTC_WIFI_BW_LEGACY == wifiBw) //for HID at 11b/g mode + { + halbtc8821aCsr2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5aff5aff, 0xffff, 0x3); + } + else //for HID quality & wifi performance balance at 11n mode + { + halbtc8821aCsr2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5aff5aff, 0xffff, 0x3); + } + + if(BTC_WIFI_BW_HT40 == wifiBw) + { + // fw mechanism + if( (btRssiState == BTC_RSSI_STATE_HIGH) || + (btRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1); + } + else + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5); + } + + // sw mechanism + if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || + (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18); + } + else + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); + } + } + else + { + // fw mechanism + if( (btRssiState == BTC_RSSI_STATE_HIGH) || + (btRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 1); + } + else + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 5); + } + + // sw mechanism + if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || + (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18); + } + else + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); + } + } +} + + +//PAN(HS) only +VOID +halbtc8821aCsr2ant_ActionPanHs( + IN PBTC_COEXIST pBtCoexist + ) +{ + u1Byte wifiRssiState, btRssiState; + u4Byte wifiBw; + + wifiRssiState = halbtc8821aCsr2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0); + btRssiState = halbtc8821aCsr2ant_BtRssiState(2, 35, 0); + + halbtc8821aCsr2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6); + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); + + if(BTC_WIFI_BW_HT40 == wifiBw) + { + // fw mechanism + if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || + (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + halbtc8821aCsr2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE); + } + else + { + halbtc8821aCsr2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE); + } + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1); + + // sw mechanism + if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || + (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18); + } + else + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); + } + } + else + { + // fw mechanism + if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || + (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + halbtc8821aCsr2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE); + } + else + { + halbtc8821aCsr2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE); + } + + if( (btRssiState == BTC_RSSI_STATE_HIGH) || + (btRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1); + } + else + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, FALSE, 1); + } + + // sw mechanism + if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || + (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18); + } + else + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); + } + } +} + +//PAN(EDR)+A2DP +VOID +halbtc8821aCsr2ant_ActionPanEdrA2dp( + IN PBTC_COEXIST pBtCoexist + ) +{ + u1Byte wifiRssiState, btRssiState, btInfoExt; + u4Byte wifiBw; + + btInfoExt = pCoexSta->btInfoExt; + wifiRssiState = halbtc8821aCsr2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0); + btRssiState = halbtc8821aCsr2ant_BtRssiState(2, 35, 0); + + halbtc8821aCsr2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6); + + if(halbtc8821aCsr2ant_NeedToDecBtPwr(pBtCoexist)) + halbtc8821aCsr2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE); + else + halbtc8821aCsr2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE); + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); + + if (BTC_WIFI_BW_LEGACY == wifiBw) //for HID at 11b/g mode + { + halbtc8821aCsr2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5afa5afa, 0xffff, 0x3); + } + else //for HID quality & wifi performance balance at 11n mode + { + halbtc8821aCsr2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5afa5afa, 0xffff, 0x3); + } + + if(BTC_WIFI_BW_HT40 == wifiBw) + { + // fw mechanism + if( (btRssiState == BTC_RSSI_STATE_HIGH) || + (btRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + if(btInfoExt&BIT0) //a2dp basic rate + { + halbtc8821aCsr2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 3); + } + else //a2dp edr rate + { + halbtc8821aCsr2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 3); + } + } + else + { + if(btInfoExt&BIT0) //a2dp basic rate + { + halbtc8821aCsr2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 3); + } + else //a2dp edr rate + { + halbtc8821aCsr2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 3); + } + } + + // sw mechanism + if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || + (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18); + } + else + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,TRUE,FALSE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); + }; + } + else + { + // fw mechanism + if( (btRssiState == BTC_RSSI_STATE_HIGH) || + (btRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + if(btInfoExt&BIT0) //a2dp basic rate + { + halbtc8821aCsr2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 3); + } + else //a2dp edr rate + { + halbtc8821aCsr2ant_TdmaDurationAdjust(pBtCoexist, FALSE, FALSE, 3); + } + } + else + { + if(btInfoExt&BIT0) //a2dp basic rate + { + halbtc8821aCsr2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 3); + } + else //a2dp edr rate + { + halbtc8821aCsr2ant_TdmaDurationAdjust(pBtCoexist, FALSE, TRUE, 3); + } + } + + // sw mechanism + if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || + (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18); + } + else + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,FALSE,FALSE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); + } + } +} + +VOID +halbtc8821aCsr2ant_ActionPanEdrHid( + IN PBTC_COEXIST pBtCoexist + ) +{ + u1Byte wifiRssiState, btRssiState; + u4Byte wifiBw; + + wifiRssiState = halbtc8821aCsr2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0); + btRssiState = halbtc8821aCsr2ant_BtRssiState(2, 35, 0); + + halbtc8821aCsr2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6); + + if(halbtc8821aCsr2ant_NeedToDecBtPwr(pBtCoexist)) + halbtc8821aCsr2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE); + else + halbtc8821aCsr2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE); + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); + + if (BTC_WIFI_BW_LEGACY == wifiBw) //for HID at 11b/g mode + { + halbtc8821aCsr2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5a5f5a5f, 0xffff, 0x3); + } + else //for HID quality & wifi performance balance at 11n mode + { + halbtc8821aCsr2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5a5f5a5f, 0xffff, 0x3); + } + + if(BTC_WIFI_BW_HT40 == wifiBw) + { + halbtc8821aCsr2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 3); + // fw mechanism + if( (btRssiState == BTC_RSSI_STATE_HIGH) || + (btRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10); + } + else + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14); + } + + // sw mechanism + if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || + (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18); + } + else + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); + } + } + else + { + halbtc8821aCsr2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6); + // fw mechanism + if( (btRssiState == BTC_RSSI_STATE_HIGH) || + (btRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 10); + } + else + { + halbtc8821aCsr2ant_PsTdma(pBtCoexist, NORMAL_EXEC, TRUE, 14); + } + + // sw mechanism + if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || + (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18); + } + else + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); + } + } +} + +// HID+A2DP+PAN(EDR) +VOID +halbtc8821aCsr2ant_ActionHidA2dpPanEdr( + IN PBTC_COEXIST pBtCoexist + ) +{ + u1Byte wifiRssiState, btRssiState, btInfoExt; + u4Byte wifiBw; + + btInfoExt = pCoexSta->btInfoExt; + wifiRssiState = halbtc8821aCsr2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0); + btRssiState = halbtc8821aCsr2ant_BtRssiState(2, 35, 0); + + halbtc8821aCsr2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6); + + if(halbtc8821aCsr2ant_NeedToDecBtPwr(pBtCoexist)) + halbtc8821aCsr2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE); + else + halbtc8821aCsr2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE); + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); + + if (BTC_WIFI_BW_LEGACY == wifiBw) //for HID at 11b/g mode + { + halbtc8821aCsr2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5a5a5a5a, 0xffff, 0x3); + } + else //for HID quality & wifi performance balance at 11n mode + { + halbtc8821aCsr2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5a5a5a5a, 0xffff, 0x3); + } + + if(BTC_WIFI_BW_HT40 == wifiBw) + { + // fw mechanism + if( (btRssiState == BTC_RSSI_STATE_HIGH) || + (btRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + if(btInfoExt&BIT0) //a2dp basic rate + { + halbtc8821aCsr2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 3); + } + else //a2dp edr rate + { + halbtc8821aCsr2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 3); + } + } + else + { + if(btInfoExt&BIT0) //a2dp basic rate + { + halbtc8821aCsr2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 3); + } + else //a2dp edr rate + { + halbtc8821aCsr2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 3); + } + } + + // sw mechanism + if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || + (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18); + } + else + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); + } + } + else + { + // fw mechanism + if( (btRssiState == BTC_RSSI_STATE_HIGH) || + (btRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + if(btInfoExt&BIT0) //a2dp basic rate + { + halbtc8821aCsr2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 3); + } + else //a2dp edr rate + { + halbtc8821aCsr2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 3); + } + } + else + { + if(btInfoExt&BIT0) //a2dp basic rate + { + halbtc8821aCsr2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 3); + } + else //a2dp edr rate + { + halbtc8821aCsr2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 3); + } + } + + // sw mechanism + if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || + (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18); + } + else + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); + } + } +} + +VOID +halbtc8821aCsr2ant_ActionHidA2dp( + IN PBTC_COEXIST pBtCoexist + ) +{ + u1Byte wifiRssiState, btRssiState, btInfoExt; + u4Byte wifiBw; + + btInfoExt = pCoexSta->btInfoExt; + wifiRssiState = halbtc8821aCsr2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0); + btRssiState = halbtc8821aCsr2ant_BtRssiState(2, 35, 0); + + if(halbtc8821aCsr2ant_NeedToDecBtPwr(pBtCoexist)) + halbtc8821aCsr2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, TRUE); + else + halbtc8821aCsr2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, FALSE); + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); + + if (BTC_WIFI_BW_LEGACY == wifiBw) //for HID at 11b/g mode + { +//Allen halbtc8821aCsr2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5a5a5a5a, 0xffff, 0x3); + halbtc8821aCsr2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5f5b5f5b, 0xffffff, 0x3); + } + else //for HID quality & wifi performance balance at 11n mode + { +//Allen halbtc8821aCsr2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5a5a5a5a, 0xffff, 0x3); + halbtc8821aCsr2ant_CoexTable(pBtCoexist, NORMAL_EXEC, 0x55ff55ff, 0x5f5b5f5b, 0xffffff, 0x3); + + } + + if(BTC_WIFI_BW_HT40 == wifiBw) + { + // fw mechanism + if( (btRssiState == BTC_RSSI_STATE_HIGH) || + (btRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + if(btInfoExt&BIT0) //a2dp basic rate + { + halbtc8821aCsr2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2); + } + else //a2dp edr rate + { + halbtc8821aCsr2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2); + } + } + else + { + if(btInfoExt&BIT0) //a2dp basic rate + { + halbtc8821aCsr2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2); + } + else //a2dp edr rate + { + halbtc8821aCsr2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2); + } + } + + // sw mechanism + if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || + (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18); + } + else + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,TRUE,TRUE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); + } + } + else + { + // fw mechanism + if( (btRssiState == BTC_RSSI_STATE_HIGH) || + (btRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + if(btInfoExt&BIT0) //a2dp basic rate + { +// halbtc8821aCsr2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 2); + halbtc8821aCsr2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2); + + } + else //a2dp edr rate + { +//Allen halbtc8821aCsr2ant_TdmaDurationAdjust(pBtCoexist, TRUE, FALSE, 2); + halbtc8821aCsr2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2); + } + } + else + { + if(btInfoExt&BIT0) //a2dp basic rate + { + halbtc8821aCsr2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2); + } + else //a2dp edr rate + { + halbtc8821aCsr2ant_TdmaDurationAdjust(pBtCoexist, TRUE, TRUE, 2); + } + } + + // sw mechanism + if( (wifiRssiState == BTC_RSSI_STATE_HIGH) || + (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ) + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,TRUE,FALSE,FALSE,0x18); + } + else + { + halbtc8821aCsr2ant_SwMechanism1(pBtCoexist,FALSE,TRUE,FALSE,FALSE); + halbtc8821aCsr2ant_SwMechanism2(pBtCoexist,FALSE,FALSE,FALSE,0x18); + } + } +} + +VOID +halbtc8821aCsr2ant_RunCoexistMechanism( + IN PBTC_COEXIST pBtCoexist + ) +{ + PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo; + BOOLEAN bWifiUnder5G=FALSE; + u1Byte btInfoOriginal=0, btRetryCnt=0; + u1Byte algorithm=0; + + if(pBtCoexist->bManualControl) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Manual control!!!\n")); + return; + } + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_UNDER_5G, &bWifiUnder5G); + + if(bWifiUnder5G) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism(), run 5G coex setting!!<===\n")); + halbtc8821aCsr2ant_CoexUnder5G(pBtCoexist); + return; + } + + //if(pStackInfo->bProfileNotified) + { + algorithm = halbtc8821aCsr2ant_ActionAlgorithm(pBtCoexist); + if(pCoexSta->bC2hBtInquiryPage && (BT_8821A_CSR_2ANT_COEX_ALGO_PANHS!=algorithm)) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT is under inquiry/page scan !!\n")); + halbtc8821aCsr2ant_BtInquiryPage(pBtCoexist); + return; + } + + pCoexDm->curAlgorithm = algorithm; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Algorithm = %d \n", pCoexDm->curAlgorithm)); + + if(halbtc8821aCsr2ant_IsCommonAction(pBtCoexist)) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant common.\n")); + pCoexDm->bResetTdmaAdjust = TRUE; + } + else + { + if(pCoexDm->curAlgorithm != pCoexDm->preAlgorithm) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], preAlgorithm=%d, curAlgorithm=%d\n", + pCoexDm->preAlgorithm, pCoexDm->curAlgorithm)); + pCoexDm->bResetTdmaAdjust = TRUE; + } + switch(pCoexDm->curAlgorithm) + { + case BT_8821A_CSR_2ANT_COEX_ALGO_SCO: + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = SCO.\n")); + halbtc8821aCsr2ant_ActionSco(pBtCoexist); + break; + case BT_8821A_CSR_2ANT_COEX_ALGO_HID: + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID.\n")); + halbtc8821aCsr2ant_ActionHid(pBtCoexist); + break; + case BT_8821A_CSR_2ANT_COEX_ALGO_A2DP: + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = A2DP.\n")); + halbtc8821aCsr2ant_ActionA2dp(pBtCoexist); + break; + case BT_8821A_CSR_2ANT_COEX_ALGO_A2DP_PANHS: + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = A2DP+PAN(HS).\n")); + halbtc8821aCsr2ant_ActionA2dpPanHs(pBtCoexist); + break; + case BT_8821A_CSR_2ANT_COEX_ALGO_PANEDR: + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR).\n")); + halbtc8821aCsr2ant_ActionPanEdr(pBtCoexist); + break; + case BT_8821A_CSR_2ANT_COEX_ALGO_PANHS: + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HS mode.\n")); + halbtc8821aCsr2ant_ActionPanHs(pBtCoexist); + break; + case BT_8821A_CSR_2ANT_COEX_ALGO_PANEDR_A2DP: + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN+A2DP.\n")); + halbtc8821aCsr2ant_ActionPanEdrA2dp(pBtCoexist); + break; + case BT_8821A_CSR_2ANT_COEX_ALGO_PANEDR_HID: + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR)+HID.\n")); + halbtc8821aCsr2ant_ActionPanEdrHid(pBtCoexist); + break; + case BT_8821A_CSR_2ANT_COEX_ALGO_HID_A2DP_PANEDR: + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP+PAN.\n")); + halbtc8821aCsr2ant_ActionHidA2dpPanEdr(pBtCoexist); + break; + case BT_8821A_CSR_2ANT_COEX_ALGO_HID_A2DP: + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP.\n")); + halbtc8821aCsr2ant_ActionHidA2dp(pBtCoexist); + break; + default: + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = coexist All Off!!\n")); + halbtc8821aCsr2ant_CoexAllOff(pBtCoexist); + break; + } + pCoexDm->preAlgorithm = pCoexDm->curAlgorithm; + } + } +} + + + +//============================================================ +// work around function start with wa_halbtc8821aCsr2ant_ +//============================================================ +//============================================================ +// extern function start with EXhalbtc8821aCsr2ant_ +//============================================================ +VOID +EXhalbtc8821aCsr2ant_PowerOnSetting( + IN PBTC_COEXIST pBtCoexist + ) +{ +} + +VOID +EXhalbtc8821aCsr2ant_InitHwConfig( + IN PBTC_COEXIST pBtCoexist, + IN BOOLEAN bWifiOnly + ) +{ + PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo; + u4Byte u4Tmp=0; + u2Byte u2Tmp=0; + u1Byte u1Tmp=0; + u1Byte H2C_Parameter[2] ={0}; + + + BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], 2Ant Init HW Config!!\n")); + + if(bWifiOnly) + return; + + //if(bBackUp) + { + // backup rf 0x1e value + pCoexDm->btRf0x1eBackup = pBtCoexist->fBtcGetRfReg(pBtCoexist, BTC_RF_A, 0x1e, 0xfffff); + pCoexDm->backupArfrCnt1 = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x430); + pCoexDm->backupArfrCnt2 = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x434); + pCoexDm->backupRetryLimit = pBtCoexist->fBtcRead2Byte(pBtCoexist, 0x42a); + pCoexDm->backupAmpduMaxTime = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x456); + pCoexDm->backupAmpduMaxNum = pBtCoexist->fBtcRead2Byte(pBtCoexist, 0x4ca); + } + + #if 0 /* REMOVE */ + // 0x790[5:0]=0x5 + u1Tmp = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x790); + u1Tmp &= 0xc0; + u1Tmp |= 0x5; + pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x790, u1Tmp); + #endif + + //Antenna config + halbtc8821aCsr2ant_SetAntPath(pBtCoexist, BTC_ANT_WIFI_AT_MAIN, TRUE, FALSE); + + // PTA parameter + halbtc8821aCsr2ant_CoexTable(pBtCoexist, FORCE_EXEC, 0x55555555, 0x55555555, 0xffff, 0x3); + + // Enable counter statistics + pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0xc); //0x76e[3] =1, WLAN_Act control by PTA + pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x778, 0x3); + + #if 0 /* REMOVE */ + pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x40, 0x20, 0x1); + #endif +} + +VOID +EXhalbtc8821aCsr2ant_InitCoexDm( + IN PBTC_COEXIST pBtCoexist + ) +{ + BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], Coex Mechanism Init!!\n")); + + halbtc8821aCsr2ant_InitCoexDm(pBtCoexist); +} + +VOID +EXhalbtc8821aCsr2ant_DisplayCoexInfo( + IN PBTC_COEXIST pBtCoexist + ) +{ + PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo; + PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo; + pu1Byte cliBuf=pBtCoexist->cliBuf; + u1Byte u1Tmp[4], i, btInfoExt, psTdmaCase=0; + u4Byte u4Tmp[4]; + BOOLEAN bRoam=FALSE, bScan=FALSE, bLink=FALSE, bWifiUnder5G=FALSE; + BOOLEAN bBtHsOn=FALSE, bWifiBusy=FALSE; + s4Byte wifiRssi=0, btHsRssi=0; + u4Byte wifiBw, wifiTrafficDir; + u1Byte wifiDot11Chnl, wifiHsChnl; + u4Byte fwVer=0, btPatchVer=0; + + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[BT Coexist info]============"); + CL_PRINTF(cliBuf); + + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d ", "Ant PG number/ Ant mechanism:", \ + pBoardInfo->pgAntNum, pBoardInfo->btdmAntNum); + CL_PRINTF(cliBuf); + + if(pBtCoexist->bManualControl) + { + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "[Action Manual control]!!"); + CL_PRINTF(cliBuf); + } + + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s / %d", "BT stack/ hci ext ver", \ + ((pStackInfo->bProfileNotified)? "Yes":"No"), pStackInfo->hciVersion); + CL_PRINTF(cliBuf); + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_BT_PATCH_VER, &btPatchVer); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_FW_VER, &fwVer); + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d_%d/ 0x%x/ 0x%x(%d)", "CoexVer/ FwVer/ PatchVer", \ + GLCoexVerDate8821aCsr2Ant, GLCoexVer8821aCsr2Ant, fwVer, btPatchVer, btPatchVer); + CL_PRINTF(cliBuf); + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_WIFI_DOT11_CHNL, &wifiDot11Chnl); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_WIFI_HS_CHNL, &wifiHsChnl); + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d / %d(%d)", "Dot11 channel / HsMode(HsChnl)", \ + wifiDot11Chnl, bBtHsOn, wifiHsChnl); + CL_PRINTF(cliBuf); + + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x ", "H2C Wifi inform bt chnl Info", \ + pCoexDm->wifiChnlInfo[0], pCoexDm->wifiChnlInfo[1], + pCoexDm->wifiChnlInfo[2]); + CL_PRINTF(cliBuf); + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_S4_WIFI_RSSI, &wifiRssi); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_S4_HS_RSSI, &btHsRssi); + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "Wifi rssi/ HS rssi", \ + wifiRssi, btHsRssi); + CL_PRINTF(cliBuf); + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_SCAN, &bScan); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_LINK, &bLink); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_ROAM, &bRoam); + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d/ %d ", "Wifi bLink/ bRoam/ bScan", \ + bLink, bRoam, bScan); + CL_PRINTF(cliBuf); + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_UNDER_5G, &bWifiUnder5G); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_TRAFFIC_DIRECTION, &wifiTrafficDir); + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s / %s/ %s ", "Wifi status", \ + (bWifiUnder5G? "5G":"2.4G"), + ((BTC_WIFI_BW_LEGACY==wifiBw)? "Legacy": (((BTC_WIFI_BW_HT40==wifiBw)? "HT40":"HT20"))), + ((!bWifiBusy)? "idle": ((BTC_WIFI_TRAFFIC_TX==wifiTrafficDir)? "uplink":"downlink"))); + CL_PRINTF(cliBuf); + + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = [%s/ %d/ %d] ", "BT [status/ rssi/ retryCnt]", \ + ((pCoexSta->bC2hBtInquiryPage)?("inquiry/page scan"):((BT_8821A_CSR_2ANT_BT_STATUS_IDLE == pCoexDm->btStatus)? "idle":( (BT_8821A_CSR_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus)? "connected-idle":"busy"))), + pCoexSta->btRssi, pCoexSta->btRetryCnt); + CL_PRINTF(cliBuf); + + if(pStackInfo->bProfileNotified) + { + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d / %d / %d / %d", "SCO/HID/PAN/A2DP", \ + pStackInfo->bScoExist, pStackInfo->bHidExist, pStackInfo->bPanExist, pStackInfo->bA2dpExist); + CL_PRINTF(cliBuf); + + pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_BT_LINK_INFO); + } + + btInfoExt = pCoexSta->btInfoExt; + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s", "BT Info A2DP rate", \ + (btInfoExt&BIT0)? "Basic rate":"EDR rate"); + CL_PRINTF(cliBuf); + + for(i=0; ibtInfoC2hCnt[i]) + { + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x %02x %02x(%d)", GLBtInfoSrc8821aCsr2Ant[i], \ + pCoexSta->btInfoC2h[i][0], pCoexSta->btInfoC2h[i][1], + pCoexSta->btInfoC2h[i][2], pCoexSta->btInfoC2h[i][3], + pCoexSta->btInfoC2h[i][4], pCoexSta->btInfoC2h[i][5], + pCoexSta->btInfoC2h[i][6], pCoexSta->btInfoC2hCnt[i]); + CL_PRINTF(cliBuf); + } + } + + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s/%s", "PS state, IPS/LPS", \ + ((pCoexSta->bUnderIps? "IPS ON":"IPS OFF")), + ((pCoexSta->bUnderLps? "LPS ON":"LPS OFF"))); + CL_PRINTF(cliBuf); + pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_FW_PWR_MODE_CMD); + + // Sw mechanism + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Sw mechanism]============"); + CL_PRINTF(cliBuf); + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d/ %d ", "SM1[ShRf/ LpRA/ LimDig]", \ + pCoexDm->bCurRfRxLpfShrink, pCoexDm->bCurLowPenaltyRa, pCoexDm->bLimitedDig); + CL_PRINTF(cliBuf); + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d/ %d(0x%x) ", "SM2[AgcT/ AdcB/ SwDacSwing(lvl)]", \ + pCoexDm->bCurAgcTableEn, pCoexDm->bCurAdcBackOff, pCoexDm->bCurDacSwingOn, pCoexDm->curDacSwingLvl); + CL_PRINTF(cliBuf); + + // Fw mechanism + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Fw mechanism]============"); + CL_PRINTF(cliBuf); + + if(!pBtCoexist->bManualControl) + { + psTdmaCase = pCoexDm->curPsTdma; + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x case-%d", "PS TDMA", \ + pCoexDm->psTdmaPara[0], pCoexDm->psTdmaPara[1], + pCoexDm->psTdmaPara[2], pCoexDm->psTdmaPara[3], + pCoexDm->psTdmaPara[4], psTdmaCase); + CL_PRINTF(cliBuf); + + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d ", "DecBtPwr/ IgnWlanAct", \ + pCoexDm->bCurDecBtPwr, pCoexDm->bCurIgnoreWlanAct); + CL_PRINTF(cliBuf); + } + + // Hw setting + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Hw setting]============"); + CL_PRINTF(cliBuf); + + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "RF-A, 0x1e initVal", \ + pCoexDm->btRf0x1eBackup); + CL_PRINTF(cliBuf); + + u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x778); + u1Tmp[1] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x6cc); + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x ", "0x778 (W_Act)/ 0x6cc (CoTab Sel)", \ + u1Tmp[0], u1Tmp[1]); + CL_PRINTF(cliBuf); + + u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x8db); + u1Tmp[1] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0xc5b); + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x", "0x8db(ADC)/0xc5b[29:25](DAC)", \ + ((u1Tmp[0]&0x60)>>5), ((u1Tmp[1]&0x3e)>>1)); + CL_PRINTF(cliBuf); + + u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xcb4); + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x", "0xcb4[7:0](ctrl)/ 0xcb4[29:28](val)", \ + u4Tmp[0]&0xff, ((u4Tmp[0]&0x30000000)>>28)); + CL_PRINTF(cliBuf); + + u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x40); + u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x4c); + u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x974); + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0x40/ 0x4c[24:23]/ 0x974", \ + u1Tmp[0], ((u4Tmp[0]&0x01800000)>>23), u4Tmp[1]); + CL_PRINTF(cliBuf); + + u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x550); + u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x522); + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x", "0x550(bcn ctrl)/0x522", \ + u4Tmp[0], u1Tmp[0]); + CL_PRINTF(cliBuf); + + u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xc50); + u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0xa0a); + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x", "0xc50(DIG)/0xa0a(CCK-TH)", \ + u4Tmp[0], u1Tmp[0]); + CL_PRINTF(cliBuf); + + u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xf48); + u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0xa5b); + u1Tmp[1] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0xa5c); + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x", "OFDM-FA/ CCK-FA", \ + u4Tmp[0], (u1Tmp[0]<<8) + u1Tmp[1] ); + CL_PRINTF(cliBuf); + + u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x6c0); + u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x6c4); + u4Tmp[2] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x6c8); + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0x6c0/0x6c4/0x6c8", \ + u4Tmp[0], u4Tmp[1], u4Tmp[2]); + CL_PRINTF(cliBuf); + + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x770 (hi-pri Rx/Tx)", \ + pCoexSta->highPriorityRx, pCoexSta->highPriorityTx); + CL_PRINTF(cliBuf); + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x774(low-pri Rx/Tx)", \ + pCoexSta->lowPriorityRx, pCoexSta->lowPriorityTx); + CL_PRINTF(cliBuf); + + // Tx mgnt queue hang or not, 0x41b should = 0xf, ex: 0xd ==>hang + u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x41b); + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x41b (mgntQ hang chk == 0xf)", \ + u1Tmp[0]); + CL_PRINTF(cliBuf); + + pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_COEX_STATISTICS); +} + + +VOID +EXhalbtc8821aCsr2ant_IpsNotify( + IN PBTC_COEXIST pBtCoexist, + IN u1Byte type + ) +{ + if(BTC_IPS_ENTER == type) + { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS ENTER notify\n")); + pCoexSta->bUnderIps = TRUE; + halbtc8821aCsr2ant_CoexAllOff(pBtCoexist); + } + else if(BTC_IPS_LEAVE == type) + { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS LEAVE notify\n")); + pCoexSta->bUnderIps = FALSE; + //halbtc8821aCsr2ant_InitCoexDm(pBtCoexist); + } +} + +VOID +EXhalbtc8821aCsr2ant_LpsNotify( + IN PBTC_COEXIST pBtCoexist, + IN u1Byte type + ) +{ + if(BTC_LPS_ENABLE == type) + { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], LPS ENABLE notify\n")); + pCoexSta->bUnderLps = TRUE; + } + else if(BTC_LPS_DISABLE == type) + { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], LPS DISABLE notify\n")); + pCoexSta->bUnderLps = FALSE; + } +} + +VOID +EXhalbtc8821aCsr2ant_ScanNotify( + IN PBTC_COEXIST pBtCoexist, + IN u1Byte type + ) +{ + if(BTC_SCAN_START == type) + { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN START notify\n")); + } + else if(BTC_SCAN_FINISH == type) + { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN FINISH notify\n")); + } +} + +VOID +EXhalbtc8821aCsr2ant_ConnectNotify( + IN PBTC_COEXIST pBtCoexist, + IN u1Byte type + ) +{ + if(BTC_ASSOCIATE_START == type) + { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], CONNECT START notify\n")); + } + else if(BTC_ASSOCIATE_FINISH == type) + { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], CONNECT FINISH notify\n")); + } +} + +VOID +EXhalbtc8821aCsr2ant_MediaStatusNotify( + IN PBTC_COEXIST pBtCoexist, + IN u1Byte type + ) +{ + u1Byte H2C_Parameter[3] ={0}; + u4Byte wifiBw; + u1Byte wifiCentralChnl; + + if(BTC_MEDIA_CONNECT == type) + { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], MEDIA connect notify\n")); + } + else + { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], MEDIA disconnect notify\n")); + } + + // only 2.4G we need to inform bt the chnl mask + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_WIFI_CENTRAL_CHNL, &wifiCentralChnl); + if( (BTC_MEDIA_CONNECT == type) && + (wifiCentralChnl <= 14) ) + { + H2C_Parameter[0] = 0x1; + H2C_Parameter[1] = wifiCentralChnl; + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); + if(BTC_WIFI_BW_HT40 == wifiBw) + H2C_Parameter[2] = 0x30; + else + H2C_Parameter[2] = 0x20; + } + + #if 0 /* REMOVE */ + pCoexDm->wifiChnlInfo[0] = H2C_Parameter[0]; + pCoexDm->wifiChnlInfo[1] = H2C_Parameter[1]; + pCoexDm->wifiChnlInfo[2] = H2C_Parameter[2]; + + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], FW write 0x66=0x%x\n", + H2C_Parameter[0]<<16|H2C_Parameter[1]<<8|H2C_Parameter[2])); + + rtw_warn_on(_BTCOEX_CSR); + pBtCoexist->fBtcFillH2c(pBtCoexist, 0x66, 3, H2C_Parameter); + #endif +} + +VOID +EXhalbtc8821aCsr2ant_SpecialPacketNotify( + IN PBTC_COEXIST pBtCoexist, + IN u1Byte type + ) +{ + if(type == BTC_PACKET_DHCP) + { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], DHCP Packet notify\n")); + } +} + +VOID +EXhalbtc8821aCsr2ant_BtInfoNotify( + IN PBTC_COEXIST pBtCoexist, + IN pu1Byte tmpBuf, + IN u1Byte length + ) +{ + u1Byte btInfo=0; + u1Byte i, rspSource=0; + BOOLEAN bBtBusy=FALSE, bLimitedDig=FALSE; + BOOLEAN bWifiConnected=FALSE, bBtHsOn=FALSE, bWifiUnder5G=FALSE; + + pCoexSta->bC2hBtInfoReqSent = FALSE; + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_UNDER_5G, &bWifiUnder5G); + + rspSource = tmpBuf[0]&0xf; + if(rspSource >= BT_INFO_SRC_8821A_CSR_2ANT_MAX) + rspSource = BT_INFO_SRC_8821A_CSR_2ANT_WIFI_FW; + pCoexSta->btInfoC2hCnt[rspSource]++; + + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Bt info[%d], length=%d, hex data=[", rspSource, length)); + for(i=0; ibtInfoC2h[rspSource][i] = tmpBuf[i]; + if(i == 1) + btInfo = tmpBuf[i]; + if(i == length-1) + { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("0x%02x]\n", tmpBuf[i])); + } + else + { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("0x%02x, ", tmpBuf[i])); + } + } + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected); + if(BT_INFO_SRC_8821A_CSR_2ANT_WIFI_FW != rspSource) + { + pCoexSta->btRetryCnt = // [3:0] + pCoexSta->btInfoC2h[rspSource][2]&0xf; + + pCoexSta->btRssi = + pCoexSta->btInfoC2h[rspSource][3]*2+10; + + pCoexSta->btInfoExt = + pCoexSta->btInfoC2h[rspSource][4]; + + #if 0 /* REMOVE */ + // Here we need to resend some wifi info to BT + // because bt is reset and loss of the info. + if( (pCoexSta->btInfoExt & BIT1) ) + { + + if(bWifiConnected) + { + EXhalbtc8821aCsr2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_CONNECT); + } + else + { + EXhalbtc8821aCsr2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT); + } + } + #endif + + #if 0 /* REMOVE */ + if(!pBtCoexist->bManualControl && !bWifiUnder5G) + { + if( (pCoexSta->btInfoExt&BIT3) ) + { + if(bWifiConnected) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit3 check, set BT NOT to ignore Wlan active!!\n")); + halbtc8821aCsr2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, FALSE); + } + } + else + { + // BT already NOT ignore Wlan active, do nothing here. + if(!bWifiConnected) + { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit3 check, set BT to ignore Wlan active!!\n")); + halbtc8821aCsr2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE); + } + } + } + #endif + + #if 0 /* REMOVE */ + if( (pCoexSta->btInfoExt & BIT4) ) + { + // BT auto report already enabled, do nothing + } + else + { + halbtc8821aCsr2ant_BtAutoReport(pBtCoexist, FORCE_EXEC, TRUE); + } + #endif + } + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn); + + if(btInfo == BT_INFO_8821A_CSR_2ANT_B_CONNECTION) // connection exists but no busy + { + pCoexSta->bBtLinkExist = TRUE; + pCoexDm->btStatus = BT_8821A_CSR_2ANT_BT_STATUS_CONNECTED_IDLE; + } + else if(btInfo & BT_INFO_8821A_CSR_2ANT_B_CONNECTION) // connection exists and some link is busy + { + pCoexSta->bBtLinkExist = TRUE; + + if(btInfo & BT_INFO_8821A_CSR_2ANT_B_FTP) + pCoexSta->bPanExist = TRUE; + else + pCoexSta->bPanExist = FALSE; + + if(btInfo & BT_INFO_8821A_CSR_2ANT_B_A2DP) + pCoexSta->bA2dpExist = TRUE; + else + pCoexSta->bA2dpExist = FALSE; + + if(btInfo & BT_INFO_8821A_CSR_2ANT_B_HID) + pCoexSta->bHidExist = TRUE; + else + pCoexSta->bHidExist = FALSE; + + if(btInfo & BT_INFO_8821A_CSR_2ANT_B_SCO_ESCO) + pCoexSta->bScoExist = TRUE; + else + pCoexSta->bScoExist = FALSE; + + if (pCoexSta->btInfoExt & 0x80) + pCoexSta->bSlave = TRUE; //Slave + else + pCoexSta->bSlave = FALSE; //Master + + pCoexDm->btStatus = BT_8821A_CSR_2ANT_BT_STATUS_NON_IDLE; + } + else + { + pCoexSta->bBtLinkExist = FALSE; + pCoexSta->bPanExist = FALSE; + pCoexSta->bA2dpExist = FALSE; + pCoexSta->bSlave = FALSE; + pCoexSta->bHidExist = FALSE; + pCoexSta->bScoExist = FALSE; + pCoexDm->btStatus = BT_8821A_CSR_2ANT_BT_STATUS_IDLE; + } + + if(bBtHsOn) + { + pCoexDm->btStatus = BT_8821A_CSR_2ANT_BT_STATUS_NON_IDLE; + } + + if(btInfo & BT_INFO_8821A_CSR_2ANT_B_INQ_PAGE) + { + pCoexSta->bC2hBtInquiryPage = TRUE; + pCoexDm->btStatus = BT_8821A_CSR_2ANT_BT_STATUS_NON_IDLE; + } + else + { + pCoexSta->bC2hBtInquiryPage = FALSE; + } + + + if(BT_8821A_CSR_2ANT_BT_STATUS_NON_IDLE == pCoexDm->btStatus) + { + bBtBusy = TRUE; + } + else + { + bBtBusy = FALSE; + } + pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_TRAFFIC_BUSY, &bBtBusy); + + if(BT_8821A_CSR_2ANT_BT_STATUS_IDLE != pCoexDm->btStatus) + { + bLimitedDig = TRUE; + } + else + { + bLimitedDig = FALSE; + } + pCoexDm->bLimitedDig = bLimitedDig; + pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_LIMITED_DIG, &bLimitedDig); + + halbtc8821aCsr2ant_RunCoexistMechanism(pBtCoexist); +} + +VOID +EXhalbtc8821aCsr2ant_HaltNotify( + IN PBTC_COEXIST pBtCoexist + ) +{ + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Halt notify\n")); + + halbtc8821aCsr2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE); + EXhalbtc8821aCsr2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT); +} + +VOID +EXhalbtc8821aCsr2ant_PnpNotify( + IN PBTC_COEXIST pBtCoexist, + IN u1Byte pnpState + ) +{ + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Pnp notify\n")); + + if(BTC_WIFI_PNP_SLEEP == pnpState) + { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Pnp notify to SLEEP\n")); + halbtc8821aCsr2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, TRUE); + } + else if(BTC_WIFI_PNP_WAKE_UP == pnpState) + { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Pnp notify to WAKE UP\n")); + } +} + +VOID +EXhalbtc8821aCsr2ant_Periodical( + IN PBTC_COEXIST pBtCoexist + ) +{ + static u1Byte disVerInfoCnt=0; + u4Byte fwVer=0, btPatchVer=0; + PBTC_BOARD_INFO pBoardInfo=&pBtCoexist->boardInfo; + PBTC_STACK_INFO pStackInfo=&pBtCoexist->stackInfo; + + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], ==========================Periodical===========================\n")); + + if(disVerInfoCnt <= 5) + { + disVerInfoCnt += 1; + BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], ****************************************************************\n")); + BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], Ant PG Num/ Ant Mech/ Ant Pos = %d/ %d/ %d\n", \ + pBoardInfo->pgAntNum, pBoardInfo->btdmAntNum, pBoardInfo->btdmAntPos)); + BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], BT stack/ hci ext ver = %s / %d\n", \ + ((pStackInfo->bProfileNotified)? "Yes":"No"), pStackInfo->hciVersion)); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_BT_PATCH_VER, &btPatchVer); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_FW_VER, &fwVer); + BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], CoexVer/ FwVer/ PatchVer = %d_%x/ 0x%x/ 0x%x(%d)\n", \ + GLCoexVerDate8821aCsr2Ant, GLCoexVer8821aCsr2Ant, fwVer, btPatchVer, btPatchVer)); + BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], ****************************************************************\n")); + } + + //halbtc8821aCsr2ant_QueryBtInfo(pBtCoexist); + //halbtc8821aCsr2ant_RunCoexistMechanism(pBtCoexist); + halbtc8821aCsr2ant_MonitorBtCtr(pBtCoexist); + halbtc8821aCsr2ant_MonitorBtEnableDisable(pBtCoexist); +} + + +#endif + diff --git a/hal/OUTSRC-BTCoexist/HalBtc8821aCsr2Ant.h b/hal/OUTSRC-BTCoexist/HalBtc8821aCsr2Ant.h new file mode 100644 index 0000000..aeebf82 --- /dev/null +++ b/hal/OUTSRC-BTCoexist/HalBtc8821aCsr2Ant.h @@ -0,0 +1,207 @@ +//=========================================== +// The following is for 8821A_CSR 2Ant BT Co-exist definition +//=========================================== +#define BT_INFO_8821A_CSR_2ANT_B_FTP BIT7 +#define BT_INFO_8821A_CSR_2ANT_B_A2DP BIT6 +#define BT_INFO_8821A_CSR_2ANT_B_HID BIT5 +#define BT_INFO_8821A_CSR_2ANT_B_SCO_BUSY BIT4 +#define BT_INFO_8821A_CSR_2ANT_B_ACL_BUSY BIT3 +#define BT_INFO_8821A_CSR_2ANT_B_INQ_PAGE BIT2 +#define BT_INFO_8821A_CSR_2ANT_B_SCO_ESCO BIT1 +#define BT_INFO_8821A_CSR_2ANT_B_CONNECTION BIT0 + +#define BTC_RSSI_COEX_THRESH_TOL_8821A_CSR_2ANT 2 + +typedef enum _BT_INFO_SRC_8821A_CSR_2ANT{ + BT_INFO_SRC_8821A_CSR_2ANT_WIFI_FW = 0x0, + BT_INFO_SRC_8821A_CSR_2ANT_BT_RSP = 0x1, + BT_INFO_SRC_8821A_CSR_2ANT_BT_ACTIVE_SEND = 0x2, + BT_INFO_SRC_8821A_CSR_2ANT_MAX +}BT_INFO_SRC_8821A_CSR_2ANT,*PBT_INFO_SRC_8821A_CSR_2ANT; + +typedef enum _BT_8821A_CSR_2ANT_BT_STATUS{ + BT_8821A_CSR_2ANT_BT_STATUS_IDLE = 0x0, + BT_8821A_CSR_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1, + BT_8821A_CSR_2ANT_BT_STATUS_NON_IDLE = 0x2, + BT_8821A_CSR_2ANT_BT_STATUS_MAX +}BT_8821A_CSR_2ANT_BT_STATUS,*PBT_8821A_CSR_2ANT_BT_STATUS; + +typedef enum _BT_8821A_CSR_2ANT_COEX_ALGO{ + BT_8821A_CSR_2ANT_COEX_ALGO_UNDEFINED = 0x0, + BT_8821A_CSR_2ANT_COEX_ALGO_SCO = 0x1, + BT_8821A_CSR_2ANT_COEX_ALGO_HID = 0x2, + BT_8821A_CSR_2ANT_COEX_ALGO_A2DP = 0x3, + BT_8821A_CSR_2ANT_COEX_ALGO_A2DP_PANHS = 0x4, + BT_8821A_CSR_2ANT_COEX_ALGO_PANEDR = 0x5, + BT_8821A_CSR_2ANT_COEX_ALGO_PANHS = 0x6, + BT_8821A_CSR_2ANT_COEX_ALGO_PANEDR_A2DP = 0x7, + BT_8821A_CSR_2ANT_COEX_ALGO_PANEDR_HID = 0x8, + BT_8821A_CSR_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9, + BT_8821A_CSR_2ANT_COEX_ALGO_HID_A2DP = 0xa, + BT_8821A_CSR_2ANT_COEX_ALGO_MAX = 0xb, +}BT_8821A_CSR_2ANT_COEX_ALGO,*PBT_8821A_CSR_2ANT_COEX_ALGO; + +typedef struct _COEX_DM_8821A_CSR_2ANT{ + // fw mechanism + BOOLEAN bPreDecBtPwr; + BOOLEAN bCurDecBtPwr; + u1Byte preFwDacSwingLvl; + u1Byte curFwDacSwingLvl; + BOOLEAN bCurIgnoreWlanAct; + BOOLEAN bPreIgnoreWlanAct; + u1Byte prePsTdma; + u1Byte curPsTdma; + u1Byte psTdmaPara[6]; + u1Byte psTdmaDuAdjType; + BOOLEAN bResetTdmaAdjust; + BOOLEAN bPrePsTdmaOn; + BOOLEAN bCurPsTdmaOn; + BOOLEAN bPreBtAutoReport; + BOOLEAN bCurBtAutoReport; + + // sw mechanism + BOOLEAN bPreRfRxLpfShrink; + BOOLEAN bCurRfRxLpfShrink; + u4Byte btRf0x1eBackup; + BOOLEAN bPreLowPenaltyRa; + BOOLEAN bCurLowPenaltyRa; + BOOLEAN bPreDacSwingOn; + u4Byte preDacSwingLvl; + BOOLEAN bCurDacSwingOn; + u4Byte curDacSwingLvl; + BOOLEAN bPreAdcBackOff; + BOOLEAN bCurAdcBackOff; + BOOLEAN bPreAgcTableEn; + BOOLEAN bCurAgcTableEn; + u4Byte preVal0x6c0; + u4Byte curVal0x6c0; + u4Byte preVal0x6c4; + u4Byte curVal0x6c4; + u4Byte preVal0x6c8; + u4Byte curVal0x6c8; + u1Byte preVal0x6cc; + u1Byte curVal0x6cc; + BOOLEAN bLimitedDig; + + u4Byte preRaMask; + u4Byte curRaMask; + + u1Byte curAmpduNumType; + u1Byte preAmpduNumType; + u2Byte backupAmpduMaxNum; + + u1Byte curAmpduTimeType; + u1Byte preAmpduTimeType; + u1Byte backupAmpduMaxTime; + + u1Byte curArfrType; + u1Byte preArfrType; + u4Byte backupArfrCnt1; + u4Byte backupArfrCnt2; + + u1Byte curRetryLimitType; + u1Byte preRetryLimitType; + u2Byte backupRetryLimit; + + // algorithm related + u1Byte preAlgorithm; + u1Byte curAlgorithm; + u1Byte btStatus; + u1Byte wifiChnlInfo[3]; +} COEX_DM_8821A_CSR_2ANT, *PCOEX_DM_8821A_CSR_2ANT; + +typedef struct _COEX_STA_8821A_CSR_2ANT{ + BOOLEAN bBtLinkExist; + BOOLEAN bScoExist; + BOOLEAN bA2dpExist; + BOOLEAN bSlave; + BOOLEAN bHidExist; + BOOLEAN bPanExist; + + BOOLEAN bUnderLps; + BOOLEAN bUnderIps; + u4Byte highPriorityTx; + u4Byte highPriorityRx; + u4Byte lowPriorityTx; + u4Byte lowPriorityRx; + u1Byte btRssi; + u1Byte preBtRssiState; + u1Byte preWifiRssiState[4]; + BOOLEAN bC2hBtInfoReqSent; + u1Byte btInfoC2h[BT_INFO_SRC_8821A_CSR_2ANT_MAX][10]; + u4Byte btInfoC2hCnt[BT_INFO_SRC_8821A_CSR_2ANT_MAX]; + BOOLEAN bC2hBtInquiryPage; + u1Byte btRetryCnt; + u1Byte btInfoExt; +}COEX_STA_8821A_CSR_2ANT, *PCOEX_STA_8821A_CSR_2ANT; + +//=========================================== +// The following is interface which will notify coex module. +//=========================================== +VOID +EXhalbtc8821aCsr2ant_PowerOnSetting( + IN PBTC_COEXIST pBtCoexist + ); +VOID +EXhalbtc8821aCsr2ant_InitHwConfig( + IN PBTC_COEXIST pBtCoexist, + IN BOOLEAN bWifiOnly + ); +VOID +EXhalbtc8821aCsr2ant_InitCoexDm( + IN PBTC_COEXIST pBtCoexist + ); +VOID +EXhalbtc8821aCsr2ant_IpsNotify( + IN PBTC_COEXIST pBtCoexist, + IN u1Byte type + ); +VOID +EXhalbtc8821aCsr2ant_LpsNotify( + IN PBTC_COEXIST pBtCoexist, + IN u1Byte type + ); +VOID +EXhalbtc8821aCsr2ant_ScanNotify( + IN PBTC_COEXIST pBtCoexist, + IN u1Byte type + ); +VOID +EXhalbtc8821aCsr2ant_ConnectNotify( + IN PBTC_COEXIST pBtCoexist, + IN u1Byte type + ); +VOID +EXhalbtc8821aCsr2ant_MediaStatusNotify( + IN PBTC_COEXIST pBtCoexist, + IN u1Byte type + ); +VOID +EXhalbtc8821aCsr2ant_SpecialPacketNotify( + IN PBTC_COEXIST pBtCoexist, + IN u1Byte type + ); +VOID +EXhalbtc8821aCsr2ant_BtInfoNotify( + IN PBTC_COEXIST pBtCoexist, + IN pu1Byte tmpBuf, + IN u1Byte length + ); +VOID +EXhalbtc8821aCsr2ant_HaltNotify( + IN PBTC_COEXIST pBtCoexist + ); +VOID +EXhalbtc8821aCsr2ant_PnpNotify( + IN PBTC_COEXIST pBtCoexist, + IN u1Byte pnpState + ); +VOID +EXhalbtc8821aCsr2ant_Periodical( + IN PBTC_COEXIST pBtCoexist + ); +VOID +EXhalbtc8821aCsr2ant_DisplayCoexInfo( + IN PBTC_COEXIST pBtCoexist + ); + diff --git a/hal/OUTSRC-BTCoexist/HalBtcOutSrc.h b/hal/OUTSRC-BTCoexist/HalBtcOutSrc.h index 5706098..3ec6bb7 100644 --- a/hal/OUTSRC-BTCoexist/HalBtcOutSrc.h +++ b/hal/OUTSRC-BTCoexist/HalBtcOutSrc.h @@ -4,6 +4,9 @@ #define NORMAL_EXEC FALSE #define FORCE_EXEC TRUE +#define BTC_RF_OFF 0x0 +#define BTC_RF_ON 0x1 + #define BTC_RF_A 0x0 #define BTC_RF_B 0x1 #define BTC_RF_C 0x2 @@ -165,7 +168,8 @@ typedef struct _BTC_BOARD_INFO{ u1Byte pgAntNum; // pg ant number u1Byte btdmAntNum; // ant number for btdm u1Byte btdmAntPos; //Bryant Add to indicate Antenna Position for (pgAntNum = 2) && (btdmAntNum =1) (DPDT+1Ant case) - BOOLEAN bBtExist; + u1Byte singleAntPath; // current used for 8723b only, 1=>s0, 0=>s1 + //BOOLEAN bBtExist; } BTC_BOARD_INFO, *PBTC_BOARD_INFO; typedef enum _BTC_DBG_OPCODE{ @@ -244,8 +248,8 @@ typedef enum _BTC_GET_TYPE{ BTC_GET_BL_WIFI_AP_MODE_ENABLE, BTC_GET_BL_WIFI_ENABLE_ENCRYPTION, BTC_GET_BL_WIFI_UNDER_B_MODE, - BTC_GET_BL_WIFI_IS_IN_MP_MODE, BTC_GET_BL_EXT_SWITCH, + BTC_GET_BL_WIFI_IS_IN_MP_MODE, // type s4Byte BTC_GET_S4_WIFI_RSSI, @@ -282,6 +286,7 @@ typedef enum _BTC_SET_TYPE{ BTC_SET_BL_BT_CTRL_AGG_SIZE, BTC_SET_BL_INC_SCAN_DEV_NUM, BTC_SET_BL_BT_TX_RX_MASK, + BTC_SET_BL_MIRACAST_PLUS_BT, // type u1Byte BTC_SET_U1_RSSI_ADJ_VAL_FOR_AGC_TABLE_ON, @@ -405,6 +410,12 @@ typedef VOID IN u4Byte Data ); typedef VOID +(*BFP_BTC_LOCAL_REG_W1)( + IN PVOID pBtcContext, + IN u4Byte RegAddr, + IN u1Byte Data + ); +typedef VOID (*BFP_BTC_SET_BB_REG)( IN PVOID pBtcContext, IN u4Byte RegAddr, @@ -488,6 +499,8 @@ typedef struct _BTC_BT_INFO{ u2Byte btHciVer; u2Byte btRealFwVer; u1Byte btFwVer; + u4Byte getBtFwVerCnt; + BOOLEAN bMiracastPlusBt; BOOLEAN bBtDisableLowPwr; @@ -524,10 +537,13 @@ typedef struct _BTC_BT_LINK_INFO{ BOOLEAN bHidOnly; BOOLEAN bPanExist; BOOLEAN bPanOnly; + BOOLEAN bSlaveRole; } BTC_BT_LINK_INFO, *PBTC_BT_LINK_INFO; typedef struct _BTC_STATISTICS{ u4Byte cntBind; + u4Byte cntPowerOn; + u4Byte cntPreLoadFirmware; u4Byte cntInitHwConfig; u4Byte cntInitCoexDm; u4Byte cntIpsNotify; @@ -537,6 +553,7 @@ typedef struct _BTC_STATISTICS{ u4Byte cntMediaStatusNotify; u4Byte cntSpecialPacketNotify; u4Byte cntBtInfoNotify; + u4Byte cntRfStatusNotify; u4Byte cntPeriodical; u4Byte cntCoexDmSwitch; u4Byte cntStackOperationNotify; @@ -568,6 +585,7 @@ typedef struct _BTC_COEXIST{ BFP_BTC_W2 fBtcWrite2Byte; BFP_BTC_R4 fBtcRead4Byte; BFP_BTC_W4 fBtcWrite4Byte; + BFP_BTC_LOCAL_REG_W1 fBtcWriteLocalReg1Byte; // read/write bb related BFP_BTC_SET_BB_REG fBtcSetBbReg; BFP_BTC_GET_BB_REG fBtcGetBbReg; @@ -592,7 +610,15 @@ extern BTC_COEXIST GLBtCoexist; BOOLEAN EXhalbtcoutsrc_InitlizeVariables( - IN PVOID Adapter + IN PVOID Adapter + ); +VOID +EXhalbtcoutsrc_PowerOnSetting( + IN PBTC_COEXIST pBtCoexist + ); +VOID +EXhalbtcoutsrc_PreLoadFirmware( + IN PBTC_COEXIST pBtCoexist ); VOID EXhalbtcoutsrc_InitHwConfig( @@ -640,6 +666,11 @@ EXhalbtcoutsrc_BtInfoNotify( IN u1Byte length ); VOID +EXhalbtcoutsrc_RfStatusNotify( + IN PBTC_COEXIST pBtCoexist, + IN u1Byte type + ); +VOID EXhalbtcoutsrc_StackOperationNotify( IN PBTC_COEXIST pBtCoexist, IN u1Byte type @@ -655,8 +686,7 @@ EXhalbtcoutsrc_PnpNotify( ); VOID EXhalbtcoutsrc_CoexDmSwitch( - IN PBTC_COEXIST pBtCoexist, - IN BOOLEAN antInverse + IN PBTC_COEXIST pBtCoexist ); VOID EXhalbtcoutsrc_Periodical( @@ -686,10 +716,12 @@ VOID EXhalbtcoutsrc_UpdateMinBtRssi( IN s1Byte btRssi ); +#if 0 VOID EXhalbtcoutsrc_SetBtExist( IN BOOLEAN bBtExist ); +#endif VOID EXhalbtcoutsrc_SetChipType( IN u1Byte chipType @@ -697,8 +729,11 @@ EXhalbtcoutsrc_SetChipType( VOID EXhalbtcoutsrc_SetAntNum( IN u1Byte type, - IN u1Byte antNum, - IN BOOLEAN antInverse + IN u1Byte antNum + ); +VOID +EXhalbtcoutsrc_SetSingleAntPath( + IN u1Byte singleAntPath ); VOID EXhalbtcoutsrc_DisplayBtCoexInfo( diff --git a/hal/OUTSRC-BTCoexist/Mp_Precomp.h b/hal/OUTSRC-BTCoexist/Mp_Precomp.h index fdd9406..b1fc17b 100644 --- a/hal/OUTSRC-BTCoexist/Mp_Precomp.h +++ b/hal/OUTSRC-BTCoexist/Mp_Precomp.h @@ -52,5 +52,6 @@ #include "HalBtc8812a2Ant.h" #include "HalBtc8821a1Ant.h" #include "HalBtc8821a2Ant.h" +#include "HalBtc8821aCsr2Ant.h" #endif // __MP_PRECOMP_H__ diff --git a/hal/OUTSRC/HalPhyRf.c b/hal/OUTSRC/HalPhyRf.c index d74846c..58d4485 100644 --- a/hal/OUTSRC/HalPhyRf.c +++ b/hal/OUTSRC/HalPhyRf.c @@ -18,7 +18,7 @@ * ******************************************************************************/ -//#include "Mp_Precomp.h" +#include "Mp_Precomp.h" #include "odm_precomp.h" @@ -161,7 +161,7 @@ ODM_TXPowerTrackingCallback_ThermalMeter( #endif #if (DM_ODM_SUPPORT_TYPE == ODM_CE) - if ( *(pDM_Odm->mp_mode) == 1) + if (pDM_Odm->mp_mode == TRUE) #endif // RFCalibrateInfo.RegA24 will be initialized when ODM HW configuring, but MP configures with para files. pDM_Odm->RFCalibrateInfo.RegA24 = 0x090e1317; diff --git a/hal/OUTSRC/Mp_Precomp.h b/hal/OUTSRC/Mp_Precomp.h new file mode 100644 index 0000000..1bd4da6 --- /dev/null +++ b/hal/OUTSRC/Mp_Precomp.h @@ -0,0 +1,24 @@ +/****************************************************************************** + * + * 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 +//#include "odm_precomp.h" +//#include "../odm_precomp.h" + diff --git a/hal/OUTSRC/PhyDM_Adaptivity.c b/hal/OUTSRC/PhyDM_Adaptivity.c new file mode 100644 index 0000000..dc59a83 --- /dev/null +++ b/hal/OUTSRC/PhyDM_Adaptivity.c @@ -0,0 +1,880 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA + * + * + ******************************************************************************/ + +//============================================================ +// include files +//============================================================ +#include "Mp_Precomp.h" +#include "odm_precomp.h" + + +VOID +Phydm_CheckAdaptivity( + IN PVOID pDM_VOID + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + if(pDM_Odm->SupportAbility & ODM_BB_ADAPTIVITY) + { + if(pDM_Odm->bAdaOn == TRUE) + { + if(pDM_Odm->DynamicLinkAdaptivity == TRUE) + { + if(pDM_Odm->bLinked && pDM_Odm->bCheck == FALSE) + { + Phydm_NHMCounterStatistics(pDM_Odm); + Phydm_CheckEnvironment(pDM_Odm); + } + else if(!pDM_Odm->bLinked) + { + pDM_Odm->bCheck = FALSE; + } + } + else + { + Phydm_MACEDCCAState(pDM_Odm, PhyDM_DONT_IGNORE_EDCCA); + pDM_Odm->adaptivity_flag = TRUE; + } + } + else + { + Phydm_MACEDCCAState(pDM_Odm, PhyDM_IGNORE_EDCCA); + pDM_Odm->adaptivity_flag = FALSE; + } + } +} + +VOID +Phydm_NHMCounterStatisticsInit( + IN PVOID pDM_VOID + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + + if(pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) + { + //PHY parameters initialize for ac series + ODM_Write2Byte(pDM_Odm, ODM_REG_NHM_TIMER_11AC+2, 0xC350); //0x990[31:16]=0xC350 Time duration for NHM unit: us, 0xc350=200ms + ODM_Write2Byte(pDM_Odm, ODM_REG_NHM_TH9_TH10_11AC+2, 0xffff); //0x994[31:16]=0xffff th_9, th_10 + //ODM_Write4Byte(pDM_Odm, ODM_REG_NHM_TH3_TO_TH0_11AC, 0xffffff5c); //0x998=0xffffff5c th_3, th_2, th_1, th_0 + ODM_Write4Byte(pDM_Odm, ODM_REG_NHM_TH3_TO_TH0_11AC, 0xffffff50); //0x998=0xffffff52 th_3, th_2, th_1, th_0 + ODM_Write4Byte(pDM_Odm, ODM_REG_NHM_TH7_TO_TH4_11AC, 0xffffffff); //0x99c=0xffffffff th_7, th_6, th_5, th_4 + ODM_SetBBReg(pDM_Odm, ODM_REG_NHM_TH8_11AC, bMaskByte0, 0xff); //0x9a0[7:0]=0xff th_8 + //ODM_SetBBReg(pDM_Odm, ODM_REG_NHM_TH9_TH10_11AC, BIT8|BIT9|BIT10, 0x7); //0x994[9:8]=3 enable CCX + ODM_SetBBReg(pDM_Odm, ODM_REG_NHM_TH9_TH10_11AC, BIT8|BIT9|BIT10, 0x1); //0x994[10:8]=1 ignoreCCA ignore PHYTXON enable CCX + ODM_SetBBReg(pDM_Odm, ODM_REG_NHM_9E8_11AC, BIT0, 0x1); //0x9e8[7]=1 max power among all RX ants + + } + else if (pDM_Odm->SupportICType & ODM_IC_11N_SERIES) + { + //PHY parameters initialize for n series + ODM_Write2Byte(pDM_Odm, ODM_REG_NHM_TIMER_11N+2, 0xC350); //0x894[31:16]=0x0xC350 Time duration for NHM unit: us, 0xc350=200ms + //ODM_Write2Byte(pDM_Odm, ODM_REG_NHM_TIMER_11N+2, 0x4e20); //0x894[31:16]=0x4e20 Time duration for NHM unit: 4us, 0x4e20=80ms + ODM_Write2Byte(pDM_Odm, ODM_REG_NHM_TH9_TH10_11N+2, 0xffff); //0x890[31:16]=0xffff th_9, th_10 + //ODM_Write4Byte(pDM_Odm, ODM_REG_NHM_TH3_TO_TH0_11N, 0xffffff5c); //0x898=0xffffff5c th_3, th_2, th_1, th_0 + ODM_Write4Byte(pDM_Odm, ODM_REG_NHM_TH3_TO_TH0_11N, 0xffffff50); //0x898=0xffffff52 th_3, th_2, th_1, th_0 + ODM_Write4Byte(pDM_Odm, ODM_REG_NHM_TH7_TO_TH4_11N, 0xffffffff); //0x89c=0xffffffff th_7, th_6, th_5, th_4 + ODM_SetBBReg(pDM_Odm, ODM_REG_FPGA0_IQK_11N, bMaskByte0, 0xff); //0xe28[7:0]=0xff th_8 + //ODM_SetBBReg(pDM_Odm, ODM_REG_NHM_TH9_TH10_11N, BIT10|BIT9|BIT8, 0x7); //0x890[9:8]=3 enable CCX + ODM_SetBBReg(pDM_Odm, ODM_REG_NHM_TH9_TH10_11N, BIT10|BIT9|BIT8, 0x1); //0x890[10:8]=1 ignoreCCA ignore PHYTXON enable CCX + ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RSTC_11N, BIT7, 0x1); //0xc0c[7]=1 max power among all RX ants + } +} + +VOID +Phydm_NHMCounterStatistics( + IN PVOID pDM_VOID + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + + if(!(pDM_Odm->SupportAbility & ODM_BB_NHM_CNT)) + return; + + // Get NHM report + Phydm_GetNHMCounterStatistics(pDM_Odm); + + // Reset NHM counter + Phydm_NHMCounterStatisticsReset(pDM_Odm); +} + +VOID +Phydm_GetNHMCounterStatistics( + IN PVOID pDM_VOID + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + u4Byte value32 = 0; + + if (pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) + value32 = ODM_GetBBReg(pDM_Odm, ODM_REG_NHM_CNT_11AC, bMaskDWord); + else if (pDM_Odm->SupportICType & ODM_IC_11N_SERIES) + value32 = ODM_GetBBReg(pDM_Odm, ODM_REG_NHM_CNT_11N, bMaskDWord); + + pDM_Odm->NHM_cnt_0 = (u1Byte)(value32 & bMaskByte0); + pDM_Odm->NHM_cnt_1 = (u1Byte)((value32 & bMaskByte1)>>8); + +} + +VOID +Phydm_NHMCounterStatisticsReset( + IN PVOID pDM_VOID + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + + if (pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) + { + ODM_SetBBReg(pDM_Odm, ODM_REG_NHM_TH9_TH10_11AC, BIT1, 0); + ODM_SetBBReg(pDM_Odm, ODM_REG_NHM_TH9_TH10_11AC, BIT1, 1); + } + else if (pDM_Odm->SupportICType & ODM_IC_11N_SERIES) + { + ODM_SetBBReg(pDM_Odm, ODM_REG_NHM_TH9_TH10_11N, BIT1, 0); + ODM_SetBBReg(pDM_Odm, ODM_REG_NHM_TH9_TH10_11N, BIT1, 1); + } +} + +VOID +Phydm_NHMBBInit( + IN PVOID pDM_VOID +) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + + pDM_Odm->adaptivity_flag = FALSE; + pDM_Odm->tolerance_cnt = 3; + pDM_Odm->NHMLastTxOkcnt = 0; + pDM_Odm->NHMLastRxOkcnt = 0; + pDM_Odm->NHMCurTxOkcnt = 0; + pDM_Odm->NHMCurRxOkcnt = 0; +} + +VOID +Phydm_SetEDCCAThreshold( + IN PVOID pDM_VOID, + IN s1Byte H2L, + IN s1Byte L2H +) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + + if(pDM_Odm->SupportICType & ODM_IC_11N_SERIES) + { + ODM_SetBBReg(pDM_Odm,rOFDM0_ECCAThreshold, bMaskByte0, (u1Byte)L2H); + ODM_SetBBReg(pDM_Odm,rOFDM0_ECCAThreshold, bMaskByte2, (u1Byte)H2L); + } + else if(pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) + { + ODM_SetBBReg(pDM_Odm, rFPGA0_XB_LSSIReadBack, bMaskByte0, (u1Byte)L2H); + ODM_SetBBReg(pDM_Odm, rFPGA0_XB_LSSIReadBack, bMaskByte1, (u1Byte)H2L); + } +} + +VOID +Phydm_SetTRxMux( + IN PVOID pDM_VOID, + IN PhyDM_Trx_MUX_Type txMode, + IN PhyDM_Trx_MUX_Type rxMode +) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + + if (pDM_Odm->SupportICType & ODM_IC_11N_SERIES) + { + ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_RPT_FORMAT_11N, BIT3|BIT2|BIT1, txMode); // set TXmod to standby mode to remove outside noise affect + ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_RPT_FORMAT_11N, BIT22|BIT21|BIT20, rxMode); // set RXmod to standby mode to remove outside noise affect + if(pDM_Odm->RFType > ODM_1T1R) + { + ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_RPT_FORMAT_11N_B, BIT3|BIT2|BIT1, txMode); // set TXmod to standby mode to remove outside noise affect + ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_RPT_FORMAT_11N_B, BIT22|BIT21|BIT20, rxMode); // set RXmod to standby mode to remove outside noise affect + } + } + else if(pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) + { + ODM_SetBBReg(pDM_Odm, ODM_REG_TRMUX_11AC, BIT11|BIT10|BIT9|BIT8, txMode); // set TXmod to standby mode to remove outside noise affect + ODM_SetBBReg(pDM_Odm, ODM_REG_TRMUX_11AC, BIT7|BIT6|BIT5|BIT4, rxMode); // set RXmod to standby mode to remove outside noise affect + if(pDM_Odm->RFType > ODM_1T1R) + { + ODM_SetBBReg(pDM_Odm, ODM_REG_TRMUX_11AC_B, BIT11|BIT10|BIT9|BIT8, txMode); // set TXmod to standby mode to remove outside noise affect + ODM_SetBBReg(pDM_Odm, ODM_REG_TRMUX_11AC_B, BIT7|BIT6|BIT5|BIT4, rxMode); // set RXmod to standby mode to remove outside noise affect + } + } + +} + +VOID +Phydm_MACEDCCAState( + IN PVOID pDM_VOID, + IN PhyDM_MACEDCCA_Type State +) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + if(State == PhyDM_IGNORE_EDCCA) + { + ODM_SetMACReg(pDM_Odm, REG_TX_PTCL_CTRL, BIT15, 1); //ignore EDCCA reg520[15]=1 + ODM_SetMACReg(pDM_Odm, REG_RD_CTRL, BIT11, 0); //reg524[11]=0 + } + else // don't set MAC ignore EDCCA signal + { + ODM_SetMACReg(pDM_Odm, REG_TX_PTCL_CTRL, BIT15, 0); //don't ignore EDCCA reg520[15]=0 + ODM_SetMACReg(pDM_Odm, REG_RD_CTRL, BIT11, 1); //reg524[11]=1 + } + + pDM_Odm->EDCCA_enable_state = State; + + ODM_RT_TRACE(pDM_Odm,PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("EDCCA enable State = %d \n", State)); + +} + +BOOLEAN +Phydm_CalNHMcnt( + IN PVOID pDM_VOID +) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + u2Byte Base = 0; + + Base = pDM_Odm->NHM_cnt_0 + pDM_Odm->NHM_cnt_1; + + if(Base != 0) + { + pDM_Odm->NHM_cnt_0 = ((pDM_Odm->NHM_cnt_0) << 8) / Base; + pDM_Odm->NHM_cnt_1 = ((pDM_Odm->NHM_cnt_1) << 8) / Base; + } + if((pDM_Odm->NHM_cnt_0 - pDM_Odm->NHM_cnt_1) >= 100) + return TRUE; // clean environment + else + return FALSE; //noisy environment + +} + + +VOID +Phydm_CheckEnvironment( + IN PVOID pDM_VOID +) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + BOOLEAN isCleanEnvironment = FALSE; + u1Byte i, clean = 0; + + if(pDM_Odm->bFirstLink == TRUE) + { + pDM_Odm->adaptivity_flag = TRUE; + pDM_Odm->bFirstLink = FALSE; + return; + } + else + { + if(pDM_Odm->NHMWait < 3) // Start enter NHM after 4 NHMWait + { + pDM_Odm->NHMWait ++; + Phydm_NHMCounterStatistics(pDM_Odm); + return; + } + else + { + Phydm_NHMCounterStatistics(pDM_Odm); + isCleanEnvironment = Phydm_CalNHMcnt(pDM_Odm); + if(isCleanEnvironment == TRUE) + { + Phydm_MACEDCCAState(pDM_Odm, PhyDM_DONT_IGNORE_EDCCA); +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + pDM_Odm->TH_L2H_ini = pDM_Odm->TH_L2H_ini_backup; //mode 1 + pDM_Odm->TH_EDCCA_HL_diff= pDM_Odm->TH_EDCCA_HL_diff_backup; +#endif + pDM_Odm->adaptivity_flag = TRUE; + } + else + { +#if(DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) + Phydm_MACEDCCAState(pDM_Odm, PhyDM_IGNORE_EDCCA); +#else + Phydm_MACEDCCAState(pDM_Odm, PhyDM_DONT_IGNORE_EDCCA); + pDM_Odm->TH_L2H_ini = pDM_Odm->TH_L2H_ini_mode2; // for AP mode 2 + pDM_Odm->TH_EDCCA_HL_diff= pDM_Odm->TH_EDCCA_HL_diff_mode2; +#endif + pDM_Odm->adaptivity_flag = FALSE; + } + + pDM_Odm->bFirstLink = TRUE; + pDM_Odm->bCheck = TRUE; + } + + } + + +} + + +VOID +Phydm_NHMBB( + IN PVOID pDM_VOID +) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + BOOLEAN bCleanEnvironment; + + bCleanEnvironment = Phydm_CalNHMcnt(pDM_Odm); + + pDM_Odm->NHMCurTxOkcnt = *(pDM_Odm->pNumTxBytesUnicast) - pDM_Odm->NHMLastTxOkcnt; + pDM_Odm->NHMCurRxOkcnt = *(pDM_Odm->pNumRxBytesUnicast) - pDM_Odm->NHMLastRxOkcnt; + pDM_Odm->NHMLastTxOkcnt = *(pDM_Odm->pNumTxBytesUnicast); + pDM_Odm->NHMLastRxOkcnt = *(pDM_Odm->pNumRxBytesUnicast); + ODM_RT_TRACE(pDM_Odm,PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("cnt_0=%d, cnt_1=%d, bCleanEnvironment = %d, NHMCurTxOkcnt = %llu, NHMCurRxOkcnt = %llu\n", + pDM_Odm->NHM_cnt_0, pDM_Odm->NHM_cnt_1, bCleanEnvironment, pDM_Odm->NHMCurTxOkcnt, pDM_Odm->NHMCurRxOkcnt)); + + if(pDM_Odm->NHMWait < 4) // Start enter NHM after 4 NHMWait + { + pDM_Odm->NHMWait ++; + Phydm_MACEDCCAState(pDM_Odm, PhyDM_IGNORE_EDCCA); + } + else if ( ((pDM_Odm->NHMCurTxOkcnt>>10) > 2) && ((pDM_Odm->NHMCurTxOkcnt) + 1 > (u8Byte)(pDM_Odm->NHMCurRxOkcnt<<2) + 1)) //Tx > 4*Rx and Tx > 2Mb possible for adaptivity test + { + if(bCleanEnvironment == TRUE || pDM_Odm->adaptivity_flag == TRUE) + { + //Enable EDCCA since it is possible running Adaptivity testing + pDM_Odm->adaptivity_flag = TRUE; + Phydm_MACEDCCAState(pDM_Odm, PhyDM_DONT_IGNORE_EDCCA); + pDM_Odm->tolerance_cnt = 0; +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + pDM_Odm->TH_L2H_ini = pDM_Odm->TH_L2H_ini_backup; + pDM_Odm->TH_EDCCA_HL_diff = pDM_Odm->TH_EDCCA_HL_diff_backup ; +#endif + } + else + { + if(pDM_Odm->tolerance_cnt < 3) + pDM_Odm->tolerance_cnt ++; + else + { +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + pDM_Odm->TH_L2H_ini = pDM_Odm->TH_L2H_ini_mode2; + pDM_Odm->TH_EDCCA_HL_diff = pDM_Odm->TH_EDCCA_HL_diff_mode2 ; +#else + Phydm_MACEDCCAState(pDM_Odm, PhyDM_IGNORE_EDCCA); +#endif + pDM_Odm->adaptivity_flag = FALSE; + } + } + } + else // TXadaptivity_flag == TRUE && bCleanEnvironment == FALSE) + { + Phydm_MACEDCCAState(pDM_Odm, PhyDM_DONT_IGNORE_EDCCA); + pDM_Odm->tolerance_cnt = 0; +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + pDM_Odm->TH_L2H_ini = pDM_Odm->TH_L2H_ini_backup; + pDM_Odm->TH_EDCCA_HL_diff = pDM_Odm->TH_EDCCA_HL_diff_backup ; +#endif + } +#if(DM_ODM_SUPPORT_TYPE & ODM_AP) // for repeater mode add by YuChen 2014.06.23 +#ifdef UNIVERSAL_REPEATER + else if((bCleanEnvironment == TRUE) && (pDM_Odm->VXD_bLinked) && ((pDM_Odm->NHMCurTxOkcnt>>10) > 1)) // clean environment and VXD linked and Tx TP>1Mb + { + pDM_Odm->adaptivity_flag = TRUE; + Phydm_MACEDCCAState(pDM_Odm, PhyDM_DONT_IGNORE_EDCCA); + pDM_Odm->tolerance_cnt = 0; + pDM_Odm->TH_L2H_ini = pDM_Odm->TH_L2H_ini_backup; + pDM_Odm->TH_EDCCA_HL_diff = pDM_Odm->TH_EDCCA_HL_diff_backup ; + } +#endif +#endif // for repeater mode add by YuChen 2014.06.23 + else + { + if(pDM_Odm->tolerance_cnt < 3) + pDM_Odm->tolerance_cnt ++; + else + { +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + pDM_Odm->TH_L2H_ini = pDM_Odm->TH_L2H_ini_mode2; + pDM_Odm->TH_EDCCA_HL_diff = pDM_Odm->TH_EDCCA_HL_diff_mode2 ; +#else + Phydm_MACEDCCAState(pDM_Odm, PhyDM_IGNORE_EDCCA); +#endif + pDM_Odm->adaptivity_flag = FALSE; + } + } + } + + ODM_RT_TRACE(pDM_Odm,PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("adaptivity_flag = %d\n ", pDM_Odm->adaptivity_flag)); +} + +VOID +Phydm_SearchPwdBLowerBound( + IN PVOID pDM_VOID +) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + u4Byte value32 =0; + u1Byte cnt, IGI_Pause = 0x7f, IGI_Resume = 0x20, IGI = 0x50; //IGI = 0x50 for cal EDCCA lower bound + u1Byte txEdcca1 = 0, txEdcca0 = 0; + BOOLEAN bAdjust=TRUE; + s1Byte TH_L2H_dmc, TH_H2L_dmc, IGI_target = 0x32; + s1Byte Diff; + + Phydm_SetTRxMux(pDM_Odm, PhyDM_STANDBY_MODE, PhyDM_STANDBY_MODE); + ODM_Write_DIG(pDM_Odm, IGI_Pause); + + Diff = IGI_target -(s1Byte)IGI; + TH_L2H_dmc = pDM_Odm->TH_L2H_ini + Diff; + if(TH_L2H_dmc > 10) + TH_L2H_dmc = 10; + TH_H2L_dmc = TH_L2H_dmc - pDM_Odm->TH_EDCCA_HL_diff; + + Phydm_SetEDCCAThreshold(pDM_Odm, TH_H2L_dmc, TH_L2H_dmc); + ODM_delay_ms(5); + + while(bAdjust) + { + for(cnt=0; cnt<20; cnt ++) + { + if (pDM_Odm->SupportICType & ODM_IC_11N_SERIES) + value32 = ODM_GetBBReg(pDM_Odm,ODM_REG_RPT_11N, bMaskDWord); + else if(pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) + value32 = ODM_GetBBReg(pDM_Odm,ODM_REG_RPT_11AC, bMaskDWord); + + if (value32 & BIT30 && (pDM_Odm->SupportICType & (ODM_RTL8723A|ODM_RTL8723B|ODM_RTL8188E))) + txEdcca1 = txEdcca1 + 1; + else if(value32 & BIT29) + txEdcca1 = txEdcca1 + 1; + else + txEdcca0 = txEdcca0 + 1; + } + + if(txEdcca1 > 9 ) + { + IGI = IGI -1; + TH_L2H_dmc = TH_L2H_dmc + 1; + if(TH_L2H_dmc > 10) + TH_L2H_dmc = 10; + TH_H2L_dmc = TH_L2H_dmc - pDM_Odm->TH_EDCCA_HL_diff; + + Phydm_SetEDCCAThreshold(pDM_Odm, TH_H2L_dmc, TH_L2H_dmc); + + txEdcca1 = 0; + txEdcca0 = 0; + + if(TH_L2H_dmc == 10) + { + bAdjust = FALSE; + pDM_Odm->H2L_lb = TH_H2L_dmc; + pDM_Odm->L2H_lb = TH_L2H_dmc; + pDM_Odm->Adaptivity_IGI_upper = IGI; + } + } + else + { + bAdjust = FALSE; + pDM_Odm->H2L_lb = TH_H2L_dmc; + pDM_Odm->L2H_lb = TH_L2H_dmc; + pDM_Odm->Adaptivity_IGI_upper = IGI; + } + } + + Phydm_SetTRxMux(pDM_Odm, PhyDM_TX_MODE, PhyDM_RX_MODE); + ODM_Write_DIG(pDM_Odm, IGI_Resume); + Phydm_SetEDCCAThreshold(pDM_Odm, 0x7f, 0x7f); // resume to no link state +} + +VOID +Phydm_AdaptivityInit( + IN PVOID pDM_VOID +) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; +#if(DM_ODM_SUPPORT_TYPE == ODM_WIN) + PADAPTER pAdapter = pDM_Odm->Adapter; + PMGNT_INFO pMgntInfo = &(pAdapter->MgntInfo); + pDM_Odm->Carrier_Sense_enable = (BOOLEAN)pMgntInfo->RegEnableCarrierSense; + pDM_Odm->NHM_enable = (BOOLEAN)pMgntInfo->RegNHMEnable; + pDM_Odm->DynamicLinkAdaptivity = (BOOLEAN)pMgntInfo->RegDmLinkAdaptivity; +#elif(DM_ODM_SUPPORT_TYPE == ODM_CE) + pDM_Odm->Carrier_Sense_enable = (pDM_Odm->Adapter->registrypriv.adaptivity_mode!=0)?TRUE:FALSE; + pDM_Odm->NHM_enable = (BOOLEAN)pDM_Odm->Adapter->registrypriv.nhm_en; + pDM_Odm->DynamicLinkAdaptivity = FALSE; // Jeff please add this +#endif + +#if(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_WIN)) + + if(pDM_Odm->Carrier_Sense_enable == FALSE) + { +#if(DM_ODM_SUPPORT_TYPE == ODM_WIN) + if( pMgntInfo->RegL2HForAdaptivity != 0 ) + pDM_Odm->TH_L2H_ini = pMgntInfo->RegL2HForAdaptivity; + else +#endif + pDM_Odm->TH_L2H_ini = 0xf5; // -7 + } + else + { +#if(DM_ODM_SUPPORT_TYPE == ODM_WIN) + if( pMgntInfo->RegL2HForAdaptivity != 0 ) + pDM_Odm->TH_L2H_ini = pMgntInfo->RegL2HForAdaptivity; + else +#endif + pDM_Odm->TH_L2H_ini = 0xa; + } + + pDM_Odm->AdapEn_RSSI = 20; + +#if(DM_ODM_SUPPORT_TYPE == ODM_WIN) + if( pMgntInfo->RegHLDiffForAdaptivity != 0 ) + pDM_Odm->TH_EDCCA_HL_diff = pMgntInfo->RegHLDiffForAdaptivity; + else +#endif + pDM_Odm->TH_EDCCA_HL_diff = 7; + + ODM_RT_TRACE(pDM_Odm,PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("TH_L2H_ini = 0x%x, TH_EDCCA_HL_diff = 0x%x\n", pDM_Odm->TH_L2H_ini, pDM_Odm->TH_EDCCA_HL_diff)); + +#elif (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + prtl8192cd_priv priv = pDM_Odm->priv; + + if(pDM_Odm->Carrier_Sense_enable){ + pDM_Odm->TH_L2H_ini = 10; + pDM_Odm->TH_EDCCA_HL_diff = 7; + pDM_Odm->AdapEn_RSSI = 30; + } + else + { + pDM_Odm->TH_L2H_ini = pDM_Odm->TH_L2H_ini_backup; //set by mib + pDM_Odm->TH_EDCCA_HL_diff = 7; + pDM_Odm->AdapEn_RSSI = 20; + } + + pDM_Odm->TH_L2H_ini_mode2 = 20; + pDM_Odm->TH_EDCCA_HL_diff_mode2 = 8; + //pDM_Odm->TH_L2H_ini_backup = pDM_Odm->TH_L2H_ini; + pDM_Odm->TH_EDCCA_HL_diff_backup = pDM_Odm->TH_EDCCA_HL_diff ; + if(priv->pshare->rf_ft_var.adaptivity_enable == 2) + pDM_Odm->DynamicLinkAdaptivity = TRUE; + else + pDM_Odm->DynamicLinkAdaptivity = FALSE; +// pDM_Odm->NHM_enable = FALSE; +#endif + + pDM_Odm->IGI_Base = 0x32; + pDM_Odm->IGI_target = 0x1c; + pDM_Odm->ForceEDCCA = 0; + pDM_Odm->H2L_lb= 0; + pDM_Odm->L2H_lb= 0; + pDM_Odm->Adaptivity_IGI_upper = 0; + pDM_Odm->NHMWait = 0; + Phydm_NHMBBInit(pDM_Odm); + pDM_Odm->bCheck = FALSE; + pDM_Odm->bFirstLink = TRUE; + pDM_Odm->bAdaOn = TRUE; + + ODM_SetBBReg(pDM_Odm, REG_RD_CTRL, BIT11, 1); // stop counting if EDCCA is asserted + + //Search pwdB lower bound + { + if (pDM_Odm->SupportICType & ODM_IC_11N_SERIES) + ODM_SetBBReg(pDM_Odm,ODM_REG_DBG_RPT_11N, bMaskDWord, 0x208); + else if(pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) + ODM_SetBBReg(pDM_Odm,ODM_REG_DBG_RPT_11AC, bMaskDWord, 0x209); + Phydm_SearchPwdBLowerBound(pDM_Odm); + } + Phydm_MACEDCCAState(pDM_Odm, PhyDM_IGNORE_EDCCA); +} + + +BOOLEAN +Phydm_Adaptivity( + IN PVOID pDM_VOID, + IN u1Byte IGI +) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + s1Byte TH_L2H_dmc, TH_H2L_dmc, L2H_nolink_Band4 = 0x7f, H2L_nolink_Band4 = 0x7f; + s1Byte Diff, IGI_target; + BOOLEAN EDCCA_State = FALSE; + +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + PADAPTER pAdapter = pDM_Odm->Adapter; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + BOOLEAN bFwCurrentInPSMode=FALSE; + PMGNT_INFO pMgntInfo = &(pAdapter->MgntInfo); + + pAdapter->HalFunc.GetHwRegHandler(pAdapter, HW_VAR_FW_PSMODE_STATUS, (pu1Byte)(&bFwCurrentInPSMode)); + + // Disable EDCCA mode while under LPS mode, added by Roger, 2012.09.14. + if(bFwCurrentInPSMode) + return FALSE; +#endif + + if(!(pDM_Odm->SupportAbility & ODM_BB_ADAPTIVITY)) + { + ODM_RT_TRACE(pDM_Odm,PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("Go to odm_DynamicEDCCA() \n")); + // Add by Neil Chen to enable edcca to MP Platform +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + // Adjust EDCCA. + if(pDM_Odm->SupportICType & ODM_IC_11N_SERIES) + Phydm_DynamicEDCCA(pDM_Odm); +#endif + return FALSE; + } + +#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + if(pMgntInfo->RegEnableAdaptivity== 2) +#else + if (pDM_Odm->Adapter->registrypriv.adaptivity_en == 2) +#endif + { + if(pDM_Odm->Carrier_Sense_enable == FALSE) // check domain Code for Adaptivity or CarrierSense + { + if ((*pDM_Odm->pBandType == ODM_BAND_5G) && + !(pDM_Odm->odm_Regulation5G == REGULATION_ETSI || pDM_Odm->odm_Regulation5G == REGULATION_WW)) + { + ODM_RT_TRACE(pDM_Odm,PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("Adaptivity skip 5G domain code : %d \n", pDM_Odm->odm_Regulation5G)); + return FALSE; + } + + else if((*pDM_Odm->pBandType == ODM_BAND_2_4G) && + !(pDM_Odm->odm_Regulation2_4G == REGULATION_ETSI || pDM_Odm->odm_Regulation2_4G == REGULATION_WW)) + { + ODM_RT_TRACE(pDM_Odm,PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("Adaptivity skip 2.4G domain code : %d \n", pDM_Odm->odm_Regulation2_4G)); + return FALSE; + + } + else if ((*pDM_Odm->pBandType != ODM_BAND_2_4G) && (*pDM_Odm->pBandType != ODM_BAND_5G)) + { + ODM_RT_TRACE(pDM_Odm,PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("Adaptivity neither 2G nor 5G band, return\n")); + return FALSE; + } + } + else + { + if ((*pDM_Odm->pBandType == ODM_BAND_5G) && + !(pDM_Odm->odm_Regulation5G == REGULATION_ETSI || pDM_Odm->odm_Regulation5G == REGULATION_WW)) + { + ODM_RT_TRACE(pDM_Odm,PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("CarrierSense skip 5G domain code : %d\n", pDM_Odm->odm_Regulation5G)); + return FALSE; + } + + else if((*pDM_Odm->pBandType == ODM_BAND_2_4G) && + !(pDM_Odm->odm_Regulation2_4G == REGULATION_ETSI || pDM_Odm->odm_Regulation2_4G == REGULATION_WW)) + { + ODM_RT_TRACE(pDM_Odm,PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("CarrierSense skip 2.4G domain code : %d\n", pDM_Odm->odm_Regulation2_4G)); + return FALSE; + + } + else if ((*pDM_Odm->pBandType != ODM_BAND_2_4G) && (*pDM_Odm->pBandType != ODM_BAND_5G)) + { + ODM_RT_TRACE(pDM_Odm,PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("CarrierSense neither 2G nor 5G band, return\n")); + return FALSE; + } + } + } +#endif + + + ODM_RT_TRACE(pDM_Odm,PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("odm_Adaptivity() =====> \n")); + ODM_RT_TRACE(pDM_Odm,PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("ForceEDCCA=%d, IGI_Base=0x%x, TH_L2H_ini = %d, TH_EDCCA_HL_diff = %d, AdapEn_RSSI = %d\n", + pDM_Odm->ForceEDCCA, pDM_Odm->IGI_Base, pDM_Odm->TH_L2H_ini, pDM_Odm->TH_EDCCA_HL_diff, pDM_Odm->AdapEn_RSSI)); + + if(pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) + ODM_SetBBReg(pDM_Odm, 0x800, BIT10, 0); //ADC_mask enable + + if(*pDM_Odm->pBandWidth == ODM_BW20M) //CHANNEL_WIDTH_20 + IGI_target = pDM_Odm->IGI_Base; + else if(*pDM_Odm->pBandWidth == ODM_BW40M) + IGI_target = pDM_Odm->IGI_Base + 2; + else if(*pDM_Odm->pBandWidth == ODM_BW80M) + IGI_target = pDM_Odm->IGI_Base + 2; + else + IGI_target = pDM_Odm->IGI_Base; + pDM_Odm->IGI_target = (u1Byte) IGI_target; + + if(*pDM_Odm->pChannel >= 149) // Band4 -> for AP : mode2, for sd4 and sd7 : turnoff adaptivity + { +#if (DM_ODM_SUPPORT_TYPE & ODM_AP) + if(pDM_Odm->bLinked) + { + Diff = IGI_target -(s1Byte)IGI; + L2H_nolink_Band4 = pDM_Odm->TH_L2H_ini_mode2 + Diff; + if(L2H_nolink_Band4 > 10) + L2H_nolink_Band4 = 10; + H2L_nolink_Band4 = L2H_nolink_Band4 - pDM_Odm->TH_EDCCA_HL_diff_mode2; + } +#endif + Phydm_SetEDCCAThreshold(pDM_Odm, H2L_nolink_Band4, L2H_nolink_Band4); + return FALSE; + } + + if(!pDM_Odm->ForceEDCCA) + { + if(pDM_Odm->RSSI_Min > pDM_Odm->AdapEn_RSSI) + EDCCA_State = 1; + else if(pDM_Odm->RSSI_Min < (pDM_Odm->AdapEn_RSSI - 5)) + EDCCA_State = 0; + } + else + EDCCA_State = 1; + + if(pDM_Odm->Carrier_Sense_enable == FALSE && pDM_Odm->NHM_enable == TRUE) + Phydm_NHMBB(pDM_Odm); + + ODM_RT_TRACE(pDM_Odm,PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("BandWidth=%s, IGI_target=0x%x, EDCCA_State=%d, EDCCA_enable_state = %d\n", + (*pDM_Odm->pBandWidth==ODM_BW80M)?"80M":((*pDM_Odm->pBandWidth==ODM_BW40M)?"40M":"20M"), IGI_target, EDCCA_State, pDM_Odm->EDCCA_enable_state)); + ODM_RT_TRACE(pDM_Odm,PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("RSSI_min = %d, AdapIGIUpper= 0x %x\n", pDM_Odm->RSSI_Min, pDM_Odm->Adaptivity_IGI_upper)); + + + if(EDCCA_State == 1) + { + Diff = IGI_target -(s1Byte)IGI; + TH_L2H_dmc = pDM_Odm->TH_L2H_ini + Diff; + if(TH_L2H_dmc > 10) + TH_L2H_dmc = 10; + + TH_H2L_dmc = TH_L2H_dmc - pDM_Odm->TH_EDCCA_HL_diff; + + //replace lower bound to prevent EDCCA always equal 1 + if(TH_H2L_dmc < pDM_Odm->H2L_lb) + TH_H2L_dmc = pDM_Odm->H2L_lb; + if(TH_L2H_dmc < pDM_Odm->L2H_lb) + TH_L2H_dmc = pDM_Odm->L2H_lb; + } + else + { + TH_L2H_dmc = 0x7f; + TH_H2L_dmc = 0x7f; + } + ODM_RT_TRACE(pDM_Odm,PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("IGI=0x%x, TH_L2H_dmc = %d, TH_H2L_dmc = %d, adaptivity_flg = %d, bAdaOn = %d, DynamicLinkAdaptivity = %d, NHM_enable = %d\n", + IGI, TH_L2H_dmc, TH_H2L_dmc, pDM_Odm->adaptivity_flag, pDM_Odm->bAdaOn, pDM_Odm->DynamicLinkAdaptivity, pDM_Odm->NHM_enable)); + + Phydm_SetEDCCAThreshold(pDM_Odm, TH_H2L_dmc, TH_L2H_dmc); + return TRUE; +} + + +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) +VOID +Phydm_EnableEDCCA( + IN PVOID pDM_VOID +) +{ + + // This should be moved out of OUTSRC + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + PADAPTER pAdapter = pDM_Odm->Adapter; + // Enable EDCCA. The value is suggested by SD3 Wilson. + + // + // Revised for ASUS 11b/g performance issues, suggested by BB Neil, 2012.04.13. + // + if((pDM_Odm->SupportICType == ODM_RTL8723A)&&(IS_WIRELESS_MODE_G(pAdapter))) + { + //PlatformEFIOWrite1Byte(Adapter, rOFDM0_ECCAThreshold, 0x00); + ODM_Write1Byte(pDM_Odm,rOFDM0_ECCAThreshold,0x00); + ODM_Write1Byte(pDM_Odm,rOFDM0_ECCAThreshold+2,0xFD); + + } + else + { + //PlatformEFIOWrite1Byte(Adapter, rOFDM0_ECCAThreshold, 0x03); + ODM_Write1Byte(pDM_Odm,rOFDM0_ECCAThreshold,0x03); + ODM_Write1Byte(pDM_Odm,rOFDM0_ECCAThreshold+2,0x00); + } + + //PlatformEFIOWrite1Byte(Adapter, rOFDM0_ECCAThreshold+2, 0x00); +} + +VOID +Phydm_DisableEDCCA( + IN PVOID pDM_VOID +) +{ + // Disable EDCCA.. + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + ODM_Write1Byte(pDM_Odm, rOFDM0_ECCAThreshold, 0x7f); + ODM_Write1Byte(pDM_Odm, rOFDM0_ECCAThreshold+2, 0x7f); +} + +// +// Description: According to initial gain value to determine to enable or disable EDCCA. +// +// Suggested by SD3 Wilson. Added by tynli. 2011.11.25. +// +VOID +Phydm_DynamicEDCCA( + IN PVOID pDM_VOID +) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + PADAPTER pAdapter = pDM_Odm->Adapter; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + u1Byte RegC50, RegC58; + BOOLEAN bEDCCAenable = FALSE; + +#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN)) + BOOLEAN bFwCurrentInPSMode=FALSE; + + pAdapter->HalFunc.GetHwRegHandler(pAdapter, HW_VAR_FW_PSMODE_STATUS, (pu1Byte)(&bFwCurrentInPSMode)); + + // Disable EDCCA mode while under LPS mode, added by Roger, 2012.09.14. + if(bFwCurrentInPSMode) + return; +#endif + // + // 2013/11/14 Ken According to BB team Jame's suggestion, we need to disable soft AP mode EDCCA. + // 2014/01/08 MH For Miracst AP mode test. We need to disable EDCCA. Otherwise, we may stop + // to send beacon in noisy environment or platform. + // + if(ACTING_AS_AP(pAdapter) || ACTING_AS_AP(GetFirstAPAdapter(pAdapter))) + //if(ACTING_AS_AP(pAdapter)) + { + ODM_RT_TRACE(pDM_Odm,PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("At least One Port as AP disable EDCCA\n")); + Phydm_DisableEDCCA(pDM_Odm); + if(pHalData->bPreEdccaEnable) + Phydm_DisableEDCCA(pDM_Odm); + pHalData->bPreEdccaEnable = FALSE; + return; + } + + RegC50 = (u1Byte)ODM_GetBBReg(pDM_Odm, rOFDM0_XAAGCCore1, bMaskByte0); + RegC58 = (u1Byte)ODM_GetBBReg(pDM_Odm, rOFDM0_XBAGCCore1, bMaskByte0); + + + if((RegC50 > 0x28 && RegC58 > 0x28) || + ((pDM_Odm->SupportICType == ODM_RTL8723A && IS_WIRELESS_MODE_G(pAdapter) && RegC50>0x26)) || + (pDM_Odm->SupportICType == ODM_RTL8188E && RegC50 > 0x28)) + { + if(!pHalData->bPreEdccaEnable) + { + Phydm_EnableEDCCA(pDM_Odm); + pHalData->bPreEdccaEnable = TRUE; + } + + } + else if((RegC50 < 0x25 && RegC58 < 0x25) || (pDM_Odm->SupportICType == ODM_RTL8188E && RegC50 < 0x25)) + { + if(pHalData->bPreEdccaEnable) + { + Phydm_DisableEDCCA(pDM_Odm); + pHalData->bPreEdccaEnable = FALSE; + } + } +} + +#endif diff --git a/hal/OUTSRC/PhyDM_Adaptivity.h b/hal/OUTSRC/PhyDM_Adaptivity.h new file mode 100644 index 0000000..e586ac8 --- /dev/null +++ b/hal/OUTSRC/PhyDM_Adaptivity.h @@ -0,0 +1,146 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA + * + * + ******************************************************************************/ + +#ifndef __PHYDMADAPTIVITY_H__ +#define __PHYDMADAPTIVITY_H__ + +#define ADAPTIVITY_VERSION "7.1" + +#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) +typedef enum _tag_PhyDM_REGULATION_Type { + REGULATION_FCC = 0, + REGULATION_MKK = 1, + REGULATION_ETSI = 2, + REGULATION_WW = 3, + + MAX_REGULATION_NUM = 4 +} PhyDM_REGULATION_TYPE; +#endif + +typedef enum tag_PhyDM_TRx_MUX_Type +{ + PhyDM_SHUTDOWN = 0, + PhyDM_STANDBY_MODE = 1, + PhyDM_TX_MODE = 2, + PhyDM_RX_MODE = 3 +}PhyDM_Trx_MUX_Type; + +typedef enum tag_PhyDM_MACEDCCA_Type +{ + PhyDM_IGNORE_EDCCA = 0, + PhyDM_DONT_IGNORE_EDCCA = 1 +}PhyDM_MACEDCCA_Type; + + +VOID +Phydm_CheckAdaptivity( + IN PVOID pDM_VOID + ); + +VOID +Phydm_CheckEnvironment( + IN PVOID pDM_VOID + ); + +VOID +Phydm_NHMCounterStatisticsInit( + IN PVOID pDM_VOID + ); + +VOID +Phydm_NHMCounterStatistics( + IN PVOID pDM_VOID + ); + +VOID +Phydm_NHMBBInit( + IN PVOID pDM_VOID +); + +VOID +Phydm_NHMBB( + IN PVOID pDM_VOID +); + +VOID +Phydm_NHMCounterStatisticsReset( + IN PVOID pDM_VOID +); + +VOID +Phydm_GetNHMCounterStatistics( + IN PVOID pDM_VOID +); + +VOID +Phydm_MACEDCCAState( + IN PVOID pDM_VOID, + IN PhyDM_MACEDCCA_Type State +); + +VOID +Phydm_SetEDCCAThreshold( + IN PVOID pDM_VOID, + IN s1Byte H2L, + IN s1Byte L2H +); + +VOID +Phydm_SetTRxMux( + IN PVOID pDM_VOID, + IN PhyDM_Trx_MUX_Type txMode, + IN PhyDM_Trx_MUX_Type rxMode +); + +BOOLEAN +Phydm_CalNHMcnt( + IN PVOID pDM_VOID +); + +VOID +Phydm_SearchPwdBLowerBound( + IN PVOID pDM_VOID +); + +VOID +Phydm_AdaptivityInit( + IN PVOID pDM_VOID + ); + +BOOLEAN +Phydm_Adaptivity( + IN PVOID pDM_VOID, + IN u1Byte IGI + ); + +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) +VOID +Phydm_DisableEDCCA( + IN PVOID pDM_VOID +); + +VOID +Phydm_DynamicEDCCA( + IN PVOID pDM_VOID +); +#endif + + +#endif diff --git a/hal/OUTSRC/odm.c b/hal/OUTSRC/odm.c index e4668f5..143c574 100644 --- a/hal/OUTSRC/odm.c +++ b/hal/OUTSRC/odm.c @@ -22,6 +22,7 @@ // include files //============================================================ +#include "Mp_Precomp.h" #include "odm_precomp.h" @@ -36,725 +37,44 @@ const u2Byte dB_Invert_Table[8][12] = { { 17783, 19953, 22387, 25119, 28184, 31623, 35481, 39811, 44668, 50119, 56234, 65535}}; -#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) -static u4Byte edca_setting_UL[HT_IOT_PEER_MAX] = -// UNKNOWN REALTEK_90 REALTEK_92SE BROADCOM RALINK ATHEROS CISCO MERU MARVELL 92U_AP SELF_AP(DownLink/Tx) -{ 0x5e4322, 0xa44f, 0x5e4322, 0x5ea32b, 0x5ea422, 0x5ea322, 0x3ea430, 0x5ea42b, 0x5ea44f, 0x5e4322, 0x5e4322}; - - -static u4Byte edca_setting_DL[HT_IOT_PEER_MAX] = -// UNKNOWN REALTEK_90 REALTEK_92SE BROADCOM RALINK ATHEROS CISCO MERU, MARVELL 92U_AP SELF_AP(UpLink/Rx) -{ 0xa44f, 0x5ea44f, 0x5e4322, 0x5ea42b, 0xa44f, 0xa630, 0x5ea630, 0x5ea42b, 0xa44f, 0xa42b, 0xa42b}; - -static u4Byte edca_setting_DL_GMode[HT_IOT_PEER_MAX] = -// UNKNOWN REALTEK_90 REALTEK_92SE BROADCOM RALINK ATHEROS CISCO MERU, MARVELL 92U_AP SELF_AP -{ 0x4322, 0xa44f, 0x5e4322, 0xa42b, 0x5e4322, 0x4322, 0xa42b, 0x5ea42b, 0xa44f, 0x5e4322, 0x5ea42b}; - - -//============================================================ -// EDCA Paramter for AP/ADSL by Mingzhi 2011-11-22 -//============================================================ -#elif (DM_ODM_SUPPORT_TYPE &ODM_ADSL) -enum qos_prio { BK, BE, VI, VO, VI_AG, VO_AG }; - -static const struct ParaRecord rtl_ap_EDCA[] = -{ -//ACM,AIFSN, ECWmin, ECWmax, TXOplimit - {0, 7, 4, 10, 0}, //BK - {0, 3, 4, 6, 0}, //BE - {0, 1, 3, 4, 188}, //VI - {0, 1, 2, 3, 102}, //VO - {0, 1, 3, 4, 94}, //VI_AG - {0, 1, 2, 3, 47}, //VO_AG -}; - -static const struct ParaRecord rtl_sta_EDCA[] = -{ -//ACM,AIFSN, ECWmin, ECWmax, TXOplimit - {0, 7, 4, 10, 0}, - {0, 3, 4, 10, 0}, - {0, 2, 3, 4, 188}, - {0, 2, 2, 3, 102}, - {0, 2, 3, 4, 94}, - {0, 2, 2, 3, 47}, -}; -#endif - -//============================================================ -// Global var -//============================================================ - -u4Byte OFDMSwingTable[OFDM_TABLE_SIZE] = { - 0x7f8001fe, // 0, +6.0dB - 0x788001e2, // 1, +5.5dB - 0x71c001c7, // 2, +5.0dB - 0x6b8001ae, // 3, +4.5dB - 0x65400195, // 4, +4.0dB - 0x5fc0017f, // 5, +3.5dB - 0x5a400169, // 6, +3.0dB - 0x55400155, // 7, +2.5dB - 0x50800142, // 8, +2.0dB - 0x4c000130, // 9, +1.5dB - 0x47c0011f, // 10, +1.0dB - 0x43c0010f, // 11, +0.5dB - 0x40000100, // 12, +0dB - 0x3c8000f2, // 13, -0.5dB - 0x390000e4, // 14, -1.0dB - 0x35c000d7, // 15, -1.5dB - 0x32c000cb, // 16, -2.0dB - 0x300000c0, // 17, -2.5dB - 0x2d4000b5, // 18, -3.0dB - 0x2ac000ab, // 19, -3.5dB - 0x288000a2, // 20, -4.0dB - 0x26000098, // 21, -4.5dB - 0x24000090, // 22, -5.0dB - 0x22000088, // 23, -5.5dB - 0x20000080, // 24, -6.0dB - 0x1e400079, // 25, -6.5dB - 0x1c800072, // 26, -7.0dB - 0x1b00006c, // 27. -7.5dB - 0x19800066, // 28, -8.0dB - 0x18000060, // 29, -8.5dB - 0x16c0005b, // 30, -9.0dB - 0x15800056, // 31, -9.5dB - 0x14400051, // 32, -10.0dB - 0x1300004c, // 33, -10.5dB - 0x12000048, // 34, -11.0dB - 0x11000044, // 35, -11.5dB - 0x10000040, // 36, -12.0dB -}; - -u1Byte CCKSwingTable_Ch1_Ch13[CCK_TABLE_SIZE][8] = { - {0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04}, // 0, +0dB - {0x33, 0x32, 0x2b, 0x23, 0x1a, 0x11, 0x08, 0x04}, // 1, -0.5dB - {0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x03}, // 2, -1.0dB - {0x2d, 0x2d, 0x27, 0x1f, 0x18, 0x0f, 0x08, 0x03}, // 3, -1.5dB - {0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03}, // 4, -2.0dB - {0x28, 0x28, 0x22, 0x1c, 0x15, 0x0d, 0x07, 0x03}, // 5, -2.5dB - {0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03}, // 6, -3.0dB - {0x24, 0x23, 0x1f, 0x19, 0x13, 0x0c, 0x06, 0x03}, // 7, -3.5dB - {0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02}, // 8, -4.0dB - {0x20, 0x20, 0x1b, 0x16, 0x11, 0x08, 0x05, 0x02}, // 9, -4.5dB - {0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02}, // 10, -5.0dB - {0x1d, 0x1c, 0x18, 0x14, 0x0f, 0x0a, 0x05, 0x02}, // 11, -5.5dB - {0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02}, // 12, -6.0dB <== default - {0x1a, 0x19, 0x16, 0x12, 0x0d, 0x09, 0x04, 0x02}, // 13, -6.5dB - {0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02}, // 14, -7.0dB - {0x17, 0x16, 0x13, 0x10, 0x0c, 0x08, 0x04, 0x02}, // 15, -7.5dB - {0x16, 0x15, 0x12, 0x0f, 0x0b, 0x07, 0x04, 0x01}, // 16, -8.0dB - {0x14, 0x14, 0x11, 0x0e, 0x0b, 0x07, 0x03, 0x02}, // 17, -8.5dB - {0x13, 0x13, 0x10, 0x0d, 0x0a, 0x06, 0x03, 0x01}, // 18, -9.0dB - {0x12, 0x12, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, // 19, -9.5dB - {0x11, 0x11, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, // 20, -10.0dB - {0x10, 0x10, 0x0e, 0x0b, 0x08, 0x05, 0x03, 0x01}, // 21, -10.5dB - {0x0f, 0x0f, 0x0d, 0x0b, 0x08, 0x05, 0x03, 0x01}, // 22, -11.0dB - {0x0e, 0x0e, 0x0c, 0x0a, 0x08, 0x05, 0x02, 0x01}, // 23, -11.5dB - {0x0d, 0x0d, 0x0c, 0x0a, 0x07, 0x05, 0x02, 0x01}, // 24, -12.0dB - {0x0d, 0x0c, 0x0b, 0x09, 0x07, 0x04, 0x02, 0x01}, // 25, -12.5dB - {0x0c, 0x0c, 0x0a, 0x09, 0x06, 0x04, 0x02, 0x01}, // 26, -13.0dB - {0x0b, 0x0b, 0x0a, 0x08, 0x06, 0x04, 0x02, 0x01}, // 27, -13.5dB - {0x0b, 0x0a, 0x09, 0x08, 0x06, 0x04, 0x02, 0x01}, // 28, -14.0dB - {0x0a, 0x0a, 0x09, 0x07, 0x05, 0x03, 0x02, 0x01}, // 29, -14.5dB - {0x0a, 0x09, 0x08, 0x07, 0x05, 0x03, 0x02, 0x01}, // 30, -15.0dB - {0x09, 0x09, 0x08, 0x06, 0x05, 0x03, 0x01, 0x01}, // 31, -15.5dB - {0x09, 0x08, 0x07, 0x06, 0x04, 0x03, 0x01, 0x01} // 32, -16.0dB -}; - - -u1Byte CCKSwingTable_Ch14[CCK_TABLE_SIZE][8] = { - {0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00}, // 0, +0dB - {0x33, 0x32, 0x2b, 0x19, 0x00, 0x00, 0x00, 0x00}, // 1, -0.5dB - {0x30, 0x2f, 0x29, 0x18, 0x00, 0x00, 0x00, 0x00}, // 2, -1.0dB - {0x2d, 0x2d, 0x17, 0x17, 0x00, 0x00, 0x00, 0x00}, // 3, -1.5dB - {0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00}, // 4, -2.0dB - {0x28, 0x28, 0x24, 0x14, 0x00, 0x00, 0x00, 0x00}, // 5, -2.5dB - {0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00}, // 6, -3.0dB - {0x24, 0x23, 0x1f, 0x12, 0x00, 0x00, 0x00, 0x00}, // 7, -3.5dB - {0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00}, // 8, -4.0dB - {0x20, 0x20, 0x1b, 0x10, 0x00, 0x00, 0x00, 0x00}, // 9, -4.5dB - {0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00}, // 10, -5.0dB - {0x1d, 0x1c, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00}, // 11, -5.5dB - {0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00}, // 12, -6.0dB <== default - {0x1a, 0x19, 0x16, 0x0d, 0x00, 0x00, 0x00, 0x00}, // 13, -6.5dB - {0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00}, // 14, -7.0dB - {0x17, 0x16, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x00}, // 15, -7.5dB - {0x16, 0x15, 0x12, 0x0b, 0x00, 0x00, 0x00, 0x00}, // 16, -8.0dB - {0x14, 0x14, 0x11, 0x0a, 0x00, 0x00, 0x00, 0x00}, // 17, -8.5dB - {0x13, 0x13, 0x10, 0x0a, 0x00, 0x00, 0x00, 0x00}, // 18, -9.0dB - {0x12, 0x12, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, // 19, -9.5dB - {0x11, 0x11, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, // 20, -10.0dB - {0x10, 0x10, 0x0e, 0x08, 0x00, 0x00, 0x00, 0x00}, // 21, -10.5dB - {0x0f, 0x0f, 0x0d, 0x08, 0x00, 0x00, 0x00, 0x00}, // 22, -11.0dB - {0x0e, 0x0e, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, // 23, -11.5dB - {0x0d, 0x0d, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, // 24, -12.0dB - {0x0d, 0x0c, 0x0b, 0x06, 0x00, 0x00, 0x00, 0x00}, // 25, -12.5dB - {0x0c, 0x0c, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, // 26, -13.0dB - {0x0b, 0x0b, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, // 27, -13.5dB - {0x0b, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, // 28, -14.0dB - {0x0a, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, // 29, -14.5dB - {0x0a, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, // 30, -15.0dB - {0x09, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, // 31, -15.5dB - {0x09, 0x08, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00} // 32, -16.0dB -}; - - -u4Byte OFDMSwingTable_New[OFDM_TABLE_SIZE] = { - 0x0b40002d, // 0, -15.0dB - 0x0c000030, // 1, -14.5dB - 0x0cc00033, // 2, -14.0dB - 0x0d800036, // 3, -13.5dB - 0x0e400039, // 4, -13.0dB - 0x0f00003c, // 5, -12.5dB - 0x10000040, // 6, -12.0dB - 0x11000044, // 7, -11.5dB - 0x12000048, // 8, -11.0dB - 0x1300004c, // 9, -10.5dB - 0x14400051, // 10, -10.0dB - 0x15800056, // 11, -9.5dB - 0x16c0005b, // 12, -9.0dB - 0x18000060, // 13, -8.5dB - 0x19800066, // 14, -8.0dB - 0x1b00006c, // 15, -7.5dB - 0x1c800072, // 16, -7.0dB - 0x1e400079, // 17, -6.5dB - 0x20000080, // 18, -6.0dB - 0x22000088, // 19, -5.5dB - 0x24000090, // 20, -5.0dB - 0x26000098, // 21, -4.5dB - 0x288000a2, // 22, -4.0dB - 0x2ac000ab, // 23, -3.5dB - 0x2d4000b5, // 24, -3.0dB - 0x300000c0, // 25, -2.5dB - 0x32c000cb, // 26, -2.0dB - 0x35c000d7, // 27, -1.5dB - 0x390000e4, // 28, -1.0dB - 0x3c8000f2, // 29, -0.5dB - 0x40000100, // 30, +0dB - 0x43c0010f, // 31, +0.5dB - 0x47c0011f, // 32, +1.0dB - 0x4c000130, // 33, +1.5dB - 0x50800142, // 34, +2.0dB - 0x55400155, // 35, +2.5dB - 0x5a400169, // 36, +3.0dB - 0x5fc0017f, // 37, +3.5dB - 0x65400195, // 38, +4.0dB - 0x6b8001ae, // 39, +4.5dB - 0x71c001c7, // 40, +5.0dB - 0x788001e2, // 41, +5.5dB - 0x7f8001fe // 42, +6.0dB -}; - - -u1Byte CCKSwingTable_Ch1_Ch13_New[CCK_TABLE_SIZE][8] = { - {0x09, 0x08, 0x07, 0x06, 0x04, 0x03, 0x01, 0x01}, // 0, -16.0dB - {0x09, 0x09, 0x08, 0x06, 0x05, 0x03, 0x01, 0x01}, // 1, -15.5dB - {0x0a, 0x09, 0x08, 0x07, 0x05, 0x03, 0x02, 0x01}, // 2, -15.0dB - {0x0a, 0x0a, 0x09, 0x07, 0x05, 0x03, 0x02, 0x01}, // 3, -14.5dB - {0x0b, 0x0a, 0x09, 0x08, 0x06, 0x04, 0x02, 0x01}, // 4, -14.0dB - {0x0b, 0x0b, 0x0a, 0x08, 0x06, 0x04, 0x02, 0x01}, // 5, -13.5dB - {0x0c, 0x0c, 0x0a, 0x09, 0x06, 0x04, 0x02, 0x01}, // 6, -13.0dB - {0x0d, 0x0c, 0x0b, 0x09, 0x07, 0x04, 0x02, 0x01}, // 7, -12.5dB - {0x0d, 0x0d, 0x0c, 0x0a, 0x07, 0x05, 0x02, 0x01}, // 8, -12.0dB - {0x0e, 0x0e, 0x0c, 0x0a, 0x08, 0x05, 0x02, 0x01}, // 9, -11.5dB - {0x0f, 0x0f, 0x0d, 0x0b, 0x08, 0x05, 0x03, 0x01}, // 10, -11.0dB - {0x10, 0x10, 0x0e, 0x0b, 0x08, 0x05, 0x03, 0x01}, // 11, -10.5dB - {0x11, 0x11, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, // 12, -10.0dB - {0x12, 0x12, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, // 13, -9.5dB - {0x13, 0x13, 0x10, 0x0d, 0x0a, 0x06, 0x03, 0x01}, // 14, -9.0dB - {0x14, 0x14, 0x11, 0x0e, 0x0b, 0x07, 0x03, 0x02}, // 15, -8.5dB - {0x16, 0x15, 0x12, 0x0f, 0x0b, 0x07, 0x04, 0x01}, // 16, -8.0dB - {0x17, 0x16, 0x13, 0x10, 0x0c, 0x08, 0x04, 0x02}, // 17, -7.5dB - {0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02}, // 18, -7.0dB - {0x1a, 0x19, 0x16, 0x12, 0x0d, 0x09, 0x04, 0x02}, // 19, -6.5dB - {0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02}, // 20, -6.0dB - {0x1d, 0x1c, 0x18, 0x14, 0x0f, 0x0a, 0x05, 0x02}, // 21, -5.5dB - {0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02}, // 22, -5.0dB - {0x20, 0x20, 0x1b, 0x16, 0x11, 0x08, 0x05, 0x02}, // 23, -4.5dB - {0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02}, // 24, -4.0dB - {0x24, 0x23, 0x1f, 0x19, 0x13, 0x0c, 0x06, 0x03}, // 25, -3.5dB - {0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03}, // 26, -3.0dB - {0x28, 0x28, 0x22, 0x1c, 0x15, 0x0d, 0x07, 0x03}, // 27, -2.5dB - {0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03}, // 28, -2.0dB - {0x2d, 0x2d, 0x27, 0x1f, 0x18, 0x0f, 0x08, 0x03}, // 29, -1.5dB - {0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x03}, // 30, -1.0dB - {0x33, 0x32, 0x2b, 0x23, 0x1a, 0x11, 0x08, 0x04}, // 31, -0.5dB - {0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04} // 32, +0dB -}; - - -u1Byte CCKSwingTable_Ch14_New[CCK_TABLE_SIZE][8]= { - {0x09, 0x08, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00}, // 0, -16.0dB - {0x09, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, // 1, -15.5dB - {0x0a, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, // 2, -15.0dB - {0x0a, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, // 3, -14.5dB - {0x0b, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, // 4, -14.0dB - {0x0b, 0x0b, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, // 5, -13.5dB - {0x0c, 0x0c, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, // 6, -13.0dB - {0x0d, 0x0c, 0x0b, 0x06, 0x00, 0x00, 0x00, 0x00}, // 7, -12.5dB - {0x0d, 0x0d, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, // 8, -12.0dB - {0x0e, 0x0e, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, // 9, -11.5dB - {0x0f, 0x0f, 0x0d, 0x08, 0x00, 0x00, 0x00, 0x00}, // 10, -11.0dB - {0x10, 0x10, 0x0e, 0x08, 0x00, 0x00, 0x00, 0x00}, // 11, -10.5dB - {0x11, 0x11, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, // 12, -10.0dB - {0x12, 0x12, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, // 13, -9.5dB - {0x13, 0x13, 0x10, 0x0a, 0x00, 0x00, 0x00, 0x00}, // 14, -9.0dB - {0x14, 0x14, 0x11, 0x0a, 0x00, 0x00, 0x00, 0x00}, // 15, -8.5dB - {0x16, 0x15, 0x12, 0x0b, 0x00, 0x00, 0x00, 0x00}, // 16, -8.0dB - {0x17, 0x16, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x00}, // 17, -7.5dB - {0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00}, // 18, -7.0dB - {0x1a, 0x19, 0x16, 0x0d, 0x00, 0x00, 0x00, 0x00}, // 19, -6.5dB - {0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00}, // 20, -6.0dB - {0x1d, 0x1c, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00}, // 21, -5.5dB - {0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00}, // 22, -5.0dB - {0x20, 0x20, 0x1b, 0x10, 0x00, 0x00, 0x00, 0x00}, // 23, -4.5dB - {0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00}, // 24, -4.0dB - {0x24, 0x23, 0x1f, 0x12, 0x00, 0x00, 0x00, 0x00}, // 25, -3.5dB - {0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00}, // 26, -3.0dB - {0x28, 0x28, 0x24, 0x14, 0x00, 0x00, 0x00, 0x00}, // 27, -2.5dB - {0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00}, // 28, -2.0dB - {0x2d, 0x2d, 0x17, 0x17, 0x00, 0x00, 0x00, 0x00}, // 29, -1.5dB - {0x30, 0x2f, 0x29, 0x18, 0x00, 0x00, 0x00, 0x00}, // 30, -1.0dB - {0x33, 0x32, 0x2b, 0x19, 0x00, 0x00, 0x00, 0x00}, // 31, -0.5dB - {0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00} // 32, +0dB -}; - -u4Byte TxScalingTable_Jaguar[TXSCALE_TABLE_SIZE] = -{ - 0x081, // 0, -12.0dB - 0x088, // 1, -11.5dB - 0x090, // 2, -11.0dB - 0x099, // 3, -10.5dB - 0x0A2, // 4, -10.0dB - 0x0AC, // 5, -9.5dB - 0x0B6, // 6, -9.0dB - 0x0C0, // 7, -8.5dB - 0x0CC, // 8, -8.0dB - 0x0D8, // 9, -7.5dB - 0x0E5, // 10, -7.0dB - 0x0F2, // 11, -6.5dB - 0x101, // 12, -6.0dB - 0x110, // 13, -5.5dB - 0x120, // 14, -5.0dB - 0x131, // 15, -4.5dB - 0x143, // 16, -4.0dB - 0x156, // 17, -3.5dB - 0x16A, // 18, -3.0dB - 0x180, // 19, -2.5dB - 0x197, // 20, -2.0dB - 0x1AF, // 21, -1.5dB - 0x1C8, // 22, -1.0dB - 0x1E3, // 23, -0.5dB - 0x200, // 24, +0 dB - 0x21E, // 25, +0.5dB - 0x23E, // 26, +1.0dB - 0x261, // 27, +1.5dB - 0x285, // 28, +2.0dB - 0x2AB, // 29, +2.5dB - 0x2D3, // 30, +3.0dB - 0x2FE, // 31, +3.5dB - 0x32B, // 32, +4.0dB - 0x35C, // 33, +4.5dB - 0x38E, // 34, +5.0dB - 0x3C4, // 35, +5.5dB - 0x3FE // 36, +6.0dB -}; - -#ifdef AP_BUILD_WORKAROUND - -unsigned int TxPwrTrk_OFDM_SwingTbl[TxPwrTrk_OFDM_SwingTbl_Len] = { - /* +6.0dB */ 0x7f8001fe, - /* +5.5dB */ 0x788001e2, - /* +5.0dB */ 0x71c001c7, - /* +4.5dB */ 0x6b8001ae, - /* +4.0dB */ 0x65400195, - /* +3.5dB */ 0x5fc0017f, - /* +3.0dB */ 0x5a400169, - /* +2.5dB */ 0x55400155, - /* +2.0dB */ 0x50800142, - /* +1.5dB */ 0x4c000130, - /* +1.0dB */ 0x47c0011f, - /* +0.5dB */ 0x43c0010f, - /* 0.0dB */ 0x40000100, - /* -0.5dB */ 0x3c8000f2, - /* -1.0dB */ 0x390000e4, - /* -1.5dB */ 0x35c000d7, - /* -2.0dB */ 0x32c000cb, - /* -2.5dB */ 0x300000c0, - /* -3.0dB */ 0x2d4000b5, - /* -3.5dB */ 0x2ac000ab, - /* -4.0dB */ 0x288000a2, - /* -4.5dB */ 0x26000098, - /* -5.0dB */ 0x24000090, - /* -5.5dB */ 0x22000088, - /* -6.0dB */ 0x20000080, - /* -6.5dB */ 0x1a00006c, - /* -7.0dB */ 0x1c800072, - /* -7.5dB */ 0x18000060, - /* -8.0dB */ 0x19800066, - /* -8.5dB */ 0x15800056, - /* -9.0dB */ 0x26c0005b, - /* -9.5dB */ 0x14400051, - /* -10.0dB */ 0x24400051, - /* -10.5dB */ 0x1300004c, - /* -11.0dB */ 0x12000048, - /* -11.5dB */ 0x11000044, - /* -12.0dB */ 0x10000040 -}; -#endif - //============================================================ // Local Function predefine. //============================================================ -//START------------COMMON INFO RELATED---------------// -VOID -odm_CommonInfoSelfInit( - IN PDM_ODM_T pDM_Odm - ); - -VOID -odm_CommonInfoSelfUpdate( - IN PDM_ODM_T pDM_Odm - ); - -VOID -odm_CmnInfoInit_Debug( - IN PDM_ODM_T pDM_Odm - ); - -VOID -odm_CmnInfoHook_Debug( - IN PDM_ODM_T pDM_Odm - ); - -VOID -odm_CmnInfoUpdate_Debug( - IN PDM_ODM_T pDM_Odm - ); -VOID -odm_BasicDbgMessage -( - IN PDM_ODM_T pDM_Odm - ); - -//END------------COMMON INFO RELATED---------------// - -//START---------------DIG---------------------------// -VOID -odm_FalseAlarmCounterStatistics( - IN PDM_ODM_T pDM_Odm - ); - -VOID -odm_DIGInit( - IN PDM_ODM_T pDM_Odm - ); - -VOID -odm_DIG( - IN PDM_ODM_T pDM_Odm - ); - -BOOLEAN -odm_DigAbort( - IN PDM_ODM_T pDM_Odm - ); - -VOID -odm_CCKPacketDetectionThresh( - IN PDM_ODM_T pDM_Odm - ); - -VOID -odm_AdaptivityInit( - IN PDM_ODM_T pDM_Odm -); - -VOID -odm_Adaptivity( - IN PDM_ODM_T pDM_Odm, - IN u1Byte IGI -); -//END---------------DIG---------------------------// - -//START-------BB POWER SAVE-----------------------// -VOID -odm_DynamicBBPowerSavingInit( - IN PDM_ODM_T pDM_Odm - ); - -VOID -odm_DynamicBBPowerSaving( - IN PDM_ODM_T pDM_Odm - ); - -VOID -odm_1R_CCA( - IN PDM_ODM_T pDM_Odm - ); -//END---------BB POWER SAVE-----------------------// - -//START-----------------PSD-----------------------// -#if(DM_ODM_SUPPORT_TYPE & (ODM_WIN)) -//============================================================ -// Function predefine. -//============================================================ -VOID odm_PathDiversityInit_92C( IN PADAPTER Adapter); -VOID odm_2TPathDiversityInit_92C( IN PADAPTER Adapter); -VOID odm_1TPathDiversityInit_92C( IN PADAPTER Adapter); -BOOLEAN odm_IsConnected_92C(IN PADAPTER Adapter); -VOID odm_PathDiversityAfterLink_92C( IN PADAPTER Adapter); - -VOID -odm_CCKTXPathDiversityCallback( - PRT_TIMER pTimer - ); - -VOID -odm_CCKTXPathDiversityWorkItemCallback( - IN PVOID pContext - ); - -VOID -odm_PathDivChkAntSwitchCallback( - PRT_TIMER pTimer - ); - -VOID -odm_PathDivChkAntSwitchWorkitemCallback( - IN PVOID pContext - ); - -VOID odm_SetRespPath_92C( IN PADAPTER Adapter, IN u1Byte DefaultRespPath); -VOID odm_OFDMTXPathDiversity_92C( IN PADAPTER Adapter); -VOID odm_CCKTXPathDiversity_92C( IN PADAPTER Adapter); -VOID odm_ResetPathDiversity_92C( IN PADAPTER Adapter); - -//Start-------------------- RX High Power------------------------// -VOID odm_RXHPInit( IN PDM_ODM_T pDM_Odm); -VOID odm_RXHP( IN PDM_ODM_T pDM_Odm); -VOID odm_Write_RXHP( IN PDM_ODM_T pDM_Odm); - -VOID odm_PSD_RXHP( IN PDM_ODM_T pDM_Odm); -VOID odm_PSD_RXHPCallback( PRT_TIMER pTimer); -VOID odm_PSD_RXHPWorkitemCallback( IN PVOID pContext); -//End--------------------- RX High Power -----------------------// - -VOID odm_PathDivInit_92D( IN PDM_ODM_T pDM_Odm); - -VOID -odm_SetRespPath_92C( - IN PADAPTER Adapter, - IN u1Byte DefaultRespPath - ); - -#endif -//END-------------------PSD-----------------------// - -VOID -odm_RefreshRateAdaptiveMaskMP( - IN PDM_ODM_T pDM_Odm - ); - -VOID -odm_RefreshRateAdaptiveMaskCE( - IN PDM_ODM_T pDM_Odm - ); - -VOID -odm_RefreshRateAdaptiveMaskAPADSL( - IN PDM_ODM_T pDM_Odm - ); - -VOID -ODM_DynamicATCSwitch_init( - IN PDM_ODM_T pDM_Odm - ); - -VOID -ODM_DynamicATCSwitch( - IN PDM_ODM_T pDM_Odm - ); - -VOID -odm_Write_CrystalCap( - IN PDM_ODM_T pDM_Odm, - IN u1Byte CrystalCap -); - -VOID -odm_DynamicTxPowerInit( - IN PDM_ODM_T pDM_Odm - ); - -VOID -odm_DynamicTxPowerRestorePowerIndex( - IN PDM_ODM_T pDM_Odm - ); - -VOID -odm_DynamicTxPowerNIC( - IN PDM_ODM_T pDM_Odm - ); - -#if(DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) -VOID -odm_DynamicTxPowerSavePowerIndex( - IN PDM_ODM_T pDM_Odm - ); - -VOID -odm_DynamicTxPowerWritePowerIndex( - IN PDM_ODM_T pDM_Odm, - IN u1Byte Value); - -VOID -odm_DynamicTxPower_92C( - IN PDM_ODM_T pDM_Odm - ); - -VOID -odm_DynamicTxPower_92D( - IN PDM_ODM_T pDM_Odm - ); - -VOID -odm_MPT_DIGCallback( - PRT_TIMER pTimer -); - -VOID -odm_MPT_DIGWorkItemCallback( - IN PVOID pContext - ); -#endif - - -VOID -odm_RSSIMonitorInit( - IN PDM_ODM_T pDM_Odm - ); - -VOID -odm_RSSIMonitorCheckMP( - IN PDM_ODM_T pDM_Odm - ); - -VOID -odm_RSSIMonitorCheckCE( - IN PDM_ODM_T pDM_Odm - ); -VOID -odm_RSSIMonitorCheckAP( - IN PDM_ODM_T pDM_Odm - ); - - - -VOID -odm_RSSIMonitorCheck( - IN PDM_ODM_T pDM_Odm - ); -VOID -odm_DynamicTxPower( - IN PDM_ODM_T pDM_Odm - ); - -VOID -odm_DynamicTxPowerAP( - IN PDM_ODM_T pDM_Odm - ); - - -VOID -odm_SwAntDivInit( - IN PDM_ODM_T pDM_Odm - ); - -VOID -odm_SwAntDivInit_NIC( - IN PDM_ODM_T pDM_Odm - ); - VOID odm_SwAntDetectInit( IN PDM_ODM_T pDM_Odm ); -VOID -odm_SwAntDivChkAntSwitch( - IN PDM_ODM_T pDM_Odm, - IN u1Byte Step - ); + + + VOID -odm_SwAntDivChkAntSwitchNIC( - IN PDM_ODM_T pDM_Odm, - IN u1Byte Step - ); +odm_AntennaDiversityInit( + IN PDM_ODM_T pDM_Odm +); +VOID +odm_AntennaDiversity( + IN PDM_ODM_T pDM_Odm +); #if (DM_ODM_SUPPORT_TYPE == ODM_WIN) VOID -odm_SwAntDivChkAntSwitchCallback( - PRT_TIMER pTimer -); -VOID -odm_SwAntDivChkAntSwitchWorkitemCallback( - IN PVOID pContext - ); -VOID ODM_UpdateInitRateWorkItemCallback( IN PVOID pContext ); -#elif (DM_ODM_SUPPORT_TYPE == ODM_CE) -VOID odm_SwAntDivChkAntSwitchCallback(void *FunctionContext); -#elif (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) -VOID odm_SwAntDivChkAntSwitchCallback(void *FunctionContext); #endif - VOID odm_GlobalAdapterCheck( IN VOID ); -VOID -odm_RefreshBasicRateMask( - IN PDM_ODM_T pDM_Odm - ); +//Remove RAMask by RS_James -VOID -odm_RefreshRateAdaptiveMask( - IN PDM_ODM_T pDM_Odm - ); - -VOID -ODM_TXPowerTrackingCheck( - IN PDM_ODM_T pDM_Odm - ); - -VOID -odm_TXPowerTrackingCheckAP( - IN PDM_ODM_T pDM_Odm - ); - - - - - - - -VOID -odm_RateAdaptiveMaskInit( - IN PDM_ODM_T pDM_Odm - ); - -VOID -odm_TXPowerTrackingThermalMeterInit( - IN PDM_ODM_T pDM_Odm - ); VOID @@ -762,154 +82,179 @@ odm_IQCalibrate( IN PDM_ODM_T pDM_Odm ); -VOID -odm_TXPowerTrackingInit( - IN PDM_ODM_T pDM_Odm - ); +//remove PT by Yuchen -VOID -odm_TXPowerTrackingCheckMP( - IN PDM_ODM_T pDM_Odm - ); +//Remove Edca by Yu Chen VOID -odm_TXPowerTrackingCheckCE( - IN PDM_ODM_T pDM_Odm - ); - -#if(DM_ODM_SUPPORT_TYPE & (ODM_WIN)) - -VOID -ODM_RateAdaptiveStateApInit( - IN PADAPTER Adapter , - IN PRT_WLAN_STA pEntry - ); - -VOID -odm_TXPowerTrackingCallbackThermalMeter92C( - IN PADAPTER Adapter - ); - -VOID -odm_TXPowerTrackingCallbackRXGainThermalMeter92D( - IN PADAPTER Adapter - ); - -VOID -odm_TXPowerTrackingCallbackThermalMeter92D( - IN PADAPTER Adapter - ); - -VOID -odm_TXPowerTrackingDirectCall92C( - IN PADAPTER Adapter - ); - -VOID -odm_TXPowerTrackingThermalMeterCheck( - IN PADAPTER Adapter - ); - -#endif - -VOID -odm_EdcaTurboCheck( - IN PDM_ODM_T pDM_Odm - ); -VOID -ODM_EdcaTurboInit( - IN PDM_ODM_T pDM_Odm -); - -#if(DM_ODM_SUPPORT_TYPE==ODM_WIN) -VOID -odm_EdcaTurboCheckMP( - IN PDM_ODM_T pDM_Odm - ); - -//check if edca turbo is disabled -BOOLEAN -odm_IsEdcaTurboDisable( - IN PDM_ODM_T pDM_Odm -); -//choose edca paramter for special IOT case -VOID -ODM_EdcaParaSelByIot( - IN PDM_ODM_T pDM_Odm, - OUT u4Byte *EDCA_BE_UL, - OUT u4Byte *EDCA_BE_DL - ); -//check if it is UL or DL -VOID -odm_EdcaChooseTrafficIdx( - IN PDM_ODM_T pDM_Odm, - IN u8Byte cur_tx_bytes, - IN u8Byte cur_rx_bytes, - IN BOOLEAN bBiasOnRx, - OUT BOOLEAN *pbIsCurRDLState - ); - -#elif (DM_ODM_SUPPORT_TYPE==ODM_CE) -VOID -odm_EdcaTurboCheckCE( - IN PDM_ODM_T pDM_Odm - ); -#else -VOID -odm_IotEngine( - IN PDM_ODM_T pDM_Odm - ); - -VOID -odm_EdcaParaInit( - IN PDM_ODM_T pDM_Odm - ); -#endif - - - -#define RxDefaultAnt1 0x65a9 -#define RxDefaultAnt2 0x569a - -VOID -odm_InitHybridAntDiv( - IN PDM_ODM_T pDM_Odm - ); - -BOOLEAN -odm_StaDefAntSel( - IN PDM_ODM_T pDM_Odm, - IN u4Byte OFDM_Ant1_Cnt, - IN u4Byte OFDM_Ant2_Cnt, - IN u4Byte CCK_Ant1_Cnt, - IN u4Byte CCK_Ant2_Cnt, - OUT u1Byte *pDefAnt - ); - -VOID -odm_SetRxIdleAnt( - IN PDM_ODM_T pDM_Odm, - IN u1Byte Ant, - IN BOOLEAN bDualPath -); - - - -VOID -odm_HwAntDiv( +odm_UpdatePowerTrainingState( IN PDM_ODM_T pDM_Odm ); -VOID odm_PathDiversityInit(IN PDM_ODM_T pDM_Odm); -VOID odm_PathDiversity( IN PDM_ODM_T pDM_Odm); - - +VOID +ODM_AsocEntry_Init( + IN PDM_ODM_T pDM_Odm + ); //============================================================ //3 Export Interface //============================================================ +VOID +ODM_InitMpDriverStatus( + IN PDM_ODM_T pDM_Odm +) +{ +#if(DM_ODM_SUPPORT_TYPE & ODM_WIN) + + // Decide when compile time + #if(MP_DRIVER == 1) + pDM_Odm->mp_mode = TRUE; + #else + pDM_Odm->mp_mode = FALSE; + #endif + +#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) + + PADAPTER Adapter = pDM_Odm->Adapter; + + // Update information every period + pDM_Odm->mp_mode = (BOOLEAN)Adapter->registrypriv.mp_mode; + +#else + + // MP mode is always false at AP side + pDM_Odm->mp_mode = FALSE; + +#endif +} + +VOID +ODM_UpdateMpDriverStatus( + IN PDM_ODM_T pDM_Odm +) +{ +#if(DM_ODM_SUPPORT_TYPE & ODM_WIN) + + // Do nothing. + +#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) + PADAPTER Adapter = pDM_Odm->Adapter; + + // Update information erery period + pDM_Odm->mp_mode = (BOOLEAN)Adapter->registrypriv.mp_mode; + +#else + + // Do nothing. + +#endif +} + +VOID +odm_CommonInfoSelfInit( + IN PDM_ODM_T pDM_Odm + ) +{ + pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; + pDM_Odm->bCckHighPower = (BOOLEAN) ODM_GetBBReg(pDM_Odm, ODM_REG(CCK_RPT_FORMAT,pDM_Odm), ODM_BIT(CCK_RPT_FORMAT,pDM_Odm)); + pDM_Odm->RFPathRxEnable = (u1Byte) ODM_GetBBReg(pDM_Odm, ODM_REG(BB_RX_PATH,pDM_Odm), ODM_BIT(BB_RX_PATH,pDM_Odm)); +#if (DM_ODM_SUPPORT_TYPE != ODM_CE) + pDM_Odm->pbNet_closed = &pDM_Odm->BOOLEAN_temp; +#endif + + ODM_InitDebugSetting(pDM_Odm); + ODM_InitMpDriverStatus(pDM_Odm); + + pDM_Odm->TxRate = 0xFF; + +} + +VOID +odm_CommonInfoSelfUpdate( + IN PDM_ODM_T pDM_Odm + ) +{ + u1Byte EntryCnt=0; + u1Byte i; + PSTA_INFO_T pEntry; + +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + + PADAPTER Adapter = pDM_Odm->Adapter; + PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; + + pEntry = pDM_Odm->pODM_StaInfo[0]; + if(pMgntInfo->mAssoc) + { + pEntry->bUsed=TRUE; + for (i=0; i<6; i++) + pEntry->MacAddr[i] = pMgntInfo->Bssid[i]; + } + else + { + pEntry->bUsed=FALSE; + for (i=0; i<6; i++) + pEntry->MacAddr[i] = 0; + } + + //STA mode is linked to AP + if(IS_STA_VALID(pDM_Odm->pODM_StaInfo[0]) && !ACTING_AS_AP(Adapter)) + pDM_Odm->bsta_state = TRUE; + else + pDM_Odm->bsta_state = FALSE; +#endif + + + if(*(pDM_Odm->pBandWidth) == ODM_BW40M) + { + if(*(pDM_Odm->pSecChOffset) == 1) + pDM_Odm->ControlChannel = *(pDM_Odm->pChannel) -2; + else if(*(pDM_Odm->pSecChOffset) == 2) + pDM_Odm->ControlChannel = *(pDM_Odm->pChannel) +2; + } + else + pDM_Odm->ControlChannel = *(pDM_Odm->pChannel); + + for (i=0; ipODM_StaInfo[i]; + if(IS_STA_VALID(pEntry)) + EntryCnt++; + } + + if(EntryCnt == 1) + pDM_Odm->bOneEntryOnly = TRUE; + else + pDM_Odm->bOneEntryOnly = FALSE; + + // Update MP driver status + ODM_UpdateMpDriverStatus(pDM_Odm); +} + +VOID +odm_CommonInfoSelfReset( + IN PDM_ODM_T pDM_Odm + ) +{ +#if( DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) + pDM_Odm->PhyDbgInfo.NumQryBeaconPkt = 0; +#endif +} + +VOID +odm_HWSetting( + IN PDM_ODM_T pDM_Odm + ) +{ +#if (RTL8821A_SUPPORT == 1) + if(pDM_Odm->SupportICType & ODM_RTL8821) + odm_HWSetting_8821A(pDM_Odm); +#endif + +} + // // 2011/09/21 MH Add to describe different team necessary resource allocate?? // @@ -919,89 +264,78 @@ ODM_DMInit( ) { - //2012.05.03 Luke: For all IC series odm_CommonInfoSelfInit(pDM_Odm); - odm_CmnInfoInit_Debug(pDM_Odm); - odm_DIGInit(pDM_Odm); - odm_AdaptivityInit(pDM_Odm); + odm_DIGInit(pDM_Odm); + Phydm_NHMCounterStatisticsInit(pDM_Odm); + Phydm_AdaptivityInit(pDM_Odm); odm_RateAdaptiveMaskInit(pDM_Odm); + ODM_CfoTrackingInit(pDM_Odm); + ODM_EdcaTurboInit(pDM_Odm); odm_RSSIMonitorInit(pDM_Odm); - -#if (RTL8192E_SUPPORT == 1) - if(pDM_Odm->SupportICType==ODM_RTL8192E) - { - odm_PrimaryCCA_Check_Init(pDM_Odm); - } + odm_TXPowerTrackingInit(pDM_Odm); + odm_AntennaDiversityInit(pDM_Odm); + odm_AutoChannelSelectInit(pDM_Odm); + +#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) + ODM_ClearTxPowerTrackingState(pDM_Odm); + odm_PathDiversityInit(pDM_Odm); #endif -//#if (MP_DRIVER != 1) - if ( *(pDM_Odm->mp_mode) != 1) - odm_PathDiversityInit(pDM_Odm); -//#endif - ODM_EdcaTurboInit(pDM_Odm); - - if(pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) - { - odm_TXPowerTrackingInit(pDM_Odm); -//#if (MP_DRIVER != 1) - if ( *(pDM_Odm->mp_mode) != 1) - ODM_AntDivInit(pDM_Odm); -//#endif - } - else if(pDM_Odm->SupportICType & ODM_IC_11N_SERIES) + if(pDM_Odm->SupportICType & ODM_IC_11N_SERIES) { odm_DynamicBBPowerSavingInit(pDM_Odm); odm_DynamicTxPowerInit(pDM_Odm); - odm_TXPowerTrackingInit(pDM_Odm); - //ODM_EdcaTurboInit(pDM_Odm); -//#if (MP_DRIVER != 1) - if ( *(pDM_Odm->mp_mode) != 1) { - if(pDM_Odm->SupportICType==ODM_RTL8723A) - odm_SwAntDivInit(pDM_Odm); - else if(pDM_Odm->SupportICType & (ODM_RTL8192C|ODM_RTL8192D)) - { - if(pDM_Odm->AntDivType == HW_ANTDIV) - odm_InitHybridAntDiv(pDM_Odm); - else - odm_SwAntDivInit(pDM_Odm); - } - else - ODM_AntDivInit(pDM_Odm); - - if(pDM_Odm->SupportICType == ODM_RTL8723B) - odm_SwAntDetectInit(pDM_Odm); - } -//#endif -//2010.05.30 LukeLee: For CE platform, files in IC subfolders may not be included to be compiled, -// so compile flags must be left here to prevent from compile errors #if (RTL8188E_SUPPORT == 1) if(pDM_Odm->SupportICType==ODM_RTL8188E) { - odm_PrimaryCCA_Init(pDM_Odm); // Gary + odm_PrimaryCCA_Init(pDM_Odm); ODM_RAInfo_Init_all(pDM_Odm); - } -#endif - -//2010.05.30 LukeLee: Following are not incorporated into ODM structure yet. -#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) - if(pDM_Odm->SupportICType&ODM_RTL8723A) - odm_PSDMonitorInit(pDM_Odm); - - if(!(pDM_Odm->SupportICType & (ODM_RTL8723A|ODM_RTL8188E))) - { - odm_RXHPInit(pDM_Odm); } - if(pDM_Odm->SupportICType==ODM_RTL8192D) - { - odm_PathDivInit_92D(pDM_Odm); //92D Path Div Init //Neil Chen - } #endif + +#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) + + #if (RTL8723B_SUPPORT == 1) + if(pDM_Odm->SupportICType == ODM_RTL8723B) + odm_SwAntDetectInit(pDM_Odm); + #endif + + #if (RTL8192E_SUPPORT == 1) + if(pDM_Odm->SupportICType==ODM_RTL8192E) + odm_PrimaryCCA_Check_Init(pDM_Odm); + #endif + +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + #if (RTL8723A_SUPPORT == 1) + if(pDM_Odm->SupportICType == ODM_RTL8723A) + odm_PSDMonitorInit(pDM_Odm); + #endif + + #if (RTL8192D_SUPPORT == 1) + if(pDM_Odm->SupportICType==ODM_RTL8192D) + odm_PathDivInit_92D(pDM_Odm); + #endif + + #if ((RTL8192C_SUPPORT == 1) || (RTL8192D_SUPPORT == 1)) + if(pDM_Odm->SupportICType & (ODM_RTL8192C|ODM_RTL8192D)) + odm_RXHPInit(pDM_Odm); + #endif +#endif +#endif + } - ODM_DynamicATCSwitch_init(pDM_Odm); - ODM_ClearTxPowerTrackingState(pDM_Odm); +} +VOID +ODM_DMReset( + IN PDM_ODM_T pDM_Odm + ) +{ + #if (defined(CONFIG_HW_ANTENNA_DIVERSITY)) + ODM_AntDivReset(pDM_Odm); + #endif } // @@ -1013,126 +347,80 @@ VOID ODM_DMWatchdog( IN PDM_ODM_T pDM_Odm ) -{ - if((pDM_Odm->SupportICType == ODM_RTL8821) && (pDM_Odm->SupportInterface == ODM_ITRF_USB)) - { - if(pDM_Odm->RSSI_Min > 25) - ODM_Write1Byte(pDM_Odm, 0x4CF, 0x02); - else if(pDM_Odm->RSSI_Min < 20) - ODM_Write1Byte(pDM_Odm, 0x4CF, 0x00); - } - - +{ + ODM_AsocEntry_Init(pDM_Odm); odm_CommonInfoSelfUpdate(pDM_Odm); odm_BasicDbgMessage(pDM_Odm); + odm_HWSetting(pDM_Odm); odm_FalseAlarmCounterStatistics(pDM_Odm); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): RSSI=0x%x\n",pDM_Odm->RSSI_Min)); - odm_RSSIMonitorCheck(pDM_Odm); -#if (DM_ODM_SUPPORT_TYPE == ODM_CE) -//#ifdef CONFIG_PLATFORM_SPRD - //For CE Platform(SPRD or Tablet) - //8723A or 8189ES platform - //NeilChen--2012--08--24-- - //Fix Leave LPS issue - if( (adapter_to_pwrctl(pDM_Odm->Adapter)->pwr_mode != PS_MODE_ACTIVE) // in LPS mode - //&&( - // (pDM_Odm->SupportICType & (ODM_RTL8723A ) )|| - // (pDM_Odm->SupportICType & (ODM_RTL8188E) &&((pDM_Odm->SupportInterface == ODM_ITRF_SDIO)) ) - //) - ) + if(*(pDM_Odm->pbPowerSaving) == TRUE) { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("----Step1: odm_DIG is in LPS mode\n")); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("---Step2: 8723AS is in LPS mode\n")); - odm_DIGbyRSSI_LPS(pDM_Odm); - } - else -//#endif -#endif - { - odm_DIG(pDM_Odm); + odm_DIGbyRSSI_LPS(pDM_Odm); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("DMWatchdog in power saving mode\n")); + return; } - + + Phydm_CheckAdaptivity(pDM_Odm); + odm_UpdatePowerTrainingState(pDM_Odm); + odm_DIG(pDM_Odm); { pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; - odm_Adaptivity(pDM_Odm, pDM_DigTable->CurIGValue); + pDM_Odm->bAdaOn = Phydm_Adaptivity(pDM_Odm, pDM_DigTable->CurIGValue); } odm_CCKPacketDetectionThresh(pDM_Odm); - - if(*(pDM_Odm->pbPowerSaving)==TRUE) - return; - - odm_RefreshRateAdaptiveMask(pDM_Odm); odm_RefreshBasicRateMask(pDM_Odm); - odm_DynamicBBPowerSaving(pDM_Odm); + odm_DynamicBBPowerSaving(pDM_Odm); odm_EdcaTurboCheck(pDM_Odm); odm_PathDiversity(pDM_Odm); - ODM_DynamicATCSwitch(pDM_Odm); - odm_DynamicTxPower(pDM_Odm); + ODM_CfoTracking(pDM_Odm); + odm_DynamicTxPower(pDM_Odm); + odm_AntennaDiversity(pDM_Odm); -#if (RTL8192E_SUPPORT == 1) - if(pDM_Odm->SupportICType==ODM_RTL8192E) - odm_DynamicPrimaryCCA_Check(pDM_Odm); -#endif - //if(pDM_Odm->SupportICType == ODM_RTL8192E) - // return; +#if( DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) - -//#if (MP_DRIVER != 1) -if ( *(pDM_Odm->mp_mode) != 1) { - if(pDM_Odm->SupportICType==ODM_RTL8723A) - { - odm_SwAntDivChkAntSwitch(pDM_Odm, SWAW_STEP_PEAK); - } - else if(pDM_Odm->SupportICType & (ODM_RTL8192C|ODM_RTL8192D)) - { - if(pDM_Odm->AntDivType == HW_ANTDIV) - odm_HwAntDiv(pDM_Odm); - else - odm_SwAntDivChkAntSwitch(pDM_Odm, SWAW_STEP_PEAK); - } - else - ODM_AntDiv(pDM_Odm); -} -//#endif + ODM_TXPowerTrackingCheck(pDM_Odm); if(pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) - { - ODM_TXPowerTrackingCheck(pDM_Odm); - odm_IQCalibrate(pDM_Odm); - } - else if(pDM_Odm->SupportICType & ODM_IC_11N_SERIES) + else +#endif + if(pDM_Odm->SupportICType & ODM_IC_11N_SERIES) { - ODM_TXPowerTrackingCheck(pDM_Odm); - - //odm_EdcaTurboCheck(pDM_Odm); - - #if( DM_ODM_SUPPORT_TYPE & (ODM_WIN)) - if(!(pDM_Odm->SupportICType & (ODM_RTL8723A|ODM_RTL8188E))) - odm_RXHP(pDM_Odm); - #endif - - //2010.05.30 LukeLee: For CE platform, files in IC subfolders may not be included to be compiled, - // so compile flags must be left here to prevent from compile errors #if (RTL8192D_SUPPORT == 1) if(pDM_Odm->SupportICType==ODM_RTL8192D) - ODM_DynamicEarlyMode(pDM_Odm); + ODM_DynamicEarlyMode(pDM_Odm); #endif - odm_DynamicBBPowerSaving(pDM_Odm); + #if (RTL8188E_SUPPORT == 1) if(pDM_Odm->SupportICType==ODM_RTL8188E) odm_DynamicPrimaryCCA(pDM_Odm); #endif +#if( DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) + + #if (RTL8192E_SUPPORT == 1) + if(pDM_Odm->SupportICType==ODM_RTL8192E) + odm_DynamicPrimaryCCA_Check(pDM_Odm); + #endif + +#if( DM_ODM_SUPPORT_TYPE == ODM_WIN) + #if ((RTL8192C_SUPPORT == 1) || (RTL8192D_SUPPORT == 1)) + if(pDM_Odm->SupportICType & (ODM_RTL8192C|ODM_RTL8192D)) + odm_RXHP(pDM_Odm); + #endif +#endif +#endif } - pDM_Odm->PhyDbgInfo.NumQryBeaconPkt = 0; #if (DM_ODM_SUPPORT_TYPE == ODM_CE) odm_dtc(pDM_Odm); #endif + + odm_CommonInfoSelfReset(pDM_Odm); + } @@ -1243,11 +531,18 @@ ODM_CmnInfoInit( case ODM_CMNINFO_BWIFI_TEST: pDM_Odm->bWIFITest = (BOOLEAN)Value; break; - case ODM_CMNINFO_SMART_CONCURRENT: pDM_Odm->bDualMacSmartConcurrent = (BOOLEAN )Value; break; - + case ODM_CMNINFO_DOMAIN_CODE_2G: + pDM_Odm->odm_Regulation2_4G = (u1Byte)Value; + break; + case ODM_CMNINFO_DOMAIN_CODE_5G: + pDM_Odm->odm_Regulation5G = (u1Byte)Value; + break; + case ODM_CMNINFO_IQKFWOFFLOAD: + pDM_Odm->IQKFWOffload = (u1Byte)Value; + break; //To remove the compiler warning, must add an empty default statement to handle the other values. default: //do nothing @@ -1361,10 +656,15 @@ ODM_CmnInfoHook( pDM_Odm->pu1ForcedIgiLb = (u1Byte *)pValue; break; - case ODM_CMNINFO_MP_MODE: - pDM_Odm->mp_mode = (u1Byte *)pValue; + case ODM_CMNINFO_P2P_LINK: + pDM_Odm->DM_DigTable.pbP2pLinkInProgress = (u1Byte *)pValue; break; + case ODM_CMNINFO_FCS_MODE: + pDM_Odm->pIsFcsModeEnable = (BOOLEAN *)pValue; + break; +//sd7 only + //case ODM_CMNINFO_RTSTA_AID: // pDM_Odm->pAidMap = (u1Byte *)pValue; // break; @@ -1483,8 +783,8 @@ ODM_CmnInfoUpdate( pDM_Odm->RateAdaptive.LowRSSIThresh = (u1Byte)Value; break; // The following is for BT HS mode and BT coexist mechanism. - case ODM_CMNINFO_BT_DISABLED: - pDM_Odm->bBtDisabled = (BOOLEAN)Value; + case ODM_CMNINFO_BT_ENABLED: + pDM_Odm->bBtEnabled = (BOOLEAN)Value; break; case ODM_CMNINFO_BT_HS_CONNECT_PROCESS: @@ -1506,7 +806,15 @@ ODM_CmnInfoUpdate( case ODM_CMNINFO_BT_DISABLE_EDCA: pDM_Odm->bBtDisableEdcaTurbo = (BOOLEAN)Value; break; - + + +#if(DM_ODM_SUPPORT_TYPE & ODM_AP) // for repeater mode add by YuChen 2014.06.23 +#ifdef UNIVERSAL_REPEATER + case ODM_CMNINFO_VXD_LINK: + pDM_Odm->VXD_bLinked= (BOOLEAN)Value; + break; +#endif +#endif /* case ODM_CMNINFO_OP_MODE: pDM_Odm->OPMode = (u1Byte)Value; @@ -1544,271 +852,6 @@ ODM_CmnInfoUpdate( } -VOID -odm_CommonInfoSelfInit( - IN PDM_ODM_T pDM_Odm - ) -{ - pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; - pDM_Odm->bCckHighPower = (BOOLEAN) ODM_GetBBReg(pDM_Odm, ODM_REG(CCK_RPT_FORMAT,pDM_Odm), ODM_BIT(CCK_RPT_FORMAT,pDM_Odm)); - pDM_Odm->RFPathRxEnable = (u1Byte) ODM_GetBBReg(pDM_Odm, ODM_REG(BB_RX_PATH,pDM_Odm), ODM_BIT(BB_RX_PATH,pDM_Odm)); -#if (DM_ODM_SUPPORT_TYPE != ODM_CE) - pDM_Odm->pbNet_closed = &pDM_Odm->BOOLEAN_temp; -#endif - - ODM_InitDebugSetting(pDM_Odm); - - if(pDM_Odm->SupportICType==ODM_RTL8723A) - { - pDM_Odm->AntDivType = SW_ANTDIV; - } - else if(pDM_Odm->SupportICType & (ODM_RTL8192C|ODM_RTL8192D)) - { - #if(defined(CONFIG_HW_ANTENNA_DIVERSITY)) - pDM_Odm->AntDivType = HW_ANTDIV; - #elif (defined(CONFIG_SW_ANTENNA_DIVERSITY)) - pDM_Odm->AntDivType = SW_ANTDIV; - #endif - } - pDM_Odm->TxRate = 0xFF; -#if(defined(CONFIG_HW_ANTENNA_DIVERSITY)) -#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) - - if(pDM_Odm->SupportICType==ODM_RTL8723B) - { - if((!pDM_Odm->DM_SWAT_Table.ANTA_ON || !pDM_Odm->DM_SWAT_Table.ANTB_ON)) - pDM_Odm->SupportAbility &= ~(ODM_BB_ANT_DIV); - } - -#elif (DM_ODM_SUPPORT_TYPE == ODM_AP) - - #if(defined(CONFIG_NOT_SUPPORT_ANTDIV)) - pDM_Odm->SupportAbility &= ~(ODM_BB_ANT_DIV); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ Disable AntDiv function] : Not Support 2.4G & 5G Antenna Diversity\n")); - #elif(defined(CONFIG_2G5G_SUPPORT_ANTDIV)) - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ Enable AntDiv function] : 2.4G & 5G Support Antenna Diversity Simultaneously \n")); - pDM_FatTable->AntDiv_2G_5G = (ODM_ANTDIV_2G|ODM_ANTDIV_5G); - if(pDM_Odm->SupportICType & ODM_ANTDIV_SUPPORT) - pDM_Odm->SupportAbility |= ODM_BB_ANT_DIV; - if(*pDM_Odm->pBandType == ODM_BAND_5G ) - { - #if ( defined(CONFIG_5G_CGCS_RX_DIVERSITY) ) - pDM_Odm->AntDivType = CGCS_RX_HW_ANTDIV; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 5G] : AntDiv Type = CGCS_RX_HW_ANTDIV\n")); - #elif( defined(CONFIG_5G_CG_TRX_DIVERSITY) ) - pDM_Odm->AntDivType = CG_TRX_HW_ANTDIV; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 5G] : AntDiv Type = CG_TRX_HW_ANTDIV\n")); - #elif( defined(CONFIG_5G_CG_SMART_ANT_DIVERSITY) ) - pDM_Odm->AntDivType = CG_TRX_SMART_ANTDIV; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 5G] : AntDiv Type = CG_SMART_ANTDIV\n")); - #endif - } - else if(*pDM_Odm->pBandType == ODM_BAND_2_4G ) - { - #if ( defined(CONFIG_2G_CGCS_RX_DIVERSITY) ) - pDM_Odm->AntDivType = CGCS_RX_HW_ANTDIV; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 2.4G] : AntDiv Type = CGCS_RX_HW_ANTDIV\n")); - #elif( defined(CONFIG_2G_CG_TRX_DIVERSITY) ) - pDM_Odm->AntDivType = CG_TRX_HW_ANTDIV; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 2.4G] : AntDiv Type = CG_TRX_HW_ANTDIV\n")); - #elif( defined(CONFIG_2G_CG_SMART_ANT_DIVERSITY) ) - pDM_Odm->AntDivType = CG_TRX_SMART_ANTDIV; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 2.4G] : AntDiv Type = CG_SMART_ANTDIV\n")); - #endif - } - #elif(defined(CONFIG_5G_SUPPORT_ANTDIV)) - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ Enable AntDiv function] : Only 5G Support Antenna Diversity\n")); - pDM_FatTable->AntDiv_2G_5G = (ODM_ANTDIV_5G); - if(*pDM_Odm->pBandType == ODM_BAND_5G ) - { - if(pDM_Odm->SupportICType & ODM_ANTDIV_5G_SUPPORT_IC) - pDM_Odm->SupportAbility |= ODM_BB_ANT_DIV; - #if ( defined(CONFIG_5G_CGCS_RX_DIVERSITY) ) - pDM_Odm->AntDivType = CGCS_RX_HW_ANTDIV; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 5G] : AntDiv Type = CGCS_RX_HW_ANTDIV\n")); - #elif( defined(CONFIG_5G_CG_TRX_DIVERSITY) ) - pDM_Odm->AntDivType = CG_TRX_HW_ANTDIV; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 5G] : AntDiv Type = CG_TRX_HW_ANTDIV\n")); - #elif( defined(CONFIG_5G_CG_SMART_ANT_DIVERSITY) ) - pDM_Odm->AntDivType = CG_TRX_SMART_ANTDIV; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 5G] : AntDiv Type = CG_SMART_ANTDIV\n")); - #endif - } - else if(*pDM_Odm->pBandType == ODM_BAND_2_4G ) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("Not Support 2G AntDivType\n")); - pDM_Odm->SupportAbility &= ~(ODM_BB_ANT_DIV); - } - #elif(defined(CONFIG_2G_SUPPORT_ANTDIV)) - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ Enable AntDiv function] : Only 2.4G Support Antenna Diversity\n")); - pDM_FatTable->AntDiv_2G_5G = (ODM_ANTDIV_2G); - if(*pDM_Odm->pBandType == ODM_BAND_2_4G ) - { - if(pDM_Odm->SupportICType & ODM_ANTDIV_2G_SUPPORT_IC) - pDM_Odm->SupportAbility |= ODM_BB_ANT_DIV; - #if ( defined(CONFIG_2G_CGCS_RX_DIVERSITY) ) - pDM_Odm->AntDivType = CGCS_RX_HW_ANTDIV; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 2.4G] : AntDiv Type = CGCS_RX_HW_ANTDIV\n")); - #elif( defined(CONFIG_2G_CG_TRX_DIVERSITY) ) - pDM_Odm->AntDivType = CG_TRX_HW_ANTDIV; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 2.4G] : AntDiv Type = CG_TRX_HW_ANTDIV\n")); - #elif( defined(CONFIG_2G_CG_SMART_ANT_DIVERSITY) ) - pDM_Odm->AntDivType = CG_TRX_SMART_ANTDIV; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 2.4G] : AntDiv Type = CG_SMART_ANTDIV\n")); - #endif - } - else if(*pDM_Odm->pBandType == ODM_BAND_5G ) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("Not Support 5G AntDivType\n")); - pDM_Odm->SupportAbility &= ~(ODM_BB_ANT_DIV); - } - #endif -#endif //#if (DM_ODM_SUPPORT_TYPE == ODM_AP) -#endif //#if(defined(CONFIG_HW_ANTENNA_DIVERSITY)) - -} - -VOID -odm_CommonInfoSelfUpdate( - IN PDM_ODM_T pDM_Odm - ) -{ - u1Byte EntryCnt=0; - u1Byte i; - PSTA_INFO_T pEntry; - -#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) - - PADAPTER Adapter = pDM_Odm->Adapter; - PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; - - pEntry = pDM_Odm->pODM_StaInfo[0]; - if(pMgntInfo->mAssoc) - { - pEntry->bUsed=TRUE; - for (i=0; i<6; i++) - pEntry->MacAddr[i] = pMgntInfo->Bssid[i]; - } - else - { - pEntry->bUsed=FALSE; - for (i=0; i<6; i++) - pEntry->MacAddr[i] = 0; - } -#endif - - - if(*(pDM_Odm->pBandWidth) == ODM_BW40M) - { - if(*(pDM_Odm->pSecChOffset) == 1) - pDM_Odm->ControlChannel = *(pDM_Odm->pChannel) -2; - else if(*(pDM_Odm->pSecChOffset) == 2) - pDM_Odm->ControlChannel = *(pDM_Odm->pChannel) +2; - } - else - pDM_Odm->ControlChannel = *(pDM_Odm->pChannel); - - for (i=0; ipODM_StaInfo[i]; - if(IS_STA_VALID(pEntry)) - EntryCnt++; - } - if(EntryCnt == 1) - pDM_Odm->bOneEntryOnly = TRUE; - else - pDM_Odm->bOneEntryOnly = FALSE; -} - -VOID -odm_CmnInfoInit_Debug( - IN PDM_ODM_T pDM_Odm - ) -{ - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("odm_CmnInfoInit_Debug==>\n")); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("SupportPlatform=%d\n",pDM_Odm->SupportPlatform) ); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("SupportAbility=0x%x\n",pDM_Odm->SupportAbility) ); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("SupportInterface=%d\n",pDM_Odm->SupportInterface) ); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("SupportICType=0x%x\n",pDM_Odm->SupportICType) ); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("CutVersion=%d\n",pDM_Odm->CutVersion) ); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("FabVersion=%d\n",pDM_Odm->FabVersion) ); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("RFType=%d\n",pDM_Odm->RFType) ); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("BoardType=%d\n",pDM_Odm->BoardType) ); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("ExtLNA=%d\n",pDM_Odm->ExtLNA) ); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("ExtPA=%d\n",pDM_Odm->ExtPA) ); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("ExtTRSW=%d\n",pDM_Odm->ExtTRSW) ); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("PatchID=%d\n",pDM_Odm->PatchID) ); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("bInHctTest=%d\n",pDM_Odm->bInHctTest) ); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("bWIFITest=%d\n",pDM_Odm->bWIFITest) ); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("bDualMacSmartConcurrent=%d\n",pDM_Odm->bDualMacSmartConcurrent) ); - -} - -VOID -odm_CmnInfoHook_Debug( - IN PDM_ODM_T pDM_Odm - ) -{ - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("odm_CmnInfoHook_Debug==>\n")); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("pNumTxBytesUnicast=%llu\n",*(pDM_Odm->pNumTxBytesUnicast)) ); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("pNumRxBytesUnicast=%llu\n",*(pDM_Odm->pNumRxBytesUnicast)) ); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("pWirelessMode=0x%x\n",*(pDM_Odm->pWirelessMode)) ); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("pSecChOffset=%d\n",*(pDM_Odm->pSecChOffset)) ); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("pSecurity=%d\n",*(pDM_Odm->pSecurity)) ); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("pBandWidth=%d\n",*(pDM_Odm->pBandWidth)) ); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("pChannel=%d\n",*(pDM_Odm->pChannel)) ); - - if(pDM_Odm->SupportICType==ODM_RTL8192D) - { - if(pDM_Odm->pBandType) - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("pBandType=%d\n",*(pDM_Odm->pBandType)) ); - if(pDM_Odm->pMacPhyMode) - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("pMacPhyMode=%d\n",*(pDM_Odm->pMacPhyMode)) ); - if(pDM_Odm->pBuddyAdapter) - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("pbGetValueFromOtherMac=%d\n",*(pDM_Odm->pbGetValueFromOtherMac)) ); - if(pDM_Odm->pBuddyAdapter) - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("pBuddyAdapter=%p\n",*(pDM_Odm->pBuddyAdapter)) ); - if(pDM_Odm->pbMasterOfDMSP) - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("pbMasterOfDMSP=%d\n",*(pDM_Odm->pbMasterOfDMSP)) ); - } - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("pbScanInProcess=%d\n",*(pDM_Odm->pbScanInProcess)) ); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("pbPowerSaving=%d\n",*(pDM_Odm->pbPowerSaving)) ); - - if(pDM_Odm->SupportPlatform & (ODM_AP|ODM_ADSL)) - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("pOnePathCCA=%d\n",*(pDM_Odm->pOnePathCCA)) ); -} - -VOID -odm_CmnInfoUpdate_Debug( - IN PDM_ODM_T pDM_Odm - ) -{ - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("odm_CmnInfoUpdate_Debug==>\n")); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("bWIFI_Direct=%d\n",pDM_Odm->bWIFI_Direct) ); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("bWIFI_Display=%d\n",pDM_Odm->bWIFI_Display) ); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("bLinked=%d\n",pDM_Odm->bLinked) ); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("RSSI_Min=%d\n",pDM_Odm->RSSI_Min) ); -} - -VOID -odm_BasicDbgMessage -( - IN PDM_ODM_T pDM_Odm - ) -{ - PFALSE_ALARM_STATISTICS FalseAlmCnt = &(pDM_Odm->FalseAlmCnt); - pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("odm_BasicDbgMsg==>\n")); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("bLinked = %d, RSSI_Min = %d, CurrentIGI = 0x%x \n", - pDM_Odm->bLinked, pDM_Odm->RSSI_Min, pDM_DigTable->CurIGValue) ); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("Cnt_Cck_fail = %d, Cnt_Ofdm_fail = %d, Total False Alarm = %d\n", - FalseAlmCnt->Cnt_Cck_fail, FalseAlmCnt->Cnt_Ofdm_fail, FalseAlmCnt->Cnt_all)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("RxRate = 0x%x, RSSI_A = %d, RSSI_B = %d\n", - pDM_Odm->RxRate, pDM_Odm->RSSI_A, pDM_Odm->RSSI_B)); - //ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("RSSI_C = %d, RSSI_D = %d\n", pDM_Odm->RSSI_C, pDM_Odm->RSSI_D)); - -} #if (DM_ODM_SUPPORT_TYPE == ODM_WIN) VOID @@ -1967,1867 +1010,17 @@ odm_IsLinked( * When Who Remark * *---------------------------------------------------------------------------*/ -VOID -ODM_ChangeDynamicInitGainThresh( - IN PDM_ODM_T pDM_Odm, - IN u4Byte DM_Type, - IN u4Byte DM_Value - ) -{ - pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; - if (DM_Type == DIG_TYPE_THRESH_HIGH) - { - pDM_DigTable->RssiHighThresh = DM_Value; - } - else if (DM_Type == DIG_TYPE_THRESH_LOW) - { - pDM_DigTable->RssiLowThresh = DM_Value; - } - else if (DM_Type == DIG_TYPE_ENABLE) - { - pDM_DigTable->Dig_Enable_Flag = TRUE; - } - else if (DM_Type == DIG_TYPE_DISABLE) - { - pDM_DigTable->Dig_Enable_Flag = FALSE; - } - else if (DM_Type == DIG_TYPE_BACKOFF) - { - if(DM_Value > 30) - DM_Value = 30; - pDM_DigTable->BackoffVal = (u1Byte)DM_Value; - } - else if(DM_Type == DIG_TYPE_RX_GAIN_MIN) - { - if(DM_Value == 0) - DM_Value = 0x1; - pDM_DigTable->rx_gain_range_min = (u1Byte)DM_Value; - } - else if(DM_Type == DIG_TYPE_RX_GAIN_MAX) - { - if(DM_Value > 0x50) - DM_Value = 0x50; - pDM_DigTable->rx_gain_range_max = (u1Byte)DM_Value; - } -} /* DM_ChangeDynamicInitGainThresh */ +//Remove DIG by yuchen -int getIGIForDiff(int value_IGI) -{ - #define ONERCCA_LOW_TH 0x30 - #define ONERCCA_LOW_DIFF 8 +//Remove DIG and FA check by Yu Chen - if (value_IGI < ONERCCA_LOW_TH) { - if ((ONERCCA_LOW_TH - value_IGI) < ONERCCA_LOW_DIFF) - return ONERCCA_LOW_TH; - else - return value_IGI + ONERCCA_LOW_DIFF; - } else { - return value_IGI; - } -} - - -VOID -odm_AdaptivityInit( -IN PDM_ODM_T pDM_Odm -) -{ - if(pDM_Odm->SupportICType == ODM_RTL8723B) - { - pDM_Odm->TH_L2H_ini = 0xf8; // -8 - } - if((pDM_Odm->SupportICType == ODM_RTL8192E)&&(pDM_Odm->SupportInterface == ODM_ITRF_PCIE)) - { - pDM_Odm->TH_L2H_ini = 0xf0; // -16 - } - else - { - pDM_Odm->TH_L2H_ini = 0xf9; // -7 - } - - pDM_Odm->TH_EDCCA_HL_diff = 7; - pDM_Odm->IGI_Base = 0x32; - pDM_Odm->IGI_target = 0x1c; - pDM_Odm->ForceEDCCA = 0; - pDM_Odm->AdapEn_RSSI = 20; - - //Reg524[11]=0 is easily to transmit packets during adaptivity test - - //ODM_SetBBReg(pDM_Odm, 0x524, BIT11, 1);// stop counting if EDCCA is asserted -} - -// Add by Neil Chen to enable edcca to MP Platform -#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) - -VOID -odm_EnableEDCCA( - IN PDM_ODM_T pDM_Odm -) -{ - - // This should be moved out of OUTSRC - PADAPTER pAdapter = pDM_Odm->Adapter; - // Enable EDCCA. The value is suggested by SD3 Wilson. - - // - // Revised for ASUS 11b/g performance issues, suggested by BB Neil, 2012.04.13. - // - if((pDM_Odm->SupportICType == ODM_RTL8723A)&&(IS_WIRELESS_MODE_G(pAdapter))) - { - //PlatformEFIOWrite1Byte(Adapter, rOFDM0_ECCAThreshold, 0x00); - ODM_Write1Byte(pDM_Odm,rOFDM0_ECCAThreshold,0x00); - ODM_Write1Byte(pDM_Odm,rOFDM0_ECCAThreshold+2,0xFD); - - } - else - { - //PlatformEFIOWrite1Byte(Adapter, rOFDM0_ECCAThreshold, 0x03); - ODM_Write1Byte(pDM_Odm,rOFDM0_ECCAThreshold,0x03); - ODM_Write1Byte(pDM_Odm,rOFDM0_ECCAThreshold+2,0x00); - } - - //PlatformEFIOWrite1Byte(Adapter, rOFDM0_ECCAThreshold+2, 0x00); -} - -VOID -odm_DisableEDCCA( - IN PDM_ODM_T pDM_Odm -) -{ - // Disable EDCCA.. - ODM_Write1Byte(pDM_Odm, rOFDM0_ECCAThreshold, 0x7f); - ODM_Write1Byte(pDM_Odm, rOFDM0_ECCAThreshold+2, 0x7f); -} - -// -// Description: According to initial gain value to determine to enable or disable EDCCA. -// -// Suggested by SD3 Wilson. Added by tynli. 2011.11.25. -// -VOID -odm_DynamicEDCCA( - IN PDM_ODM_T pDM_Odm -) -{ - PADAPTER pAdapter = pDM_Odm->Adapter; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - u1Byte RegC50, RegC58; - BOOLEAN bFwCurrentInPSMode=FALSE; - - pAdapter->HalFunc.GetHwRegHandler(pAdapter, HW_VAR_FW_PSMODE_STATUS, (pu1Byte)(&bFwCurrentInPSMode)); - - // Disable EDCCA mode while under LPS mode, added by Roger, 2012.09.14. - if(bFwCurrentInPSMode) - return; - - RegC50 = (u1Byte)ODM_GetBBReg(pDM_Odm, rOFDM0_XAAGCCore1, bMaskByte0); - RegC58 = (u1Byte)ODM_GetBBReg(pDM_Odm, rOFDM0_XBAGCCore1, bMaskByte0); - - - if((RegC50 > 0x28 && RegC58 > 0x28) || - ((pDM_Odm->SupportICType == ODM_RTL8723A && IS_WIRELESS_MODE_G(pAdapter) && RegC50>0x26)) || - (pDM_Odm->SupportICType == ODM_RTL8188E && RegC50 > 0x28)) - { - if(!pHalData->bPreEdccaEnable) - { - odm_EnableEDCCA(pDM_Odm); - pHalData->bPreEdccaEnable = TRUE; - } - - } - else if((RegC50 < 0x25 && RegC58 < 0x25) || (pDM_Odm->SupportICType == ODM_RTL8188E && RegC50 < 0x25)) - { - if(pHalData->bPreEdccaEnable) - { - odm_DisableEDCCA(pDM_Odm); - pHalData->bPreEdccaEnable = FALSE; - } - } -} - - -#endif // end MP platform support - -VOID -odm_Adaptivity( - IN PDM_ODM_T pDM_Odm, - IN u1Byte IGI -) -{ - s1Byte TH_L2H_dmc, TH_H2L_dmc; - s1Byte Diff, IGI_target; - BOOLEAN EDCCA_State = 0; - -#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) - PADAPTER pAdapter = pDM_Odm->Adapter; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - BOOLEAN bFwCurrentInPSMode=FALSE; - PMGNT_INFO pMgntInfo = &(pAdapter->MgntInfo); - - pAdapter->HalFunc.GetHwRegHandler(pAdapter, HW_VAR_FW_PSMODE_STATUS, (pu1Byte)(&bFwCurrentInPSMode)); - - // Disable EDCCA mode while under LPS mode, added by Roger, 2012.09.14. - if(bFwCurrentInPSMode) - return; -#endif - - if(!(pDM_Odm->SupportAbility & ODM_BB_ADAPTIVITY)) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("Go to odm_DynamicEDCCA() \n")); - // Add by Neil Chen to enable edcca to MP Platform -#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) - // Adjust EDCCA. - if(pDM_Odm->SupportICType & ODM_IC_11N_SERIES) - odm_DynamicEDCCA(pDM_Odm); -#endif - return; - } - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_Adaptivity() =====> \n")); - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("ForceEDCCA=%d, IGI_Base=0x%x, TH_L2H_ini = %d, TH_EDCCA_HL_diff = %d, AdapEn_RSSI = %d\n", - pDM_Odm->ForceEDCCA, pDM_Odm->IGI_Base, pDM_Odm->TH_L2H_ini, pDM_Odm->TH_EDCCA_HL_diff, pDM_Odm->AdapEn_RSSI)); - - if(pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) - ODM_SetBBReg(pDM_Odm, 0x800, BIT10, 0); //ADC_mask enable - - if((!pDM_Odm->bLinked)||(*pDM_Odm->pChannel > 149)) // Band4 doesn't need adaptivity - { - if(pDM_Odm->SupportICType & ODM_IC_11N_SERIES) - { - ODM_SetBBReg(pDM_Odm,rOFDM0_ECCAThreshold, bMaskByte0, 0x7f); - ODM_SetBBReg(pDM_Odm,rOFDM0_ECCAThreshold, bMaskByte2, 0x7f); - } - else - ODM_SetBBReg(pDM_Odm, rFPGA0_XB_LSSIReadBack, 0xFFFF, (0x7f<<8) | 0x7f); - return; - } - -#if (DM_ODM_SUPPORT_TYPE==ODM_WIN) - if(pMgntInfo->IOTPeer == HT_IOT_PEER_BROADCOM) - ODM_Write1Byte(pDM_Odm, REG_TRX_SIFS_OFDM, 0x0a); - else - ODM_Write1Byte(pDM_Odm, REG_TRX_SIFS_OFDM, 0x0e); -#endif - if(!pDM_Odm->ForceEDCCA) - { - if(pDM_Odm->RSSI_Min > pDM_Odm->AdapEn_RSSI) - EDCCA_State = 1; - else if(pDM_Odm->RSSI_Min < (pDM_Odm->AdapEn_RSSI - 5)) - EDCCA_State = 0; - } - else - EDCCA_State = 1; - //if((pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) && (*pDM_Odm->pBandType == BAND_ON_5G)) - //IGI_target = pDM_Odm->IGI_Base; - //else - { - - if(*pDM_Odm->pBandWidth == ODM_BW20M) //CHANNEL_WIDTH_20 - IGI_target = pDM_Odm->IGI_Base; - else if(*pDM_Odm->pBandWidth == ODM_BW40M) - IGI_target = pDM_Odm->IGI_Base + 2; - else if(*pDM_Odm->pBandWidth == ODM_BW80M) - IGI_target = pDM_Odm->IGI_Base + 6; - else - IGI_target = pDM_Odm->IGI_Base; - } - - pDM_Odm->IGI_target = (u1Byte) IGI_target; - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("BandWidth=%s, IGI_target=0x%x, EDCCA_State=%d\n", - (*pDM_Odm->pBandWidth==ODM_BW80M)?"80M":((*pDM_Odm->pBandWidth==ODM_BW40M)?"40M":"20M"), IGI_target, EDCCA_State)); - - if(EDCCA_State == 1) - { - Diff = IGI_target -(s1Byte)IGI; - TH_L2H_dmc = pDM_Odm->TH_L2H_ini + Diff; - if(TH_L2H_dmc > 10) TH_L2H_dmc = 10; - TH_H2L_dmc = TH_L2H_dmc - pDM_Odm->TH_EDCCA_HL_diff; - } - else - { - TH_L2H_dmc = 0x7f; - TH_H2L_dmc = 0x7f; - } - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("IGI=0x%x, TH_L2H_dmc = %d, TH_H2L_dmc = %d\n", - IGI, TH_L2H_dmc, TH_H2L_dmc)); - - if(pDM_Odm->SupportICType & ODM_IC_11N_SERIES) - { - ODM_SetBBReg(pDM_Odm,rOFDM0_ECCAThreshold, bMaskByte0, (u1Byte)TH_L2H_dmc); - ODM_SetBBReg(pDM_Odm,rOFDM0_ECCAThreshold, bMaskByte2, (u1Byte)TH_H2L_dmc); - } - else - ODM_SetBBReg(pDM_Odm, rFPGA0_XB_LSSIReadBack, 0xFFFF, ((u1Byte)TH_H2L_dmc<<8) | (u1Byte)TH_L2H_dmc); -} - -VOID -ODM_DynamicATCSwitch_init( - IN PDM_ODM_T pDM_Odm -) -{ - PADAPTER Adapter = pDM_Odm->Adapter; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - -#if (DM_ODM_SUPPORT_TYPE == ODM_WIN ) - - pDM_Odm->CrystalCap = pHalData->CrystalCap; - pDM_Odm->bATCStatus = (u1Byte)ODM_GetBBReg(pDM_Odm, rOFDM1_CFOTracking, BIT11); - pDM_Odm->CFOThreshold = CFO_Threshold_Xtal; - -#endif -} - -VOID -ODM_DynamicATCSwitch( - IN PDM_ODM_T pDM_Odm -) -{ - PADAPTER Adapter = pDM_Odm->Adapter; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - u1Byte CrystalCap,ATC_status_temp = 0; - u4Byte packet_count; - int CFO_kHz_A,CFO_kHz_B,CFO_ave = 0, Adjust_Xtal = 0; - int CFO_ave_diff; - -#if (MP_DRIVER == 1) - if ( *(pDM_Odm->mp_mode) == 1) - pDM_Odm->bLinked = TRUE; -#endif - -#if (DM_ODM_SUPPORT_TYPE == ODM_WIN ) - - if(!(pDM_Odm->SupportAbility & ODM_BB_DYNAMIC_ATC)) - return; - - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DYNAMIC_ATC, ODM_DBG_LOUD, ("=========> ODM_DynamicATCSwitch()\n")); - - //2 No link! - // - if(!pDM_Odm->bLinked) - { - //3 - //3 1.Enable ATC - if(pDM_Odm->bATCStatus == ATC_Status_Off) - { - if(pDM_Odm->SupportICType & ODM_IC_11N_SERIES) - ODM_SetBBReg(pDM_Odm, rOFDM1_CFOTracking, BIT11, ATC_Status_On); - - if(pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) - ODM_SetBBReg(pDM_Odm, rFc_area_Jaguar, BIT14, ATC_Status_On); - - pDM_Odm->bATCStatus = ATC_Status_On; - } - - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DYNAMIC_ATC, ODM_DBG_LOUD, ("ODM_DynamicATCSwitch(): No link!!\n")); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DYNAMIC_ATC, ODM_DBG_LOUD, ("ODM_DynamicATCSwitch(): ATCStatus = %d\n", pDM_Odm->bATCStatus)); - - //3 2.Disable CFO tracking for BT - if(!pDM_Odm->bBtDisabled) - { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DYNAMIC_ATC, ODM_DBG_LOUD, ("ODM_DynamicATCSwitch(): Disable CFO tracking for BT!!\n")); - return; - } - - //3 3.Reset Crystal Cap. - if(pDM_Odm->CrystalCap != pHalData->CrystalCap) - { - pDM_Odm->CrystalCap = pHalData->CrystalCap; - CrystalCap = pDM_Odm->CrystalCap & 0x3f; - odm_Write_CrystalCap(pDM_Odm,CrystalCap); - } - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DYNAMIC_ATC, ODM_DBG_LOUD, ("ODM_DynamicATCSwitch(): CrystalCap = 0x%x\n", pDM_Odm->CrystalCap)); - - } - else - { - - //2 Initialization - // - //3 1. Calculate CFO for path-A & path-B - CFO_kHz_A = (int)(pDM_Odm->CFO_tail[0] * 3125) / 1280; - CFO_kHz_B = (int)(pDM_Odm->CFO_tail[1] * 3125) / 1280; - packet_count = pDM_Odm->packetCount; - - //3 2.No new packet - if(packet_count == pDM_Odm->packetCount_pre) - { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DYNAMIC_ATC, ODM_DBG_LOUD, ("ODM_DynamicATCSwitch(): packet counter doesn't change\n")); - return; - } - pDM_Odm->packetCount_pre = packet_count; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DYNAMIC_ATC, ODM_DBG_LOUD, ("ODM_DynamicATCSwitch(): packet counter = %d\n", pDM_Odm->packetCount)); - - //3 3.Average CFO - if(pDM_Odm->RFType == ODM_1T1R) - CFO_ave = CFO_kHz_A; - else - CFO_ave = (int)(CFO_kHz_A + CFO_kHz_B) >> 1; - - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DYNAMIC_ATC, ODM_DBG_LOUD, ("ODM_DynamicATCSwitch(): CFO_kHz_A = %dkHz, CFO_kHz_B = %dkHz, CFO_ave = %dkHz\n", - CFO_kHz_A, CFO_kHz_B, CFO_ave)); - - //3 4.Avoid abnormal large CFO - CFO_ave_diff = (pDM_Odm->CFO_ave_pre >= CFO_ave)?(pDM_Odm->CFO_ave_pre - CFO_ave):(CFO_ave - pDM_Odm->CFO_ave_pre); - if(CFO_ave_diff > 20 && pDM_Odm->largeCFOHit == 0) - { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DYNAMIC_ATC, ODM_DBG_LOUD, ("ODM_DynamicATCSwitch(): first large CFO hit\n")); - pDM_Odm->largeCFOHit = 1; - return; - } - else - pDM_Odm->largeCFOHit = 0; - pDM_Odm->CFO_ave_pre = CFO_ave; - - //2 CFO tracking by adjusting Xtal cap. - // - if (pDM_Odm->bBtDisabled) - { - //3 1.Dynamic Xtal threshold - if(CFO_ave >= -pDM_Odm->CFOThreshold && CFO_ave <= pDM_Odm->CFOThreshold && pDM_Odm->bIsfreeze == 0) - { - if (pDM_Odm->CFOThreshold == CFO_Threshold_Xtal) - { - pDM_Odm->CFOThreshold = CFO_Threshold_Xtal + 10; - pDM_Odm->bIsfreeze = 1; - } - else - pDM_Odm->CFOThreshold = CFO_Threshold_Xtal; - } - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DYNAMIC_ATC, ODM_DBG_LOUD, ("ODM_DynamicATCSwitch(): Dynamic threshold = %d\n", pDM_Odm->CFOThreshold)); - - //3 2.Calculate Xtal offset - if(CFO_ave > pDM_Odm->CFOThreshold && pDM_Odm->CrystalCap < 0x3f) - Adjust_Xtal = ((CFO_ave - CFO_Threshold_Xtal) >> 2) + 1; - else if(CFO_ave < (-pDM_Odm->CFOThreshold) && pDM_Odm->CrystalCap > 0) - Adjust_Xtal = ((CFO_ave + CFO_Threshold_Xtal) >> 2) - 1; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DYNAMIC_ATC, ODM_DBG_LOUD, ("ODM_DynamicATCSwitch(): Crystal cap = 0x%x, Crystal cap offset = %d\n", pDM_Odm->CrystalCap, Adjust_Xtal)); - - //3 3.Adjudt Crystal Cap. - if(Adjust_Xtal != 0) - { - pDM_Odm->bIsfreeze = 0; - pDM_Odm->CrystalCap = pDM_Odm->CrystalCap + Adjust_Xtal; - - if(pDM_Odm->CrystalCap > 0x3f) - pDM_Odm->CrystalCap = 0x3f; - else if (pDM_Odm->CrystalCap < 0) - pDM_Odm->CrystalCap = 0; - - CrystalCap = pDM_Odm->CrystalCap & 0x3f; - odm_Write_CrystalCap(pDM_Odm,CrystalCap); - - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DYNAMIC_ATC, ODM_DBG_LOUD, ("ODM_DynamicATCSwitch(): New crystal cap = 0x%x \n", pDM_Odm->CrystalCap)); - } - } - else if(pDM_Odm->CrystalCap != pHalData->CrystalCap) - { - //3 Reset Xtal Cap when BT is enable - pDM_Odm->CrystalCap = pHalData->CrystalCap; - CrystalCap = pDM_Odm->CrystalCap & 0x3f; - odm_Write_CrystalCap(pDM_Odm,CrystalCap); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DYNAMIC_ATC, ODM_DBG_LOUD, ("ODM_DynamicATCSwitch(): Disable CFO tracking for BT!! (CrystalCap is reset)\n")); - } - else - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DYNAMIC_ATC, ODM_DBG_LOUD, ("ODM_DynamicATCSwitch(): Disable CFO tracking for BT!! (CrystalCap is unchanged)\n")); - if(pDM_Odm->SupportICType & ODM_IC_11N_SERIES){ - //2 Dynamic ATC switch - // - //3 1.Enable ATC when CFO is larger then 80kHz - if(CFO_ave < CFO_Threshold_ATC && CFO_ave > -CFO_Threshold_ATC) - { - if(pDM_Odm->bATCStatus == ATC_Status_On) - { - ODM_SetBBReg(pDM_Odm, rOFDM1_CFOTracking, BIT11, ATC_Status_Off); - pDM_Odm->bATCStatus = ATC_Status_Off; - } - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DYNAMIC_ATC, ODM_DBG_LOUD, ("ODM_DynamicATCSwitch(): Disable ATC!!\n")); - } - else - { - if(pDM_Odm->bATCStatus == ATC_Status_Off) - { - ODM_SetBBReg(pDM_Odm, rOFDM1_CFOTracking, BIT11, ATC_Status_On); - pDM_Odm->bATCStatus = ATC_Status_On; - } - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DYNAMIC_ATC, ODM_DBG_LOUD, ("ODM_DynamicATCSwitch(): Enable ATC!!\n")); - } - } - } -#endif -} - -VOID -odm_Write_CrystalCap( - IN PDM_ODM_T pDM_Odm, - IN u1Byte CrystalCap -) -{ - PADAPTER Adapter = pDM_Odm->Adapter; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - - if(IS_HARDWARE_TYPE_8192D(Adapter)) - { - PHY_SetBBReg(Adapter, 0x24, 0xF0, CrystalCap & 0x0F); - PHY_SetBBReg(Adapter, 0x28, 0xF0000000, ((CrystalCap & 0xF0) >> 4)); - } - - if(IS_HARDWARE_TYPE_8188E(Adapter)) - { - // write 0x24[16:11] = 0x24[22:17] = CrystalCap - PHY_SetBBReg(Adapter, REG_AFE_XTAL_CTRL, 0x7ff800, (CrystalCap | (CrystalCap << 6))); - } - - if(IS_HARDWARE_TYPE_8812(Adapter)) - { - // write 0x2C[30:25] = 0x2C[24:19] = CrystalCap - CrystalCap = CrystalCap & 0x3F; - PHY_SetBBReg(Adapter, REG_MAC_PHY_CTRL, 0x7FF80000, (CrystalCap | (CrystalCap << 6))); - } - - //only for B-cut - if ((IS_HARDWARE_TYPE_8723A(Adapter) && pHalData->EEPROMVersion >= 0x01) || - IS_HARDWARE_TYPE_8723B(Adapter) ||IS_HARDWARE_TYPE_8192E(Adapter) || IS_HARDWARE_TYPE_8821(Adapter)) - { - // 0x2C[23:18] = 0x2C[17:12] = CrystalCap - CrystalCap = CrystalCap & 0x3F; - PHY_SetBBReg(Adapter, REG_MAC_PHY_CTRL, 0xFFF000, (CrystalCap | (CrystalCap << 6))); - } - - if(IS_HARDWARE_TYPE_8723AE(Adapter)) - PHY_SetBBReg(Adapter, REG_LDOA15_CTRL, bMaskDWord, 0x01572505); - -} - - -VOID -ODM_Write_DIG( - IN PDM_ODM_T pDM_Odm, - IN u1Byte CurrentIGI - ) -{ - pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; - - if(pDM_Odm->StopDIG) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("Stop Writing IGI\n")); - return; - } - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("ODM_REG(IGI_A,pDM_Odm)=0x%x, ODM_BIT(IGI,pDM_Odm)=0x%x \n", - ODM_REG(IGI_A,pDM_Odm),ODM_BIT(IGI,pDM_Odm))); - - if(pDM_DigTable->CurIGValue != CurrentIGI)//if(pDM_DigTable->PreIGValue != CurrentIGI) - { - if(pDM_Odm->SupportPlatform & (ODM_CE|ODM_WIN)) - { - ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_A,pDM_Odm), ODM_BIT(IGI,pDM_Odm), CurrentIGI); - if(pDM_Odm->RFType != ODM_1T1R) - ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_B,pDM_Odm), ODM_BIT(IGI,pDM_Odm), CurrentIGI); - } - else if(pDM_Odm->SupportPlatform & (ODM_AP|ODM_ADSL)) - { - switch(*(pDM_Odm->pOnePathCCA)) - { - case ODM_CCA_2R: - ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_A,pDM_Odm), ODM_BIT(IGI,pDM_Odm), CurrentIGI); - if(pDM_Odm->RFType != ODM_1T1R) - ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_B,pDM_Odm), ODM_BIT(IGI,pDM_Odm), CurrentIGI); - break; - case ODM_CCA_1R_A: - ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_A,pDM_Odm), ODM_BIT(IGI,pDM_Odm), CurrentIGI); - if(pDM_Odm->RFType != ODM_1T1R) - ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_B,pDM_Odm), ODM_BIT(IGI,pDM_Odm), getIGIForDiff(CurrentIGI)); - break; - case ODM_CCA_1R_B: - ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_A,pDM_Odm), ODM_BIT(IGI,pDM_Odm), getIGIForDiff(CurrentIGI)); - if(pDM_Odm->RFType != ODM_1T1R) - ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_B,pDM_Odm), ODM_BIT(IGI,pDM_Odm), CurrentIGI); - break; - } - } - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("CurrentIGI(0x%02x). \n",CurrentIGI)); - //pDM_DigTable->PreIGValue = pDM_DigTable->CurIGValue; - pDM_DigTable->CurIGValue = CurrentIGI; - } - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("ODM_Write_DIG():CurrentIGI=0x%x \n",CurrentIGI)); - -} - -VOID -odm_DIGbyRSSI_LPS( - IN PDM_ODM_T pDM_Odm - ) -{ - //PADAPTER pAdapter =pDM_Odm->Adapter; - //pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; - PFALSE_ALARM_STATISTICS pFalseAlmCnt = &pDM_Odm->FalseAlmCnt; - -#if 0 //and 2.3.5 coding rule - struct mlme_priv *pmlmepriv = &(pAdapter->mlmepriv); - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - struct dm_priv *pdmpriv = &pHalData->dmpriv; -#endif - - u1Byte RSSI_Lower=DM_DIG_MIN_NIC; //0x1E or 0x1C - u1Byte CurrentIGI=pDM_Odm->RSSI_Min; - - CurrentIGI=CurrentIGI+RSSI_OFFSET_DIG; - - - //ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG_LPS, ODM_DBG_LOUD, ("odm_DIG()==>\n")); - - // Using FW PS mode to make IGI - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("---Neil---odm_DIG is in LPS mode\n")); - //Adjust by FA in LPS MODE - if(pFalseAlmCnt->Cnt_all> DM_DIG_FA_TH2_LPS) - CurrentIGI = CurrentIGI+2; - else if (pFalseAlmCnt->Cnt_all > DM_DIG_FA_TH1_LPS) - CurrentIGI = CurrentIGI+1; - else if(pFalseAlmCnt->Cnt_all < DM_DIG_FA_TH0_LPS) - CurrentIGI = CurrentIGI-1; - - - //Lower bound checking - - //RSSI Lower bound check - if((pDM_Odm->RSSI_Min-10) > DM_DIG_MIN_NIC) - RSSI_Lower =(pDM_Odm->RSSI_Min-10); - else - RSSI_Lower =DM_DIG_MIN_NIC; - - //Upper and Lower Bound checking - if(CurrentIGI > DM_DIG_MAX_NIC) - CurrentIGI=DM_DIG_MAX_NIC; - else if(CurrentIGI < RSSI_Lower) - CurrentIGI =RSSI_Lower; - - ODM_Write_DIG(pDM_Odm, CurrentIGI);//ODM_Write_DIG(pDM_Odm, pDM_DigTable->CurIGValue); - -} - -VOID -odm_DIGInit( - IN PDM_ODM_T pDM_Odm - ) -{ - pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; - - //pDM_DigTable->Dig_Enable_Flag = TRUE; - //pDM_DigTable->Dig_Ext_Port_Stage = DIG_EXT_PORT_STAGE_MAX; - pDM_DigTable->CurIGValue = (u1Byte) ODM_GetBBReg(pDM_Odm, ODM_REG(IGI_A,pDM_Odm), ODM_BIT(IGI,pDM_Odm)); - //pDM_DigTable->PreIGValue = 0x0; - //pDM_DigTable->CurSTAConnectState = pDM_DigTable->PreSTAConnectState = DIG_STA_DISCONNECT; - //pDM_DigTable->CurMultiSTAConnectState = DIG_MultiSTA_DISCONNECT; - pDM_DigTable->RssiLowThresh = DM_DIG_THRESH_LOW; - pDM_DigTable->RssiHighThresh = DM_DIG_THRESH_HIGH; - pDM_DigTable->FALowThresh = DM_FALSEALARM_THRESH_LOW; - pDM_DigTable->FAHighThresh = DM_FALSEALARM_THRESH_HIGH; - if(pDM_Odm->BoardType & (ODM_BOARD_EXT_PA|ODM_BOARD_EXT_LNA)) - { - pDM_DigTable->rx_gain_range_max = DM_DIG_MAX_NIC; - pDM_DigTable->rx_gain_range_min = DM_DIG_MIN_NIC; - } - else - { - pDM_DigTable->rx_gain_range_max = DM_DIG_MAX_NIC; - pDM_DigTable->rx_gain_range_min = DM_DIG_MIN_NIC; - } - pDM_DigTable->BackoffVal = DM_DIG_BACKOFF_DEFAULT; - pDM_DigTable->BackoffVal_range_max = DM_DIG_BACKOFF_MAX; - pDM_DigTable->BackoffVal_range_min = DM_DIG_BACKOFF_MIN; - pDM_DigTable->PreCCK_CCAThres = 0xFF; - pDM_DigTable->CurCCK_CCAThres = 0x83; - pDM_DigTable->ForbiddenIGI = DM_DIG_MIN_NIC; - pDM_DigTable->LargeFAHit = 0; - pDM_DigTable->Recover_cnt = 0; - pDM_DigTable->DIG_Dynamic_MIN_0 = DM_DIG_MIN_NIC; - pDM_DigTable->DIG_Dynamic_MIN_1 = DM_DIG_MIN_NIC; - pDM_DigTable->bMediaConnect_0 = FALSE; - pDM_DigTable->bMediaConnect_1 = FALSE; - - //To Initialize pDM_Odm->bDMInitialGainEnable == FALSE to avoid DIG error - pDM_Odm->bDMInitialGainEnable = TRUE; - - //To Initi BT30 IGI - pDM_DigTable->BT30_CurIGI=0x32; - -} - -VOID -odm_DigForBtHsMode( - IN PDM_ODM_T pDM_Odm - ) -{ -#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) - pDIG_T pDM_DigTable=&pDM_Odm->DM_DigTable; - u1Byte digForBtHs=0; - u1Byte digUpBound=0x5a; - - if(pDM_Odm->bBtConnectProcess) - { - if(pDM_Odm->SupportICType&(ODM_RTL8723A)) - digForBtHs = 0x28; - else - digForBtHs = 0x22; - } - else - { - // - // Decide DIG value by BT HS RSSI. - // - digForBtHs = pDM_Odm->btHsRssi+4; - - //DIG Bound - if(pDM_Odm->SupportICType&(ODM_RTL8723A)) - digUpBound = 0x3e; - - if(digForBtHs > digUpBound) - digForBtHs = digUpBound; - if(digForBtHs < 0x1c) - digForBtHs = 0x1c; - - // update Current IGI - pDM_DigTable->BT30_CurIGI = digForBtHs; - } - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DigForBtHsMode() : set DigValue=0x%x\n", digForBtHs)); -#endif -} - -VOID -odm_DIG( - IN PDM_ODM_T pDM_Odm - ) -{ - pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; - PFALSE_ALARM_STATISTICS pFalseAlmCnt = &pDM_Odm->FalseAlmCnt; - pRXHP_T pRX_HP_Table = &pDM_Odm->DM_RXHP_Table; - u1Byte DIG_Dynamic_MIN; - u1Byte DIG_MaxOfMin; - BOOLEAN FirstConnect, FirstDisConnect; - u1Byte dm_dig_max, dm_dig_min, offset; - u1Byte CurrentIGI = pDM_DigTable->CurIGValue; - u1Byte Adap_IGI_Upper = pDM_Odm->IGI_target + 30 + (u1Byte) pDM_Odm->TH_L2H_ini -(u1Byte) pDM_Odm->TH_EDCCA_HL_diff; - -#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) -// This should be moved out of OUTSRC - PADAPTER pAdapter = pDM_Odm->Adapter; -#if OS_WIN_FROM_WIN7(OS_VERSION) - if(IsAPModeExist( pAdapter) && pAdapter->bInHctTest) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() Return: Is AP mode or In HCT Test \n")); - return; - } -#endif -/* - if (pDM_Odm->SupportICType==ODM_RTL8723B) - return; -*/ - - if(pDM_Odm->bBtHsOperation) - { - odm_DigForBtHsMode(pDM_Odm); - } - - if(!(pDM_Odm->SupportICType &(ODM_RTL8723A|ODM_RTL8188E))) - { - if(pRX_HP_Table->RXHP_flag == 1) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() Return: In RXHP Operation \n")); - return; - } - } -#endif -#if (DM_ODM_SUPPORT_TYPE == ODM_CE) -#ifdef CONFIG_SPECIAL_SETTING_FOR_FUNAI_TV - if((pDM_Odm->bLinked) && (pDM_Odm->Adapter->registrypriv.force_igi !=0)) - { - printk("pDM_Odm->RSSI_Min=%d \n",pDM_Odm->RSSI_Min); - ODM_Write_DIG(pDM_Odm,pDM_Odm->Adapter->registrypriv.force_igi); - return; - } -#endif -#endif -#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - prtl8192cd_priv priv = pDM_Odm->priv; - if (!((priv->up_time > 5) && (priv->up_time % 2)) ) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() Return: Not In DIG Operation Period \n")); - return; - } -#endif - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG()==>\n")); - //if(!(pDM_Odm->SupportAbility & (ODM_BB_DIG|ODM_BB_FA_CNT))) - if((!(pDM_Odm->SupportAbility&ODM_BB_DIG)) ||(!(pDM_Odm->SupportAbility&ODM_BB_FA_CNT))) - { -#if 0 - if(pDM_Odm->SupportPlatform & (ODM_AP|ODM_ADSL)) - { - if ((pDM_Odm->SupportICType == ODM_RTL8192C) && (pDM_Odm->ExtLNA == 1)) - CurrentIGI = 0x30; //pDM_DigTable->CurIGValue = 0x30; - else - CurrentIGI = 0x20; //pDM_DigTable->CurIGValue = 0x20; - ODM_Write_DIG(pDM_Odm, CurrentIGI);//ODM_Write_DIG(pDM_Odm, pDM_DigTable->CurIGValue); - } -#endif - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() Return: SupportAbility ODM_BB_DIG or ODM_BB_FA_CNT is disabled\n")); - return; - } - - if(*(pDM_Odm->pbScanInProcess)) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() Return: In Scan Progress \n")); - return; - } - - //add by Neil Chen to avoid PSD is processing - if(pDM_Odm->SupportICType==ODM_RTL8723A) - { - if(pDM_Odm->bDMInitialGainEnable == FALSE) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() Return: PSD is Processing \n")); - return; - } - } - - if(pDM_Odm->SupportICType == ODM_RTL8192D) - { - if(*(pDM_Odm->pMacPhyMode) == ODM_DMSP) - { - if(*(pDM_Odm->pbMasterOfDMSP)) - { - DIG_Dynamic_MIN = pDM_DigTable->DIG_Dynamic_MIN_0; - FirstConnect = (pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_0 == FALSE); - FirstDisConnect = (!pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_0 == TRUE); - } - else - { - DIG_Dynamic_MIN = pDM_DigTable->DIG_Dynamic_MIN_1; - FirstConnect = (pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_1 == FALSE); - FirstDisConnect = (!pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_1 == TRUE); - } - } - else - { - if(*(pDM_Odm->pBandType) == ODM_BAND_5G) - { - DIG_Dynamic_MIN = pDM_DigTable->DIG_Dynamic_MIN_0; - FirstConnect = (pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_0 == FALSE); - FirstDisConnect = (!pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_0 == TRUE); - } - else - { - DIG_Dynamic_MIN = pDM_DigTable->DIG_Dynamic_MIN_1; - FirstConnect = (pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_1 == FALSE); - FirstDisConnect = (!pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_1 == TRUE); - } - } - } - else - { - DIG_Dynamic_MIN = pDM_DigTable->DIG_Dynamic_MIN_0; - FirstConnect = (pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_0 == FALSE); - FirstDisConnect = (!pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_0 == TRUE); - } - - //1 Boundary Decision - if(pDM_Odm->SupportICType & (ODM_RTL8192C) &&(pDM_Odm->BoardType & (ODM_BOARD_EXT_LNA | ODM_BOARD_EXT_PA))) - { - if(pDM_Odm->SupportPlatform & (ODM_AP|ODM_ADSL)) - { - - dm_dig_max = DM_DIG_MAX_AP_HP; - dm_dig_min = DM_DIG_MIN_AP_HP; - } - else - { - dm_dig_max = DM_DIG_MAX_NIC_HP; - dm_dig_min = DM_DIG_MIN_NIC_HP; - } - DIG_MaxOfMin = DM_DIG_MAX_AP_HP; - } - else - { - if(pDM_Odm->SupportPlatform & (ODM_AP|ODM_ADSL)) - { -#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) -#ifdef DFS - if (!priv->pmib->dot11DFSEntry.disable_DFS && - (OPMODE & WIFI_AP_STATE) && - (((pDM_Odm->ControlChannel >= 52) && - (pDM_Odm->ControlChannel <= 64)) || - ((pDM_Odm->ControlChannel >= 100) && - (pDM_Odm->ControlChannel <= 140)))) - dm_dig_max = 0x24; - else -#endif - if (priv->pmib->dot11RFEntry.tx2path) { - if (*(pDM_Odm->pWirelessMode) == ODM_WM_B)//(priv->pmib->dot11BssType.net_work_type == WIRELESS_11B) - dm_dig_max = 0x2A; - else - dm_dig_max = 0x32; - } - else -#endif - dm_dig_max = DM_DIG_MAX_AP; - dm_dig_min = DM_DIG_MIN_AP; - DIG_MaxOfMin = dm_dig_max; - } - else - { - if((pDM_Odm->SupportICType >= ODM_RTL8188E) && (pDM_Odm->SupportPlatform & (ODM_WIN|ODM_CE))) - dm_dig_max = 0x5A; - else - dm_dig_max = DM_DIG_MAX_NIC; - - if(pDM_Odm->SupportICType != ODM_RTL8821) - dm_dig_min = DM_DIG_MIN_NIC; - else - dm_dig_min = 0x1C; - - DIG_MaxOfMin = DM_DIG_MAX_AP; - } - } - - if(0 < *pDM_Odm->pu1ForcedIgiLb) - { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): force IGI lb to: %u\n", *pDM_Odm->pu1ForcedIgiLb)); - dm_dig_min = *pDM_Odm->pu1ForcedIgiLb; - dm_dig_max = (dm_dig_min <= dm_dig_max) ? (dm_dig_max) : (dm_dig_min + 1); - } - - if(pDM_Odm->bLinked) - { - if(pDM_Odm->SupportICType&(ODM_RTL8723A/*|ODM_RTL8821*/)) - { - //2 Upper Bound - if(( pDM_Odm->RSSI_Min + 10) > DM_DIG_MAX_NIC ) - pDM_DigTable->rx_gain_range_max = DM_DIG_MAX_NIC; - else if(( pDM_Odm->RSSI_Min + 10) < DM_DIG_MIN_NIC ) - pDM_DigTable->rx_gain_range_max = DM_DIG_MIN_NIC; - else - pDM_DigTable->rx_gain_range_max = pDM_Odm->RSSI_Min + 10; - - //BT is Concurrent - - if(pDM_Odm->bBtLimitedDig) - { - if(pDM_Odm->RSSI_Min>10) - { - if((pDM_Odm->RSSI_Min - 10) > DM_DIG_MAX_NIC) - DIG_Dynamic_MIN = DM_DIG_MAX_NIC; - else if((pDM_Odm->RSSI_Min - 10) < DM_DIG_MIN_NIC) - DIG_Dynamic_MIN = DM_DIG_MIN_NIC; - else - DIG_Dynamic_MIN = pDM_Odm->RSSI_Min - 10; - } - else - DIG_Dynamic_MIN=DM_DIG_MIN_NIC; - } - else - { - if((pDM_Odm->RSSI_Min + 20) > dm_dig_max ) - pDM_DigTable->rx_gain_range_max = dm_dig_max; - else if((pDM_Odm->RSSI_Min + 20) < dm_dig_min ) - pDM_DigTable->rx_gain_range_max = dm_dig_min; - else - pDM_DigTable->rx_gain_range_max = pDM_Odm->RSSI_Min + 20; - - } - } - else - { - if((pDM_Odm->SupportICType & (ODM_RTL8192E|ODM_RTL8723B|ODM_RTL8812|ODM_RTL8821)) && (pDM_Odm->bBtLimitedDig==1)){ - //2 Modify DIG upper bound for 92E, 8723B, 8821 & 8812 BT - if((pDM_Odm->RSSI_Min + 10) > dm_dig_max ) - pDM_DigTable->rx_gain_range_max = dm_dig_max; - else if((pDM_Odm->RSSI_Min + 10) < dm_dig_min ) - pDM_DigTable->rx_gain_range_max = dm_dig_min; - else - pDM_DigTable->rx_gain_range_max = pDM_Odm->RSSI_Min + 10; - } - else{ - - //2 Modify DIG upper bound - //2013.03.19 Luke: Modified upper bound for Netgear rental house test - if(pDM_Odm->SupportICType != ODM_RTL8821 && pDM_Odm->SupportICType != ODM_RTL8192E) - offset = 20; - else - offset = 10; - - if((pDM_Odm->RSSI_Min + offset) > dm_dig_max ) - pDM_DigTable->rx_gain_range_max = dm_dig_max; - else if((pDM_Odm->RSSI_Min + offset) < dm_dig_min ) - pDM_DigTable->rx_gain_range_max = dm_dig_min; - else - pDM_DigTable->rx_gain_range_max = pDM_Odm->RSSI_Min + offset; - - } - - //2 Modify DIG lower bound - /* - if((pFalseAlmCnt->Cnt_all > 500)&&(DIG_Dynamic_MIN < 0x25)) - DIG_Dynamic_MIN++; - else if(((pFalseAlmCnt->Cnt_all < 500)||(pDM_Odm->RSSI_Min < 8))&&(DIG_Dynamic_MIN > dm_dig_min)) - DIG_Dynamic_MIN--; - */ - if(pDM_Odm->bOneEntryOnly) - { - if(pDM_Odm->SupportICType != ODM_RTL8723B) - offset = 0; - else - offset = 12; - - if(pDM_Odm->RSSI_Min - offset < dm_dig_min) - DIG_Dynamic_MIN = dm_dig_min; - else if (pDM_Odm->RSSI_Min - offset > DIG_MaxOfMin) - DIG_Dynamic_MIN = DIG_MaxOfMin; - else - DIG_Dynamic_MIN = pDM_Odm->RSSI_Min - offset; - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() : bOneEntryOnly=TRUE, DIG_Dynamic_MIN=0x%x\n",DIG_Dynamic_MIN)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() : pDM_Odm->RSSI_Min=%d",pDM_Odm->RSSI_Min)); - } - //1 Lower Bound for 88E AntDiv -#if (defined(CONFIG_HW_ANTENNA_DIVERSITY)) - else if( (pDM_Odm->SupportICType & ODM_ANTDIV_SUPPORT) &&(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV) ) - //else if((pDM_Odm->SupportICType == ODM_RTL8188E)&&(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV)) - { - if((pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)||(pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV) ||pDM_Odm->AntDivType == S0S1_SW_ANTDIV) - { - DIG_Dynamic_MIN = (u1Byte) pDM_DigTable->AntDiv_RSSI_max; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_DIG(): pDM_DigTable->AntDiv_RSSI_max=%d \n",pDM_DigTable->AntDiv_RSSI_max)); - } - } -#endif - else - { - DIG_Dynamic_MIN=dm_dig_min; - } - } - } - else - { - pDM_DigTable->rx_gain_range_max = dm_dig_max; - DIG_Dynamic_MIN = dm_dig_min; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() : No Link\n")); - } - - //1 Modify DIG lower bound, deal with abnorally large false alarm - if(pFalseAlmCnt->Cnt_all > 10000) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("dm_DIG(): Abnornally false alarm case. \n")); - - if(pDM_DigTable->LargeFAHit != 3) - pDM_DigTable->LargeFAHit++; - if(pDM_DigTable->ForbiddenIGI < CurrentIGI)//if(pDM_DigTable->ForbiddenIGI < pDM_DigTable->CurIGValue) - { - pDM_DigTable->ForbiddenIGI = (u1Byte)CurrentIGI;//pDM_DigTable->ForbiddenIGI = pDM_DigTable->CurIGValue; - pDM_DigTable->LargeFAHit = 1; - } - - if(pDM_DigTable->LargeFAHit >= 3) - { - if((pDM_DigTable->ForbiddenIGI+1) >pDM_DigTable->rx_gain_range_max) - pDM_DigTable->rx_gain_range_min = pDM_DigTable->rx_gain_range_max; - else - pDM_DigTable->rx_gain_range_min = (pDM_DigTable->ForbiddenIGI + 1); - pDM_DigTable->Recover_cnt = 3600; //3600=2hr - } - - } - else - { - //Recovery mechanism for IGI lower bound - if(pDM_DigTable->Recover_cnt != 0) - pDM_DigTable->Recover_cnt --; - else - { - if(pDM_DigTable->LargeFAHit < 3) - { - if((pDM_DigTable->ForbiddenIGI -1) < DIG_Dynamic_MIN) //DM_DIG_MIN) - { - pDM_DigTable->ForbiddenIGI = DIG_Dynamic_MIN; //DM_DIG_MIN; - pDM_DigTable->rx_gain_range_min = DIG_Dynamic_MIN; //DM_DIG_MIN; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Normal Case: At Lower Bound\n")); - } - else - { - pDM_DigTable->ForbiddenIGI --; - pDM_DigTable->rx_gain_range_min = (pDM_DigTable->ForbiddenIGI + 1); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Normal Case: Approach Lower Bound\n")); - } - } - else - { - pDM_DigTable->LargeFAHit = 0; - } - } - } - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): pDM_DigTable->LargeFAHit=%d\n",pDM_DigTable->LargeFAHit)); - - #if (DM_ODM_SUPPORT_TYPE == ODM_WIN) - if(IS_STA_VALID(pDM_Odm->pODM_StaInfo[0])) //STA mode is linked to AP - pDM_Odm->bsta_state = _TRUE; - #endif - - if((pDM_Odm->SupportPlatform&(ODM_WIN|ODM_CE))&&(pDM_Odm->PhyDbgInfo.NumQryBeaconPkt < 2) && (pDM_Odm->bsta_state) ) - { - pDM_DigTable->rx_gain_range_min = dm_dig_min; - } - - if(pDM_DigTable->rx_gain_range_min > pDM_DigTable->rx_gain_range_max) - pDM_DigTable->rx_gain_range_min = pDM_DigTable->rx_gain_range_max; - - //1 Adjust initial gain by false alarm - if(pDM_Odm->bLinked) - { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): DIG AfterLink\n")); - if(FirstConnect) - { - if(pDM_Odm->RSSI_Min <= DIG_MaxOfMin) - CurrentIGI = pDM_Odm->RSSI_Min; - else - CurrentIGI = DIG_MaxOfMin; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("DIG: First Connect\n")); - - ODM_ConfigBBWithHeaderFile(pDM_Odm, CONFIG_BB_AGC_TAB_DIFF); - } - else - { - if(pDM_Odm->SupportICType == ODM_RTL8192D) - { - if(pFalseAlmCnt->Cnt_all > DM_DIG_FA_TH2_92D) - CurrentIGI = CurrentIGI + 4;//pDM_DigTable->CurIGValue = pDM_DigTable->PreIGValue+2; - else if (pFalseAlmCnt->Cnt_all > DM_DIG_FA_TH1_92D) - CurrentIGI = CurrentIGI + 2; //pDM_DigTable->CurIGValue = pDM_DigTable->PreIGValue+1; - else if(pFalseAlmCnt->Cnt_all < DM_DIG_FA_TH0_92D) - CurrentIGI = CurrentIGI - 2;//pDM_DigTable->CurIGValue =pDM_DigTable->PreIGValue-1; - } - else - { - //FA for Combo IC--NeilChen--2012--09--28 - if(pDM_Odm->SupportICType == ODM_RTL8723A) - { - //WLAN and BT ConCurrent - if(pDM_Odm->bBtLimitedDig) - { - if(pFalseAlmCnt->Cnt_all > 0x300) - CurrentIGI = CurrentIGI + 4; - else if (pFalseAlmCnt->Cnt_all > 0x250) - CurrentIGI = CurrentIGI + 2; - else if(pFalseAlmCnt->Cnt_all < DM_DIG_FA_TH0) - CurrentIGI = CurrentIGI -2; - } - else //Not Concurrent - { - if(pFalseAlmCnt->Cnt_all > DM_DIG_FA_TH2) - CurrentIGI = CurrentIGI + 4;//pDM_DigTable->CurIGValue = pDM_DigTable->PreIGValue+2; - else if (pFalseAlmCnt->Cnt_all > DM_DIG_FA_TH1) - CurrentIGI = CurrentIGI + 2;//pDM_DigTable->CurIGValue = pDM_DigTable->PreIGValue+1; - else if(pFalseAlmCnt->Cnt_all < DM_DIG_FA_TH0) - CurrentIGI = CurrentIGI - 2;//pDM_DigTable->CurIGValue =pDM_DigTable->PreIGValue-1; - } - } - else - { - if(pFalseAlmCnt->Cnt_all > DM_DIG_FA_TH2) - CurrentIGI = CurrentIGI + 4;//pDM_DigTable->CurIGValue = pDM_DigTable->PreIGValue+2; - else if (pFalseAlmCnt->Cnt_all > DM_DIG_FA_TH1) - CurrentIGI = CurrentIGI + 2;//pDM_DigTable->CurIGValue = pDM_DigTable->PreIGValue+1; - else if(pFalseAlmCnt->Cnt_all < DM_DIG_FA_TH0) - CurrentIGI = CurrentIGI - 2;//pDM_DigTable->CurIGValue =pDM_DigTable->PreIGValue-1; - - #if (DM_ODM_SUPPORT_TYPE == ODM_WIN) - if(IS_STA_VALID(pDM_Odm->pODM_StaInfo[0])) //STA mode is linked to AP - pDM_Odm->bsta_state = _TRUE; - #endif - - if((pDM_Odm->SupportPlatform&(ODM_WIN|ODM_CE))&&(pDM_Odm->PhyDbgInfo.NumQryBeaconPkt < 2) - &&(pFalseAlmCnt->Cnt_all < DM_DIG_FA_TH1) && (pDM_Odm->bsta_state)) - { - CurrentIGI = pDM_DigTable->rx_gain_range_min; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Beacon is less than 10 and FA is less than 768, IGI GOES TO 0x1E!!!!!!!!!!!!\n")); - } - /*{ - u2Byte value16; - value16 = (u2Byte) ODM_GetBBReg(pDM_Odm, 0x664, bMaskLWord); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): NumQryBeaconPkt = %d, OFDM_OK_Cnt = %d\n", - pDM_Odm->PhyDbgInfo.NumQryBeaconPkt, value16)); - }*/ - } - } - } - } - else - { - //CurrentIGI = pDM_DigTable->rx_gain_range_min;//pDM_DigTable->CurIGValue = pDM_DigTable->rx_gain_range_min - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): DIG BeforeLink\n")); - if(FirstDisConnect) - { - CurrentIGI = pDM_DigTable->rx_gain_range_min; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): First DisConnect \n")); - } - else - { - //2012.03.30 LukeLee: enable DIG before link but with very high thresholds - if(pFalseAlmCnt->Cnt_all > 10000) - CurrentIGI = CurrentIGI + 4; - else if (pFalseAlmCnt->Cnt_all > 8000) - CurrentIGI = CurrentIGI + 2; - else if(pFalseAlmCnt->Cnt_all < 500) - CurrentIGI = CurrentIGI - 2; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): England DIG \n")); - } - } - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): DIG End Adjust IGI\n")); - //1 Check initial gain by upper/lower bound - - if(CurrentIGI > pDM_DigTable->rx_gain_range_max) - CurrentIGI = pDM_DigTable->rx_gain_range_max; - if(CurrentIGI < pDM_DigTable->rx_gain_range_min) - CurrentIGI = pDM_DigTable->rx_gain_range_min; - - if(pDM_Odm->SupportAbility & ODM_BB_ADAPTIVITY) - { - if(CurrentIGI > Adap_IGI_Upper) - CurrentIGI = Adap_IGI_Upper; - - if(pDM_Odm->IGI_LowerBound != 0) - { - if(CurrentIGI < pDM_Odm->IGI_LowerBound) - CurrentIGI = pDM_Odm->IGI_LowerBound; - } - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): pDM_Odm->IGI_LowerBound = %d\n", pDM_Odm->IGI_LowerBound)); - } - - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): rx_gain_range_max=0x%x, rx_gain_range_min=0x%x\n", - pDM_DigTable->rx_gain_range_max, pDM_DigTable->rx_gain_range_min)); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): TotalFA=%d\n", pFalseAlmCnt->Cnt_all)); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): CurIGValue=0x%x\n", CurrentIGI)); - - //2 High power RSSI threshold -#if (DM_ODM_SUPPORT_TYPE & ODM_WIN) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pDM_Odm->Adapter); - //PMGNT_INFO pMgntInfo = &(pAdapter->MgntInfo); - // for LC issue to dymanic modify DIG lower bound----------LC Mocca Issue - u8Byte curTxOkCnt=0, curRxOkCnt=0; - static u8Byte lastTxOkCnt=0, lastRxOkCnt=0; - - //u8Byte OKCntAll=0; - //static u8Byte TXByteCnt_A=0, TXByteCnt_B=0, RXByteCnt_A=0, RXByteCnt_B=0; - //u8Byte CurByteCnt=0, PreByteCnt=0; - - curTxOkCnt = pAdapter->TxStats.NumTxBytesUnicast - lastTxOkCnt; - curRxOkCnt =pAdapter->RxStats.NumRxBytesUnicast - lastRxOkCnt; - lastTxOkCnt = pAdapter->TxStats.NumTxBytesUnicast; - lastRxOkCnt = pAdapter->RxStats.NumRxBytesUnicast; - //----------------------------------------------------------end for LC Mocca issue - if((pDM_Odm->SupportICType == ODM_RTL8723A)&& (pHalData->UndecoratedSmoothedPWDB > DM_DIG_HIGH_PWR_THRESHOLD)) - { - // High power IGI lower bound - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): UndecoratedSmoothedPWDB(%#x)\n", pHalData->UndecoratedSmoothedPWDB)); - if(CurrentIGI < DM_DIG_HIGH_PWR_IGI_LOWER_BOUND) - { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): CurIGValue(%#x)\n", pDM_DigTable->CurIGValue)); - //pDM_DigTable->CurIGValue = DM_DIG_HIGH_PWR_IGI_LOWER_BOUND; - CurrentIGI=DM_DIG_HIGH_PWR_IGI_LOWER_BOUND; - } - } - if((pDM_Odm->SupportICType & ODM_RTL8723A) && - IS_WIRELESS_MODE_G(pAdapter)) - { - if(pHalData->UndecoratedSmoothedPWDB > 0x28) - { - if(CurrentIGI < DM_DIG_Gmode_HIGH_PWR_IGI_LOWER_BOUND) - { - //pDM_DigTable->CurIGValue = DM_DIG_Gmode_HIGH_PWR_IGI_LOWER_BOUND; - CurrentIGI = DM_DIG_Gmode_HIGH_PWR_IGI_LOWER_BOUND; - } - } - } -#if 0 - if((pDM_Odm->SupportICType & ODM_RTL8723A)&&(pMgntInfo->CustomerID = RT_CID_LENOVO_CHINA)) - { - OKCntAll = (curTxOkCnt+curRxOkCnt); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): CurIGValue(%#x)\n", CurrentIGI)); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): UndecoratedSmoothedPWDB(%#x)\n", pHalData->UndecoratedSmoothedPWDB)); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): OKCntAll(%#x)\n", OKCntAll)); - //8723AS_VAU - if(pDM_Odm->SupportInterface==ODM_ITRF_USB) - { - if(pHalData->UndecoratedSmoothedPWDB < 12) - { - if(CurrentIGI > DM_DIG_MIN_NIC) - { - if(OKCntAll >= 1500000) // >=6Mbps - CurrentIGI=0x1B; - else if(OKCntAll >= 1000000) //4Mbps - CurrentIGI=0x1A; - else if(OKCntAll >= 500000) //2Mbps - CurrentIGI=0x19; - else if(OKCntAll >= 250000) //1Mbps - CurrentIGI=0x18; - else - { - CurrentIGI=0x17; //SCAN mode - } - } - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("Modify---->CurIGValue(%#x)\n", CurrentIGI)); - } - } - } -#endif -} -#endif - -#if (RTL8192D_SUPPORT==1) - if(pDM_Odm->SupportICType == ODM_RTL8192D) - { - //sherry delete DualMacSmartConncurrent 20110517 - if(*(pDM_Odm->pMacPhyMode) == ODM_DMSP) - { - ODM_Write_DIG_DMSP(pDM_Odm, (u1Byte)CurrentIGI);//ODM_Write_DIG_DMSP(pDM_Odm, pDM_DigTable->CurIGValue); - if(*(pDM_Odm->pbMasterOfDMSP)) - { - pDM_DigTable->bMediaConnect_0 = pDM_Odm->bLinked; - pDM_DigTable->DIG_Dynamic_MIN_0 = DIG_Dynamic_MIN; - } - else - { - pDM_DigTable->bMediaConnect_1 = pDM_Odm->bLinked; - pDM_DigTable->DIG_Dynamic_MIN_1 = DIG_Dynamic_MIN; - } - } - else - { - ODM_Write_DIG(pDM_Odm, CurrentIGI);//ODM_Write_DIG(pDM_Odm, pDM_DigTable->CurIGValue); - if(*(pDM_Odm->pBandType) == ODM_BAND_5G) - { - pDM_DigTable->bMediaConnect_0 = pDM_Odm->bLinked; - pDM_DigTable->DIG_Dynamic_MIN_0 = DIG_Dynamic_MIN; - } - else - { - pDM_DigTable->bMediaConnect_1 = pDM_Odm->bLinked; - pDM_DigTable->DIG_Dynamic_MIN_1 = DIG_Dynamic_MIN; - } - } - } - else -#endif - { - if(pDM_Odm->bBtHsOperation) - { - if(pDM_Odm->bLinked) - { - if(pDM_DigTable->BT30_CurIGI > (CurrentIGI)) - { - ODM_Write_DIG(pDM_Odm, CurrentIGI); - - } - else - { - ODM_Write_DIG(pDM_Odm, pDM_DigTable->BT30_CurIGI); - } - pDM_DigTable->bMediaConnect_0 = pDM_Odm->bLinked; - pDM_DigTable->DIG_Dynamic_MIN_0 = DIG_Dynamic_MIN; - } - else - { - if(pDM_Odm->bLinkInProcess) - { - ODM_Write_DIG(pDM_Odm, 0x1c); - } - else if(pDM_Odm->bBtConnectProcess) - { - ODM_Write_DIG(pDM_Odm, 0x28); - } - else - { - ODM_Write_DIG(pDM_Odm, pDM_DigTable->BT30_CurIGI);//ODM_Write_DIG(pDM_Odm, pDM_DigTable->CurIGValue); - } - } - } - else // BT is not using - { - ODM_Write_DIG(pDM_Odm, CurrentIGI);//ODM_Write_DIG(pDM_Odm, pDM_DigTable->CurIGValue); - pDM_DigTable->bMediaConnect_0 = pDM_Odm->bLinked; - pDM_DigTable->DIG_Dynamic_MIN_0 = DIG_Dynamic_MIN; - } - } -} - - -BOOLEAN -odm_DigAbort( - IN PDM_ODM_T pDM_Odm - ) -{ -#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) -// This should be moved out of OUTSRC - PADAPTER pAdapter = pDM_Odm->Adapter; - pRXHP_T pRX_HP_Table = &pDM_Odm->DM_RXHP_Table; - -#if OS_WIN_FROM_WIN7(OS_VERSION) - if(IsAPModeExist( pAdapter) && pAdapter->bInHctTest) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() Return: Is AP mode or In HCT Test \n")); - return TRUE; - } -#endif - - if(pRX_HP_Table->RXHP_flag == 1) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() Return: In RXHP Operation \n")); - return TRUE; - } - - return FALSE; -#else // For Other team any special case for DIG? - return FALSE; -#endif - - -} - -//3============================================================ -//3 FASLE ALARM CHECK -//3============================================================ - -VOID -odm_FalseAlarmCounterStatistics( - IN PDM_ODM_T pDM_Odm - ) -{ - u4Byte ret_value; - PFALSE_ALARM_STATISTICS FalseAlmCnt = &(pDM_Odm->FalseAlmCnt); - -#if (DM_ODM_SUPPORT_TYPE == ODM_AP) - prtl8192cd_priv priv = pDM_Odm->priv; - if( (priv->auto_channel != 0) && (priv->auto_channel != 2) ) - return; -#endif - -#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) - if((pDM_Odm->SupportICType == ODM_RTL8192D) && - (*(pDM_Odm->pMacPhyMode)==ODM_DMSP)&& ////modify by Guo.Mingzhi 2011-12-29 - (!(*(pDM_Odm->pbMasterOfDMSP)))) - { - odm_FalseAlarmCounterStatistics_ForSlaveOfDMSP(pDM_Odm); - return; - } -#endif - - if(!(pDM_Odm->SupportAbility & ODM_BB_FA_CNT)) - return; - - if(pDM_Odm->SupportICType & ODM_IC_11N_SERIES) - { - - //hold ofdm counter - ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_HOLDC_11N, BIT31, 1); //hold page C counter - ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RSTD_11N, BIT31, 1); //hold page D counter - - ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_OFDM_FA_TYPE1_11N, bMaskDWord); - FalseAlmCnt->Cnt_Fast_Fsync = (ret_value&0xffff); - FalseAlmCnt->Cnt_SB_Search_fail = ((ret_value&0xffff0000)>>16); - ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_OFDM_FA_TYPE2_11N, bMaskDWord); - FalseAlmCnt->Cnt_OFDM_CCA = (ret_value&0xffff); - FalseAlmCnt->Cnt_Parity_Fail = ((ret_value&0xffff0000)>>16); - ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_OFDM_FA_TYPE3_11N, bMaskDWord); - FalseAlmCnt->Cnt_Rate_Illegal = (ret_value&0xffff); - FalseAlmCnt->Cnt_Crc8_fail = ((ret_value&0xffff0000)>>16); - ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_OFDM_FA_TYPE4_11N, bMaskDWord); - FalseAlmCnt->Cnt_Mcs_fail = (ret_value&0xffff); - - FalseAlmCnt->Cnt_Ofdm_fail = FalseAlmCnt->Cnt_Parity_Fail + FalseAlmCnt->Cnt_Rate_Illegal + - FalseAlmCnt->Cnt_Crc8_fail + FalseAlmCnt->Cnt_Mcs_fail + - FalseAlmCnt->Cnt_Fast_Fsync + FalseAlmCnt->Cnt_SB_Search_fail; - -#if (RTL8188E_SUPPORT==1) - if((pDM_Odm->SupportICType == ODM_RTL8188E)||(pDM_Odm->SupportICType == ODM_RTL8192E)) - { - ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_SC_CNT_11N, bMaskDWord); - FalseAlmCnt->Cnt_BW_LSC = (ret_value&0xffff); - FalseAlmCnt->Cnt_BW_USC = ((ret_value&0xffff0000)>>16); - } -#endif - -#if (RTL8192D_SUPPORT==1) - if(pDM_Odm->SupportICType == ODM_RTL8192D) - { - odm_GetCCKFalseAlarm_92D(pDM_Odm); - } - else -#endif - { - //hold cck counter - ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT12, 1); - ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT14, 1); - - ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_CCK_FA_LSB_11N, bMaskByte0); - FalseAlmCnt->Cnt_Cck_fail = ret_value; - ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_CCK_FA_MSB_11N, bMaskByte3); - FalseAlmCnt->Cnt_Cck_fail += (ret_value& 0xff)<<8; - - ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_CCK_CCA_CNT_11N, bMaskDWord); - FalseAlmCnt->Cnt_CCK_CCA = ((ret_value&0xFF)<<8) |((ret_value&0xFF00)>>8); - } - - FalseAlmCnt->Cnt_all = ( FalseAlmCnt->Cnt_Fast_Fsync + - FalseAlmCnt->Cnt_SB_Search_fail + - FalseAlmCnt->Cnt_Parity_Fail + - FalseAlmCnt->Cnt_Rate_Illegal + - FalseAlmCnt->Cnt_Crc8_fail + - FalseAlmCnt->Cnt_Mcs_fail + - FalseAlmCnt->Cnt_Cck_fail); - - FalseAlmCnt->Cnt_CCA_all = FalseAlmCnt->Cnt_OFDM_CCA + FalseAlmCnt->Cnt_CCK_CCA; - -#if (RTL8192C_SUPPORT==1) - if(pDM_Odm->SupportICType == ODM_RTL8192C) - odm_ResetFACounter_92C(pDM_Odm); -#endif - -#if (RTL8192D_SUPPORT==1) - if(pDM_Odm->SupportICType == ODM_RTL8192D) - odm_ResetFACounter_92D(pDM_Odm); -#endif - - if(pDM_Odm->SupportICType >=ODM_RTL8723A) - { - //reset false alarm counter registers - ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RSTC_11N, BIT31, 1); - ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RSTC_11N, BIT31, 0); - ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RSTD_11N, BIT27, 1); - ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RSTD_11N, BIT27, 0); - //update ofdm counter - ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_HOLDC_11N, BIT31, 0); //update page C counter - ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RSTD_11N, BIT31, 0); //update page D counter - - //reset CCK CCA counter - ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT13|BIT12, 0); - ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT13|BIT12, 2); - //reset CCK FA counter - ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT15|BIT14, 0); - ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT15|BIT14, 2); - } - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Enter odm_FalseAlarmCounterStatistics\n")); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_Fast_Fsync=%d, Cnt_SB_Search_fail=%d\n", - FalseAlmCnt->Cnt_Fast_Fsync, FalseAlmCnt->Cnt_SB_Search_fail)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_Parity_Fail=%d, Cnt_Rate_Illegal=%d\n", - FalseAlmCnt->Cnt_Parity_Fail, FalseAlmCnt->Cnt_Rate_Illegal)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_Crc8_fail=%d, Cnt_Mcs_fail=%d\n", - FalseAlmCnt->Cnt_Crc8_fail, FalseAlmCnt->Cnt_Mcs_fail)); - } - else if(pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) - { - u4Byte CCKenable; - //read OFDM FA counter - FalseAlmCnt->Cnt_Ofdm_fail = ODM_GetBBReg(pDM_Odm, ODM_REG_OFDM_FA_11AC, bMaskLWord); - FalseAlmCnt->Cnt_Cck_fail = ODM_GetBBReg(pDM_Odm, ODM_REG_CCK_FA_11AC, bMaskLWord); - - CCKenable = ODM_GetBBReg(pDM_Odm, ODM_REG_BB_RX_PATH_11AC, BIT28); - if(CCKenable)//if(*pDM_Odm->pBandType == ODM_BAND_2_4G) - FalseAlmCnt->Cnt_all = FalseAlmCnt->Cnt_Ofdm_fail + FalseAlmCnt->Cnt_Cck_fail; - else - FalseAlmCnt->Cnt_all = FalseAlmCnt->Cnt_Ofdm_fail; - - // reset OFDM FA coutner - ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RST_11AC, BIT17, 1); - ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RST_11AC, BIT17, 0); - // reset CCK FA counter - ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11AC, BIT15, 0); - ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11AC, BIT15, 1); - } - ODM_RT_TRACE(pDM_Odm,ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_Cck_fail=%d\n", FalseAlmCnt->Cnt_Cck_fail)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_Ofdm_fail=%d\n", FalseAlmCnt->Cnt_Ofdm_fail)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Total False Alarm=%d\n", FalseAlmCnt->Cnt_all)); -} - -//3============================================================ -//3 CCK Packet Detect Threshold -//3============================================================ - -VOID -odm_CCKPacketDetectionThresh( - IN PDM_ODM_T pDM_Odm - ) -{ - - u1Byte CurCCK_CCAThres; - PFALSE_ALARM_STATISTICS FalseAlmCnt = &(pDM_Odm->FalseAlmCnt); - -#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) -//modify by Guo.Mingzhi 2011-12-29 - if (pDM_Odm->bDualMacSmartConcurrent == TRUE) -// if (pDM_Odm->bDualMacSmartConcurrent == FALSE) - return; - - if(pDM_Odm->bBtHsOperation) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_CCKPacketDetectionThresh() write 0xcd for BT HS mode!!\n")); - ODM_Write_CCK_CCA_Thres(pDM_Odm, 0xcd); - return; - } - -#endif - - if(!(pDM_Odm->SupportAbility & (ODM_BB_CCK_PD|ODM_BB_FA_CNT))) - return; - - if(pDM_Odm->ExtLNA) - return; - - if(pDM_Odm->bLinked) - { - if(pDM_Odm->RSSI_Min > 25) - CurCCK_CCAThres = 0xcd; - else if((pDM_Odm->RSSI_Min <= 25) && (pDM_Odm->RSSI_Min > 10)) - CurCCK_CCAThres = 0x83; - else - { - if(FalseAlmCnt->Cnt_Cck_fail > 1000) - CurCCK_CCAThres = 0x83; - else - CurCCK_CCAThres = 0x40; - } - } - else - { - if(FalseAlmCnt->Cnt_Cck_fail > 1000) - CurCCK_CCAThres = 0x83; - else - CurCCK_CCAThres = 0x40; - } - -#if (RTL8192D_SUPPORT==1) - if((pDM_Odm->SupportICType == ODM_RTL8192D)&&(*pDM_Odm->pBandType == ODM_BAND_2_4G)) - ODM_Write_CCK_CCA_Thres_92D(pDM_Odm, CurCCK_CCAThres); - else -#endif - ODM_Write_CCK_CCA_Thres(pDM_Odm, CurCCK_CCAThres); -} - -VOID -ODM_Write_CCK_CCA_Thres( - IN PDM_ODM_T pDM_Odm, - IN u1Byte CurCCK_CCAThres - ) -{ - pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; - - if(pDM_DigTable->CurCCK_CCAThres!=CurCCK_CCAThres) //modify by Guo.Mingzhi 2012-01-03 - { - ODM_Write1Byte(pDM_Odm, ODM_REG(CCK_CCA,pDM_Odm), CurCCK_CCAThres); - } - pDM_DigTable->PreCCK_CCAThres = pDM_DigTable->CurCCK_CCAThres; - pDM_DigTable->CurCCK_CCAThres = CurCCK_CCAThres; - -} //3============================================================ //3 BB Power Save //3============================================================ -VOID -odm_DynamicBBPowerSavingInit( - IN PDM_ODM_T pDM_Odm - ) -{ - pPS_T pDM_PSTable = &pDM_Odm->DM_PSTable; - - pDM_PSTable->PreCCAState = CCA_MAX; - pDM_PSTable->CurCCAState = CCA_MAX; - pDM_PSTable->PreRFState = RF_MAX; - pDM_PSTable->CurRFState = RF_MAX; - pDM_PSTable->Rssi_val_min = 0; - pDM_PSTable->initialize = 0; -} - - -VOID -odm_DynamicBBPowerSaving( - IN PDM_ODM_T pDM_Odm - ) -{ -#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) - - if (pDM_Odm->SupportICType != ODM_RTL8723A) - return; - if(!(pDM_Odm->SupportAbility & ODM_BB_PWR_SAVE)) - return; - if(!(pDM_Odm->SupportPlatform & (ODM_WIN|ODM_CE))) - return; - - //1 2.Power Saving for 92C - if((pDM_Odm->SupportICType == ODM_RTL8192C) &&(pDM_Odm->RFType == ODM_2T2R)) - { - odm_1R_CCA(pDM_Odm); - } - - // 20100628 Joseph: Turn off BB power save for 88CE because it makesthroughput unstable. - // 20100831 Joseph: Turn ON BB power save again after modifying AGC delay from 900ns ot 600ns. - //1 3.Power Saving for 88C - else - { - ODM_RF_Saving(pDM_Odm, FALSE); - } -#endif // #if (DM_ODM_SUPPORT_TYPE == ODM_WIN) - -} - -VOID -odm_1R_CCA( - IN PDM_ODM_T pDM_Odm - ) -{ - pPS_T pDM_PSTable = &pDM_Odm->DM_PSTable; - - if(pDM_Odm->RSSI_Min!= 0xFF) - { - - if(pDM_PSTable->PreCCAState == CCA_2R) - { - if(pDM_Odm->RSSI_Min >= 35) - pDM_PSTable->CurCCAState = CCA_1R; - else - pDM_PSTable->CurCCAState = CCA_2R; - - } - else{ - if(pDM_Odm->RSSI_Min <= 30) - pDM_PSTable->CurCCAState = CCA_2R; - else - pDM_PSTable->CurCCAState = CCA_1R; - } - } - else{ - pDM_PSTable->CurCCAState=CCA_MAX; - } - - if(pDM_PSTable->PreCCAState != pDM_PSTable->CurCCAState) - { - if(pDM_PSTable->CurCCAState == CCA_1R) - { - if( pDM_Odm->RFType ==ODM_2T2R ) - { - ODM_SetBBReg(pDM_Odm, 0xc04 , bMaskByte0, 0x13); - //PHY_SetBBReg(pAdapter, 0xe70, bMaskByte3, 0x20); - } - else - { - ODM_SetBBReg(pDM_Odm, 0xc04 , bMaskByte0, 0x23); - //PHY_SetBBReg(pAdapter, 0xe70, 0x7fc00000, 0x10c); // Set RegE70[30:22] = 9b'100001100 - } - } - else - { - ODM_SetBBReg(pDM_Odm, 0xc04 , bMaskByte0, 0x33); - //PHY_SetBBReg(pAdapter,0xe70, bMaskByte3, 0x63); - } - pDM_PSTable->PreCCAState = pDM_PSTable->CurCCAState; - } - //ODM_RT_TRACE(pDM_Odm, COMP_BB_POWERSAVING, DBG_LOUD, ("CCAStage = %s\n",(pDM_PSTable->CurCCAState==0)?"1RCCA":"2RCCA")); -} - -void -ODM_RF_Saving( - IN PDM_ODM_T pDM_Odm, - IN u1Byte bForceInNormal - ) -{ -#if (DM_ODM_SUPPORT_TYPE != ODM_AP) - pPS_T pDM_PSTable = &pDM_Odm->DM_PSTable; - u1Byte Rssi_Up_bound = 30 ; - u1Byte Rssi_Low_bound = 25; - #if (DM_ODM_SUPPORT_TYPE == ODM_CE) - if(pDM_Odm->PatchID == 40 ) //RT_CID_819x_FUNAI_TV - { - Rssi_Up_bound = 50 ; - Rssi_Low_bound = 45; - } - #endif - if(pDM_PSTable->initialize == 0){ - - pDM_PSTable->Reg874 = (ODM_GetBBReg(pDM_Odm, 0x874, bMaskDWord)&0x1CC000)>>14; - pDM_PSTable->RegC70 = (ODM_GetBBReg(pDM_Odm, 0xc70, bMaskDWord)&BIT3)>>3; - pDM_PSTable->Reg85C = (ODM_GetBBReg(pDM_Odm, 0x85c, bMaskDWord)&0xFF000000)>>24; - pDM_PSTable->RegA74 = (ODM_GetBBReg(pDM_Odm, 0xa74, bMaskDWord)&0xF000)>>12; - //Reg818 = PHY_QueryBBReg(pAdapter, 0x818, bMaskDWord); - pDM_PSTable->initialize = 1; - } - - if(!bForceInNormal) - { - if(pDM_Odm->RSSI_Min != 0xFF) - { - if(pDM_PSTable->PreRFState == RF_Normal) - { - if(pDM_Odm->RSSI_Min >= Rssi_Up_bound) - pDM_PSTable->CurRFState = RF_Save; - else - pDM_PSTable->CurRFState = RF_Normal; - } - else{ - if(pDM_Odm->RSSI_Min <= Rssi_Low_bound) - pDM_PSTable->CurRFState = RF_Normal; - else - pDM_PSTable->CurRFState = RF_Save; - } - } - else - pDM_PSTable->CurRFState=RF_MAX; - } - else - { - pDM_PSTable->CurRFState = RF_Normal; - } - - if(pDM_PSTable->PreRFState != pDM_PSTable->CurRFState) - { - if(pDM_PSTable->CurRFState == RF_Save) - { - // 8723 RSSI report will be wrong. Set 0x874[5]=1 when enter BB power saving mode. - // Suggested by SD3 Yu-Nan. 2011.01.20. - if(pDM_Odm->SupportICType == ODM_RTL8723A) - { - ODM_SetBBReg(pDM_Odm, 0x874 , BIT5, 0x1); //Reg874[5]=1b'1 - } - ODM_SetBBReg(pDM_Odm, 0x874 , 0x1C0000, 0x2); //Reg874[20:18]=3'b010 - ODM_SetBBReg(pDM_Odm, 0xc70, BIT3, 0); //RegC70[3]=1'b0 - ODM_SetBBReg(pDM_Odm, 0x85c, 0xFF000000, 0x63); //Reg85C[31:24]=0x63 - ODM_SetBBReg(pDM_Odm, 0x874, 0xC000, 0x2); //Reg874[15:14]=2'b10 - ODM_SetBBReg(pDM_Odm, 0xa74, 0xF000, 0x3); //RegA75[7:4]=0x3 - ODM_SetBBReg(pDM_Odm, 0x818, BIT28, 0x0); //Reg818[28]=1'b0 - ODM_SetBBReg(pDM_Odm, 0x818, BIT28, 0x1); //Reg818[28]=1'b1 - //ODM_RT_TRACE(pDM_Odm, COMP_BB_POWERSAVING, DBG_LOUD, (" RF_Save")); - } - else - { - ODM_SetBBReg(pDM_Odm, 0x874 , 0x1CC000, pDM_PSTable->Reg874); - ODM_SetBBReg(pDM_Odm, 0xc70, BIT3, pDM_PSTable->RegC70); - ODM_SetBBReg(pDM_Odm, 0x85c, 0xFF000000, pDM_PSTable->Reg85C); - ODM_SetBBReg(pDM_Odm, 0xa74, 0xF000, pDM_PSTable->RegA74); - ODM_SetBBReg(pDM_Odm,0x818, BIT28, 0x0); - - if(pDM_Odm->SupportICType == ODM_RTL8723A) - { - ODM_SetBBReg(pDM_Odm,0x874 , BIT5, 0x0); //Reg874[5]=1b'0 - } - //ODM_RT_TRACE(pDM_Odm, COMP_BB_POWERSAVING, DBG_LOUD, (" RF_Normal")); - } - pDM_PSTable->PreRFState =pDM_PSTable->CurRFState; - } -#endif -} +//Remove BB power saving by Yuchen //3============================================================ //3 RATR MASK @@ -3836,2118 +1029,15 @@ ODM_RF_Saving( //3 Rate Adaptive //3============================================================ -VOID -odm_RateAdaptiveMaskInit( - IN PDM_ODM_T pDM_Odm - ) -{ - PODM_RATE_ADAPTIVE pOdmRA = &pDM_Odm->RateAdaptive; - -#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) - PMGNT_INFO pMgntInfo = &pDM_Odm->Adapter->MgntInfo; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pDM_Odm->Adapter); - - pMgntInfo->Ratr_State = DM_RATR_STA_INIT; - - if (pMgntInfo->DM_Type == DM_Type_ByDriver) - pHalData->bUseRAMask = TRUE; - else - pHalData->bUseRAMask = FALSE; - -#elif (DM_ODM_SUPPORT_TYPE == ODM_CE) - pOdmRA->Type = DM_Type_ByDriver; - if (pOdmRA->Type == DM_Type_ByDriver) - pDM_Odm->bUseRAMask = _TRUE; - else - pDM_Odm->bUseRAMask = _FALSE; -#endif - - pOdmRA->RATRState = DM_RATR_STA_INIT; - pOdmRA->LdpcThres = 35; - pOdmRA->bUseLdpc = FALSE; - pOdmRA->HighRSSIThresh = 50; - pOdmRA->LowRSSIThresh = 20; -} - -#if (DM_ODM_SUPPORT_TYPE & ODM_WIN) -VOID -ODM_RateAdaptiveStateApInit( - IN PADAPTER Adapter , - IN PRT_WLAN_STA pEntry - ) -{ - pEntry->Ratr_State = DM_RATR_STA_INIT; -} -#endif - -#if (DM_ODM_SUPPORT_TYPE == ODM_CE) -u4Byte ODM_Get_Rate_Bitmap( - IN PDM_ODM_T pDM_Odm, - IN u4Byte macid, - IN u4Byte ra_mask, - IN u1Byte rssi_level) -{ - PSTA_INFO_T pEntry; - u4Byte rate_bitmap = 0; - u1Byte WirelessMode; - //u1Byte WirelessMode =*(pDM_Odm->pWirelessMode); - - - pEntry = pDM_Odm->pODM_StaInfo[macid]; - if(!IS_STA_VALID(pEntry)) - return ra_mask; - - WirelessMode = pEntry->wireless_mode; - - switch(WirelessMode) - { - case ODM_WM_B: - if(ra_mask & 0x0000000c) //11M or 5.5M enable - rate_bitmap = 0x0000000d; - else - rate_bitmap = 0x0000000f; - break; - - case (ODM_WM_G): - case (ODM_WM_A): - if(rssi_level == DM_RATR_STA_HIGH) - rate_bitmap = 0x00000f00; - else - rate_bitmap = 0x00000ff0; - break; - - case (ODM_WM_B|ODM_WM_G): - if(rssi_level == DM_RATR_STA_HIGH) - rate_bitmap = 0x00000f00; - else if(rssi_level == DM_RATR_STA_MIDDLE) - rate_bitmap = 0x00000ff0; - else - rate_bitmap = 0x00000ff5; - break; - - case (ODM_WM_B|ODM_WM_G|ODM_WM_N24G) : - case (ODM_WM_B|ODM_WM_N24G) : - case (ODM_WM_G|ODM_WM_N24G) : - case (ODM_WM_A|ODM_WM_N5G) : - { - if ( pDM_Odm->RFType == ODM_1T2R ||pDM_Odm->RFType == ODM_1T1R) - { - if(rssi_level == DM_RATR_STA_HIGH) - { - rate_bitmap = 0x000f0000; - } - else if(rssi_level == DM_RATR_STA_MIDDLE) - { - rate_bitmap = 0x000ff000; - } - else{ - if (*(pDM_Odm->pBandWidth) == ODM_BW40M) - rate_bitmap = 0x000ff015; - else - rate_bitmap = 0x000ff005; - } - } - else - { - if(rssi_level == DM_RATR_STA_HIGH) - { - rate_bitmap = 0x0f8f0000; - } - else if(rssi_level == DM_RATR_STA_MIDDLE) - { - rate_bitmap = 0x0f8ff000; - } - else - { - if (*(pDM_Odm->pBandWidth) == ODM_BW40M) - rate_bitmap = 0x0f8ff015; - else - rate_bitmap = 0x0f8ff005; - } - } - } - break; - - case (ODM_WM_AC|ODM_WM_G): - if(rssi_level == 1) - rate_bitmap = 0xfc3f0000; - else if(rssi_level == 2) - rate_bitmap = 0xfffff000; - else - rate_bitmap = 0xffffffff; - break; - - case (ODM_WM_AC|ODM_WM_A): - - if (pDM_Odm->RFType == RF_1T1R) - { - if(rssi_level == 1) // add by Gary for ac-series - rate_bitmap = 0x003f8000; - else if (rssi_level == 2) - rate_bitmap = 0x003ff000; - else - rate_bitmap = 0x003ff010; - } - else - { - if(rssi_level == 1) // add by Gary for ac-series - rate_bitmap = 0xfe3f8000; // VHT 2SS MCS3~9 - else if (rssi_level == 2) - rate_bitmap = 0xfffff000; // VHT 2SS MCS0~9 - else - rate_bitmap = 0xfffff010; // All - } - break; - - default: - if(pDM_Odm->RFType == RF_1T2R) - rate_bitmap = 0x000fffff; - else - rate_bitmap = 0x0fffffff; - break; - - } - - //printk("%s ==> rssi_level:0x%02x, WirelessMode:0x%02x, rate_bitmap:0x%08x \n",__FUNCTION__,rssi_level,WirelessMode,rate_bitmap); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, (" ==> rssi_level:0x%02x, WirelessMode:0x%02x, rate_bitmap:0x%08x \n",rssi_level,WirelessMode,rate_bitmap)); - - return (ra_mask&rate_bitmap); - -} -#endif - - -VOID -odm_RefreshBasicRateMask( - IN PDM_ODM_T pDM_Odm - ) -{ -#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) - PADAPTER Adapter = pDM_Odm->Adapter; - static u1Byte Stage = 0; - u1Byte CurStage = 0; - OCTET_STRING osRateSet; - PMGNT_INFO pMgntInfo = GetDefaultMgntInfo(Adapter); - u1Byte RateSet[5] = {MGN_1M, MGN_2M, MGN_5_5M, MGN_11M, MGN_6M}; - - if(pDM_Odm->SupportICType != ODM_RTL8812 && pDM_Odm->SupportICType != ODM_RTL8821 ) - return; - - if(pDM_Odm->bLinked == FALSE) // unlink Default port information - CurStage = 0; - else if(pDM_Odm->RSSI_Min < 40) // link RSSI < 40% - CurStage = 1; - else if(pDM_Odm->RSSI_Min > 45) // link RSSI > 45% - CurStage = 3; - else - CurStage = 2; // link 25% <= RSSI <= 30% - - if(CurStage != Stage) - { - if(CurStage == 1) - { - FillOctetString(osRateSet, RateSet, 5); - FilterSupportRate(pMgntInfo->mBrates, &osRateSet, FALSE); - Adapter->HalFunc.SetHwRegHandler(Adapter, HW_VAR_BASIC_RATE, (pu1Byte)&osRateSet); - } - else if(CurStage == 3 && (Stage == 1 || Stage == 2)) - { - Adapter->HalFunc.SetHwRegHandler( Adapter, HW_VAR_BASIC_RATE, (pu1Byte)(&pMgntInfo->mBrates) ); - } - } - - Stage = CurStage; -#endif -} - -/*----------------------------------------------------------------------------- - * Function: odm_RefreshRateAdaptiveMask() - * - * Overview: Update rate table mask according to rssi - * - * Input: NONE - * - * Output: NONE - * - * Return: NONE - * - * Revised History: - * When Who Remark - * 05/27/2009 hpfan Create Version 0. - * - *---------------------------------------------------------------------------*/ -VOID -odm_RefreshRateAdaptiveMask( - IN PDM_ODM_T pDM_Odm - ) -{ - - ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_TRACE, ("odm_RefreshRateAdaptiveMask()---------->\n")); - if (!(pDM_Odm->SupportAbility & ODM_BB_RA_MASK)) - { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_TRACE, ("odm_RefreshRateAdaptiveMask(): Return cos not supported\n")); - return; - } - // - // 2011/09/29 MH In HW integration first stage, we provide 4 different handle to operate - // at the same time. In the stage2/3, we need to prive universal interface and merge all - // HW dynamic mechanism. - // - switch (pDM_Odm->SupportPlatform) - { - case ODM_WIN: - odm_RefreshRateAdaptiveMaskMP(pDM_Odm); - break; - - case ODM_CE: - odm_RefreshRateAdaptiveMaskCE(pDM_Odm); - break; - - case ODM_AP: - case ODM_ADSL: - odm_RefreshRateAdaptiveMaskAPADSL(pDM_Odm); - break; - } - -} - -VOID -odm_RefreshRateAdaptiveMaskMP( - IN PDM_ODM_T pDM_Odm - ) -{ -#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) - PADAPTER pAdapter = pDM_Odm->Adapter; - PADAPTER pTargetAdapter = NULL; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - PMGNT_INFO pMgntInfo = GetDefaultMgntInfo(pAdapter); - PODM_RATE_ADAPTIVE pRA = &pDM_Odm->RateAdaptive; - - if(pAdapter->bDriverStopped) - { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_TRACE, ("<---- odm_RefreshRateAdaptiveMask(): driver is going to unload\n")); - return; - } - - if(!pHalData->bUseRAMask) - { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, ("<---- odm_RefreshRateAdaptiveMask(): driver does not control rate adaptive mask\n")); - return; - } - - // if default port is connected, update RA table for default port (infrastructure mode only) - if(pMgntInfo->mAssoc && (!ACTING_AS_AP(pAdapter))) - { - - if(pHalData->UndecoratedSmoothedPWDB < pRA->LdpcThres) - { - pRA->bUseLdpc = TRUE; - pRA->bLowerRtsRate = TRUE; - if((pDM_Odm->SupportICType == ODM_RTL8821) && (pDM_Odm->CutVersion == ODM_CUT_A)) - MgntSet_TX_LDPC(pAdapter,0,TRUE); - //DbgPrint("RSSI=%d, bUseLdpc = TRUE\n", pHalData->UndecoratedSmoothedPWDB); - } - else if(pHalData->UndecoratedSmoothedPWDB > (pRA->LdpcThres-5)) - { - pRA->bUseLdpc = FALSE; - pRA->bLowerRtsRate = FALSE; - if((pDM_Odm->SupportICType == ODM_RTL8821) && (pDM_Odm->CutVersion == ODM_CUT_A)) - MgntSet_TX_LDPC(pAdapter,0,FALSE); - //DbgPrint("RSSI=%d, bUseLdpc = FALSE\n", pHalData->UndecoratedSmoothedPWDB); - } - - ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, ("odm_RefreshRateAdaptiveMask(): Infrasture Mode\n")); - if( ODM_RAStateCheck(pDM_Odm, pHalData->UndecoratedSmoothedPWDB, pMgntInfo->bSetTXPowerTrainingByOid, &pMgntInfo->Ratr_State) ) - { - ODM_PRINT_ADDR(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, ("Target AP addr : "), pMgntInfo->Bssid); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, ("RSSI:%d, RSSI_LEVEL:%d\n", pHalData->UndecoratedSmoothedPWDB, pMgntInfo->Ratr_State)); - pAdapter->HalFunc.UpdateHalRAMaskHandler(pAdapter, pMgntInfo->mMacId, NULL, pMgntInfo->Ratr_State); - } - } - - // - // The following part configure AP/VWifi/IBSS rate adaptive mask. - // - - if(pMgntInfo->mIbss) // Target: AP/IBSS peer. - pTargetAdapter = GetDefaultAdapter(pAdapter); - else - pTargetAdapter = GetFirstAPAdapter(pAdapter); - - // if extension port (softap) is started, updaet RA table for more than one clients associate - if(pTargetAdapter != NULL) - { - int i; - PRT_WLAN_STA pEntry; - - for(i = 0; i < ODM_ASSOCIATE_ENTRY_NUM; i++) - { - pEntry = AsocEntry_EnumStation(pTargetAdapter, i); - if(NULL != pEntry) - { - if(pEntry->bAssociated) - { - if(ODM_RAStateCheck(pDM_Odm, pEntry->rssi_stat.UndecoratedSmoothedPWDB, pMgntInfo->bSetTXPowerTrainingByOid, &pEntry->Ratr_State) ) - { - ODM_PRINT_ADDR(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, ("Target STA addr : "), pEntry->MacAddr); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, ("RSSI:%d, RSSI_LEVEL:%d\n", pEntry->rssi_stat.UndecoratedSmoothedPWDB, pEntry->Ratr_State)); - pAdapter->HalFunc.UpdateHalRAMaskHandler(pTargetAdapter, pEntry->AssociatedMacId, pEntry, pEntry->Ratr_State); - } - } - } - } - } - - if(pMgntInfo->bSetTXPowerTrainingByOid) - pMgntInfo->bSetTXPowerTrainingByOid = FALSE; -#endif // #if (DM_ODM_SUPPORT_TYPE == ODM_WIN) -} - - -VOID -odm_RefreshRateAdaptiveMaskCE( - IN PDM_ODM_T pDM_Odm - ) -{ -#if (DM_ODM_SUPPORT_TYPE == ODM_CE) - u1Byte i; - PADAPTER pAdapter = pDM_Odm->Adapter; - PODM_RATE_ADAPTIVE pRA = &pDM_Odm->RateAdaptive; - - if(pAdapter->bDriverStopped) - { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_TRACE, ("<---- odm_RefreshRateAdaptiveMask(): driver is going to unload\n")); - return; - } - - if(!pDM_Odm->bUseRAMask) - { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, ("<---- odm_RefreshRateAdaptiveMask(): driver does not control rate adaptive mask\n")); - return; - } - - //printk("==> %s \n",__FUNCTION__); - - for(i=0; ipODM_StaInfo[i]; - if(IS_STA_VALID(pstat) ) { - if(IS_MCAST( pstat->hwaddr)) //if(psta->mac_id ==1) - continue; - if(IS_MCAST( pstat->hwaddr)) - continue; - - #if((RTL8812A_SUPPORT==1)||(RTL8821A_SUPPORT==1)) - if((pDM_Odm->SupportICType == ODM_RTL8812)||(pDM_Odm->SupportICType == ODM_RTL8821)) - { - if(pstat->rssi_stat.UndecoratedSmoothedPWDB < pRA->LdpcThres) - { - pRA->bUseLdpc = TRUE; - pRA->bLowerRtsRate = TRUE; - if((pDM_Odm->SupportICType == ODM_RTL8821) && (pDM_Odm->CutVersion == ODM_CUT_A)) - Set_RA_LDPC_8812(pstat, TRUE); - //DbgPrint("RSSI=%d, bUseLdpc = TRUE\n", pHalData->UndecoratedSmoothedPWDB); - } - else if(pstat->rssi_stat.UndecoratedSmoothedPWDB > (pRA->LdpcThres-5)) - { - pRA->bUseLdpc = FALSE; - pRA->bLowerRtsRate = FALSE; - if((pDM_Odm->SupportICType == ODM_RTL8821) && (pDM_Odm->CutVersion == ODM_CUT_A)) - Set_RA_LDPC_8812(pstat, FALSE); - //DbgPrint("RSSI=%d, bUseLdpc = FALSE\n", pHalData->UndecoratedSmoothedPWDB); - } - } - #endif - - if( TRUE == ODM_RAStateCheck(pDM_Odm, pstat->rssi_stat.UndecoratedSmoothedPWDB, FALSE , &pstat->rssi_level) ) - { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, ("RSSI:%d, RSSI_LEVEL:%d\n", pstat->rssi_stat.UndecoratedSmoothedPWDB, pstat->rssi_level)); - //printk("RSSI:%d, RSSI_LEVEL:%d\n", pstat->rssi_stat.UndecoratedSmoothedPWDB, pstat->rssi_level); - rtw_hal_update_ra_mask(pstat, pstat->rssi_level); - } - - } - } - -#endif -} - -VOID -odm_RefreshRateAdaptiveMaskAPADSL( - IN PDM_ODM_T pDM_Odm - ) -{ -#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - struct rtl8192cd_priv *priv = pDM_Odm->priv; - struct stat_info *pstat; - - if (!priv->pmib->dot11StationConfigEntry.autoRate) - return; - - if (list_empty(&priv->asoc_list)) - return; - - list_for_each_entry(pstat, &priv->asoc_list, asoc_list) { - if(ODM_RAStateCheck(pDM_Odm, (s4Byte)pstat->rssi, FALSE, &pstat->rssi_level) ) { - ODM_PRINT_ADDR(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, ("Target STA addr : "), pstat->hwaddr); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, ("RSSI:%d, RSSI_LEVEL:%d\n", pstat->rssi, pstat->rssi_level)); - -#ifdef CONFIG_RTL_88E_SUPPORT - if (GET_CHIP_VER(priv)==VERSION_8188E) { -#ifdef TXREPORT - add_RATid(priv, pstat); -#endif - } else -#endif - { -#if defined(CONFIG_RTL_92D_SUPPORT) || defined(CONFIG_RTL_92C_SUPPORT) - add_update_RATid(priv, pstat); -#endif - } - } - } -#endif -} - -#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) -VOID -ODM_DynamicARFBSelect( - IN PDM_ODM_T pDM_Odm, - IN u1Byte rate, - IN BOOLEAN Collision_State -) -{ - - if(pDM_Odm->SupportICType != ODM_RTL8192E) - return; - - if (rate >= DESC_RATEMCS8 && rate <= DESC_RATEMCS12){ - if (Collision_State == 1){ - if(rate == DESC_RATEMCS12){ - - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x0); - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x07060501); - } - else if(rate == DESC_RATEMCS11){ - - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x0); - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x07070605); - } - else if(rate == DESC_RATEMCS10){ - - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x0); - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x08080706); - } - else if(rate == DESC_RATEMCS9){ - - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x0); - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x08080707); - } - else{ - - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x0); - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x09090808); - } - } - else{ // Collision_State == 0 - if(rate == DESC_RATEMCS12){ - - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x05010000); - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x09080706); - } - else if(rate == DESC_RATEMCS11){ - - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x06050000); - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x09080807); - } - else if(rate == DESC_RATEMCS10){ - - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x07060000); - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x0a090908); - } - else if(rate == DESC_RATEMCS9){ - - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x07070000); - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x0a090808); - } - else{ - - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x08080000); - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x0b0a0909); - } - } - } - else{ // MCS13~MCS15, 1SS, G-mode - if (Collision_State == 1){ - if(rate == DESC_RATEMCS15){ - - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x00000000); - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x05040302); - } - else if(rate == DESC_RATEMCS14){ - - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x00000000); - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x06050302); - } - else if(rate == DESC_RATEMCS13){ - - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x00000000); - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x07060502); - } - else{ - - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x00000000); - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x06050402); - } - } - else{ // Collision_State == 0 - if(rate == DESC_RATEMCS15){ - - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x03020000); - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x07060504); - } - else if(rate == DESC_RATEMCS14){ - - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x03020000); - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x08070605); - } - else if(rate == DESC_RATEMCS13){ - - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x05020000); - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x09080706); - } - else{ - - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x04020000); - ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x08070605); - } - - - } - - } - -} - -#endif - -// Return Value: BOOLEAN -// - TRUE: RATRState is changed. -BOOLEAN -ODM_RAStateCheck( - IN PDM_ODM_T pDM_Odm, - IN s4Byte RSSI, - IN BOOLEAN bForceUpdate, - OUT pu1Byte pRATRState - ) -{ - PODM_RATE_ADAPTIVE pRA = &pDM_Odm->RateAdaptive; - const u1Byte GoUpGap = 5; - u1Byte HighRSSIThreshForRA = pRA->HighRSSIThresh; - u1Byte LowRSSIThreshForRA = pRA->LowRSSIThresh; - u1Byte RATRState; - - // Threshold Adjustment: - // when RSSI state trends to go up one or two levels, make sure RSSI is high enough. - // Here GoUpGap is added to solve the boundary's level alternation issue. - switch (*pRATRState) - { - case DM_RATR_STA_INIT: - case DM_RATR_STA_HIGH: - break; - - case DM_RATR_STA_MIDDLE: - HighRSSIThreshForRA += GoUpGap; - break; - - case DM_RATR_STA_LOW: - HighRSSIThreshForRA += GoUpGap; - LowRSSIThreshForRA += GoUpGap; - break; - - default: - ODM_RT_ASSERT(pDM_Odm, FALSE, ("wrong rssi level setting %d !", *pRATRState) ); - break; - } - - // Decide RATRState by RSSI. - if(RSSI > HighRSSIThreshForRA) - RATRState = DM_RATR_STA_HIGH; - else if(RSSI > LowRSSIThreshForRA) - RATRState = DM_RATR_STA_MIDDLE; - else - RATRState = DM_RATR_STA_LOW; - //printk("==>%s,RATRState:0x%02x ,RSSI:%d \n",__FUNCTION__,RATRState,RSSI); - - if( *pRATRState!=RATRState || bForceUpdate) - { - ODM_RT_TRACE( pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, ("RSSI Level %d -> %d\n", *pRATRState, RATRState) ); - *pRATRState = RATRState; - return TRUE; - } - - return FALSE; -} - - -//============================================================ +//Remove RAMask by RS_James //3============================================================ //3 Dynamic Tx Power //3============================================================ -VOID -odm_DynamicTxPowerInit( - IN PDM_ODM_T pDM_Odm - ) -{ -#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) - PADAPTER Adapter = pDM_Odm->Adapter; - PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - - #if DEV_BUS_TYPE==RT_USB_INTERFACE - if(RT_GetInterfaceSelection(Adapter) == INTF_SEL1_USB_High_Power) - { - odm_DynamicTxPowerSavePowerIndex(pDM_Odm); - pMgntInfo->bDynamicTxPowerEnable = TRUE; - } - else - #else - //so 92c pci do not need dynamic tx power? vivi check it later - if(IS_HARDWARE_TYPE_8192D(Adapter)) - pMgntInfo->bDynamicTxPowerEnable = TRUE; - else - pMgntInfo->bDynamicTxPowerEnable = FALSE; - #endif - - - pHalData->LastDTPLvl = TxHighPwrLevel_Normal; - pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; -#elif (DM_ODM_SUPPORT_TYPE == ODM_CE) - PADAPTER Adapter = pDM_Odm->Adapter; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - struct dm_priv *pdmpriv = &pHalData->dmpriv; - pdmpriv->bDynamicTxPowerEnable = _FALSE; - - #if (RTL8192C_SUPPORT==1) - #ifdef CONFIG_USB_HCI - - #ifdef CONFIG_INTEL_PROXIM - if((pHalData->BoardType == BOARD_USB_High_PA)||(Adapter->proximity.proxim_support==_TRUE)) - #else - if(pHalData->BoardType == BOARD_USB_High_PA) - #endif - - { - //odm_SavePowerIndex(Adapter); - odm_DynamicTxPowerSavePowerIndex(pDM_Odm); - pdmpriv->bDynamicTxPowerEnable = _TRUE; - } - else - #else - pdmpriv->bDynamicTxPowerEnable = _FALSE; - #endif - #endif - - pdmpriv->LastDTPLvl = TxHighPwrLevel_Normal; - pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; - -#endif - -} - -VOID -odm_DynamicTxPowerSavePowerIndex( - IN PDM_ODM_T pDM_Odm - ) -{ - u1Byte index; - u4Byte Power_Index_REG[6] = {0xc90, 0xc91, 0xc92, 0xc98, 0xc99, 0xc9a}; - -#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) - PADAPTER Adapter = pDM_Odm->Adapter; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - for(index = 0; index< 6; index++) - pHalData->PowerIndex_backup[index] = PlatformEFIORead1Byte(Adapter, Power_Index_REG[index]); -#elif (DM_ODM_SUPPORT_TYPE == ODM_CE) - PADAPTER Adapter = pDM_Odm->Adapter; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - struct dm_priv *pdmpriv = &pHalData->dmpriv; - for(index = 0; index< 6; index++) - pdmpriv->PowerIndex_backup[index] = rtw_read8(Adapter, Power_Index_REG[index]); -#endif -} - -VOID -odm_DynamicTxPowerRestorePowerIndex( - IN PDM_ODM_T pDM_Odm - ) -{ - u1Byte index; - PADAPTER Adapter = pDM_Odm->Adapter; - -#if (DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_WIN)) - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - u4Byte Power_Index_REG[6] = {0xc90, 0xc91, 0xc92, 0xc98, 0xc99, 0xc9a}; -#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) - for(index = 0; index< 6; index++) - PlatformEFIOWrite1Byte(Adapter, Power_Index_REG[index], pHalData->PowerIndex_backup[index]); -#elif(DM_ODM_SUPPORT_TYPE == ODM_CE) - struct dm_priv *pdmpriv = &pHalData->dmpriv; - for(index = 0; index< 6; index++) - rtw_write8(Adapter, Power_Index_REG[index], pdmpriv->PowerIndex_backup[index]); -#endif -#endif -} - -VOID -odm_DynamicTxPowerWritePowerIndex( - IN PDM_ODM_T pDM_Odm, - IN u1Byte Value) -{ - - u1Byte index; - u4Byte Power_Index_REG[6] = {0xc90, 0xc91, 0xc92, 0xc98, 0xc99, 0xc9a}; - - for(index = 0; index< 6; index++) - //PlatformEFIOWrite1Byte(Adapter, Power_Index_REG[index], Value); - ODM_Write1Byte(pDM_Odm, Power_Index_REG[index], Value); - -} - - -VOID -odm_DynamicTxPower( - IN PDM_ODM_T pDM_Odm - ) -{ - // - // For AP/ADSL use prtl8192cd_priv - // For CE/NIC use PADAPTER - // - //PADAPTER pAdapter = pDM_Odm->Adapter; -// prtl8192cd_priv priv = pDM_Odm->priv; - - if (!(pDM_Odm->SupportAbility & ODM_BB_DYNAMIC_TXPWR)) - return; - - // - // 2011/09/29 MH In HW integration first stage, we provide 4 different handle to operate - // at the same time. In the stage2/3, we need to prive universal interface and merge all - // HW dynamic mechanism. - // - switch (pDM_Odm->SupportPlatform) - { - case ODM_WIN: - case ODM_CE: - odm_DynamicTxPowerNIC(pDM_Odm); - break; - case ODM_AP: - odm_DynamicTxPowerAP(pDM_Odm); - break; - - case ODM_ADSL: - //odm_DIGAP(pDM_Odm); - break; - } - - -} - - -VOID -odm_DynamicTxPowerNIC( - IN PDM_ODM_T pDM_Odm - ) -{ - if (!(pDM_Odm->SupportAbility & ODM_BB_DYNAMIC_TXPWR)) - return; - -#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) - - if(pDM_Odm->SupportICType == ODM_RTL8192C) - { - odm_DynamicTxPower_92C(pDM_Odm); - } - else if(pDM_Odm->SupportICType == ODM_RTL8192D) - { - odm_DynamicTxPower_92D(pDM_Odm); - } - else if (pDM_Odm->SupportICType == ODM_RTL8821) - { -#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN)) - PADAPTER Adapter = pDM_Odm->Adapter; - PMGNT_INFO pMgntInfo = GetDefaultMgntInfo(Adapter); - - if (pMgntInfo->RegRspPwr == 1) - { - if(pDM_Odm->RSSI_Min > 60) - { - ODM_SetMACReg(pDM_Odm, ODM_REG_RESP_TX_11AC, BIT20|BIT19|BIT18, 1); // Resp TXAGC offset = -3dB - - } - else if(pDM_Odm->RSSI_Min < 55) - { - ODM_SetMACReg(pDM_Odm, ODM_REG_RESP_TX_11AC, BIT20|BIT19|BIT18, 0); // Resp TXAGC offset = 0dB - } - } -#endif - } -#endif -} - -VOID -odm_DynamicTxPowerAP( - IN PDM_ODM_T pDM_Odm - - ) -{ -#if (DM_ODM_SUPPORT_TYPE == ODM_AP) - prtl8192cd_priv priv = pDM_Odm->priv; - s4Byte i; - - if(!priv->pshare->rf_ft_var.tx_pwr_ctrl) - return; - -#ifdef HIGH_POWER_EXT_PA - if(pDM_Odm->ExtPA) - tx_power_control(priv); -#endif - - /* - * Check if station is near by to use lower tx power - */ - - if ((priv->up_time % 3) == 0 ) { - for(i=0; ipODM_StaInfo[i]; - if(IS_STA_VALID(pstat) ) { - if ((pstat->hp_level == 0) && (pstat->rssi > TX_POWER_NEAR_FIELD_THRESH_AP+4)) - pstat->hp_level = 1; - else if ((pstat->hp_level == 1) && (pstat->rssi < TX_POWER_NEAR_FIELD_THRESH_AP)) - pstat->hp_level = 0; - } - } - } - -#endif -} - - -VOID -odm_DynamicTxPower_92C( - IN PDM_ODM_T pDM_Odm - ) -{ -#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) - PADAPTER Adapter = pDM_Odm->Adapter; - PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - s4Byte UndecoratedSmoothedPWDB; - - // 2012/01/12 MH According to Luke's suggestion, only high power will support the feature. - if (pDM_Odm->ExtPA == FALSE) - return; - - // STA not connected and AP not connected - if((!pMgntInfo->bMediaConnect) && - (pHalData->EntryMinUndecoratedSmoothedPWDB == 0)) - { - ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("Not connected to any \n")); - pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; - - //the LastDTPlvl should reset when disconnect, - //otherwise the tx power level wouldn't change when disconnect and connect again. - // Maddest 20091220. - pHalData->LastDTPLvl=TxHighPwrLevel_Normal; - return; - } - -#if (INTEL_PROXIMITY_SUPPORT == 1) - // Intel set fixed tx power - if(pMgntInfo->IntelProximityModeInfo.PowerOutput > 0) - { - switch(pMgntInfo->IntelProximityModeInfo.PowerOutput){ - case 1: - pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_100; - ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("TxHighPwrLevel_100\n")); - break; - case 2: - pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_70; - ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("TxHighPwrLevel_70\n")); - break; - case 3: - pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_50; - ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("TxHighPwrLevel_50\n")); - break; - case 4: - pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_35; - ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("TxHighPwrLevel_35\n")); - break; - case 5: - pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_15; - ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("TxHighPwrLevel_15\n")); - break; - default: - pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_100; - ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("TxHighPwrLevel_100\n")); - break; - } - } - else -#endif - { - if( (pMgntInfo->bDynamicTxPowerEnable != TRUE) || - (pHalData->DMFlag & HAL_DM_HIPWR_DISABLE) || - pMgntInfo->IOTAction & HT_IOT_ACT_DISABLE_HIGH_POWER) - { - pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; - } - else - { - if(pMgntInfo->bMediaConnect) // Default port - { - if(ACTING_AS_AP(Adapter) || ACTING_AS_IBSS(Adapter)) - { - UndecoratedSmoothedPWDB = pHalData->EntryMinUndecoratedSmoothedPWDB; - ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("AP Client PWDB = 0x%x \n", UndecoratedSmoothedPWDB)); - } - else - { - UndecoratedSmoothedPWDB = pHalData->UndecoratedSmoothedPWDB; - ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("STA Default Port PWDB = 0x%x \n", UndecoratedSmoothedPWDB)); - } - } - else // associated entry pwdb - { - UndecoratedSmoothedPWDB = pHalData->EntryMinUndecoratedSmoothedPWDB; - ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("AP Ext Port PWDB = 0x%x \n", UndecoratedSmoothedPWDB)); - } - - if(UndecoratedSmoothedPWDB >= TX_POWER_NEAR_FIELD_THRESH_LVL2) - { - pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Level2; - ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("TxHighPwrLevel_Level1 (TxPwr=0x0)\n")); - } - else if((UndecoratedSmoothedPWDB < (TX_POWER_NEAR_FIELD_THRESH_LVL2-3)) && - (UndecoratedSmoothedPWDB >= TX_POWER_NEAR_FIELD_THRESH_LVL1) ) - { - pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Level1; - ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("TxHighPwrLevel_Level1 (TxPwr=0x10)\n")); - } - else if(UndecoratedSmoothedPWDB < (TX_POWER_NEAR_FIELD_THRESH_LVL1-5)) - { - pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; - ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("TxHighPwrLevel_Normal\n")); - } - } - } - if( pHalData->DynamicTxHighPowerLvl != pHalData->LastDTPLvl ) - { - ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("PHY_SetTxPowerLevel8192C() Channel = %d \n" , pHalData->CurrentChannel)); - PHY_SetTxPowerLevel8192C(Adapter, pHalData->CurrentChannel); - if( (pHalData->DynamicTxHighPowerLvl == TxHighPwrLevel_Normal) && - (pHalData->LastDTPLvl == TxHighPwrLevel_Level1 || pHalData->LastDTPLvl == TxHighPwrLevel_Level2)) //TxHighPwrLevel_Normal - odm_DynamicTxPowerRestorePowerIndex(pDM_Odm); - else if(pHalData->DynamicTxHighPowerLvl == TxHighPwrLevel_Level1) - odm_DynamicTxPowerWritePowerIndex(pDM_Odm, 0x14); - else if(pHalData->DynamicTxHighPowerLvl == TxHighPwrLevel_Level2) - odm_DynamicTxPowerWritePowerIndex(pDM_Odm, 0x10); - } - pHalData->LastDTPLvl = pHalData->DynamicTxHighPowerLvl; - - -#elif (DM_ODM_SUPPORT_TYPE == ODM_CE) - - #if (RTL8192C_SUPPORT==1) - PADAPTER Adapter = pDM_Odm->Adapter; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - struct dm_priv *pdmpriv = &pHalData->dmpriv; - struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv); - struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv; - int UndecoratedSmoothedPWDB; - - if(!pdmpriv->bDynamicTxPowerEnable) - return; - -#ifdef CONFIG_INTEL_PROXIM - if(Adapter->proximity.proxim_on== _TRUE){ - struct proximity_priv *prox_priv=Adapter->proximity.proximity_priv; - // Intel set fixed tx power - printk("\n %s Adapter->proximity.proxim_on=%d prox_priv->proxim_modeinfo->power_output=%d \n",__FUNCTION__,Adapter->proximity.proxim_on,prox_priv->proxim_modeinfo->power_output); - if(prox_priv!=NULL){ - if(prox_priv->proxim_modeinfo->power_output> 0) - { - switch(prox_priv->proxim_modeinfo->power_output) - { - case 1: - pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_100; - printk("TxHighPwrLevel_100\n"); - break; - case 2: - pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_70; - printk("TxHighPwrLevel_70\n"); - break; - case 3: - pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_50; - printk("TxHighPwrLevel_50\n"); - break; - case 4: - pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_35; - printk("TxHighPwrLevel_35\n"); - break; - case 5: - pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_15; - printk("TxHighPwrLevel_15\n"); - break; - default: - pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_100; - printk("TxHighPwrLevel_100\n"); - break; - } - } - } - } - else -#endif - { - // STA not connected and AP not connected - if((check_fwstate(pmlmepriv, _FW_LINKED) != _TRUE) && - (pdmpriv->EntryMinUndecoratedSmoothedPWDB == 0)) - { - //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("Not connected to any \n")); - pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; - - //the LastDTPlvl should reset when disconnect, - //otherwise the tx power level wouldn't change when disconnect and connect again. - // Maddest 20091220. - pdmpriv->LastDTPLvl=TxHighPwrLevel_Normal; - return; - } - - if(check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) // Default port - { - #if 0 - //todo: AP Mode - if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == _TRUE) || - (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == _TRUE)) - { - UndecoratedSmoothedPWDB = pdmpriv->EntryMinUndecoratedSmoothedPWDB; - //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("AP Client PWDB = 0x%x \n", UndecoratedSmoothedPWDB)); - } - else - { - UndecoratedSmoothedPWDB = pdmpriv->UndecoratedSmoothedPWDB; - //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("STA Default Port PWDB = 0x%x \n", UndecoratedSmoothedPWDB)); - } - #else - UndecoratedSmoothedPWDB = pdmpriv->EntryMinUndecoratedSmoothedPWDB; - #endif - } - else // associated entry pwdb - { - UndecoratedSmoothedPWDB = pdmpriv->EntryMinUndecoratedSmoothedPWDB; - //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("AP Ext Port PWDB = 0x%x \n", UndecoratedSmoothedPWDB)); - } - - if(UndecoratedSmoothedPWDB >= TX_POWER_NEAR_FIELD_THRESH_LVL2) - { - pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Level2; - //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("TxHighPwrLevel_Level1 (TxPwr=0x0)\n")); - } - else if((UndecoratedSmoothedPWDB < (TX_POWER_NEAR_FIELD_THRESH_LVL2-3)) && - (UndecoratedSmoothedPWDB >= TX_POWER_NEAR_FIELD_THRESH_LVL1) ) - { - pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Level1; - //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("TxHighPwrLevel_Level1 (TxPwr=0x10)\n")); - } - else if(UndecoratedSmoothedPWDB < (TX_POWER_NEAR_FIELD_THRESH_LVL1-5)) - { - pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; - //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("TxHighPwrLevel_Normal\n")); - } - } - if( (pdmpriv->DynamicTxHighPowerLvl != pdmpriv->LastDTPLvl) ) - { - PHY_SetTxPowerLevel8192C(Adapter, pHalData->CurrentChannel); - if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Normal) // HP1 -> Normal or HP2 -> Normal - odm_DynamicTxPowerRestorePowerIndex(pDM_Odm); - else if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level1) - odm_DynamicTxPowerWritePowerIndex(pDM_Odm, 0x14); - else if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level2) - odm_DynamicTxPowerWritePowerIndex(pDM_Odm, 0x10); - } - pdmpriv->LastDTPLvl = pdmpriv->DynamicTxHighPowerLvl; - #endif -#endif // #if (DM_ODM_SUPPORT_TYPE == ODM_WIN) - -} - - -VOID -odm_DynamicTxPower_92D( - IN PDM_ODM_T pDM_Odm - ) -{ -#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) - PADAPTER Adapter = pDM_Odm->Adapter; - PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - s4Byte UndecoratedSmoothedPWDB; - - PADAPTER BuddyAdapter = Adapter->BuddyAdapter; - BOOLEAN bGetValueFromBuddyAdapter = dm_DualMacGetParameterFromBuddyAdapter(Adapter); - u1Byte HighPowerLvlBackForMac0 = TxHighPwrLevel_Level1; - - // 2012/01/12 MH According to Luke's suggestion, only high power will support the feature. - if (pDM_Odm->ExtPA == FALSE) - return; - - // If dynamic high power is disabled. - if( (pMgntInfo->bDynamicTxPowerEnable != TRUE) || - (pHalData->DMFlag & HAL_DM_HIPWR_DISABLE) || - pMgntInfo->IOTAction & HT_IOT_ACT_DISABLE_HIGH_POWER) - { - pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; - return; - } - - // STA not connected and AP not connected - if((!pMgntInfo->bMediaConnect) && - (pHalData->EntryMinUndecoratedSmoothedPWDB == 0)) - { - ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("Not connected to any \n")); - pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; - - //the LastDTPlvl should reset when disconnect, - //otherwise the tx power level wouldn't change when disconnect and connect again. - // Maddest 20091220. - pHalData->LastDTPLvl=TxHighPwrLevel_Normal; - return; - } - - if(pMgntInfo->bMediaConnect) // Default port - { - if(ACTING_AS_AP(Adapter) || pMgntInfo->mIbss) - { - UndecoratedSmoothedPWDB = pHalData->EntryMinUndecoratedSmoothedPWDB; - ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("AP Client PWDB = 0x%x \n", UndecoratedSmoothedPWDB)); - } - else - { - UndecoratedSmoothedPWDB = pHalData->UndecoratedSmoothedPWDB; - ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("STA Default Port PWDB = 0x%x \n", UndecoratedSmoothedPWDB)); - } - } - else // associated entry pwdb - { - UndecoratedSmoothedPWDB = pHalData->EntryMinUndecoratedSmoothedPWDB; - ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("AP Ext Port PWDB = 0x%x \n", UndecoratedSmoothedPWDB)); - } - - if(IS_HARDWARE_TYPE_8192D(Adapter) && GET_HAL_DATA(Adapter)->CurrentBandType == 1){ - if(UndecoratedSmoothedPWDB >= 0x33) - { - pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Level2; - ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("5G:TxHighPwrLevel_Level2 (TxPwr=0x0)\n")); - } - else if((UndecoratedSmoothedPWDB <0x33) && - (UndecoratedSmoothedPWDB >= 0x2b) ) - { - pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Level1; - ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("5G:TxHighPwrLevel_Level1 (TxPwr=0x10)\n")); - } - else if(UndecoratedSmoothedPWDB < 0x2b) - { - pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; - ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("5G:TxHighPwrLevel_Normal\n")); - } - - } - else - - { - if(UndecoratedSmoothedPWDB >= TX_POWER_NEAR_FIELD_THRESH_LVL2) - { - pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Level1; - ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("TxHighPwrLevel_Level1 (TxPwr=0x0)\n")); - } - else if((UndecoratedSmoothedPWDB < (TX_POWER_NEAR_FIELD_THRESH_LVL2-3)) && - (UndecoratedSmoothedPWDB >= TX_POWER_NEAR_FIELD_THRESH_LVL1) ) - { - pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Level1; - ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("TxHighPwrLevel_Level1 (TxPwr=0x10)\n")); - } - else if(UndecoratedSmoothedPWDB < (TX_POWER_NEAR_FIELD_THRESH_LVL1-5)) - { - pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; - ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("TxHighPwrLevel_Normal\n")); - } - - } - -//sherry delete flag 20110517 - if(bGetValueFromBuddyAdapter) - { - ODM_RT_TRACE(pDM_Odm,COMP_MLME,DBG_LOUD,("dm_DynamicTxPower() mac 0 for mac 1 \n")); - if(Adapter->DualMacDMSPControl.bChangeTxHighPowerLvlForAnotherMacOfDMSP) - { - ODM_RT_TRACE(pDM_Odm,COMP_MLME,DBG_LOUD,("dm_DynamicTxPower() change value \n")); - HighPowerLvlBackForMac0 = pHalData->DynamicTxHighPowerLvl; - pHalData->DynamicTxHighPowerLvl = Adapter->DualMacDMSPControl.CurTxHighLvlForAnotherMacOfDMSP; - PHY_SetTxPowerLevel8192C(Adapter, pHalData->CurrentChannel); - pHalData->DynamicTxHighPowerLvl = HighPowerLvlBackForMac0; - Adapter->DualMacDMSPControl.bChangeTxHighPowerLvlForAnotherMacOfDMSP = FALSE; - } - } - - if( (pHalData->DynamicTxHighPowerLvl != pHalData->LastDTPLvl) ) - { - ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("PHY_SetTxPowerLevel8192S() Channel = %d \n" , pHalData->CurrentChannel)); - if(Adapter->DualMacSmartConcurrent == TRUE) - { - if(BuddyAdapter == NULL) - { - ODM_RT_TRACE(pDM_Odm,COMP_MLME,DBG_LOUD,("dm_DynamicTxPower() BuddyAdapter == NULL case \n")); - if(!Adapter->bSlaveOfDMSP) - { - PHY_SetTxPowerLevel8192C(Adapter, pHalData->CurrentChannel); - } - } - else - { - if(pHalData->MacPhyMode92D == DUALMAC_SINGLEPHY) - { - ODM_RT_TRACE(pDM_Odm,COMP_MLME,DBG_LOUD,("dm_DynamicTxPower() BuddyAdapter DMSP \n")); - if(Adapter->bSlaveOfDMSP) - { - ODM_RT_TRACE(pDM_Odm,COMP_MLME,DBG_LOUD,("dm_DynamicTxPower() bslave case \n")); - BuddyAdapter->DualMacDMSPControl.bChangeTxHighPowerLvlForAnotherMacOfDMSP = TRUE; - BuddyAdapter->DualMacDMSPControl.CurTxHighLvlForAnotherMacOfDMSP = pHalData->DynamicTxHighPowerLvl; - } - else - { - ODM_RT_TRACE(pDM_Odm,COMP_MLME,DBG_LOUD,("dm_DynamicTxPower() master case \n")); - if(!bGetValueFromBuddyAdapter) - { - ODM_RT_TRACE(pDM_Odm,COMP_MLME,DBG_LOUD,("dm_DynamicTxPower() mac 0 for mac 0 \n")); - PHY_SetTxPowerLevel8192C(Adapter, pHalData->CurrentChannel); - } - } - } - else - { - ODM_RT_TRACE(pDM_Odm,COMP_MLME,DBG_LOUD,("dm_DynamicTxPower() BuddyAdapter DMDP\n")); - PHY_SetTxPowerLevel8192C(Adapter, pHalData->CurrentChannel); - } - } - } - else - { - PHY_SetTxPowerLevel8192C(Adapter, pHalData->CurrentChannel); - } - - } - pHalData->LastDTPLvl = pHalData->DynamicTxHighPowerLvl; -#elif (DM_ODM_SUPPORT_TYPE == ODM_CE) -#if (RTL8192D_SUPPORT==1) - PADAPTER Adapter = pDM_Odm->Adapter; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv); - - struct dm_priv *pdmpriv = &pHalData->dmpriv; - DM_ODM_T *podmpriv = &pHalData->odmpriv; - int UndecoratedSmoothedPWDB; - #if (RTL8192D_EASY_SMART_CONCURRENT == 1) - PADAPTER BuddyAdapter = Adapter->BuddyAdapter; - BOOLEAN bGetValueFromBuddyAdapter = DualMacGetParameterFromBuddyAdapter(Adapter); - u8 HighPowerLvlBackForMac0 = TxHighPwrLevel_Level1; - #endif - - // If dynamic high power is disabled. - if( (pdmpriv->bDynamicTxPowerEnable != _TRUE) || - (!(podmpriv->SupportAbility& ODM_BB_DYNAMIC_TXPWR)) ) - { - pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; - return; - } - - // STA not connected and AP not connected - if((check_fwstate(pmlmepriv, _FW_LINKED) != _TRUE) && - (pdmpriv->EntryMinUndecoratedSmoothedPWDB == 0)) - { - //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("Not connected to any \n")); - pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; - //the LastDTPlvl should reset when disconnect, - //otherwise the tx power level wouldn't change when disconnect and connect again. - // Maddest 20091220. - pdmpriv->LastDTPLvl=TxHighPwrLevel_Normal; - return; - } - - if(check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) // Default port - { - #if 0 - //todo: AP Mode - if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == _TRUE) || - (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == _TRUE)) - { - UndecoratedSmoothedPWDB = pdmpriv->EntryMinUndecoratedSmoothedPWDB; - //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("AP Client PWDB = 0x%x \n", UndecoratedSmoothedPWDB)); - } - else - { - UndecoratedSmoothedPWDB = pdmpriv->UndecoratedSmoothedPWDB; - //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("STA Default Port PWDB = 0x%x \n", UndecoratedSmoothedPWDB)); - } - #else - UndecoratedSmoothedPWDB = pdmpriv->EntryMinUndecoratedSmoothedPWDB; - #endif - } - else // associated entry pwdb - { - UndecoratedSmoothedPWDB = pdmpriv->EntryMinUndecoratedSmoothedPWDB; - //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("AP Ext Port PWDB = 0x%x \n", UndecoratedSmoothedPWDB)); - } -#if TX_POWER_FOR_5G_BAND == 1 - if(pHalData->CurrentBandType92D == BAND_ON_5G){ - if(UndecoratedSmoothedPWDB >= 0x33) - { - pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Level2; - //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("5G:TxHighPwrLevel_Level2 (TxPwr=0x0)\n")); - } - else if((UndecoratedSmoothedPWDB <0x33) && - (UndecoratedSmoothedPWDB >= 0x2b) ) - { - pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Level1; - //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("5G:TxHighPwrLevel_Level1 (TxPwr=0x10)\n")); - } - else if(UndecoratedSmoothedPWDB < 0x2b) - { - pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; - //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("5G:TxHighPwrLevel_Normal\n")); - } - } - else -#endif - { - if(UndecoratedSmoothedPWDB >= TX_POWER_NEAR_FIELD_THRESH_LVL2) - { - pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Level2; - //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("TxHighPwrLevel_Level1 (TxPwr=0x0)\n")); - } - else if((UndecoratedSmoothedPWDB < (TX_POWER_NEAR_FIELD_THRESH_LVL2-3)) && - (UndecoratedSmoothedPWDB >= TX_POWER_NEAR_FIELD_THRESH_LVL1) ) - { - pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Level1; - //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("TxHighPwrLevel_Level1 (TxPwr=0x10)\n")); - } - else if(UndecoratedSmoothedPWDB < (TX_POWER_NEAR_FIELD_THRESH_LVL1-5)) - { - pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; - //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("TxHighPwrLevel_Normal\n")); - } - } -#if (RTL8192D_EASY_SMART_CONCURRENT == 1) - if(bGetValueFromBuddyAdapter) - { - //ODM_RT_TRACE(pDM_Odm,COMP_MLME,DBG_LOUD,("dm_DynamicTxPower() mac 0 for mac 1 \n")); - if(Adapter->DualMacDMSPControl.bChangeTxHighPowerLvlForAnotherMacOfDMSP) - { - //ODM_RT_TRACE(pDM_Odm,COMP_MLME,DBG_LOUD,("dm_DynamicTxPower() change value \n")); - HighPowerLvlBackForMac0 = pHalData->DynamicTxHighPowerLvl; - pHalData->DynamicTxHighPowerLvl = Adapter->DualMacDMSPControl.CurTxHighLvlForAnotherMacOfDMSP; - PHY_SetTxPowerLevel8192D(Adapter, pHalData->CurrentChannel); - pHalData->DynamicTxHighPowerLvl = HighPowerLvlBackForMac0; - Adapter->DualMacDMSPControl.bChangeTxHighPowerLvlForAnotherMacOfDMSP = _FALSE; - } - } -#endif - - if( (pdmpriv->DynamicTxHighPowerLvl != pdmpriv->LastDTPLvl) ) - { - //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("PHY_SetTxPowerLevel8192S() Channel = %d \n" , pHalData->CurrentChannel)); -#if (RTL8192D_EASY_SMART_CONCURRENT == 1) - if(BuddyAdapter == NULL) - { - //ODM_RT_TRACE(pDM_Odm,COMP_MLME,DBG_LOUD,("dm_DynamicTxPower() BuddyAdapter == NULL case \n")); - if(!Adapter->bSlaveOfDMSP) - { - PHY_SetTxPowerLevel8192D(Adapter, pHalData->CurrentChannel); - } - } - else - { - if(pHalData->MacPhyMode92D == DUALMAC_SINGLEPHY) - { - //ODM_RT_TRACE(pDM_Odm,COMP_MLME,DBG_LOUD,("dm_DynamicTxPower() BuddyAdapter DMSP \n")); - if(Adapter->bSlaveOfDMSP) - { - //ODM_RT_TRACE(pDM_Odm,COMP_MLME,DBG_LOUD,("dm_DynamicTxPower() bslave case \n")); - BuddyAdapter->DualMacDMSPControl.bChangeTxHighPowerLvlForAnotherMacOfDMSP = _TRUE; - BuddyAdapter->DualMacDMSPControl.CurTxHighLvlForAnotherMacOfDMSP = pHalData->DynamicTxHighPowerLvl; - } - else - { - //ODM_RT_TRACE(pDM_Odm,COMP_MLME,DBG_LOUD,("dm_DynamicTxPower() master case \n")); - if(!bGetValueFromBuddyAdapter) - { - //ODM_RT_TRACE(pDM_Odm,COMP_MLME,DBG_LOUD,("dm_DynamicTxPower() mac 0 for mac 0 \n")); - PHY_SetTxPowerLevel8192D(Adapter, pHalData->CurrentChannel); - } - } - } - else - { - //ODM_RT_TRACE(pDM_Odm,COMP_MLME,DBG_LOUD,("dm_DynamicTxPower() BuddyAdapter DMDP\n")); - PHY_SetTxPowerLevel8192D(Adapter, pHalData->CurrentChannel); - } - } -#else - PHY_SetTxPowerLevel8192D(Adapter, pHalData->CurrentChannel); -#endif - } - pdmpriv->LastDTPLvl = pdmpriv->DynamicTxHighPowerLvl; -#endif -#endif // #if (DM_ODM_SUPPORT_TYPE == ODM_WIN) - -} - - -//3============================================================ -//3 RSSI Monitor -//3============================================================ - -VOID -odm_RSSIDumpToRegister( - IN PDM_ODM_T pDM_Odm - ) -{ -#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) - PADAPTER Adapter = pDM_Odm->Adapter; - - if(pDM_Odm->SupportICType == ODM_RTL8812) - { - PlatformEFIOWrite1Byte(Adapter, rA_RSSIDump_Jaguar, Adapter->RxStats.RxRSSIPercentage[0]); - PlatformEFIOWrite1Byte(Adapter, rB_RSSIDump_Jaguar, Adapter->RxStats.RxRSSIPercentage[1]); - - // Rx EVM - PlatformEFIOWrite1Byte(Adapter, rS1_RXevmDump_Jaguar, Adapter->RxStats.RxEVMdbm[0]); - PlatformEFIOWrite1Byte(Adapter, rS2_RXevmDump_Jaguar, Adapter->RxStats.RxEVMdbm[1]); - - // Rx SNR - PlatformEFIOWrite1Byte(Adapter, rA_RXsnrDump_Jaguar, (u1Byte)(Adapter->RxStats.RxSNRdB[0])); - PlatformEFIOWrite1Byte(Adapter, rB_RXsnrDump_Jaguar, (u1Byte)(Adapter->RxStats.RxSNRdB[1])); - - // Rx Cfo_Short - PlatformEFIOWrite2Byte(Adapter, rA_CfoShortDump_Jaguar, Adapter->RxStats.RxCfoShort[0]); - PlatformEFIOWrite2Byte(Adapter, rB_CfoShortDump_Jaguar, Adapter->RxStats.RxCfoShort[1]); - - // Rx Cfo_Tail - PlatformEFIOWrite2Byte(Adapter, rA_CfoLongDump_Jaguar, Adapter->RxStats.RxCfoTail[0]); - PlatformEFIOWrite2Byte(Adapter, rB_CfoLongDump_Jaguar, Adapter->RxStats.RxCfoTail[1]); - } - else if(pDM_Odm->SupportICType == ODM_RTL8192E) - { - PlatformEFIOWrite1Byte(Adapter, rA_RSSIDump_92E, Adapter->RxStats.RxRSSIPercentage[0]); - PlatformEFIOWrite1Byte(Adapter, rB_RSSIDump_92E, Adapter->RxStats.RxRSSIPercentage[1]); - // Rx EVM - PlatformEFIOWrite1Byte(Adapter, rS1_RXevmDump_92E, Adapter->RxStats.RxEVMdbm[0]); - PlatformEFIOWrite1Byte(Adapter, rS2_RXevmDump_92E, Adapter->RxStats.RxEVMdbm[1]); - // Rx SNR - PlatformEFIOWrite1Byte(Adapter, rA_RXsnrDump_92E, (u1Byte)(Adapter->RxStats.RxSNRdB[0])); - PlatformEFIOWrite1Byte(Adapter, rB_RXsnrDump_92E, (u1Byte)(Adapter->RxStats.RxSNRdB[1])); - // Rx Cfo_Short - PlatformEFIOWrite2Byte(Adapter, rA_CfoShortDump_92E, Adapter->RxStats.RxCfoShort[0]); - PlatformEFIOWrite2Byte(Adapter, rB_CfoShortDump_92E, Adapter->RxStats.RxCfoShort[1]); - // Rx Cfo_Tail - PlatformEFIOWrite2Byte(Adapter, rA_CfoLongDump_92E, Adapter->RxStats.RxCfoTail[0]); - PlatformEFIOWrite2Byte(Adapter, rB_CfoLongDump_92E, Adapter->RxStats.RxCfoTail[1]); - } -#endif -} - - -VOID -odm_RSSIMonitorInit( - IN PDM_ODM_T pDM_Odm - ) -{ - pRA_T pRA_Table = &pDM_Odm->DM_RA_Table; - - pRA_Table->firstconnect = FALSE; - -} - -VOID -odm_RSSIMonitorCheck( - IN PDM_ODM_T pDM_Odm - ) -{ - // - // For AP/ADSL use prtl8192cd_priv - // For CE/NIC use PADAPTER - // - - if (!(pDM_Odm->SupportAbility & ODM_BB_RSSI_MONITOR)) - return; - - // - // 2011/09/29 MH In HW integration first stage, we provide 4 different handle to operate - // at the same time. In the stage2/3, we need to prive universal interface and merge all - // HW dynamic mechanism. - // - switch (pDM_Odm->SupportPlatform) - { - case ODM_WIN: - odm_RSSIMonitorCheckMP(pDM_Odm); - break; - - case ODM_CE: - odm_RSSIMonitorCheckCE(pDM_Odm); - break; - - case ODM_AP: - odm_RSSIMonitorCheckAP(pDM_Odm); - break; - - case ODM_ADSL: - //odm_DIGAP(pDM_Odm); - break; - } - -} // odm_RSSIMonitorCheck - - -VOID -odm_RSSIMonitorCheckMP( - IN PDM_ODM_T pDM_Odm - ) -{ -#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) - PADAPTER Adapter = pDM_Odm->Adapter; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - PRT_WLAN_STA pEntry; - u1Byte i; - s4Byte tmpEntryMaxPWDB=0, tmpEntryMinPWDB=0xff; - u1Byte H2C_Parameter[4] ={0}; - PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; - u8Byte curTxOkCnt = 0, curRxOkCnt = 0; - u1Byte STBC_TX = 0; - BOOLEAN FirstConnect; - pRA_T pRA_Table = &pDM_Odm->DM_RA_Table; -#if (BEAMFORMING_SUPPORT == 1) - BEAMFORMING_CAP Beamform_cap = BEAMFORMING_CAP_NONE; - u1Byte TxBF_EN = 0; -#endif - - RT_DISP(FDM, DM_PWDB, ("pHalData->UndecoratedSmoothedPWDB = 0x%x( %d)\n", - pHalData->UndecoratedSmoothedPWDB, - pHalData->UndecoratedSmoothedPWDB)); - - curTxOkCnt = Adapter->TxStats.NumTxBytesUnicast - pMgntInfo->lastTxOkCnt; - curRxOkCnt = Adapter->RxStats.NumRxBytesUnicast - pMgntInfo->lastRxOkCnt; - pMgntInfo->lastTxOkCnt = curTxOkCnt; - pMgntInfo->lastRxOkCnt = curRxOkCnt; - - RT_DISP(FDM, DM_PWDB, ("Tx = %d Rx = %d\n", curTxOkCnt, curRxOkCnt)); - - FirstConnect = (pHalData->bLinked) && (pRA_Table->firstconnect == FALSE); - pRA_Table->firstconnect = pHalData->bLinked; - H2C_Parameter[3] |= FirstConnect << 5; - - if(pDM_Odm->SupportICType == ODM_RTL8188E && (pMgntInfo->CustomerID==RT_CID_819x_HP)) - { - if(curRxOkCnt >(curTxOkCnt*6)) - PlatformEFIOWrite4Byte(Adapter, REG_ARFR0, 0x8f015); - else - PlatformEFIOWrite4Byte(Adapter, REG_ARFR0, 0xff015); - } - - if(pDM_Odm->SupportICType == ODM_RTL8812 || pDM_Odm->SupportICType == ODM_RTL8821) - { - if(curRxOkCnt >(curTxOkCnt*6)) - H2C_Parameter[3]=0x01; - else - H2C_Parameter[3]=0x00; - } - - for(i = 0; i < ODM_ASSOCIATE_ENTRY_NUM; i++) - { - if(IsAPModeExist(Adapter) && GetFirstExtAdapter(Adapter) != NULL) - { - pEntry = AsocEntry_EnumStation(GetFirstExtAdapter(Adapter), i); - } - else - { - pEntry = AsocEntry_EnumStation(GetDefaultAdapter(Adapter), i); - } - - if(pEntry != NULL) - { - if(pEntry->bAssociated) - { - - RT_DISP_ADDR(FDM, DM_PWDB, ("pEntry->MacAddr ="), pEntry->MacAddr); - RT_DISP(FDM, DM_PWDB, ("pEntry->rssi = 0x%x(%d)\n", - pEntry->rssi_stat.UndecoratedSmoothedPWDB, pEntry->rssi_stat.UndecoratedSmoothedPWDB)); - - if(pDM_Odm->SupportICType == ODM_RTL8192E || pDM_Odm->SupportICType == ODM_RTL8812) - { - -#if (BEAMFORMING_SUPPORT == 1) - Beamform_cap = Beamforming_GetEntryBeamCapByMacId(pMgntInfo, pEntry->AssociatedMacId); - if(Beamform_cap & (BEAMFORMER_CAP_HT_EXPLICIT |BEAMFORMER_CAP_VHT_SU)) - TxBF_EN = 1; - else - TxBF_EN = 0; - - H2C_Parameter[3] |= TxBF_EN << 6; - - if(TxBF_EN) - STBC_TX = 0; - else -#endif - { - if(IS_WIRELESS_MODE_AC(Adapter)) - STBC_TX = TEST_FLAG(pEntry->VHTInfo.STBC, STBC_VHT_ENABLE_TX); - else - STBC_TX = TEST_FLAG(pEntry->HTInfo.STBC, STBC_HT_ENABLE_TX); - } - - H2C_Parameter[3] |= STBC_TX << 1; - } - - if(pEntry->rssi_stat.UndecoratedSmoothedPWDB < tmpEntryMinPWDB) - tmpEntryMinPWDB = pEntry->rssi_stat.UndecoratedSmoothedPWDB; - if(pEntry->rssi_stat.UndecoratedSmoothedPWDB > tmpEntryMaxPWDB) - tmpEntryMaxPWDB = pEntry->rssi_stat.UndecoratedSmoothedPWDB; - - H2C_Parameter[2] = (u1Byte)(pEntry->rssi_stat.UndecoratedSmoothedPWDB & 0xFF); - H2C_Parameter[1] = 0x20; // fw v12 cmdid 5:use max macid ,for nic ,default macid is 0 ,max macid is 1 - H2C_Parameter[0] = (pEntry->AssociatedMacId); - if(pDM_Odm->SupportICType == ODM_RTL8812) - ODM_FillH2CCmd(Adapter, ODM_H2C_RSSI_REPORT, 4, H2C_Parameter); - else if(pDM_Odm->SupportICType == ODM_RTL8192E) - ODM_FillH2CCmd(Adapter, ODM_H2C_RSSI_REPORT, 4, H2C_Parameter); - else - ODM_FillH2CCmd(Adapter, ODM_H2C_RSSI_REPORT, 3, H2C_Parameter); - } - } - else - { - break; - } - } - - if(tmpEntryMaxPWDB != 0) // If associated entry is found - { - pHalData->EntryMaxUndecoratedSmoothedPWDB = tmpEntryMaxPWDB; - RT_DISP(FDM, DM_PWDB, ("EntryMaxPWDB = 0x%x(%d)\n", tmpEntryMaxPWDB, tmpEntryMaxPWDB)); - } - else - { - pHalData->EntryMaxUndecoratedSmoothedPWDB = 0; - } - - if(tmpEntryMinPWDB != 0xff) // If associated entry is found - { - pHalData->EntryMinUndecoratedSmoothedPWDB = tmpEntryMinPWDB; - RT_DISP(FDM, DM_PWDB, ("EntryMinPWDB = 0x%x(%d)\n", tmpEntryMinPWDB, tmpEntryMinPWDB)); - - } - else - { - pHalData->EntryMinUndecoratedSmoothedPWDB = 0; - } - - // Indicate Rx signal strength to FW. - if(pHalData->bUseRAMask) - { - if(pDM_Odm->SupportICType == ODM_RTL8192E || pDM_Odm->SupportICType == ODM_RTL8812) - { - PRT_HIGH_THROUGHPUT pHTInfo = GET_HT_INFO(pMgntInfo); - PRT_VERY_HIGH_THROUGHPUT pVHTInfo = GET_VHT_INFO(pMgntInfo); - -#if (BEAMFORMING_SUPPORT == 1) - - Beamform_cap = Beamforming_GetEntryBeamCapByMacId(pMgntInfo, pMgntInfo->mMacId); - - if(Beamform_cap & (BEAMFORMER_CAP_HT_EXPLICIT |BEAMFORMER_CAP_VHT_SU)) - TxBF_EN = 1; - else - TxBF_EN = 0; - - H2C_Parameter[3] |= TxBF_EN << 6; - - if(TxBF_EN) - STBC_TX = 0; - else -#endif - { - if(IS_WIRELESS_MODE_AC(Adapter)) - STBC_TX = TEST_FLAG(pVHTInfo->VhtCurStbc, STBC_VHT_ENABLE_TX); - else - STBC_TX = TEST_FLAG(pHTInfo->HtCurStbc, STBC_HT_ENABLE_TX); - } - - H2C_Parameter[3] |= STBC_TX << 1; - } - - H2C_Parameter[2] = (u1Byte)(pHalData->UndecoratedSmoothedPWDB & 0xFF); - H2C_Parameter[1] = 0x20; // fw v12 cmdid 5:use max macid ,for nic ,default macid is 0 ,max macid is 1 - H2C_Parameter[0] = 0; // fw v12 cmdid 5:use max macid ,for nic ,default macid is 0 ,max macid is 1 - if(pDM_Odm->SupportICType == ODM_RTL8812) - ODM_FillH2CCmd(Adapter, ODM_H2C_RSSI_REPORT, 4, H2C_Parameter); - else if(pDM_Odm->SupportICType == ODM_RTL8192E) - ODM_FillH2CCmd(Adapter, ODM_H2C_RSSI_REPORT, 4, H2C_Parameter); - else - ODM_FillH2CCmd(Adapter, ODM_H2C_RSSI_REPORT, 3, H2C_Parameter); - } - else - { - PlatformEFIOWrite1Byte(Adapter, 0x4fe, (u1Byte)pHalData->UndecoratedSmoothedPWDB); - } - - if((pDM_Odm->SupportICType == ODM_RTL8812)||(pDM_Odm->SupportICType == ODM_RTL8192E)) - odm_RSSIDumpToRegister(pDM_Odm); - - odm_FindMinimumRSSI(Adapter); - ODM_CmnInfoUpdate(&pHalData->DM_OutSrc ,ODM_CMNINFO_LINK, (u8Byte)pHalData->bLinked); - ODM_CmnInfoUpdate(&pHalData->DM_OutSrc ,ODM_CMNINFO_RSSI_MIN, (u8Byte)pHalData->MinUndecoratedPWDBForDM); -#endif // #if (DM_ODM_SUPPORT_TYPE == ODM_WIN) -} - -#if (DM_ODM_SUPPORT_TYPE == ODM_CE) -// -//sherry move from DUSC to here 20110517 -// -static VOID -FindMinimumRSSI_Dmsp( - IN PADAPTER pAdapter -) -{ -#if 0 - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - struct dm_priv *pdmpriv = &pHalData->dmpriv; - s32 Rssi_val_min_back_for_mac0; - BOOLEAN bGetValueFromBuddyAdapter = dm_DualMacGetParameterFromBuddyAdapter(pAdapter); - BOOLEAN bRestoreRssi = _FALSE; - PADAPTER BuddyAdapter = pAdapter->BuddyAdapter; - - if(pHalData->MacPhyMode92D == DUALMAC_SINGLEPHY) - { - if(BuddyAdapter!= NULL) - { - if(pHalData->bSlaveOfDMSP) - { - //ODM_RT_TRACE(pDM_Odm,COMP_EASY_CONCURRENT,DBG_LOUD,("bSlavecase of dmsp\n")); - BuddyAdapter->DualMacDMSPControl.RssiValMinForAnotherMacOfDMSP = pdmpriv->MinUndecoratedPWDBForDM; - } - else - { - if(bGetValueFromBuddyAdapter) - { - //ODM_RT_TRACE(pDM_Odm,COMP_EASY_CONCURRENT,DBG_LOUD,("get new RSSI\n")); - bRestoreRssi = _TRUE; - Rssi_val_min_back_for_mac0 = pdmpriv->MinUndecoratedPWDBForDM; - pdmpriv->MinUndecoratedPWDBForDM = pAdapter->DualMacDMSPControl.RssiValMinForAnotherMacOfDMSP; - } - } - } - - } - - if(bRestoreRssi) - { - bRestoreRssi = _FALSE; - pdmpriv->MinUndecoratedPWDBForDM = Rssi_val_min_back_for_mac0; - } -#endif -} - -static void -FindMinimumRSSI( -IN PADAPTER pAdapter - ) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - struct dm_priv *pdmpriv = &pHalData->dmpriv; - PDM_ODM_T pDM_Odm = &(pHalData->odmpriv); - - //1 1.Determine the minimum RSSI - - if((pDM_Odm->bLinked != _TRUE) && - (pdmpriv->EntryMinUndecoratedSmoothedPWDB == 0)) - { - pdmpriv->MinUndecoratedPWDBForDM = 0; - //ODM_RT_TRACE(pDM_Odm,COMP_BB_POWERSAVING, DBG_LOUD, ("Not connected to any \n")); - } - else - { - pdmpriv->MinUndecoratedPWDBForDM = pdmpriv->EntryMinUndecoratedSmoothedPWDB; - } - - //DBG_8192C("%s=>MinUndecoratedPWDBForDM(%d)\n",__FUNCTION__,pdmpriv->MinUndecoratedPWDBForDM); - //ODM_RT_TRACE(pDM_Odm,COMP_DIG, DBG_LOUD, ("MinUndecoratedPWDBForDM =%d\n",pHalData->MinUndecoratedPWDBForDM)); -} -#endif - -VOID -odm_RSSIMonitorCheckCE( - IN PDM_ODM_T pDM_Odm - ) -{ -#if (DM_ODM_SUPPORT_TYPE == ODM_CE) - PADAPTER Adapter = pDM_Odm->Adapter; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - struct dm_priv *pdmpriv = &pHalData->dmpriv; - struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(Adapter); - int i; - int tmpEntryMaxPWDB=0, tmpEntryMinPWDB=0xff; - u8 sta_cnt=0; - u32 UL_DL_STATE = 0, STBC_TX = 0, TxBF_EN = 0; - u32 PWDB_rssi[NUM_STA]={0};//[0~15]:MACID, [16~31]:PWDB_rssi - BOOLEAN FirstConnect = FALSE; - pRA_T pRA_Table = &pDM_Odm->DM_RA_Table; - - if(pDM_Odm->bLinked != _TRUE) - return; - - #if((RTL8812A_SUPPORT==1)||(RTL8821A_SUPPORT==1)) - if((pDM_Odm->SupportICType == ODM_RTL8812)||(pDM_Odm->SupportICType == ODM_RTL8821)) - { - u64 curTxOkCnt = pdvobjpriv->traffic_stat.cur_tx_bytes; - u64 curRxOkCnt = pdvobjpriv->traffic_stat.cur_rx_bytes; - - if(curRxOkCnt >(curTxOkCnt*6)) - UL_DL_STATE = 1; - else - UL_DL_STATE = 0; - } - #endif - - FirstConnect = (pDM_Odm->bLinked) && (pRA_Table->firstconnect == FALSE); - pRA_Table->firstconnect = pDM_Odm->bLinked; - - //if(check_fwstate(&Adapter->mlmepriv, WIFI_AP_STATE|WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE) == _TRUE) - { - #if 1 - struct sta_info *psta; - - for(i=0; ipODM_StaInfo[i])) - { - if(IS_MCAST( psta->hwaddr)) //if(psta->mac_id ==1) - continue; - - if(psta->rssi_stat.UndecoratedSmoothedPWDB == (-1)) - continue; - - if(psta->rssi_stat.UndecoratedSmoothedPWDB < tmpEntryMinPWDB) - tmpEntryMinPWDB = psta->rssi_stat.UndecoratedSmoothedPWDB; - - if(psta->rssi_stat.UndecoratedSmoothedPWDB > tmpEntryMaxPWDB) - tmpEntryMaxPWDB = psta->rssi_stat.UndecoratedSmoothedPWDB; - - #if 0 - DBG_871X("%s mac_id:%u, mac:"MAC_FMT", rssi:%d\n", __func__, - psta->mac_id, MAC_ARG(psta->hwaddr), psta->rssi_stat.UndecoratedSmoothedPWDB); - #endif - - if(psta->rssi_stat.UndecoratedSmoothedPWDB != (-1)) { - -#ifdef CONFIG_80211N_HT - if(pDM_Odm->SupportICType == ODM_RTL8192E || pDM_Odm->SupportICType == ODM_RTL8812) - { -#ifdef CONFIG_BEAMFORMING - BEAMFORMING_CAP Beamform_cap = beamforming_get_entry_beam_cap_by_mac_id(&Adapter->mlmepriv, psta->mac_id); - - if(Beamform_cap & (BEAMFORMER_CAP_HT_EXPLICIT |BEAMFORMER_CAP_VHT_SU)) - TxBF_EN = 1; - else - TxBF_EN = 0; - - if (TxBF_EN) { - STBC_TX = 0; - } - else -#endif - { -#ifdef CONFIG_80211AC_VHT - if(IsSupportedVHT(psta->wireless_mode)) - STBC_TX = TEST_FLAG(psta->vhtpriv.stbc_cap, STBC_VHT_ENABLE_TX); - else -#endif - STBC_TX = TEST_FLAG(psta->htpriv.stbc_cap, STBC_HT_ENABLE_TX); - } - } -#endif - - if(pDM_Odm->SupportICType == ODM_RTL8192D) - PWDB_rssi[sta_cnt++] = (psta->mac_id | (psta->rssi_stat.UndecoratedSmoothedPWDB<<16) | ((Adapter->stapriv.asoc_sta_count+1) << 8)); - else if ((pDM_Odm->SupportICType == ODM_RTL8192E)||(pDM_Odm->SupportICType == ODM_RTL8812)||(pDM_Odm->SupportICType == ODM_RTL8821)) - PWDB_rssi[sta_cnt++] = (((u8)(psta->mac_id&0xFF)) | ((psta->rssi_stat.UndecoratedSmoothedPWDB&0x7F)<<16) |(STBC_TX << 25) | (FirstConnect << 29) | (TxBF_EN << 30)); - else - PWDB_rssi[sta_cnt++] = (psta->mac_id | (psta->rssi_stat.UndecoratedSmoothedPWDB<<16) ); - } - } - } - #else - _irqL irqL; - _list *plist, *phead; - struct sta_info *psta; - struct sta_priv *pstapriv = &Adapter->stapriv; - u8 bcast_addr[ETH_ALEN]= {0xff,0xff,0xff,0xff,0xff,0xff}; - - _enter_critical_bh(&pstapriv->sta_hash_lock, &irqL); - - for(i=0; i< NUM_STA; i++) - { - phead = &(pstapriv->sta_hash[i]); - plist = get_next(phead); - - while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) - { - psta = LIST_CONTAINOR(plist, struct sta_info, hash_list); - - plist = get_next(plist); - - if(_rtw_memcmp(psta->hwaddr, bcast_addr, ETH_ALEN) || - _rtw_memcmp(psta->hwaddr, myid(&Adapter->eeprompriv), ETH_ALEN)) - continue; - - if(psta->state & WIFI_ASOC_STATE) - { - - if(psta->rssi_stat.UndecoratedSmoothedPWDB < tmpEntryMinPWDB) - tmpEntryMinPWDB = psta->rssi_stat.UndecoratedSmoothedPWDB; - - if(psta->rssi_stat.UndecoratedSmoothedPWDB > tmpEntryMaxPWDB) - tmpEntryMaxPWDB = psta->rssi_stat.UndecoratedSmoothedPWDB; - - if(psta->rssi_stat.UndecoratedSmoothedPWDB != (-1)){ - //printk("%s==> mac_id(%d),rssi(%d)\n",__FUNCTION__,psta->mac_id,psta->rssi_stat.UndecoratedSmoothedPWDB); - #if(RTL8192D_SUPPORT==1) - PWDB_rssi[sta_cnt++] = (psta->mac_id | (psta->rssi_stat.UndecoratedSmoothedPWDB<<16) | ((Adapter->stapriv.asoc_sta_count+1) << 8)); - #else - PWDB_rssi[sta_cnt++] = (psta->mac_id | (psta->rssi_stat.UndecoratedSmoothedPWDB<<16) ); - #endif - } - } - - } - - } - - _exit_critical_bh(&pstapriv->sta_hash_lock, &irqL); - #endif - - //printk("%s==> sta_cnt(%d)\n",__FUNCTION__,sta_cnt); - - for(i=0; i< sta_cnt; i++) - { - if(PWDB_rssi[i] != (0)){ - if(pHalData->fw_ractrl == _TRUE)// Report every sta's RSSI to FW - { - #if(RTL8192D_SUPPORT==1) - if(pDM_Odm->SupportICType == ODM_RTL8192D){ - FillH2CCmd92D(Adapter, H2C_RSSI_REPORT, 3, (u8 *)(&PWDB_rssi[i])); - } - #endif - - #if((RTL8192C_SUPPORT==1)||(RTL8723A_SUPPORT==1)) - if((pDM_Odm->SupportICType == ODM_RTL8192C)||(pDM_Odm->SupportICType == ODM_RTL8723A)){ - rtl8192c_set_rssi_cmd(Adapter, (u8*)&PWDB_rssi[i]); - } - #endif - - #if((RTL8812A_SUPPORT==1)||(RTL8821A_SUPPORT==1)) - if((pDM_Odm->SupportICType == ODM_RTL8812)||(pDM_Odm->SupportICType == ODM_RTL8821)){ - PWDB_rssi[i] |= (UL_DL_STATE << 24); - rtl8812_set_rssi_cmd(Adapter, (u8 *)(&PWDB_rssi[i])); - } - #endif - #if(RTL8192E_SUPPORT==1) - if(pDM_Odm->SupportICType == ODM_RTL8192E){ - rtl8192e_set_rssi_cmd(Adapter, (u8 *)(&PWDB_rssi[i])); - } - #endif - #if(RTL8723B_SUPPORT==1) - if(pDM_Odm->SupportICType == ODM_RTL8723B){ - rtl8723b_set_rssi_cmd(Adapter, (u8 *)(&PWDB_rssi[i])); - } - #endif - } - else{ - #if((RTL8188E_SUPPORT==1)&&(RATE_ADAPTIVE_SUPPORT == 1)) - if(pDM_Odm->SupportICType == ODM_RTL8188E){ - ODM_RA_SetRSSI_8188E( - &(pHalData->odmpriv), (PWDB_rssi[i]&0xFF), (u8)((PWDB_rssi[i]>>16) & 0xFF)); - } - #endif - } - } - } - } - - - - if(tmpEntryMaxPWDB != 0) // If associated entry is found - { - pdmpriv->EntryMaxUndecoratedSmoothedPWDB = tmpEntryMaxPWDB; - } - else - { - pdmpriv->EntryMaxUndecoratedSmoothedPWDB = 0; - } - - if(tmpEntryMinPWDB != 0xff) // If associated entry is found - { - pdmpriv->EntryMinUndecoratedSmoothedPWDB = tmpEntryMinPWDB; - } - else - { - pdmpriv->EntryMinUndecoratedSmoothedPWDB = 0; - } - - FindMinimumRSSI(Adapter);//get pdmpriv->MinUndecoratedPWDBForDM - - #if(RTL8192D_SUPPORT==1) - FindMinimumRSSI_Dmsp(Adapter); - #endif - pDM_Odm->RSSI_Min = pdmpriv->MinUndecoratedPWDBForDM; - //ODM_CmnInfoUpdate(&pHalData->odmpriv ,ODM_CMNINFO_RSSI_MIN, pdmpriv->MinUndecoratedPWDBForDM); -#endif//if (DM_ODM_SUPPORT_TYPE == ODM_CE) -} -VOID -odm_RSSIMonitorCheckAP( - IN PDM_ODM_T pDM_Odm - ) -{ -#if (DM_ODM_SUPPORT_TYPE == ODM_AP) -#ifdef CONFIG_RTL_92C_SUPPORT || defined(CONFIG_RTL_92D_SUPPORT) - - u4Byte i; - PSTA_INFO_T pstat; - - for(i=0; ipODM_StaInfo[i]; - if(IS_STA_VALID(pstat) ) - { -#ifdef STA_EXT - if (REMAP_AID(pstat) < (FW_NUM_STAT - 1)) -#endif - add_update_rssi(pDM_Odm->priv, pstat); - - } - } -#endif -#endif - -} +//Remove BY YuChen +//Remove Rssimonitorcheck related function to odm_rssimonitorcheck.c VOID @@ -5956,26 +1046,12 @@ ODM_InitAllTimers( ) { #if(defined(CONFIG_HW_ANTENNA_DIVERSITY)) -#if (RTL8723B_SUPPORT == 1)||(RTL8821A_SUPPORT == 1) - ODM_InitializeTimer(pDM_Odm,&pDM_Odm->DM_SWAT_Table.SwAntennaSwitchTimer_8723B, - (RT_TIMER_CALL_BACK)ODM_SW_AntDiv_Callback, NULL, "SwAntennaSwitchTimer_8723B"); -#endif -#endif - -#if(defined(CONFIG_SW_ANTENNA_DIVERSITY)) + ODM_AntDivTimers(pDM_Odm,INIT_ANTDIV_TIMMER); +#elif(defined(CONFIG_SW_ANTENNA_DIVERSITY)) ODM_InitializeTimer(pDM_Odm,&pDM_Odm->DM_SWAT_Table.SwAntennaSwitchTimer, (RT_TIMER_CALL_BACK)odm_SwAntDivChkAntSwitchCallback, NULL, "SwAntennaSwitchTimer"); #endif -#if (!(DM_ODM_SUPPORT_TYPE == ODM_CE)) -#if(defined(CONFIG_HW_ANTENNA_DIVERSITY)) -#if (RTL8188E_SUPPORT == 1) - ODM_InitializeTimer(pDM_Odm,&pDM_Odm->FastAntTrainingTimer, - (RT_TIMER_CALL_BACK)odm_FastAntTrainingCallback, NULL, "FastAntTrainingTimer"); -#endif -#endif -#endif - #if (DM_ODM_SUPPORT_TYPE == ODM_WIN) ODM_InitializeTimer(pDM_Odm, &pDM_Odm->PSDTimer, (RT_TIMER_CALL_BACK)dm_PSDMonitorCallback, NULL, "PSDTimer"); @@ -6009,21 +1085,14 @@ ODM_CancelAllTimers( // HAL_ADAPTER_STS_CHK(pDM_Odm) #endif -#if(defined(CONFIG_HW_ANTENNA_DIVERSITY)) -#if (RTL8723B_SUPPORT == 1)||(RTL8821A_SUPPORT == 1) - ODM_CancelTimer(pDM_Odm,&pDM_Odm->DM_SWAT_Table.SwAntennaSwitchTimer_8723B); -#endif -#endif -#if(defined(CONFIG_SW_ANTENNA_DIVERSITY)) +#if(defined(CONFIG_HW_ANTENNA_DIVERSITY)) + ODM_AntDivTimers(pDM_Odm,CANCEL_ANTDIV_TIMMER); +#elif(defined(CONFIG_SW_ANTENNA_DIVERSITY)) ODM_CancelTimer(pDM_Odm,&pDM_Odm->DM_SWAT_Table.SwAntennaSwitchTimer); #endif #if (DM_ODM_SUPPORT_TYPE == ODM_WIN) - -#if (RTL8188E_SUPPORT == 1) - ODM_CancelTimer(pDM_Odm,&pDM_Odm->FastAntTrainingTimer); -#endif ODM_CancelTimer(pDM_Odm, &pDM_Odm->PSDTimer); // //Path Diversity @@ -6046,21 +1115,13 @@ ODM_ReleaseAllTimers( ) { #if(defined(CONFIG_HW_ANTENNA_DIVERSITY)) -#if (RTL8723B_SUPPORT == 1)||(RTL8821A_SUPPORT == 1) - ODM_ReleaseTimer(pDM_Odm,&pDM_Odm->DM_SWAT_Table.SwAntennaSwitchTimer_8723B); -#endif -#endif - -#if(defined(CONFIG_SW_ANTENNA_DIVERSITY)) + ODM_AntDivTimers(pDM_Odm,RELEASE_ANTDIV_TIMMER); +#elif(defined(CONFIG_SW_ANTENNA_DIVERSITY)) ODM_ReleaseTimer(pDM_Odm,&pDM_Odm->DM_SWAT_Table.SwAntennaSwitchTimer); #endif #if (DM_ODM_SUPPORT_TYPE == ODM_WIN) -#if (RTL8188E_SUPPORT == 1) - ODM_ReleaseTimer(pDM_Odm,&pDM_Odm->FastAntTrainingTimer); -#endif - ODM_ReleaseTimer(pDM_Odm, &pDM_Odm->PSDTimer); // //Path Diversity @@ -6087,7 +1148,12 @@ odm_IQCalibrate( ) { PADAPTER Adapter = pDM_Odm->Adapter; - + +#if( DM_ODM_SUPPORT_TYPE == ODM_WIN) + if(*pDM_Odm->pIsFcsModeEnable) + return; +#endif + if(!IS_HARDWARE_TYPE_JAGUAR(Adapter)) return; else if(IS_HARDWARE_TYPE_8812AU(Adapter)) @@ -6108,7 +1174,7 @@ odm_IQCalibrate( { // Mark out IQK flow to prevent tx stuck. by Maddest 20130306 // Open it verified by James 20130715 - PHY_IQCalibrate_8821A(Adapter, FALSE); + PHY_IQCalibrate_8821A(pDM_Odm, FALSE); } } else @@ -6117,291 +1183,6 @@ odm_IQCalibrate( } -VOID -odm_TXPowerTrackingInit( - IN PDM_ODM_T pDM_Odm - ) -{ - odm_TXPowerTrackingThermalMeterInit(pDM_Odm); -} - -u1Byte -getSwingIndex( - IN PDM_ODM_T pDM_Odm - ) -{ - PADAPTER Adapter = pDM_Odm->Adapter; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - u1Byte i = 0; - u4Byte bbSwing; - u4Byte swingTableSize; - pu4Byte pSwingTable; - - if (pDM_Odm->SupportICType == ODM_RTL8188E || pDM_Odm->SupportICType == ODM_RTL8723B || - pDM_Odm->SupportICType == ODM_RTL8192E) - { - bbSwing = PHY_QueryBBReg(Adapter, rOFDM0_XATxIQImbalance, 0xFFC00000); - - pSwingTable = OFDMSwingTable_New; - swingTableSize = OFDM_TABLE_SIZE; - } else { -#if ((RTL8812A_SUPPORT==1)||(RTL8821A_SUPPORT==1)) - if (pDM_Odm->SupportICType == ODM_RTL8812 || pDM_Odm->SupportICType == ODM_RTL8821) - { - bbSwing = PHY_GetTxBBSwing_8812A(Adapter, pHalData->CurrentBandType, ODM_RF_PATH_A); - pSwingTable = TxScalingTable_Jaguar; - swingTableSize = TXSCALE_TABLE_SIZE; - } - else -#endif - { - bbSwing = 0; - pSwingTable = OFDMSwingTable; - swingTableSize = OFDM_TABLE_SIZE; - } - } - - for (i = 0; i < swingTableSize; ++i) { - u4Byte tableValue = pSwingTable[i]; - - if (tableValue >= 0x100000 ) - tableValue >>= 22; - if (bbSwing == tableValue) - break; - } - return i; -} - -VOID -odm_TXPowerTrackingThermalMeterInit( - IN PDM_ODM_T pDM_Odm - ) -{ - u1Byte defaultSwingIndex = getSwingIndex(pDM_Odm); - u1Byte p = 0; -#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) - PADAPTER Adapter = pDM_Odm->Adapter; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - - #if MP_DRIVER != 1 //for mp driver, turn off txpwrtracking as default - pDM_Odm->RFCalibrateInfo.TxPowerTrackControl = pHalData->TxPowerTrackControl = TRUE; - #endif -#elif (DM_ODM_SUPPORT_TYPE == ODM_CE) - PADAPTER Adapter = pDM_Odm->Adapter; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - - - if (pDM_Odm->SupportICType >= ODM_RTL8188E) - { - pDM_Odm->RFCalibrateInfo.bTXPowerTracking = _TRUE; - pDM_Odm->RFCalibrateInfo.TXPowercount = 0; - pDM_Odm->RFCalibrateInfo.bTXPowerTrackingInit = _FALSE; - //#if (MP_DRIVER != 1) //for mp driver, turn off txpwrtracking as default - if ( *(pDM_Odm->mp_mode) != 1) - pDM_Odm->RFCalibrateInfo.TxPowerTrackControl = _TRUE; - else - pDM_Odm->RFCalibrateInfo.TxPowerTrackControl = _FALSE; - //#endif//#if (MP_DRIVER != 1) - MSG_8192C("pDM_Odm TxPowerTrackControl = %d\n", pDM_Odm->RFCalibrateInfo.TxPowerTrackControl); - } - else - { - struct dm_priv *pdmpriv = &pHalData->dmpriv; - - pdmpriv->bTXPowerTracking = _TRUE; - pdmpriv->TXPowercount = 0; - pdmpriv->bTXPowerTrackingInit = _FALSE; - //#if (MP_DRIVER != 1) //for mp driver, turn off txpwrtracking as default - - if (*(pDM_Odm->mp_mode) != 1) - pdmpriv->TxPowerTrackControl = _TRUE; - else - pdmpriv->TxPowerTrackControl = _FALSE; - //#endif//#if (MP_DRIVER != 1) - - //MSG_8192C("pdmpriv->TxPowerTrackControl = %d\n", pdmpriv->TxPowerTrackControl); - } - -#elif (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - #ifdef RTL8188E_SUPPORT - { - pDM_Odm->RFCalibrateInfo.bTXPowerTracking = _TRUE; - pDM_Odm->RFCalibrateInfo.TXPowercount = 0; - pDM_Odm->RFCalibrateInfo.bTXPowerTrackingInit = _FALSE; - pDM_Odm->RFCalibrateInfo.TxPowerTrackControl = _TRUE; - } - #endif -#endif - - //pDM_Odm->RFCalibrateInfo.TxPowerTrackControl = TRUE; - pDM_Odm->RFCalibrateInfo.ThermalValue = pHalData->EEPROMThermalMeter; - pDM_Odm->RFCalibrateInfo.ThermalValue_IQK = pHalData->EEPROMThermalMeter; - pDM_Odm->RFCalibrateInfo.ThermalValue_LCK = pHalData->EEPROMThermalMeter; - - // The index of "0 dB" in SwingTable. - if (pDM_Odm->SupportICType == ODM_RTL8188E || pDM_Odm->SupportICType == ODM_RTL8723B || - pDM_Odm->SupportICType == ODM_RTL8192E) - { - pDM_Odm->DefaultOfdmIndex = (defaultSwingIndex >= OFDM_TABLE_SIZE) ? 30 : defaultSwingIndex; - pDM_Odm->DefaultCckIndex = 20; - } - else - { - pDM_Odm->DefaultOfdmIndex = (defaultSwingIndex >= TXSCALE_TABLE_SIZE) ? 24 : defaultSwingIndex; - pDM_Odm->DefaultCckIndex = 24; - } - - pDM_Odm->BbSwingIdxCckBase = pDM_Odm->DefaultCckIndex; - pDM_Odm->RFCalibrateInfo.CCK_index = pDM_Odm->DefaultCckIndex; - - for (p = ODM_RF_PATH_A; p < MAX_RF_PATH; ++p) - { - pDM_Odm->BbSwingIdxOfdmBase[p] = pDM_Odm->DefaultOfdmIndex; - pDM_Odm->RFCalibrateInfo.OFDM_index[p] = pDM_Odm->DefaultOfdmIndex; - pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[p] = 0; - pDM_Odm->RFCalibrateInfo.DeltaPowerIndexLast[p] = 0; - pDM_Odm->RFCalibrateInfo.PowerIndexOffset[p] = 0; - } - -} - - -VOID -ODM_TXPowerTrackingCheck( - IN PDM_ODM_T pDM_Odm - ) -{ - // - // 2011/09/29 MH In HW integration first stage, we provide 4 different handle to operate - // at the same time. In the stage2/3, we need to prive universal interface and merge all - // HW dynamic mechanism. - // - switch (pDM_Odm->SupportPlatform) - { - case ODM_WIN: - odm_TXPowerTrackingCheckMP(pDM_Odm); - break; - - case ODM_CE: - odm_TXPowerTrackingCheckCE(pDM_Odm); - break; - - case ODM_AP: - odm_TXPowerTrackingCheckAP(pDM_Odm); - break; - - case ODM_ADSL: - //odm_DIGAP(pDM_Odm); - break; - } - -} - -VOID -odm_TXPowerTrackingCheckCE( - IN PDM_ODM_T pDM_Odm - ) -{ -#if (DM_ODM_SUPPORT_TYPE == ODM_CE) - PADAPTER Adapter = pDM_Odm->Adapter; - #if( (RTL8192C_SUPPORT==1) || (RTL8723A_SUPPORT==1) ) - if(IS_HARDWARE_TYPE_8192C(Adapter)){ - rtl8192c_odm_CheckTXPowerTracking(Adapter); - return; - } - #endif - - #if (RTL8192D_SUPPORT==1) - if(IS_HARDWARE_TYPE_8192D(Adapter)){ - #if (RTL8192D_EASY_SMART_CONCURRENT == 1) - if(!Adapter->bSlaveOfDMSP) - #endif - rtl8192d_odm_CheckTXPowerTracking(Adapter); - return; - } - #endif - - #if(((RTL8188E_SUPPORT==1) || (RTL8812A_SUPPORT==1) || (RTL8821A_SUPPORT==1) || (RTL8192E_SUPPORT==1) || (RTL8723B_SUPPORT==1) )) - if(!(pDM_Odm->SupportAbility & ODM_RF_TX_PWR_TRACK)) - { - return; - } - - if(!pDM_Odm->RFCalibrateInfo.TM_Trigger) //at least delay 1 sec - { - //pHalData->TxPowerCheckCnt++; //cosa add for debug - if(IS_HARDWARE_TYPE_8188E(Adapter) || IS_HARDWARE_TYPE_JAGUAR(Adapter) || IS_HARDWARE_TYPE_8192E(Adapter)||IS_HARDWARE_TYPE_8723B(Adapter)) - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_T_METER_NEW, (BIT17 | BIT16), 0x03); - else - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_T_METER_OLD, bRFRegOffsetMask, 0x60); - - //DBG_871X("Trigger Thermal Meter!!\n"); - - pDM_Odm->RFCalibrateInfo.TM_Trigger = 1; - return; - } - else - { - //DBG_871X("Schedule TxPowerTracking direct call!!\n"); - ODM_TXPowerTrackingCallback_ThermalMeter(Adapter); - pDM_Odm->RFCalibrateInfo.TM_Trigger = 0; - } - #endif -#endif -} - -VOID -odm_TXPowerTrackingCheckMP( - IN PDM_ODM_T pDM_Odm - ) -{ -#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) - PADAPTER Adapter = pDM_Odm->Adapter; - - if (ODM_CheckPowerStatus(Adapter) == FALSE) - { - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, ("===>ODM_CheckPowerStatus() return FALSE\n")); - return; - } - - if(IS_HARDWARE_TYPE_8723A(Adapter)) - return; - - if(!Adapter->bSlaveOfDMSP || Adapter->DualMacSmartConcurrent == FALSE) - odm_TXPowerTrackingThermalMeterCheck(Adapter); - else { - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, ("!Adapter->bSlaveOfDMSP || Adapter->DualMacSmartConcurrent == FALSE\n")); - } -#endif - -} - - -VOID -odm_TXPowerTrackingCheckAP( - IN PDM_ODM_T pDM_Odm - ) -{ -#if (DM_ODM_SUPPORT_TYPE == ODM_AP) - prtl8192cd_priv priv = pDM_Odm->priv; - - if ( (priv->pmib->dot11RFEntry.ther) && ((priv->up_time % priv->pshare->rf_ft_var.tpt_period) == 0)){ -#ifdef CONFIG_RTL_92D_SUPPORT - if (GET_CHIP_VER(priv)==VERSION_8192D){ - tx_power_tracking_92D(priv); - } else -#endif - { -#ifdef CONFIG_RTL_92C_SUPPORT - tx_power_tracking(priv); -#endif - } - } -#endif - -} - - //antenna mapping info // 1: right-side antenna @@ -6413,45 +1194,6 @@ odm_TXPowerTrackingCheckAP( #if (DM_ODM_SUPPORT_TYPE == ODM_WIN) -VOID -odm_TXPowerTrackingThermalMeterCheck( - IN PADAPTER Adapter - ) -{ -#ifndef AP_BUILD_WORKAROUND - static u1Byte TM_Trigger = 0; - - if(!(GET_HAL_DATA(Adapter)->DM_OutSrc.SupportAbility & ODM_RF_TX_PWR_TRACK)) - { - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("===>odm_TXPowerTrackingThermalMeterCheck(),pMgntInfo->bTXPowerTracking is FALSE, return!!\n")); - return; - } - - if(!TM_Trigger) //at least delay 1 sec - { - if(IS_HARDWARE_TYPE_8192D(Adapter)) - PHY_SetRFReg(Adapter, ODM_RF_PATH_A, RF_T_METER_92D, BIT17 | BIT16, 0x03); - else if(IS_HARDWARE_TYPE_8188E(Adapter) || IS_HARDWARE_TYPE_JAGUAR(Adapter) || IS_HARDWARE_TYPE_8192E(Adapter) || - IS_HARDWARE_TYPE_8723B(Adapter)) - PHY_SetRFReg(Adapter, ODM_RF_PATH_A, RF_T_METER_88E, BIT17 | BIT16, 0x03); - else - PHY_SetRFReg(Adapter, ODM_RF_PATH_A, RF_T_METER, bRFRegOffsetMask, 0x60); - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD,("Trigger Thermal Meter!!\n")); - - TM_Trigger = 1; - return; - } - else - { - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD,("Schedule TxPowerTracking direct call!!\n")); - odm_TXPowerTrackingDirectCall(Adapter); //Using direct call is instead, added by Roger, 2009.06.18. - TM_Trigger = 0; - } -#endif -} - // Only for 8723A SW ANT DIV INIT--2012--07--17 VOID odm_SwAntDivInit_NIC_8723A( @@ -6484,119 +1226,53 @@ odm_SwAntDivInit_NIC_8723A( //3============================================================ //3 SW Antenna Diversity //3============================================================ -#if(defined(CONFIG_SW_ANTENNA_DIVERSITY)) -VOID -odm_SwAntDivInit( - IN PDM_ODM_T pDM_Odm - ) -{ -#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) - odm_SwAntDivInit_NIC(pDM_Odm); -#elif(DM_ODM_SUPPORT_TYPE == ODM_AP) - dm_SW_AntennaSwitchInit(pDM_Odm->priv); -#endif -} VOID -odm_SwAntDivInit_NIC( - IN PDM_ODM_T pDM_Odm - ) +odm_AntennaDiversityInit( + IN PDM_ODM_T pDM_Odm +) { - pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; + if(pDM_Odm->mp_mode == TRUE) + return; - -// Init SW ANT DIV mechanism for 8723AE/AU/AS -// Neil Chen--2012--07--17--- -// CE/AP/ADSL no using SW ANT DIV for 8723A Series IC -//#if (DM_ODM_SUPPORT_TYPE==ODM_WIN) -#if (RTL8723A_SUPPORT==1) - if(pDM_Odm->SupportICType == ODM_RTL8723A) + if(pDM_Odm->SupportICType & (ODM_OLD_IC_ANTDIV_SUPPORT)) { - odm_SwAntDivInit_NIC_8723A(pDM_Odm); - } -#endif - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SWAS:Init SW Antenna Switch\n")); - pDM_SWAT_Table->RSSI_sum_A = 0; - pDM_SWAT_Table->RSSI_cnt_A = 0; - pDM_SWAT_Table->RSSI_sum_B = 0; - pDM_SWAT_Table->RSSI_cnt_B = 0; - pDM_SWAT_Table->CurAntenna = MAIN_ANT; - pDM_SWAT_Table->PreAntenna = MAIN_ANT; - pDM_SWAT_Table->try_flag = 0xff; - pDM_SWAT_Table->PreRSSI = 0; - pDM_SWAT_Table->SWAS_NoLink_State = 0; - pDM_SWAT_Table->bTriggerAntennaSwitch = 0; - pDM_SWAT_Table->SelectAntennaMap=0xAA; - pDM_SWAT_Table->lastTxOkCnt = 0; - pDM_SWAT_Table->lastRxOkCnt = 0; - pDM_SWAT_Table->TXByteCnt_A = 0; - pDM_SWAT_Table->TXByteCnt_B = 0; - pDM_SWAT_Table->RXByteCnt_A = 0; - pDM_SWAT_Table->RXByteCnt_B = 0; - pDM_SWAT_Table->TrafficLoad = TRAFFIC_LOW; - pDM_SWAT_Table->SWAS_NoLink_BK_Reg860 = ODM_Read4Byte(pDM_Odm, 0x860); - -} - -// -// 20100514 Joseph: -// Add new function to reset the state of antenna diversity before link. -// -VOID -ODM_SwAntDivResetBeforeLink( - IN PDM_ODM_T pDM_Odm - ) -{ - - pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; - - pDM_SWAT_Table->SWAS_NoLink_State = 0; - -} - -// -// 20100514 Luke/Joseph: -// Add new function to reset antenna diversity state after link. -// -VOID -ODM_SwAntDivRestAfterLink( - IN PDM_ODM_T pDM_Odm - ) -{ - pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; - pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; - u4Byte i; - - if(pDM_Odm->SupportICType == ODM_RTL8723A) - { - pDM_SWAT_Table->RSSI_cnt_A = 0; - pDM_SWAT_Table->RSSI_cnt_B = 0; - pDM_Odm->RSSI_test = FALSE; - pDM_SWAT_Table->try_flag = 0xff; - pDM_SWAT_Table->RSSI_Trying = 0; - pDM_SWAT_Table->SelectAntennaMap=0xAA; - + #if (RTL8192C_SUPPORT==1) + ODM_OldIC_AntDiv_Init(pDM_Odm); + #endif } - else if(pDM_Odm->SupportICType & (ODM_RTL8723B|ODM_RTL8821)) + else { - pDM_Odm->RSSI_test = FALSE; - pDM_SWAT_Table->try_flag = 0xff; - pDM_SWAT_Table->RSSI_Trying = 0; - pDM_SWAT_Table->Double_chk_flag= 0; - - pDM_FatTable->RxIdleAnt=MAIN_ANT; - - for (i=0; iMainAnt_Sum[i] = 0; - pDM_FatTable->AuxAnt_Sum[i] = 0; - pDM_FatTable->MainAnt_Cnt[i] = 0; - pDM_FatTable->AuxAnt_Cnt[i] = 0; - } - + #if(defined(CONFIG_HW_ANTENNA_DIVERSITY)) + ODM_AntDiv_Config(pDM_Odm); + ODM_AntDivInit(pDM_Odm); + #endif } } +VOID +odm_AntennaDiversity( + IN PDM_ODM_T pDM_Odm +) +{ + if(pDM_Odm->mp_mode == TRUE) + return; + + if(pDM_Odm->SupportICType & (ODM_OLD_IC_ANTDIV_SUPPORT)) + { + #if (RTL8192C_SUPPORT==1) + ODM_OldIC_AntDiv(pDM_Odm); + #endif + } + else + { + #if(defined(CONFIG_HW_ANTENNA_DIVERSITY)) + ODM_AntDiv(pDM_Odm); + #endif + } +} + + void odm_SwAntDetectInit( IN PDM_ODM_T pDM_Odm @@ -6611,3406 +1287,12 @@ odm_SwAntDetectInit( pDM_SWAT_Table->SWAS_NoLink_State = 0; } -VOID -ODM_SwAntDivChkPerPktRssi( - IN PDM_ODM_T pDM_Odm, - IN u1Byte StationID, - IN PODM_PHY_INFO_T pPhyInfo - ) -{ - SWAT_T *pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; - - if(!(pDM_Odm->SupportAbility & (ODM_BB_ANT_DIV))) - return; - -// temporary Fix 8723A MP SW ANT DIV Bug --NeilChen--2012--07--11 -#if (DM_ODM_SUPPORT_TYPE==ODM_WIN) - if(pDM_Odm->SupportICType == ODM_RTL8723A) - { - //if(StationID == pDM_SWAT_Table->RSSI_target) - //{ - //1 RSSI for SW Antenna Switch - if(pDM_SWAT_Table->CurAntenna == MAIN_ANT) - { - pDM_SWAT_Table->RSSI_sum_A += pPhyInfo->RxPWDBAll; - pDM_SWAT_Table->RSSI_cnt_A++; - } - else - { - pDM_SWAT_Table->RSSI_sum_B += pPhyInfo->RxPWDBAll; - pDM_SWAT_Table->RSSI_cnt_B++; - - } - //} - } - else - { - if(StationID == pDM_SWAT_Table->RSSI_target) - { - //1 RSSI for SW Antenna Switch - if(pDM_SWAT_Table->CurAntenna == MAIN_ANT) - { - pDM_SWAT_Table->RSSI_sum_A += pPhyInfo->RxPWDBAll; - pDM_SWAT_Table->RSSI_cnt_A++; - } - else - { - pDM_SWAT_Table->RSSI_sum_B += pPhyInfo->RxPWDBAll; - pDM_SWAT_Table->RSSI_cnt_B++; - - } - } - } -#else - if(StationID == pDM_SWAT_Table->RSSI_target) - { - //1 RSSI for SW Antenna Switch - if(pDM_SWAT_Table->CurAntenna == MAIN_ANT) - { - pDM_SWAT_Table->RSSI_sum_A += pPhyInfo->RxPWDBAll; - pDM_SWAT_Table->RSSI_cnt_A++; - } - else - { - pDM_SWAT_Table->RSSI_sum_B += pPhyInfo->RxPWDBAll; - pDM_SWAT_Table->RSSI_cnt_B++; - - } - } -#endif -} - -// -VOID -odm_SwAntDivChkAntSwitch( - IN PDM_ODM_T pDM_Odm, - IN u1Byte Step - ) -{ - // - // For AP/ADSL use prtl8192cd_priv - // For CE/NIC use PADAPTER - // - prtl8192cd_priv priv = pDM_Odm->priv; - - // - // 2011/09/29 MH In HW integration first stage, we provide 4 different handle to operate - // at the same time. In the stage2/3, we need to prive universal interface and merge all - // HW dynamic mechanism. - // - switch (pDM_Odm->SupportPlatform) - { - case ODM_WIN: - odm_SwAntDivChkAntSwitchNIC(pDM_Odm, Step); - break; - case ODM_CE: - odm_SwAntDivChkAntSwitchNIC(pDM_Odm, Step); - break; - - case ODM_AP: - case ODM_ADSL: -#if (DM_ODM_SUPPORT_TYPE & (ODM_AP |ODM_ADSL)) - if (priv->pshare->rf_ft_var.antSw_enable && (priv->up_time % 4==1)) - dm_SW_AntennaSwitch(priv, SWAW_STEP_PEAK); -#endif - break; - } - -} - -// -// 20100514 Luke/Joseph: -// Add new function for antenna diversity after link. -// This is the main function of antenna diversity after link. -// This function is called in HalDmWatchDog() and ODM_SwAntDivChkAntSwitchCallback(). -// HalDmWatchDog() calls this function with SWAW_STEP_PEAK to initialize the antenna test. -// In SWAW_STEP_PEAK, another antenna and a 500ms timer will be set for testing. -// After 500ms, ODM_SwAntDivChkAntSwitchCallback() calls this function to compare the signal just -// listened on the air with the RSSI of original antenna. -// It chooses the antenna with better RSSI. -// There is also a aged policy for error trying. Each error trying will cost more 5 seconds waiting -// penalty to get next try. - - -VOID -ODM_SetAntenna( - IN PDM_ODM_T pDM_Odm, - IN u1Byte Antenna) -{ - ODM_SetBBReg(pDM_Odm, 0x860, BIT8|BIT9, Antenna); -} - -VOID -odm_SwAntDivChkAntSwitchNIC( - IN PDM_ODM_T pDM_Odm, - IN u1Byte Step - ) -{ -#if ((RTL8192C_SUPPORT==1)||(RTL8723A_SUPPORT==1)) - //PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo); - //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - -#if (DM_ODM_SUPPORT_TYPE==ODM_WIN) - PADAPTER Adapter=pDM_Odm->Adapter; -#endif - - pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; - s4Byte curRSSI=100, RSSI_A, RSSI_B; - u1Byte nextAntenna=AUX_ANT; - //static u8Byte lastTxOkCnt=0, lastRxOkCnt=0; - u8Byte curTxOkCnt=0, curRxOkCnt=0; - //static u8Byte TXByteCnt_A=0, TXByteCnt_B=0, RXByteCnt_A=0, RXByteCnt_B=0; - u8Byte CurByteCnt=0, PreByteCnt=0; - //static u1Byte TrafficLoad = TRAFFIC_LOW; - u1Byte Score_A=0, Score_B=0; //A: Main; B: AUX - u1Byte i; - - if(!(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV)) - return; - - if (pDM_Odm->SupportICType & (ODM_RTL8192D|ODM_RTL8188E)) - return; - - if((pDM_Odm->SupportICType == ODM_RTL8192C) &&(pDM_Odm->RFType == ODM_2T2R)) - return; - - if(pDM_Odm->SupportPlatform & ODM_WIN) - { - if(*(pDM_Odm->pAntennaTest)) - return; - } - - if((pDM_SWAT_Table->ANTA_ON == FALSE) ||(pDM_SWAT_Table->ANTB_ON == FALSE)) - { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, - ("odm_SwAntDivChkAntSwitch(): No AntDiv Mechanism, Antenna A or B is off\n")); - return; - } - - // Radio off: Status reset to default and return. - if(*(pDM_Odm->pbPowerSaving)==TRUE) //pHalData->eRFPowerState==eRfOff - { - ODM_SwAntDivRestAfterLink(pDM_Odm); - return; - } - - - // Handling step mismatch condition. - // Peak step is not finished at last time. Recover the variable and check again. - if( Step != pDM_SWAT_Table->try_flag ) - { - ODM_SwAntDivRestAfterLink(pDM_Odm); - } - -#if (DM_ODM_SUPPORT_TYPE &( ODM_WIN| ODM_CE )) - - if(pDM_SWAT_Table->try_flag == 0xff) - { - pDM_SWAT_Table->RSSI_target = 0xff; - - #if(DM_ODM_SUPPORT_TYPE & ODM_CE) - { - u1Byte index = 0; - PSTA_INFO_T pEntry = NULL; - - - for(index=0; indexpODM_StaInfo[index]; - if(IS_STA_VALID(pEntry) ) { - break; - } - } - if(pEntry == NULL) - { - ODM_SwAntDivRestAfterLink(pDM_Odm); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_SwAntDivChkAntSwitch(): No Link.\n")); - return; - } - else - { - pDM_SWAT_Table->RSSI_target = index; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_SwAntDivChkAntSwitch(): RSSI_target is PEER STA\n")); - } - } - #elif (DM_ODM_SUPPORT_TYPE & ODM_WIN) - { - PADAPTER pAdapter = pDM_Odm->Adapter; - PMGNT_INFO pMgntInfo=&pAdapter->MgntInfo; - - // Select RSSI checking target - if(pMgntInfo->mAssoc && !ACTING_AS_AP(pAdapter)) - { - // Target: Infrastructure mode AP. - //pDM_SWAT_Table->RSSI_target = NULL; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("odm_SwAntDivChkAntSwitch(): RSSI_target is DEF AP!\n")); - } - else - { - u1Byte index = 0; - PSTA_INFO_T pEntry = NULL; - PADAPTER pTargetAdapter = NULL; - - if(pMgntInfo->mIbss ) - { - // Target: AP/IBSS peer. - pTargetAdapter = pAdapter; - } - else - { - pTargetAdapter = GetFirstAPAdapter(pAdapter); - } - - if(pTargetAdapter != NULL) - { - for(index=0; indexbAssociated) - break; - } - - } - - } - - if(pEntry == NULL) - { - ODM_SwAntDivRestAfterLink(pDM_Odm); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_SwAntDivChkAntSwitch(): No Link.\n")); - return; - } - else - { - //pDM_SWAT_Table->RSSI_target = pEntry; - pDM_SWAT_Table->RSSI_target = index; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_SwAntDivChkAntSwitch(): RSSI_target is PEER STA\n")); - } - }//end if(pMgntInfo->mAssoc && !ACTING_AS_AP(Adapter)) - - } - #endif - - pDM_SWAT_Table->RSSI_cnt_A = 0; - pDM_SWAT_Table->RSSI_cnt_B = 0; - pDM_SWAT_Table->try_flag = 0; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("odm_SwAntDivChkAntSwitch(): Set try_flag to 0 prepare for peak!\n")); - return; - } - else - { - -// To Fix 8723A SW ANT DIV Bug issue -#if (DM_ODM_SUPPORT_TYPE==ODM_WIN) - if (pDM_Odm->SupportICType & ODM_RTL8723A) - { - curTxOkCnt = Adapter->TxStats.NumTxBytesUnicast - pDM_SWAT_Table->lastTxOkCnt; - curRxOkCnt =Adapter->RxStats.NumRxBytesUnicast - pDM_SWAT_Table->lastRxOkCnt; - pDM_SWAT_Table->lastTxOkCnt = Adapter->TxStats.NumTxBytesUnicast; - pDM_SWAT_Table->lastRxOkCnt = Adapter->RxStats.NumRxBytesUnicast; - } -#else - curTxOkCnt = *(pDM_Odm->pNumTxBytesUnicast) - pDM_SWAT_Table->lastTxOkCnt; - curRxOkCnt = *(pDM_Odm->pNumRxBytesUnicast) - pDM_SWAT_Table->lastRxOkCnt; - pDM_SWAT_Table->lastTxOkCnt = *(pDM_Odm->pNumTxBytesUnicast); - pDM_SWAT_Table->lastRxOkCnt = *(pDM_Odm->pNumRxBytesUnicast); -#endif - if(pDM_SWAT_Table->try_flag == 1) - { - if(pDM_SWAT_Table->CurAntenna == MAIN_ANT) - { - pDM_SWAT_Table->TXByteCnt_A += curTxOkCnt; - pDM_SWAT_Table->RXByteCnt_A += curRxOkCnt; - } - else - { - pDM_SWAT_Table->TXByteCnt_B += curTxOkCnt; - pDM_SWAT_Table->RXByteCnt_B += curRxOkCnt; - } - - nextAntenna = (pDM_SWAT_Table->CurAntenna == MAIN_ANT)? AUX_ANT : MAIN_ANT; - pDM_SWAT_Table->RSSI_Trying--; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("RSSI_Trying = %d\n",pDM_SWAT_Table->RSSI_Trying)); - if(pDM_SWAT_Table->RSSI_Trying == 0) - { - CurByteCnt = (pDM_SWAT_Table->CurAntenna == MAIN_ANT)? (pDM_SWAT_Table->TXByteCnt_A+pDM_SWAT_Table->RXByteCnt_A) : (pDM_SWAT_Table->TXByteCnt_B+pDM_SWAT_Table->RXByteCnt_B); - PreByteCnt = (pDM_SWAT_Table->CurAntenna == MAIN_ANT)? (pDM_SWAT_Table->TXByteCnt_B+pDM_SWAT_Table->RXByteCnt_B) : (pDM_SWAT_Table->TXByteCnt_A+pDM_SWAT_Table->RXByteCnt_A); - - if(pDM_SWAT_Table->TrafficLoad == TRAFFIC_HIGH) - //CurByteCnt = PlatformDivision64(CurByteCnt, 9); - PreByteCnt = PreByteCnt*9; - else if(pDM_SWAT_Table->TrafficLoad == TRAFFIC_LOW) - //CurByteCnt = PlatformDivision64(CurByteCnt, 2); - PreByteCnt = PreByteCnt*2; - - if(pDM_SWAT_Table->RSSI_cnt_A > 0) - RSSI_A = pDM_SWAT_Table->RSSI_sum_A/pDM_SWAT_Table->RSSI_cnt_A; - else - RSSI_A = 0; - if(pDM_SWAT_Table->RSSI_cnt_B > 0) - RSSI_B = pDM_SWAT_Table->RSSI_sum_B/pDM_SWAT_Table->RSSI_cnt_B; - else - RSSI_B = 0; - curRSSI = (pDM_SWAT_Table->CurAntenna == MAIN_ANT)? RSSI_A : RSSI_B; - pDM_SWAT_Table->PreRSSI = (pDM_SWAT_Table->CurAntenna == MAIN_ANT)? RSSI_B : RSSI_A; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Luke:PreRSSI = %d, CurRSSI = %d\n",pDM_SWAT_Table->PreRSSI, curRSSI)); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SWAS: preAntenna= %s, curAntenna= %s \n", - (pDM_SWAT_Table->PreAntenna == MAIN_ANT?"MAIN":"AUX"), (pDM_SWAT_Table->CurAntenna == MAIN_ANT?"MAIN":"AUX"))); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Luke:RSSI_A= %d, RSSI_cnt_A = %d, RSSI_B= %d, RSSI_cnt_B = %d\n", - RSSI_A, pDM_SWAT_Table->RSSI_cnt_A, RSSI_B, pDM_SWAT_Table->RSSI_cnt_B)); - } - - } - else - { - - if(pDM_SWAT_Table->RSSI_cnt_A > 0) - RSSI_A = pDM_SWAT_Table->RSSI_sum_A/pDM_SWAT_Table->RSSI_cnt_A; - else - RSSI_A = 0; - if(pDM_SWAT_Table->RSSI_cnt_B > 0) - RSSI_B = pDM_SWAT_Table->RSSI_sum_B/pDM_SWAT_Table->RSSI_cnt_B; - else - RSSI_B = 0; - curRSSI = (pDM_SWAT_Table->CurAntenna == MAIN_ANT)? RSSI_A : RSSI_B; - pDM_SWAT_Table->PreRSSI = (pDM_SWAT_Table->PreAntenna == MAIN_ANT)? RSSI_A : RSSI_B; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Ekul:PreRSSI = %d, CurRSSI = %d\n", pDM_SWAT_Table->PreRSSI, curRSSI)); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SWAS: preAntenna= %s, curAntenna= %s \n", - (pDM_SWAT_Table->PreAntenna == MAIN_ANT?"MAIN":"AUX"), (pDM_SWAT_Table->CurAntenna == MAIN_ANT?"MAIN":"AUX"))); - - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Ekul:RSSI_A= %d, RSSI_cnt_A = %d, RSSI_B= %d, RSSI_cnt_B = %d\n", - RSSI_A, pDM_SWAT_Table->RSSI_cnt_A, RSSI_B, pDM_SWAT_Table->RSSI_cnt_B)); - //RT_TRACE(COMP_SWAS, DBG_LOUD, ("Ekul:curTxOkCnt = %d\n", curTxOkCnt)); - //RT_TRACE(COMP_SWAS, DBG_LOUD, ("Ekul:curRxOkCnt = %d\n", curRxOkCnt)); - } - - //1 Trying State - if((pDM_SWAT_Table->try_flag == 1)&&(pDM_SWAT_Table->RSSI_Trying == 0)) - { - - if(pDM_SWAT_Table->TestMode == TP_MODE) - { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SWAS: TestMode = TP_MODE")); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("TRY:CurByteCnt = %lld,", CurByteCnt)); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("TRY:PreByteCnt = %lld\n",PreByteCnt)); - if(CurByteCnt < PreByteCnt) - { - if(pDM_SWAT_Table->CurAntenna == MAIN_ANT) - pDM_SWAT_Table->SelectAntennaMap=pDM_SWAT_Table->SelectAntennaMap<<1; - else - pDM_SWAT_Table->SelectAntennaMap=(pDM_SWAT_Table->SelectAntennaMap<<1)+1; - } - else - { - if(pDM_SWAT_Table->CurAntenna == MAIN_ANT) - pDM_SWAT_Table->SelectAntennaMap=(pDM_SWAT_Table->SelectAntennaMap<<1)+1; - else - pDM_SWAT_Table->SelectAntennaMap=pDM_SWAT_Table->SelectAntennaMap<<1; - } - for (i= 0; i<8; i++) - { - if(((pDM_SWAT_Table->SelectAntennaMap>>i)&BIT0) == 1) - Score_A++; - else - Score_B++; - } - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SelectAntennaMap=%x\n ",pDM_SWAT_Table->SelectAntennaMap)); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Score_A=%d, Score_B=%d\n", Score_A, Score_B)); - - if(pDM_SWAT_Table->CurAntenna == MAIN_ANT) - { - nextAntenna = (Score_A > Score_B)?MAIN_ANT:AUX_ANT; - } - else - { - nextAntenna = (Score_B > Score_A)?AUX_ANT:MAIN_ANT; - } - //RT_TRACE(COMP_SWAS, DBG_LOUD, ("nextAntenna=%s\n",(nextAntenna==Antenna_A)?"A":"B")); - //RT_TRACE(COMP_SWAS, DBG_LOUD, ("preAntenna= %s, curAntenna= %s \n", - //(DM_SWAT_Table.PreAntenna == Antenna_A?"A":"B"), (DM_SWAT_Table.CurAntenna == Antenna_A?"A":"B"))); - - if(nextAntenna != pDM_SWAT_Table->CurAntenna) - { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SWAS: Switch back to another antenna")); - } - else - { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SWAS: current anntena is good\n")); - } - } - - if(pDM_SWAT_Table->TestMode == RSSI_MODE) - { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SWAS: TestMode = RSSI_MODE")); - pDM_SWAT_Table->SelectAntennaMap=0xAA; - if(curRSSI < pDM_SWAT_Table->PreRSSI) //Current antenna is worse than previous antenna - { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SWAS: Switch back to another antenna")); - nextAntenna = (pDM_SWAT_Table->CurAntenna == MAIN_ANT)? AUX_ANT : MAIN_ANT; - } - else // current anntena is good - { - nextAntenna =pDM_SWAT_Table->CurAntenna; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SWAS: current anntena is good\n")); - } - } - pDM_SWAT_Table->try_flag = 0; - pDM_Odm->RSSI_test = FALSE; - pDM_SWAT_Table->RSSI_sum_A = 0; - pDM_SWAT_Table->RSSI_cnt_A = 0; - pDM_SWAT_Table->RSSI_sum_B = 0; - pDM_SWAT_Table->RSSI_cnt_B = 0; - pDM_SWAT_Table->TXByteCnt_A = 0; - pDM_SWAT_Table->TXByteCnt_B = 0; - pDM_SWAT_Table->RXByteCnt_A = 0; - pDM_SWAT_Table->RXByteCnt_B = 0; - - } - - //1 Normal State - else if(pDM_SWAT_Table->try_flag == 0) - { - if(pDM_SWAT_Table->TrafficLoad == TRAFFIC_HIGH) - { - if ((curTxOkCnt+curRxOkCnt) > 3750000)//if(PlatformDivision64(curTxOkCnt+curRxOkCnt, 2) > 1875000) - pDM_SWAT_Table->TrafficLoad = TRAFFIC_HIGH; - else - pDM_SWAT_Table->TrafficLoad = TRAFFIC_LOW; - } - else if(pDM_SWAT_Table->TrafficLoad == TRAFFIC_LOW) - { - if ((curTxOkCnt+curRxOkCnt) > 3750000) //if(PlatformDivision64(curTxOkCnt+curRxOkCnt, 2) > 1875000) - pDM_SWAT_Table->TrafficLoad = TRAFFIC_HIGH; - else - pDM_SWAT_Table->TrafficLoad = TRAFFIC_LOW; - } - if(pDM_SWAT_Table->TrafficLoad == TRAFFIC_HIGH) - pDM_SWAT_Table->bTriggerAntennaSwitch = 0; - //RT_TRACE(COMP_SWAS, DBG_LOUD, ("Normal:TrafficLoad = %llu\n", curTxOkCnt+curRxOkCnt)); - - //Prepare To Try Antenna - nextAntenna = (pDM_SWAT_Table->CurAntenna == MAIN_ANT)? AUX_ANT : MAIN_ANT; - pDM_SWAT_Table->try_flag = 1; - pDM_Odm->RSSI_test = TRUE; - if((curRxOkCnt+curTxOkCnt) > 1000) - { - pDM_SWAT_Table->RSSI_Trying = 4; - pDM_SWAT_Table->TestMode = TP_MODE; - } - else - { - pDM_SWAT_Table->RSSI_Trying = 2; - pDM_SWAT_Table->TestMode = RSSI_MODE; - - } - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SWAS: Normal State -> Begin Trying!\n")); - - - pDM_SWAT_Table->RSSI_sum_A = 0; - pDM_SWAT_Table->RSSI_cnt_A = 0; - pDM_SWAT_Table->RSSI_sum_B = 0; - pDM_SWAT_Table->RSSI_cnt_B = 0; - } - } - - //1 4.Change TRX antenna - if(nextAntenna != pDM_SWAT_Table->CurAntenna) - { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SWAS: Change TX Antenna!\n ")); - //PHY_SetBBReg(Adapter, rFPGA0_XA_RFInterfaceOE, 0x300, nextAntenna); - #if (DM_ODM_SUPPORT_TYPE == ODM_WIN) - ODM_SetAntenna(pDM_Odm,nextAntenna); - #elif (DM_ODM_SUPPORT_TYPE == ODM_CE) - { - BOOLEAN bEnqueue; - bEnqueue = (pDM_Odm->SupportInterface == ODM_ITRF_PCIE)?FALSE :TRUE; - rtw_antenna_select_cmd(pDM_Odm->Adapter, nextAntenna, bEnqueue); - } - #endif - - } - - //1 5.Reset Statistics - pDM_SWAT_Table->PreAntenna = pDM_SWAT_Table->CurAntenna; - pDM_SWAT_Table->CurAntenna = nextAntenna; - pDM_SWAT_Table->PreRSSI = curRSSI; - - //1 6.Set next timer - { - //PADAPTER pAdapter = pDM_Odm->Adapter; - //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - - - if(pDM_SWAT_Table->RSSI_Trying == 0) - return; - - if(pDM_SWAT_Table->RSSI_Trying%2 == 0) - { - if(pDM_SWAT_Table->TestMode == TP_MODE) - { - if(pDM_SWAT_Table->TrafficLoad == TRAFFIC_HIGH) - { - ODM_SetTimer(pDM_Odm,&pDM_SWAT_Table->SwAntennaSwitchTimer, 10 ); //ms - - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("dm_SW_AntennaSwitch(): Test another antenna for 10 ms\n")); - } - else if(pDM_SWAT_Table->TrafficLoad == TRAFFIC_LOW) - { - ODM_SetTimer(pDM_Odm,&pDM_SWAT_Table->SwAntennaSwitchTimer, 50 ); //ms - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("dm_SW_AntennaSwitch(): Test another antenna for 50 ms\n")); - } - } - else - { - ODM_SetTimer(pDM_Odm,&pDM_SWAT_Table->SwAntennaSwitchTimer, 500 ); //ms - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("dm_SW_AntennaSwitch(): Test another antenna for 500 ms\n")); - } - } - else - { - if(pDM_SWAT_Table->TestMode == TP_MODE) - { - if(pDM_SWAT_Table->TrafficLoad == TRAFFIC_HIGH) - ODM_SetTimer(pDM_Odm,&pDM_SWAT_Table->SwAntennaSwitchTimer, 90 ); //ms - else if(pDM_SWAT_Table->TrafficLoad == TRAFFIC_LOW) - ODM_SetTimer(pDM_Odm,&pDM_SWAT_Table->SwAntennaSwitchTimer, 100 ); //ms - } - else - ODM_SetTimer(pDM_Odm,&pDM_SWAT_Table->SwAntennaSwitchTimer, 500 ); //ms - } - } -#endif // #if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) -#endif // #if (RTL8192C_SUPPORT==1) -} - - -#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) - -u1Byte -odm_SwAntDivSelectScanChnl( - IN PADAPTER Adapter - ) -{ -#if (RT_MEM_SIZE_LEVEL != RT_MEM_SIZE_MINIMUM) - PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter); - PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo); - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - u1Byte i, j, ScanChannel = 0, ChannelNum = 0; - PRT_CHANNEL_LIST pChannelList = GET_RT_CHANNEL_LIST(pMgntInfo); - u1Byte EachChannelSTAs[MAX_SCAN_CHANNEL_NUM] = {0}; - - if(pMgntInfo->tmpNumBssDesc == 0) - return 0; - - for(i = 0; i < pMgntInfo->tmpNumBssDesc; i++) - { - ChannelNum = pMgntInfo->tmpbssDesc[i].ChannelNumber; - for(j = 0; j < pChannelList->ChannelLen; j++) - { - if(pChannelList->ChnlListEntry[j].ChannelNum == ChannelNum) - { - EachChannelSTAs[j]++; - break; - } - } - } - - for(i = 0; i < MAX_SCAN_CHANNEL_NUM; i++) - { - if(EachChannelSTAs[i] > EachChannelSTAs[ScanChannel]) - ScanChannel = i; - } - - if(EachChannelSTAs[ScanChannel] == 0) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, DBG_LOUD, ("odm_SwAntDivSelectScanChnl(): Scan List is empty.\n")); - return 0; - } - - ScanChannel = pChannelList->ChnlListEntry[ScanChannel].ChannelNum; - - - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, DBG_LOUD, - ("odm_SwAntDivSelectScanChnl(): Channel %d is select as scan channel.\n", ScanChannel)); - - return ScanChannel; -#else - return 0; -#endif -} - - -VOID -odm_SwAntDivConstructScanChnl( - IN PADAPTER Adapter, - IN u1Byte ScanChnl - ) -{ - - PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; - - if(ScanChnl == 0) - { - u1Byte i; - PRT_CHANNEL_LIST pChannelList = GET_RT_CHANNEL_LIST(pMgntInfo); - - // 20100519 Joseph: Original antenna scanned nothing. - // Test antenna shall scan all channel with half period in this condition. - RtActChannelList(Adapter, RT_CHNL_LIST_ACTION_CONSTRUCT_SCAN_LIST, NULL, NULL); - for(i = 0; i < pChannelList->ChannelLen; i++) - pChannelList->ChnlListEntry[i].ScanPeriod /= 2; - } - else - { - // The using of this CustomizedScanRequest is a trick to rescan the two channels - // under the NORMAL scanning process. It will not affect MGNT_INFO.CustomizedScanRequest. - CUSTOMIZED_SCAN_REQUEST CustomScanReq; - - CustomScanReq.bEnabled = TRUE; - CustomScanReq.Channels[0] = ScanChnl; - CustomScanReq.Channels[1] = pMgntInfo->dot11CurrentChannelNumber; - CustomScanReq.nChannels = 2; - CustomScanReq.ScanType = SCAN_ACTIVE; - CustomScanReq.Duration = DEFAULT_PASSIVE_SCAN_PERIOD; - - RtActChannelList(Adapter, RT_CHNL_LIST_ACTION_CONSTRUCT_SCAN_LIST, &CustomScanReq, NULL); - } - -} -#endif //#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) - -// -// 20100514 Luke/Joseph: -// Callback function for 500ms antenna test trying. -// -#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) -VOID -odm_SwAntDivChkAntSwitchCallback( - PRT_TIMER pTimer -) -{ - PADAPTER Adapter = (PADAPTER)pTimer->Adapter; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - pSWAT_T pDM_SWAT_Table = &pHalData->DM_OutSrc.DM_SWAT_Table; - - #if DEV_BUS_TYPE==RT_PCI_INTERFACE - #if USE_WORKITEM - ODM_ScheduleWorkItem(&pDM_SWAT_Table->SwAntennaSwitchWorkitem); - #else - odm_SwAntDivChkAntSwitch(&pHalData->DM_OutSrc, SWAW_STEP_DETERMINE); - #endif - #else - ODM_ScheduleWorkItem(&pDM_SWAT_Table->SwAntennaSwitchWorkitem); - #endif - -} -VOID -odm_SwAntDivChkAntSwitchWorkitemCallback( - IN PVOID pContext - ) -{ - - PADAPTER pAdapter = (PADAPTER)pContext; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - - odm_SwAntDivChkAntSwitch(&pHalData->DM_OutSrc, SWAW_STEP_DETERMINE); - -} -#elif (DM_ODM_SUPPORT_TYPE == ODM_CE) -VOID odm_SwAntDivChkAntSwitchCallback(void *FunctionContext) -{ - PDM_ODM_T pDM_Odm= (PDM_ODM_T)FunctionContext; - PADAPTER padapter = pDM_Odm->Adapter; - if(padapter->net_closed == _TRUE) - return; - odm_SwAntDivChkAntSwitch(pDM_Odm, SWAW_STEP_DETERMINE); -} -#elif (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) -VOID odm_SwAntDivChkAntSwitchCallback(void *FunctionContext) -{ - PDM_ODM_T pDM_Odm= (PDM_ODM_T)FunctionContext; - odm_SwAntDivChkAntSwitch(pDM_Odm, SWAW_STEP_DETERMINE); -} -#endif - -#else //#if(defined(CONFIG_SW_ANTENNA_DIVERSITY)) - -VOID odm_SwAntDivInit( IN PDM_ODM_T pDM_Odm ) {} -VOID ODM_SwAntDivChkPerPktRssi( - IN PDM_ODM_T pDM_Odm, - IN u1Byte StationID, - IN PODM_PHY_INFO_T pPhyInfo - ) {} -VOID odm_SwAntDivChkAntSwitch( - IN PDM_ODM_T pDM_Odm, - IN u1Byte Step - ) {} -VOID ODM_SwAntDivResetBeforeLink( IN PDM_ODM_T pDM_Odm ){} -VOID ODM_SwAntDivRestAfterLink( IN PDM_ODM_T pDM_Odm ){} -VOID odm_SwAntDetectInit( IN PDM_ODM_T pDM_Odm){} -#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) -VOID odm_SwAntDivChkAntSwitchCallback( PRT_TIMER pTimer){} -VOID odm_SwAntDivChkAntSwitchWorkitemCallback( IN PVOID pContext ){} -#elif (DM_ODM_SUPPORT_TYPE == ODM_CE) -VOID odm_SwAntDivChkAntSwitchCallback(void *FunctionContext){} -#elif (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) -VOID odm_SwAntDivChkAntSwitchCallback(void *FunctionContext){} -#endif - -#endif //#if(defined(CONFIG_SW_ANTENNA_DIVERSITY)) - - - -#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) -BOOLEAN -ODM_SwAntDivCheckBeforeLink( - IN PDM_ODM_T pDM_Odm - ) -{ - -#if (RT_MEM_SIZE_LEVEL != RT_MEM_SIZE_MINIMUM) - - PADAPTER Adapter = pDM_Odm->Adapter; - HAL_DATA_TYPE* pHalData = GET_HAL_DATA(Adapter); - PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; - pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; - pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; - s1Byte Score = 0; - PRT_WLAN_BSS pTmpBssDesc, pTestBssDesc; - s4Byte power_diff = 0, power_target = 10; - u1Byte index, counter = 0; - static u1Byte ScanChannel; - u8Byte tStamp_diff = 0; - - - if (pDM_Odm->Adapter == NULL) //For BSOD when plug/unplug fast. //By YJ,120413 - { // The ODM structure is not initialized. - return FALSE; - } - - // Retrieve antenna detection registry info, added by Roger, 2012.11.27. - if(!IS_ANT_DETECT_SUPPORT_RSSI(Adapter)) - return FALSE; - - // Since driver is going to set BB register, it shall check if there is another thread controlling BB/RF. - PlatformAcquireSpinLock(Adapter, RT_RF_STATE_SPINLOCK); - if(pHalData->eRFPowerState!=eRfOn || pMgntInfo->RFChangeInProgress || pMgntInfo->bMediaConnect) - { - PlatformReleaseSpinLock(Adapter, RT_RF_STATE_SPINLOCK); - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, - ("ODM_SwAntDivCheckBeforeLink(): RFChangeInProgress(%x), eRFPowerState(%x)\n", - pMgntInfo->RFChangeInProgress, pHalData->eRFPowerState)); - - pDM_SWAT_Table->SWAS_NoLink_State = 0; - - return FALSE; - } - else - { - PlatformReleaseSpinLock(Adapter, RT_RF_STATE_SPINLOCK); - } - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("pDM_SWAT_Table->SWAS_NoLink_State = %d\n", pDM_SWAT_Table->SWAS_NoLink_State)); - //1 Run AntDiv mechanism "Before Link" part. - if(pDM_SWAT_Table->SWAS_NoLink_State == 0) - { - //1 Prepare to do Scan again to check current antenna state. - - // Set check state to next step. - pDM_SWAT_Table->SWAS_NoLink_State = 1; - - // Copy Current Scan list. - pMgntInfo->tmpNumBssDesc = pMgntInfo->NumBssDesc; - PlatformMoveMemory((PVOID)Adapter->MgntInfo.tmpbssDesc, (PVOID)pMgntInfo->bssDesc, sizeof(RT_WLAN_BSS)*MAX_BSS_DESC); - - // Go back to scan function again. - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_SwAntDivCheckBeforeLink: Scan one more time\n")); - pMgntInfo->ScanStep=0; - pMgntInfo->bScanAntDetect = TRUE; - ScanChannel = odm_SwAntDivSelectScanChnl(Adapter); - - - if(pDM_Odm->SupportICType & (ODM_RTL8188E|ODM_RTL8821)) - { - if(pDM_FatTable->RxIdleAnt == MAIN_ANT) - ODM_UpdateRxIdleAnt(pDM_Odm, AUX_ANT); - else - ODM_UpdateRxIdleAnt(pDM_Odm, MAIN_ANT); - if(ScanChannel == 0) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, - ("ODM_SwAntDivCheckBeforeLink(): No AP List Avaiable, Using Ant(%s)\n", (pDM_FatTable->RxIdleAnt==MAIN_ANT)?"AUX_ANT":"MAIN_ANT")); - - if(IS_5G_WIRELESS_MODE(pMgntInfo->dot11CurrentWirelessMode)) - { - pDM_SWAT_Table->Ant5G = pDM_FatTable->RxIdleAnt; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("pDM_SWAT_Table->Ant5G=%s\n", (pDM_FatTable->RxIdleAnt==MAIN_ANT)?"MAIN_ANT":"AUX_ANT")); - } - else - { - pDM_SWAT_Table->Ant2G = pDM_FatTable->RxIdleAnt; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("pDM_SWAT_Table->Ant2G=%s\n", (pDM_FatTable->RxIdleAnt==MAIN_ANT)?"MAIN_ANT":"AUX_ANT")); - } - return FALSE; - } - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, - ("ODM_SwAntDivCheckBeforeLink: Change to %s for testing.\n", ((pDM_FatTable->RxIdleAnt == MAIN_ANT)?"MAIN_ANT":"AUX_ANT"))); - } - else if(pDM_Odm->SupportICType & (ODM_RTL8192C|ODM_RTL8723B)) - { - // Switch Antenna to another one. - pDM_SWAT_Table->PreAntenna = pDM_SWAT_Table->CurAntenna; - pDM_SWAT_Table->CurAntenna = (pDM_SWAT_Table->CurAntenna==MAIN_ANT)?AUX_ANT:MAIN_ANT; - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, - ("ODM_SwAntDivCheckBeforeLink: Change to Ant(%s) for testing.\n", (pDM_SWAT_Table->CurAntenna==MAIN_ANT)?"MAIN":"AUX")); - //PHY_SetBBReg(Adapter, rFPGA0_XA_RFInterfaceOE, 0x300, DM_SWAT_Table.CurAntenna); - if(pDM_Odm->SupportICType == ODM_RTL8192C) - { - pDM_SWAT_Table->SWAS_NoLink_BK_Reg860 = ((pDM_SWAT_Table->SWAS_NoLink_BK_Reg860 & 0xfffffcff) | (pDM_SWAT_Table->CurAntenna<<8)); - ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, bMaskDWord, pDM_SWAT_Table->SWAS_NoLink_BK_Reg860); - } - else if(pDM_Odm->SupportICType == ODM_RTL8723B) - { - pDM_SWAT_Table->SWAS_NoLink_BK_Reg92c = ((pDM_SWAT_Table->SWAS_NoLink_BK_Reg92c & 0xfffffffc) | (pDM_SWAT_Table->CurAntenna)); - ODM_SetBBReg(pDM_Odm, rfe_ctrl_anta_src, 0xff, 0x77); - ODM_SetBBReg(pDM_Odm, rDPDT_control, bMaskDWord, pDM_SWAT_Table->SWAS_NoLink_BK_Reg92c); - } - } - - odm_SwAntDivConstructScanChnl(Adapter, ScanChannel); - PlatformSetTimer(Adapter, &pMgntInfo->ScanTimer, 5); - - return TRUE; - } - else - { - //1 ScanComple() is called after antenna swiched. - //1 Check scan result and determine which antenna is going - //1 to be used. - - for(index = 0; index < pMgntInfo->tmpNumBssDesc; index++) - { - pTmpBssDesc = &(pMgntInfo->tmpbssDesc[index]); // Antenna 1 - pTestBssDesc = &(pMgntInfo->bssDesc[index]); // Antenna 2 - - if(PlatformCompareMemory(pTestBssDesc->bdBssIdBuf, pTmpBssDesc->bdBssIdBuf, 6)!=0) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_SwAntDivCheckBeforeLink(): ERROR!! This shall not happen.\n")); - continue; - } - - if(pDM_Odm->SupportICType != ODM_RTL8723B) - { - if(pTmpBssDesc->ChannelNumber == ScanChannel) - { - if(pTmpBssDesc->RecvSignalPower > pTestBssDesc->RecvSignalPower) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_SwAntDivCheckBeforeLink: Compare scan entry: Score++\n")); - RT_PRINT_STR(COMP_SCAN, DBG_WARNING, "GetScanInfo(): new Bss SSID:", pTmpBssDesc->bdSsIdBuf, pTmpBssDesc->bdSsIdLen); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("at ch %d, Original: %d, Test: %d\n\n", pTmpBssDesc->ChannelNumber, pTmpBssDesc->RecvSignalPower, pTestBssDesc->RecvSignalPower)); - - Score++; - PlatformMoveMemory(pTestBssDesc, pTmpBssDesc, sizeof(RT_WLAN_BSS)); - } - else if(pTmpBssDesc->RecvSignalPower < pTestBssDesc->RecvSignalPower) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_SwAntDivCheckBeforeLink: Compare scan entry: Score--\n")); - RT_PRINT_STR(COMP_SCAN, DBG_WARNING, "GetScanInfo(): new Bss SSID:", pTmpBssDesc->bdSsIdBuf, pTmpBssDesc->bdSsIdLen); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("at ch %d, Original: %d, Test: %d\n\n", pTmpBssDesc->ChannelNumber, pTmpBssDesc->RecvSignalPower, pTestBssDesc->RecvSignalPower)); - Score--; - } - else - { - if(pTestBssDesc->bdTstamp - pTmpBssDesc->bdTstamp < 5000) - { - RT_PRINT_STR(COMP_SCAN, DBG_WARNING, "GetScanInfo(): new Bss SSID:", pTmpBssDesc->bdSsIdBuf, pTmpBssDesc->bdSsIdLen); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("at ch %d, Original: %d, Test: %d\n", pTmpBssDesc->ChannelNumber, pTmpBssDesc->RecvSignalPower, pTestBssDesc->RecvSignalPower)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("The 2nd Antenna didn't get this AP\n\n")); - } - } - } - } - else - { - if(pTmpBssDesc->ChannelNumber == ScanChannel) - { - if(pTmpBssDesc->RecvSignalPower > pTestBssDesc->RecvSignalPower) - { - counter++; - power_diff = power_diff + (pTmpBssDesc->RecvSignalPower - pTestBssDesc->RecvSignalPower); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Original: %d, Test: %d\n", pTmpBssDesc->RecvSignalPower, pTestBssDesc->RecvSignalPower)); - ODM_PRINT_ADDR(pDM_Odm,ODM_COMP_ANT_DIV, DBG_LOUD, ("SSID:"), pTmpBssDesc->bdSsIdBuf); - ODM_PRINT_ADDR(pDM_Odm,ODM_COMP_ANT_DIV, DBG_LOUD, ("BSSID:"), pTmpBssDesc->bdBssIdBuf); - PlatformMoveMemory(pTestBssDesc, pTmpBssDesc, sizeof(RT_WLAN_BSS)); - } - else if(pTestBssDesc->RecvSignalPower > pTmpBssDesc->RecvSignalPower) - { - counter++; - power_diff = power_diff + (pTestBssDesc->RecvSignalPower - pTmpBssDesc->RecvSignalPower); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Original: %d, Test: %d\n", pTmpBssDesc->RecvSignalPower, pTestBssDesc->RecvSignalPower)); - ODM_PRINT_ADDR(pDM_Odm,ODM_COMP_ANT_DIV, DBG_LOUD, ("SSID:"), pTmpBssDesc->bdSsIdBuf); - ODM_PRINT_ADDR(pDM_Odm,ODM_COMP_ANT_DIV, DBG_LOUD, ("BSSID:"), pTmpBssDesc->bdBssIdBuf) - } - else if(pTestBssDesc->bdTstamp > pTmpBssDesc->bdTstamp) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("time_diff: %lld\n", (pTestBssDesc->bdTstamp-pTmpBssDesc->bdTstamp)/1000)); - if(pTestBssDesc->bdTstamp - pTmpBssDesc->bdTstamp > 5000) - { - counter++; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Original: %d, Test: %d\n", pTmpBssDesc->RecvSignalPower, pTestBssDesc->RecvSignalPower)); - ODM_PRINT_ADDR(pDM_Odm,ODM_COMP_ANT_DIV, DBG_LOUD, ("SSID:"), pTmpBssDesc->bdSsIdBuf); - ODM_PRINT_ADDR(pDM_Odm,ODM_COMP_ANT_DIV, DBG_LOUD, ("BSSID:"), pTmpBssDesc->bdBssIdBuf) - } - } - } - } - } - - if(pDM_Odm->SupportICType == ODM_RTL8723B) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("counter: %d power_diff: %d\n", counter, power_diff)); - - if(counter != 0) - power_diff = power_diff / counter; - - if(power_diff <= power_target && counter != 0) - Score++; - } - - if(pDM_Odm->SupportICType & (ODM_RTL8188E|ODM_RTL8821)) - { - if(pMgntInfo->NumBssDesc!=0 && Score<0) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, - ("ODM_SwAntDivCheckBeforeLink(): Using Ant(%s)\n", (pDM_FatTable->RxIdleAnt==MAIN_ANT)?"MAIN_ANT":"AUX_ANT")); - } - else - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, - ("ODM_SwAntDivCheckBeforeLink(): Remain Ant(%s)\n", (pDM_FatTable->RxIdleAnt==MAIN_ANT)?"AUX_ANT":"MAIN_ANT")); - - if(pDM_FatTable->RxIdleAnt == MAIN_ANT) - ODM_UpdateRxIdleAnt(pDM_Odm, AUX_ANT); - else - ODM_UpdateRxIdleAnt(pDM_Odm, MAIN_ANT); - } - - if(IS_5G_WIRELESS_MODE(pMgntInfo->dot11CurrentWirelessMode)) - { - pDM_SWAT_Table->Ant5G = pDM_FatTable->RxIdleAnt; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("pDM_SWAT_Table->Ant5G=%s\n", (pDM_FatTable->RxIdleAnt==MAIN_ANT)?"MAIN_ANT":"AUX_ANT")); - } - else - { - pDM_SWAT_Table->Ant2G = pDM_FatTable->RxIdleAnt; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("pDM_SWAT_Table->Ant2G=%s\n", (pDM_FatTable->RxIdleAnt==MAIN_ANT)?"MAIN_ANT":"AUX_ANT")); - } - } - else if(pDM_Odm->SupportICType == ODM_RTL8723B) - { - pDM_SWAT_Table->CurAntenna = pDM_SWAT_Table->PreAntenna; - pDM_SWAT_Table->SWAS_NoLink_BK_Reg92c = ((pDM_SWAT_Table->SWAS_NoLink_BK_Reg92c & 0xfffffffc) | (pDM_SWAT_Table->CurAntenna)); - ODM_SetBBReg(pDM_Odm, rfe_ctrl_anta_src, 0xff, 0x77); - ODM_SetBBReg(pDM_Odm, rDPDT_control,bMaskDWord, pDM_SWAT_Table->SWAS_NoLink_BK_Reg92c); - - if(counter != 0) - { - if(pMgntInfo->NumBssDesc != 0 && Score > 0) - { - if(pDM_Odm->DM_SWAT_Table.ANTB_ON == FALSE) - { - pDM_Odm->DM_SWAT_Table.ANTA_ON = TRUE; - pDM_Odm->DM_SWAT_Table.ANTB_ON = TRUE; - } - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("ODM_SwAntDivCheckBeforeLink(): Dual antenna\n")); - } - else - { - if(pDM_Odm->DM_SWAT_Table.ANTB_ON == TRUE) - { - pDM_Odm->DM_SWAT_Table.ANTA_ON = TRUE; - pDM_Odm->DM_SWAT_Table.ANTB_ON = FALSE; - BT_SetBtCoexAntNum(Adapter, BT_COEX_ANT_TYPE_DETECTED, 1); - } - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_SwAntDivCheckBeforeLink(): Single antenna\n")); - } - } - else - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("ODM_SwAntDivCheckBeforeLink(): Igone result\n")); - } - else if(pDM_Odm->SupportICType == ODM_RTL8192C) - { - if(pMgntInfo->NumBssDesc!=0 && Score<=0) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, - ("ODM_SwAntDivCheckBeforeLink(): Using Ant(%s)\n", (pDM_SWAT_Table->CurAntenna==MAIN_ANT)?"MAIN":"AUX")); - - pDM_SWAT_Table->PreAntenna = pDM_SWAT_Table->CurAntenna; - } - else - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, - ("ODM_SwAntDivCheckBeforeLink(): Remain Ant(%s)\n", (pDM_SWAT_Table->CurAntenna==MAIN_ANT)?"AUX":"MAIN")); - - pDM_SWAT_Table->CurAntenna = pDM_SWAT_Table->PreAntenna; - - //PHY_SetBBReg(Adapter, rFPGA0_XA_RFInterfaceOE, 0x300, DM_SWAT_Table.CurAntenna); - pDM_SWAT_Table->SWAS_NoLink_BK_Reg860 = ((pDM_SWAT_Table->SWAS_NoLink_BK_Reg860 & 0xfffffcff) | (pDM_SWAT_Table->CurAntenna<<8)); - PHY_SetBBReg(Adapter, rFPGA0_XA_RFInterfaceOE, bMaskDWord, pDM_SWAT_Table->SWAS_NoLink_BK_Reg860); - } - } - - // Check state reset to default and wait for next time. - pDM_SWAT_Table->SWAS_NoLink_State = 0; - pMgntInfo->bScanAntDetect = FALSE; - - return FALSE; - } - -#else - return FALSE; -#endif - -return FALSE; -} - -#endif //#if(DM_ODM_SUPPORT_TYPE==ODM_WIN) - - -//3============================================================ -//3 SW Antenna Diversity -//3============================================================ - -#if(defined(CONFIG_HW_ANTENNA_DIVERSITY)) -VOID -odm_InitHybridAntDiv_88C_92D( - IN PDM_ODM_T pDM_Odm - ) -{ - -#if((DM_ODM_SUPPORT_TYPE==ODM_AP)||(DM_ODM_SUPPORT_TYPE==ODM_ADSL)) - struct rtl8192cd_priv *priv=pDM_Odm->priv; -#endif - SWAT_T *pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; - u1Byte bTxPathSel=0; //0:Path-A 1:Path-B - u1Byte i; - - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("odm_InitHybridAntDiv==============>\n")); - - //whether to do antenna diversity or not -#if(DM_ODM_SUPPORT_TYPE==ODM_AP) - if(priv==NULL) return; - if(!priv->pshare->rf_ft_var.antHw_enable) - return; - - #ifdef SW_ANT_SWITCH - priv->pshare->rf_ft_var.antSw_enable =0; - #endif -#endif - - if((pDM_Odm->SupportICType != ODM_RTL8192C) && (pDM_Odm->SupportICType != ODM_RTL8192D)) - return; - - - bTxPathSel=(pDM_Odm->RFType==ODM_1T1R)?FALSE:TRUE; - - ODM_SetBBReg(pDM_Odm,ODM_REG_BB_PWR_SAV1_11N, BIT23, 0); //No update ANTSEL during GNT_BT=1 - ODM_SetBBReg(pDM_Odm,ODM_REG_TX_ANT_CTRL_11N, BIT21, 1); //TX atenna selection from tx_info - ODM_SetBBReg(pDM_Odm,ODM_REG_ANTSEL_PIN_11N, BIT23, 1); //enable LED[1:0] pin as ANTSEL - ODM_SetBBReg(pDM_Odm,ODM_REG_ANTSEL_CTRL_11N, BIT8|BIT9, 0x01); // 0x01: left antenna, 0x02: right antenna - // check HW setting: ANTSEL pin connection - #if(DM_ODM_SUPPORT_TYPE==ODM_AP) - ODM_Write2Byte(pDM_Odm,ODM_REG_RF_PIN_11N, (ODM_Read2Byte(pDM_Odm,0x804)&0xf0ff )| BIT(8) ); // b11-b8=0001,update RFPin setting - #endif - - // only AP support different path selection temperarly - if(!bTxPathSel){ //PATH-A - ODM_SetBBReg(pDM_Odm,ODM_REG_PIN_CTRL_11N, BIT8|BIT9, 0 ); // ANTSEL as HW control - ODM_SetBBReg(pDM_Odm,ODM_REG_ANTSEL_PATH_11N, BIT13, 1); //select TX ANTESEL from path A - } - else { - ODM_SetBBReg(pDM_Odm,ODM_REG_PIN_CTRL_11N, BIT24|BIT25, 0 ); // ANTSEL as HW control - ODM_SetBBReg(pDM_Odm,ODM_REG_ANTSEL_PATH_11N, BIT13, 0); //select ANTESEL from path B - } - - //Set OFDM HW RX Antenna Diversity - ODM_SetBBReg(pDM_Odm,ODM_REG_ANTDIV_PARA1_11N, 0x7FF, 0x0c0); //Pwdb threshold=8dB - ODM_SetBBReg(pDM_Odm,ODM_REG_ANTDIV_PARA1_11N, BIT11, 0); //Switch to another antenna by checking pwdb threshold - ODM_SetBBReg(pDM_Odm,ODM_REG_ANTDIV_PARA3_11N, BIT23, 1); // Decide final antenna by comparing 2 antennas' pwdb - - //Set CCK HW RX Antenna Diversity - ODM_SetBBReg(pDM_Odm,ODM_REG_CCK_ANTDIV_PARA2_11N, BIT4, 0); //Antenna diversity decision period = 32 sample - ODM_SetBBReg(pDM_Odm,ODM_REG_CCK_ANTDIV_PARA2_11N, 0xf, 0xf); //Threshold for antenna diversity. Check another antenna power if input power < ANT_lim*4 - ODM_SetBBReg(pDM_Odm,ODM_REG_CCK_ANTDIV_PARA3_11N, BIT13, 1); //polarity ana_A=1 and ana_B=0 - ODM_SetBBReg(pDM_Odm,ODM_REG_CCK_ANTDIV_PARA4_11N, 0x1f, 0x8); //default antenna power = inpwr*(0.5 + r_ant_step/16) - - - //Enable HW Antenna Diversity - if(!bTxPathSel) //PATH-A - ODM_SetBBReg(pDM_Odm,ODM_REG_IGI_A_11N, BIT7,1); // Enable Hardware antenna switch - else - ODM_SetBBReg(pDM_Odm,ODM_REG_IGI_B_11N, BIT7,1); // Enable Hardware antenna switch - ODM_SetBBReg(pDM_Odm,ODM_REG_CCK_ANTDIV_PARA1_11N, BIT15, 1);//Enable antenna diversity - - pDM_SWAT_Table->CurAntenna=0; //choose left antenna as default antenna - pDM_SWAT_Table->PreAntenna=0; - for(i=0; iCCK_Ant1_Cnt[i] = 0; - pDM_SWAT_Table->CCK_Ant2_Cnt[i] = 0; - pDM_SWAT_Table->OFDM_Ant1_Cnt[i] = 0; - pDM_SWAT_Table->OFDM_Ant2_Cnt[i] = 0; - pDM_SWAT_Table->RSSI_Ant1_Sum[i] = 0; - pDM_SWAT_Table->RSSI_Ant2_Sum[i] = 0; - } - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("<==============odm_InitHybridAntDiv\n")); -} - - -VOID -odm_InitHybridAntDiv( - IN PDM_ODM_T pDM_Odm - ) -{ - if(!(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV)) - { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("Return: Not Support HW AntDiv\n")); - return; - } - - if(pDM_Odm->SupportICType & (ODM_RTL8192C | ODM_RTL8192D)) - { -#if ((RTL8192C_SUPPORT == 1)||(RTL8192D_SUPPORT == 1)) - odm_InitHybridAntDiv_88C_92D(pDM_Odm); -#endif - } -} - - -BOOLEAN -odm_StaDefAntSel( - IN PDM_ODM_T pDM_Odm, - IN u4Byte OFDM_Ant1_Cnt, - IN u4Byte OFDM_Ant2_Cnt, - IN u4Byte CCK_Ant1_Cnt, - IN u4Byte CCK_Ant2_Cnt, - OUT u1Byte *pDefAnt - - ) -{ -#if 1 - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("odm_StaDefAntSelect==============>\n")); - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("OFDM_Ant1_Cnt:%d, OFDM_Ant2_Cnt:%d\n",OFDM_Ant1_Cnt,OFDM_Ant2_Cnt)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("CCK_Ant1_Cnt:%d, CCK_Ant2_Cnt:%d\n",CCK_Ant1_Cnt,CCK_Ant2_Cnt)); - - - if(((OFDM_Ant1_Cnt+OFDM_Ant2_Cnt)==0)&&((CCK_Ant1_Cnt + CCK_Ant2_Cnt) <10)){ - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("odm_StaDefAntSelect Fail: No enough packet info!\n")); - return FALSE; - } - - if(OFDM_Ant1_Cnt || OFDM_Ant2_Cnt ) { - //if RX OFDM packet number larger than 0 - if(OFDM_Ant1_Cnt > OFDM_Ant2_Cnt) - (*pDefAnt)=1; - else - (*pDefAnt)=0; - } - // else if RX CCK packet number larger than 10 - else if((CCK_Ant1_Cnt + CCK_Ant2_Cnt) >=10 ) - { - if(CCK_Ant1_Cnt > (5*CCK_Ant2_Cnt)) - (*pDefAnt)=1; - else if(CCK_Ant2_Cnt > (5*CCK_Ant1_Cnt)) - (*pDefAnt)=0; - else if(CCK_Ant1_Cnt > CCK_Ant2_Cnt) - (*pDefAnt)=0; - else - (*pDefAnt)=1; - - } - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("TxAnt = %s\n",((*pDefAnt)==1)?"Ant1":"Ant2")); - -#endif - //u4Byte antsel = ODM_GetBBReg(pDM_Odm, 0xc88, bMaskByte0); - //(*pDefAnt)= (u1Byte) antsel; - - - - - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("<==============odm_StaDefAntSelect\n")); - - return TRUE; - - -} - - -VOID -odm_SetRxIdleAnt( - IN PDM_ODM_T pDM_Odm, - IN u1Byte Ant, - IN BOOLEAN bDualPath -) -{ - SWAT_T *pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; - - //ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("odm_SetRxIdleAnt==============>\n")); - - if(Ant != pDM_SWAT_Table->RxIdleAnt) - { - //for path-A - if(Ant==1) - ODM_SetBBReg(pDM_Odm,ODM_REG_RX_DEFUALT_A_11N, 0xFFFF, 0x65a9); //right-side antenna - else - ODM_SetBBReg(pDM_Odm,ODM_REG_RX_DEFUALT_A_11N, 0xFFFF, 0x569a); //left-side antenna - - //for path-B - if(bDualPath){ - if(Ant==0) - ODM_SetBBReg(pDM_Odm,ODM_REG_RX_DEFUALT_A_11N, 0xFFFF0000, 0x65a9); //right-side antenna - else - ODM_SetBBReg(pDM_Odm,ODM_REG_RX_DEFUALT_A_11N, 0xFFFF0000, 0x569a); //left-side antenna - } - } - pDM_SWAT_Table->RxIdleAnt = Ant; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("RxIdleAnt: %s Reg858=0x%x\n",(Ant==1)?"Ant1":"Ant2",(Ant==1)?0x65a9:0x569a)); - - //ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("<==============odm_SetRxIdleAnt\n")); - - } - -VOID -ODM_AntselStatistics_88C( - IN PDM_ODM_T pDM_Odm, - IN u1Byte MacId, - IN u4Byte PWDBAll, - IN BOOLEAN isCCKrate -) -{ - SWAT_T *pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; - - if(pDM_SWAT_Table->antsel == 1) - { - if(isCCKrate) - pDM_SWAT_Table->CCK_Ant1_Cnt[MacId]++; - else - { - pDM_SWAT_Table->OFDM_Ant1_Cnt[MacId]++; - pDM_SWAT_Table->RSSI_Ant1_Sum[MacId] += PWDBAll; - } - } - else - { - if(isCCKrate) - pDM_SWAT_Table->CCK_Ant2_Cnt[MacId]++; - else - { - pDM_SWAT_Table->OFDM_Ant2_Cnt[MacId]++; - pDM_SWAT_Table->RSSI_Ant2_Sum[MacId] += PWDBAll; - } - } - -} - - - - -#if(DM_ODM_SUPPORT_TYPE==ODM_WIN) -VOID -ODM_SetTxAntByTxInfo_88C_92D( - IN PDM_ODM_T pDM_Odm, - IN pu1Byte pDesc, - IN u1Byte macId -) -{ - SWAT_T *pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; - u1Byte antsel; - - if(!(pDM_Odm->SupportAbility&ODM_BB_ANT_DIV)) - return; - - if(pDM_SWAT_Table->RxIdleAnt == 1) - antsel=(pDM_SWAT_Table->TxAnt[macId] == 1)?0:1; - else - antsel=(pDM_SWAT_Table->TxAnt[macId] == 1)?1:0; - - SET_TX_DESC_ANTSEL_A_92C(pDesc, antsel); - //SET_TX_DESC_ANTSEL_B_92C(pDesc, antsel); - //ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("SET_TX_DESC_ANTSEL_A_92C=%d\n", pDM_SWAT_Table->TxAnt[macId])); -} -#elif(DM_ODM_SUPPORT_TYPE==ODM_CE) -VOID -ODM_SetTxAntByTxInfo_88C_92D( - IN PDM_ODM_T pDM_Odm -) -{ - -} -#elif(DM_ODM_SUPPORT_TYPE==ODM_AP) -VOID -ODM_SetTxAntByTxInfo_88C_92D( - IN PDM_ODM_T pDM_Odm -) -{ - -} -#endif - -VOID -odm_HwAntDiv_92C_92D( - IN PDM_ODM_T pDM_Odm -) -{ - SWAT_T *pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; - u4Byte RSSI_Min=0xFF, RSSI, RSSI_Ant1, RSSI_Ant2; - u1Byte RxIdleAnt, i; - BOOLEAN bRet=FALSE; - PSTA_INFO_T pEntry; - -#if (DM_ODM_SUPPORT_TYPE==ODM_AP) - struct rtl8192cd_priv *priv=pDM_Odm->priv; - //if test, return - if(priv->pshare->rf_ft_var.CurAntenna & 0x80) - return; -#endif - - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("odm_HwAntDiv==============>\n")); - - if(!(pDM_Odm->SupportAbility&ODM_BB_ANT_DIV)) //if don't support antenna diveristy - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("odm_HwAntDiv: Not supported!\n")); - return; - } - - if((pDM_Odm->SupportICType != ODM_RTL8192C) && (pDM_Odm->SupportICType != ODM_RTL8192D)) - { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("Return: IC Type is not 92C or 92D\n")); - return; - } - -#if (DM_ODM_SUPPORT_TYPE&(ODM_WIN|ODM_CE)) - if(!pDM_Odm->bLinked) - { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("Return: bLinked is FALSE\n")); - return; - } -#endif - - for (i=0; ipODM_StaInfo[i]; - if(IS_STA_VALID(pEntry)) - { - - RSSI_Ant1 = (pDM_SWAT_Table->OFDM_Ant1_Cnt[i] == 0)?0:(pDM_SWAT_Table->RSSI_Ant1_Sum[i]/pDM_SWAT_Table->OFDM_Ant1_Cnt[i]); - RSSI_Ant2 = (pDM_SWAT_Table->OFDM_Ant2_Cnt[i] == 0)?0:(pDM_SWAT_Table->RSSI_Ant2_Sum[i]/pDM_SWAT_Table->OFDM_Ant2_Cnt[i]); - - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("RSSI_Ant1=%d, RSSI_Ant2=%d\n", RSSI_Ant1, RSSI_Ant2)); - - if(RSSI_Ant1 ||RSSI_Ant2) - { -#if (DM_ODM_SUPPORT_TYPE==ODM_AP) - if(pDM_Odm->pODM_StaInfo[i]->expire_to) -#endif - { - RSSI = (RSSI_Ant1 < RSSI_Ant2) ? RSSI_Ant1 : RSSI_Ant2; - if((!RSSI) || ( RSSI < RSSI_Min) ) { - pDM_SWAT_Table->TargetSTA = i; - RSSI_Min = RSSI; - } - } - } - ///STA: found out default antenna - bRet=odm_StaDefAntSel(pDM_Odm, - pDM_SWAT_Table->OFDM_Ant1_Cnt[i], - pDM_SWAT_Table->OFDM_Ant2_Cnt[i], - pDM_SWAT_Table->CCK_Ant1_Cnt[i], - pDM_SWAT_Table->CCK_Ant2_Cnt[i], - &pDM_SWAT_Table->TxAnt[i]); - - //if Tx antenna selection: successful - if(bRet){ - pDM_SWAT_Table->RSSI_Ant1_Sum[i] = 0; - pDM_SWAT_Table->RSSI_Ant2_Sum[i] = 0; - pDM_SWAT_Table->OFDM_Ant1_Cnt[i] = 0; - pDM_SWAT_Table->OFDM_Ant2_Cnt[i] = 0; - pDM_SWAT_Table->CCK_Ant1_Cnt[i] = 0; - pDM_SWAT_Table->CCK_Ant2_Cnt[i] = 0; - } - } - } - - //set RX Idle Ant - RxIdleAnt = pDM_SWAT_Table->TxAnt[pDM_SWAT_Table->TargetSTA]; - odm_SetRxIdleAnt(pDM_Odm, RxIdleAnt, FALSE); - -#if (DM_ODM_SUPPORT_TYPE==ODM_AP) -#ifdef TX_SHORTCUT - if (!priv->pmib->dot11OperationEntry.disable_txsc) { - plist = phead->next; - while(plist != phead) { - pstat = list_entry(plist, struct stat_info, asoc_list); - if(pstat->expire_to) { - for (i=0; itx_sc_ent[i].hwdesc1); - pdesc->Dword2 &= set_desc(~ (BIT(24)|BIT(25))); - if((pstat->CurAntenna^priv->pshare->rf_ft_var.CurAntenna)&1) - pdesc->Dword2 |= set_desc(BIT(24)|BIT(25)); - pdesc= &(pstat->tx_sc_ent[i].hwdesc2); - pdesc->Dword2 &= set_desc(~ (BIT(24)|BIT(25))); - if((pstat->CurAntenna^priv->pshare->rf_ft_var.CurAntenna)&1) - pdesc->Dword2 |= set_desc(BIT(24)|BIT(25)); - } - } - - if (plist == plist->next) - break; - plist = plist->next; - }; - } -#endif -#endif - - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("<==============odm_HwAntDiv\n")); - -} - -VOID -odm_HwAntDiv( - IN PDM_ODM_T pDM_Odm -) -{ - - PADAPTER pAdapter = pDM_Odm->Adapter; - -#if(DM_ODM_SUPPORT_TYPE==ODM_WIN) - if(pAdapter->MgntInfo.AntennaTest) - return; -#endif - if(!(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV)) - { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("Return: Not Support HW AntDiv\n")); - return; - } - - if(pDM_Odm->SupportICType & (ODM_RTL8192C | ODM_RTL8192D)) - { -#if ((RTL8192C_SUPPORT == 1)||(RTL8192D_SUPPORT == 1)) - odm_HwAntDiv_92C_92D(pDM_Odm); -#endif - } -} - - -#if(DM_ODM_SUPPORT_TYPE==ODM_AP) -#if 0 -VOID -odm_HwAntDiv( - IN PDM_ODM_T pDM_Odm -) -{ - struct rtl8192cd_priv *priv=pDM_Odm->priv; - struct stat_info *pstat, *pstat_min=NULL; - struct list_head *phead, *plist; - int rssi_min= 0xff, i; - u1Byte idleAnt=priv->pshare->rf_ft_var.CurAntenna; - u1Byte nextAnt; - BOOLEAN bRet=FALSE; - - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("odm_HwAntDiv==============>\n")); - - if((!priv->pshare->rf_ft_var.antHw_enable) ||(!(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV))) - return; - - //if test, return - if(priv->pshare->rf_ft_var.CurAntenna & 0x80) - return; - - phead = &priv->asoc_list; - plist = phead->next; - ////========================= - //find mimum rssi sta - ////========================= - while(plist != phead) { - pstat = list_entry(plist, struct stat_info, asoc_list); - if((pstat->expire_to) && (pstat->AntRSSI[0] || pstat->AntRSSI[1])) { - int rssi = (pstat->AntRSSI[0] < pstat->AntRSSI[1]) ? pstat->AntRSSI[0] : pstat->AntRSSI[1]; - if((!pstat_min) || ( rssi < rssi_min) ) { - pstat_min = pstat; - rssi_min = rssi; - } - } - ///STA: found out default antenna - bRet=odm_StaDefAntSel(pDM_Odm, - pstat->hwRxAntSel[1], - pstat->hwRxAntSel[0], - pstat->cckPktCount[1], - pstat->cckPktCount[0], - &nextAnt - ); - - //if default antenna selection: successful - if(bRet){ - pstat->CurAntenna = nextAnt; - //update rssi - for(i=0; i<2; i++) { - if(pstat->cckPktCount[i]==0 && pstat->hwRxAntSel[i]==0) - pstat->AntRSSI[i] = 0; - } - if(pstat->AntRSSI[idleAnt]==0) - pstat->AntRSSI[idleAnt] = pstat->AntRSSI[idleAnt^1]; - // reset variables - pstat->hwRxAntSel[1] = pstat->hwRxAntSel[0] =0; - pstat->cckPktCount[1]= pstat->cckPktCount[0] =0; - } - - if (plist == plist->next) - break; - plist = plist->next; - - }; - ////========================= - //Choose RX Idle antenna according to minmum rssi - ////========================= - if(pstat_min) { - if(priv->pshare->rf_ft_var.CurAntenna!=pstat_min->CurAntenna) - odm_SetRxIdleAnt(pDM_Odm,pstat_min->CurAntenna,TRUE); - priv->pshare->rf_ft_var.CurAntenna = pstat_min->CurAntenna; - } - - -#ifdef TX_SHORTCUT - if (!priv->pmib->dot11OperationEntry.disable_txsc) { - plist = phead->next; - while(plist != phead) { - pstat = list_entry(plist, struct stat_info, asoc_list); - if(pstat->expire_to) { - for (i=0; itx_sc_ent[i].hwdesc1); - pdesc->Dword2 &= set_desc(~ (BIT(24)|BIT(25))); - if((pstat->CurAntenna^priv->pshare->rf_ft_var.CurAntenna)&1) - pdesc->Dword2 |= set_desc(BIT(24)|BIT(25)); - pdesc= &(pstat->tx_sc_ent[i].hwdesc2); - pdesc->Dword2 &= set_desc(~ (BIT(24)|BIT(25))); - if((pstat->CurAntenna^priv->pshare->rf_ft_var.CurAntenna)&1) - pdesc->Dword2 |= set_desc(BIT(24)|BIT(25)); - } - } - - if (plist == plist->next) - break; - plist = plist->next; - }; - } -#endif - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,"<==============odm_HwAntDiv\n"); -} -#endif - -u1Byte -ODM_Diversity_AntennaSelect( - IN PDM_ODM_T pDM_Odm, - IN u1Byte *data -) -{ - struct rtl8192cd_priv *priv=pDM_Odm->priv; - - int ant = _atoi(data, 16); - - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("ODM_Diversity_AntennaSelect==============>\n")); - - #ifdef PCIE_POWER_SAVING - PCIeWakeUp(priv, POWER_DOWN_T0); - #endif - - if (ant==AUX_ANT || ant==MAIN_ANT) - { - if ( !priv->pshare->rf_ft_var.antSw_select) { - ODM_Write4Byte(pDM_Odm,0x870, ODM_Read4Byte(pDM_Odm,0x870) | BIT(8)| BIT(9) ); // ANTSEL A as SW control - ODM_Write1Byte(pDM_Odm,0xc50, ODM_Read1Byte(pDM_Odm,0xc50) & (~ BIT(7))); // rx OFDM SW control - PHY_SetBBReg(priv, 0x860, 0x300, ant); - } else { - ODM_Write4Byte(pDM_Odm,0x870, ODM_Read4Byte(pDM_Odm,0x870) | BIT(24)| BIT(25) ); // ANTSEL B as HW control - PHY_SetBBReg(priv, 0x864, 0x300, ant); - ODM_Write1Byte(pDM_Odm,0xc58, ODM_Read1Byte(pDM_Odm,0xc58) & (~ BIT(7))); // rx OFDM SW control - } - - ODM_Write1Byte(pDM_Odm,0xa01, ODM_Read1Byte(pDM_Odm,0xa01) & (~ BIT(7))); // rx CCK SW control - ODM_Write4Byte(pDM_Odm,0x80c, ODM_Read4Byte(pDM_Odm,0x80c) & (~ BIT(21))); // select ant by tx desc - ODM_Write4Byte(pDM_Odm,0x858, 0x569a569a); - - priv->pshare->rf_ft_var.antHw_enable = 0; - priv->pshare->rf_ft_var.CurAntenna = (ant%2); - - #ifdef SW_ANT_SWITCH - priv->pshare->rf_ft_var.antSw_enable = 0; - priv->pshare->DM_SWAT_Table.CurAntenna = ant; - priv->pshare->RSSI_test =0; - #endif - } - else if(ant==0){ - - if ( !priv->pshare->rf_ft_var.antSw_select) { - ODM_Write4Byte(pDM_Odm,0x870, ODM_Read4Byte(pDM_Odm,0x870) & ~(BIT(8)| BIT(9)) ); - ODM_Write1Byte(pDM_Odm,0xc50, ODM_Read1Byte(pDM_Odm,0xc50) | BIT(7)); // OFDM HW control - } else { - ODM_Write4Byte(pDM_Odm,0x870, ODM_Read4Byte(pDM_Odm,0x870) & ~(BIT(24)| BIT(25)) ); - ODM_Write1Byte(pDM_Odm,0xc58, ODM_Read1Byte(pDM_Odm,0xc58) | BIT(7)); // OFDM HW control - } - - ODM_Write1Byte(pDM_Odm,0xa01, ODM_Read1Byte(pDM_Odm,0xa01) | BIT(7)); // CCK HW control - ODM_Write4Byte(pDM_Odm,0x80c, ODM_Read4Byte(pDM_Odm,0x80c) | BIT(21) ); // by tx desc - priv->pshare->rf_ft_var.CurAntenna = 0; - ODM_Write4Byte(pDM_Odm,0x858, 0x569a569a); - priv->pshare->rf_ft_var.antHw_enable = 1; -#ifdef SW_ANT_SWITCH - priv->pshare->rf_ft_var.antSw_enable = 0; - priv->pshare->RSSI_test =0; -#endif - } -#ifdef SW_ANT_SWITCH - else if(ant==3) { - if(!priv->pshare->rf_ft_var.antSw_enable) { - - dm_SW_AntennaSwitchInit(priv); - ODM_Write4Byte(pDM_Odm,0x858, 0x569a569a); - priv->pshare->lastTxOkCnt = priv->net_stats.tx_bytes; - priv->pshare->lastRxOkCnt = priv->net_stats.rx_bytes; - } - if ( !priv->pshare->rf_ft_var.antSw_select) - ODM_Write1Byte(pDM_Odm,0xc50, ODM_Read1Byte(pDM_Odm,0xc50) & (~ BIT(7))); // rx OFDM SW control - else - ODM_Write1Byte(pDM_Odm,0xc58, ODM_Read1Byte(pDM_Odm,0xc58) & (~ BIT(7))); // rx OFDM SW control - - ODM_Write1Byte(pDM_Odm,0xa01, ODM_Read1Byte(pDM_Odm,0xa01) & (~ BIT(7))); // rx CCK SW control - ODM_Write4Byte(pDM_Odm,0x80c, ODM_Read4Byte(pDM_Odm,0x80c) & (~ BIT(21))); // select ant by tx desc - priv->pshare->rf_ft_var.antHw_enable = 0; - priv->pshare->rf_ft_var.antSw_enable = 1; - - } -#endif - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("<==============ODM_Diversity_AntennaSelect\n")); - - return 1; -} -#endif - -#else //#if(defined(CONFIG_HW_ANTENNA_DIVERSITY)) - -VOID odm_InitHybridAntDiv( IN PDM_ODM_T pDM_Odm ){} -VOID odm_HwAntDiv( IN PDM_ODM_T pDM_Odm){} -#if(DM_ODM_SUPPORT_TYPE==ODM_WIN) -VOID ODM_SetTxAntByTxInfo_88C_92D( - IN PDM_ODM_T pDM_Odm, - IN pu1Byte pDesc, - IN u1Byte macId -){} -#elif(DM_ODM_SUPPORT_TYPE==ODM_CE) -VOID ODM_SetTxAntByTxInfo_88C_92D( IN PDM_ODM_T pDM_Odm){ } -#elif(DM_ODM_SUPPORT_TYPE==ODM_AP) -VOID ODM_SetTxAntByTxInfo_88C_92D( IN PDM_ODM_T pDM_Odm){ } -#endif - -#endif //#if(defined(CONFIG_HW_ANTENNA_DIVERSITY)) - - //============================================================ //EDCA Turbo //============================================================ -VOID -ODM_EdcaTurboInit( - IN PDM_ODM_T pDM_Odm) -{ -#if ((DM_ODM_SUPPORT_TYPE == ODM_AP)||(DM_ODM_SUPPORT_TYPE==ODM_ADSL)) - odm_EdcaParaInit(pDM_Odm); -#elif (DM_ODM_SUPPORT_TYPE==ODM_WIN) - PADAPTER Adapter = NULL; - HAL_DATA_TYPE *pHalData = NULL; - - if(pDM_Odm->Adapter==NULL) { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("EdcaTurboInit fail!!!\n")); - return; - } - - Adapter=pDM_Odm->Adapter; - pHalData=GET_HAL_DATA(Adapter); - - pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA = FALSE; - pDM_Odm->DM_EDCA_Table.bIsCurRDLState = FALSE; - pHalData->bIsAnyNonBEPkts = FALSE; - -#elif(DM_ODM_SUPPORT_TYPE==ODM_CE) - PADAPTER Adapter = pDM_Odm->Adapter; - pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA = FALSE; - pDM_Odm->DM_EDCA_Table.bIsCurRDLState = FALSE; - Adapter->recvpriv.bIsAnyNonBEPkts =FALSE; - -#endif - ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Orginial VO PARAM: 0x%x\n",ODM_Read4Byte(pDM_Odm,ODM_EDCA_VO_PARAM))); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Orginial VI PARAM: 0x%x\n",ODM_Read4Byte(pDM_Odm,ODM_EDCA_VI_PARAM))); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Orginial BE PARAM: 0x%x\n",ODM_Read4Byte(pDM_Odm,ODM_EDCA_BE_PARAM))); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Orginial BK PARAM: 0x%x\n",ODM_Read4Byte(pDM_Odm,ODM_EDCA_BK_PARAM))); - - -} // ODM_InitEdcaTurbo - -VOID -odm_EdcaTurboCheck( - IN PDM_ODM_T pDM_Odm - ) -{ - // - // For AP/ADSL use prtl8192cd_priv - // For CE/NIC use PADAPTER - // - - // - // 2011/09/29 MH In HW integration first stage, we provide 4 different handle to operate - // at the same time. In the stage2/3, we need to prive universal interface and merge all - // HW dynamic mechanism. - // - ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("odm_EdcaTurboCheck========================>\n")); - - if(!(pDM_Odm->SupportAbility& ODM_MAC_EDCA_TURBO )) - return; - - switch (pDM_Odm->SupportPlatform) - { - case ODM_WIN: - -#if(DM_ODM_SUPPORT_TYPE==ODM_WIN) - odm_EdcaTurboCheckMP(pDM_Odm); -#endif - break; - - case ODM_CE: -#if(DM_ODM_SUPPORT_TYPE==ODM_CE) - odm_EdcaTurboCheckCE(pDM_Odm); -#endif - break; - - case ODM_AP: - case ODM_ADSL: - -#if ((DM_ODM_SUPPORT_TYPE == ODM_AP)||(DM_ODM_SUPPORT_TYPE==ODM_ADSL)) - odm_IotEngine(pDM_Odm); -#endif - break; - } - ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("<========================odm_EdcaTurboCheck\n")); - -} // odm_CheckEdcaTurbo - -#if(DM_ODM_SUPPORT_TYPE==ODM_CE) - - -VOID -odm_EdcaTurboCheckCE( - IN PDM_ODM_T pDM_Odm - ) -{ - -#if(DM_ODM_SUPPORT_TYPE==ODM_CE) - - PADAPTER Adapter = pDM_Odm->Adapter; - u32 EDCA_BE_UL = 0x5ea42b;//Parameter suggested by Scott //edca_setting_UL[pMgntInfo->IOTPeer]; - u32 EDCA_BE_DL = 0x5ea42b;//Parameter suggested by Scott //edca_setting_DL[pMgntInfo->IOTPeer]; - u32 ICType=pDM_Odm->SupportICType; - u32 IOTPeer=0; - u8 WirelessMode=0xFF; //invalid value - u32 trafficIndex; - u32 edca_param; - u64 cur_tx_bytes = 0; - u64 cur_rx_bytes = 0; - u8 bbtchange = _FALSE; - u8 bBiasOnRx = _FALSE; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(Adapter); - struct xmit_priv *pxmitpriv = &(Adapter->xmitpriv); - struct recv_priv *precvpriv = &(Adapter->recvpriv); - struct registry_priv *pregpriv = &Adapter->registrypriv; - struct mlme_ext_priv *pmlmeext = &(Adapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - - if(pDM_Odm->bLinked != _TRUE) - goto dm_CheckEdcaTurbo_EXIT; - - if ((pregpriv->wifi_spec == 1) )//|| (pmlmeinfo->HT_enable == 0)) - { - goto dm_CheckEdcaTurbo_EXIT; - } - - if(pDM_Odm->pWirelessMode!=NULL) - WirelessMode=*(pDM_Odm->pWirelessMode); - - IOTPeer = pmlmeinfo->assoc_AP_vendor; - - if (IOTPeer >= HT_IOT_PEER_MAX) - { - goto dm_CheckEdcaTurbo_EXIT; - } - - if( (pDM_Odm->SupportICType == ODM_RTL8192C) || - (pDM_Odm->SupportICType == ODM_RTL8723A) || - (pDM_Odm->SupportICType == ODM_RTL8188E)) - { - if((IOTPeer == HT_IOT_PEER_RALINK)||(IOTPeer == HT_IOT_PEER_ATHEROS)) - bBiasOnRx = _TRUE; - } - - // Check if the status needs to be changed. - if((bbtchange) || (!precvpriv->bIsAnyNonBEPkts) ) - { - cur_tx_bytes = pdvobjpriv->traffic_stat.cur_tx_bytes; - cur_rx_bytes = pdvobjpriv->traffic_stat.cur_rx_bytes; - - //traffic, TX or RX - if(bBiasOnRx) - { - if (cur_tx_bytes > (cur_rx_bytes << 2)) - { // Uplink TP is present. - trafficIndex = UP_LINK; - } - else - { // Balance TP is present. - trafficIndex = DOWN_LINK; - } - } - else - { - if (cur_rx_bytes > (cur_tx_bytes << 2)) - { // Downlink TP is present. - trafficIndex = DOWN_LINK; - } - else - { // Balance TP is present. - trafficIndex = UP_LINK; - } - } - - //if ((pDM_Odm->DM_EDCA_Table.prv_traffic_idx != trafficIndex) || (!pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA)) - { - if(ICType==ODM_RTL8192D) - { - // Single PHY - if(pDM_Odm->RFType==ODM_2T2R) - { - EDCA_BE_UL = 0x60a42b; //0x5ea42b; - EDCA_BE_DL = 0x60a42b; //0x5ea42b; - } - else - { - EDCA_BE_UL = 0x6ea42b; - EDCA_BE_DL = 0x6ea42b; - } - } - else - { - if(pDM_Odm->SupportInterface==ODM_ITRF_PCIE) { - if((ICType==ODM_RTL8192C)&&(pDM_Odm->RFType==ODM_2T2R)) { - EDCA_BE_UL = 0x60a42b; - EDCA_BE_DL = 0x60a42b; - } - else - { - EDCA_BE_UL = 0x6ea42b; - EDCA_BE_DL = 0x6ea42b; - } - } - } - - //92D txop can't be set to 0x3e for cisco1250 - if((ICType!=ODM_RTL8192D) && (IOTPeer== HT_IOT_PEER_CISCO) &&(WirelessMode==ODM_WM_N24G)) - { - EDCA_BE_DL = edca_setting_DL[IOTPeer]; - EDCA_BE_UL = edca_setting_UL[IOTPeer]; - } - //merge from 92s_92c_merge temp brunch v2445 20120215 - else if((IOTPeer == HT_IOT_PEER_CISCO) &&((WirelessMode==ODM_WM_G)||(WirelessMode==(ODM_WM_B|ODM_WM_G))||(WirelessMode==ODM_WM_A)||(WirelessMode==ODM_WM_B))) - { - EDCA_BE_DL = edca_setting_DL_GMode[IOTPeer]; - } - else if((IOTPeer== HT_IOT_PEER_AIRGO )&& ((WirelessMode==ODM_WM_G)||(WirelessMode==ODM_WM_A))) - { - EDCA_BE_DL = 0xa630; - } - else if(IOTPeer == HT_IOT_PEER_MARVELL) - { - EDCA_BE_DL = edca_setting_DL[IOTPeer]; - EDCA_BE_UL = edca_setting_UL[IOTPeer]; - } - else if(IOTPeer == HT_IOT_PEER_ATHEROS) - { - // Set DL EDCA for Atheros peer to 0x3ea42b. Suggested by SD3 Wilson for ASUS TP issue. - EDCA_BE_DL = edca_setting_DL[IOTPeer]; - } - - if((ICType==ODM_RTL8812)||(ICType==ODM_RTL8821)||(ICType==ODM_RTL8192E)) //add 8812AU/8812AE - { - EDCA_BE_UL = 0x5ea42b; - EDCA_BE_DL = 0x5ea42b; - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("8812A: EDCA_BE_UL=0x%x EDCA_BE_DL =0x%x",EDCA_BE_UL,EDCA_BE_DL)); - } - - if (trafficIndex == DOWN_LINK) - edca_param = EDCA_BE_DL; - else - edca_param = EDCA_BE_UL; - - rtw_write32(Adapter, REG_EDCA_BE_PARAM, edca_param); - - pDM_Odm->DM_EDCA_Table.prv_traffic_idx = trafficIndex; - } - - pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA = _TRUE; - } - else - { - // - // Turn Off EDCA turbo here. - // Restore original EDCA according to the declaration of AP. - // - if(pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA) - { - rtw_write32(Adapter, REG_EDCA_BE_PARAM, pHalData->AcParam_BE); - pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA = _FALSE; - } - } - -dm_CheckEdcaTurbo_EXIT: - // Set variables for next time. - precvpriv->bIsAnyNonBEPkts = _FALSE; -#endif -} - - -#elif(DM_ODM_SUPPORT_TYPE==ODM_WIN) -VOID -odm_EdcaTurboCheckMP( - IN PDM_ODM_T pDM_Odm - ) -{ - - - PADAPTER Adapter = pDM_Odm->Adapter; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - - PADAPTER pDefaultAdapter = GetDefaultAdapter(Adapter); - PADAPTER pExtAdapter = GetFirstExtAdapter(Adapter);//NULL; - PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; - PSTA_QOS pStaQos = Adapter->MgntInfo.pStaQos; - //[Win7 Count Tx/Rx statistic for Extension Port] odm_CheckEdcaTurbo's Adapter is always Default. 2009.08.20, by Bohn - u8Byte Ext_curTxOkCnt = 0; - u8Byte Ext_curRxOkCnt = 0; - //For future Win7 Enable Default Port to modify AMPDU size dynamically, 2009.08.20, Bohn. - u1Byte TwoPortStatus = (u1Byte)TWO_PORT_STATUS__WITHOUT_ANY_ASSOCIATE; - - // Keep past Tx/Rx packet count for RT-to-RT EDCA turbo. - u8Byte curTxOkCnt = 0; - u8Byte curRxOkCnt = 0; - u4Byte EDCA_BE_UL = 0x5ea42b;//Parameter suggested by Scott //edca_setting_UL[pMgntInfo->IOTPeer]; - u4Byte EDCA_BE_DL = 0x5ea42b;//Parameter suggested by Scott //edca_setting_DL[pMgntInfo->IOTPeer]; - u4Byte EDCA_BE = 0x5ea42b; - u1Byte IOTPeer=0; - BOOLEAN *pbIsCurRDLState=NULL; - BOOLEAN bLastIsCurRDLState=FALSE; - BOOLEAN bBiasOnRx=FALSE; - BOOLEAN bEdcaTurboOn=FALSE; - u1Byte TxRate = 0xFF; - u8Byte value64; - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("odm_EdcaTurboCheckMP========================>")); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Orginial BE PARAM: 0x%x\n",ODM_Read4Byte(pDM_Odm,ODM_EDCA_BE_PARAM))); - -////=============================== -////list paramter for different platform -////=============================== - bLastIsCurRDLState=pDM_Odm->DM_EDCA_Table.bIsCurRDLState; - pbIsCurRDLState=&(pDM_Odm->DM_EDCA_Table.bIsCurRDLState); - - //2012/09/14 MH Add - if (pMgntInfo->NumNonBePkt > pMgntInfo->RegEdcaThresh && !Adapter->MgntInfo.bWiFiConfg) - pHalData->bIsAnyNonBEPkts = TRUE; - - pMgntInfo->NumNonBePkt = 0; - - // Caculate TX/RX TP: - //curTxOkCnt = Adapter->TxStats.NumTxBytesUnicast - pMgntInfo->lastTxOkCnt; - //curRxOkCnt = Adapter->RxStats.NumRxBytesUnicast - pMgntInfo->lastRxOkCnt; - curTxOkCnt = Adapter->TxStats.NumTxBytesUnicast - pDM_Odm->lastTxOkCnt; - curRxOkCnt = Adapter->RxStats.NumRxBytesUnicast - pDM_Odm->lastRxOkCnt; - pDM_Odm->lastTxOkCnt = Adapter->TxStats.NumTxBytesUnicast; - pDM_Odm->lastRxOkCnt = Adapter->RxStats.NumRxBytesUnicast; - - if(pExtAdapter == NULL) - pExtAdapter = pDefaultAdapter; - - Ext_curTxOkCnt = pExtAdapter->TxStats.NumTxBytesUnicast - pMgntInfo->Ext_lastTxOkCnt; - Ext_curRxOkCnt = pExtAdapter->RxStats.NumRxBytesUnicast - pMgntInfo->Ext_lastRxOkCnt; - GetTwoPortSharedResource(Adapter,TWO_PORT_SHARED_OBJECT__STATUS,NULL,&TwoPortStatus); - //For future Win7 Enable Default Port to modify AMPDU size dynamically, 2009.08.20, Bohn. - if(TwoPortStatus == TWO_PORT_STATUS__EXTENSION_ONLY) - { - curTxOkCnt = Ext_curTxOkCnt ; - curRxOkCnt = Ext_curRxOkCnt ; - } - // - IOTPeer=pMgntInfo->IOTPeer; - bBiasOnRx=(pMgntInfo->IOTAction & HT_IOT_ACT_EDCA_BIAS_ON_RX)?TRUE:FALSE; - bEdcaTurboOn=((!pHalData->bIsAnyNonBEPkts) && (!pMgntInfo->bDisableFrameBursting))?TRUE:FALSE; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("bIsAnyNonBEPkts : 0x%lx bDisableFrameBursting : 0x%lx \n",pHalData->bIsAnyNonBEPkts,pMgntInfo->bDisableFrameBursting)); - - -////=============================== -////check if edca turbo is disabled -////=============================== - if(odm_IsEdcaTurboDisable(pDM_Odm)) - goto dm_CheckEdcaTurbo_EXIT; - - -////=============================== -////remove iot case out -////=============================== - ODM_EdcaParaSelByIot(pDM_Odm, &EDCA_BE_UL, &EDCA_BE_DL); - - -////=============================== -////Check if the status needs to be changed. -////=============================== - if(bEdcaTurboOn) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("bEdcaTurboOn : 0x%x bBiasOnRx : 0x%x\n",bEdcaTurboOn,bBiasOnRx)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("curTxOkCnt : 0x%lx \n",curTxOkCnt)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("curRxOkCnt : 0x%lx \n",curRxOkCnt)); - if(bBiasOnRx) - odm_EdcaChooseTrafficIdx(pDM_Odm,curTxOkCnt, curRxOkCnt, TRUE, pbIsCurRDLState); - else - odm_EdcaChooseTrafficIdx(pDM_Odm,curTxOkCnt, curRxOkCnt, FALSE, pbIsCurRDLState); - -//modify by Guo.Mingzhi 2011-12-29 - EDCA_BE=((*pbIsCurRDLState)==TRUE)?EDCA_BE_DL:EDCA_BE_UL; - if(IS_HARDWARE_TYPE_8821U(Adapter)) - { - if(pMgntInfo->RegTxDutyEnable) - { - //2013.01.23 LukeLee: debug for 8811AU thermal issue (reduce Tx duty cycle) - if(!pMgntInfo->ForcedDataRate) //auto rate - { - if(pDM_Odm->TxRate != 0xFF) - TxRate = Adapter->HalFunc.GetHwRateFromMRateHandler(pDM_Odm->TxRate); - } - else //force rate - { - TxRate = (u1Byte) pMgntInfo->ForcedDataRate; - } - - value64 = (curRxOkCnt<<2); - if(curTxOkCnt < value64) //Downlink - ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,EDCA_BE); - else //Uplink - { - //DbgPrint("pDM_Odm->RFCalibrateInfo.ThermalValue = 0x%X\n", pDM_Odm->RFCalibrateInfo.ThermalValue); - //if(pDM_Odm->RFCalibrateInfo.ThermalValue < pHalData->EEPROMThermalMeter) - if((pDM_Odm->RFCalibrateInfo.ThermalValue < 0x2c) || (*pDM_Odm->pBandType == BAND_ON_2_4G)) - ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,EDCA_BE); - else - { - switch (TxRate) - { - case MGN_VHT1SS_MCS6: - case MGN_VHT1SS_MCS5: - case MGN_MCS6: - case MGN_MCS5: - case MGN_48M: - case MGN_54M: - ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0x1ea42b); - break; - case MGN_VHT1SS_MCS4: - case MGN_MCS4: - case MGN_36M: - ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0xa42b); - break; - case MGN_VHT1SS_MCS3: - case MGN_MCS3: - case MGN_24M: - ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0xa47f); - break; - case MGN_VHT1SS_MCS2: - case MGN_MCS2: - case MGN_18M: - ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0xa57f); - break; - case MGN_VHT1SS_MCS1: - case MGN_MCS1: - case MGN_9M: - case MGN_12M: - ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0xa77f); - break; - case MGN_VHT1SS_MCS0: - case MGN_MCS0: - case MGN_6M: - ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0xa87f); - break; - default: - ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,EDCA_BE); - break; - } - } - } - } - else - { - ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,EDCA_BE); - } - - } - else if (IS_HARDWARE_TYPE_8812AU(Adapter)){ - if(pMgntInfo->RegTxDutyEnable) - { - //2013.07.26 Wilson: debug for 8812AU thermal issue (reduce Tx duty cycle) - // it;s the same issue as 8811AU - if(!pMgntInfo->ForcedDataRate) //auto rate - { - if(pDM_Odm->TxRate != 0xFF) - TxRate = Adapter->HalFunc.GetHwRateFromMRateHandler(pDM_Odm->TxRate); - } - else //force rate - { - TxRate = (u1Byte) pMgntInfo->ForcedDataRate; - } - - value64 = (curRxOkCnt<<2); - if(curTxOkCnt < value64) //Downlink - ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,EDCA_BE); - else //Uplink - { - //DbgPrint("pDM_Odm->RFCalibrateInfo.ThermalValue = 0x%X\n", pDM_Odm->RFCalibrateInfo.ThermalValue); - //if(pDM_Odm->RFCalibrateInfo.ThermalValue < pHalData->EEPROMThermalMeter) - if((pDM_Odm->RFCalibrateInfo.ThermalValue < 0x2c) || (*pDM_Odm->pBandType == BAND_ON_2_4G)) - ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,EDCA_BE); - else - { - switch (TxRate) - { - case MGN_VHT2SS_MCS9: - case MGN_VHT1SS_MCS9: - case MGN_VHT1SS_MCS8: - case MGN_MCS15: - case MGN_MCS7: - ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0x1ea44f); - case MGN_VHT2SS_MCS8: - case MGN_VHT1SS_MCS7: - case MGN_MCS14: - case MGN_MCS6: - case MGN_54M: - ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0xa44f); - case MGN_VHT2SS_MCS7: - case MGN_VHT2SS_MCS6: - case MGN_VHT1SS_MCS6: - case MGN_VHT1SS_MCS5: - case MGN_MCS13: - case MGN_MCS5: - case MGN_48M: - ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0xa630); - break; - case MGN_VHT2SS_MCS5: - case MGN_VHT2SS_MCS4: - case MGN_VHT1SS_MCS4: - case MGN_VHT1SS_MCS3: - case MGN_MCS12: - case MGN_MCS4: - case MGN_MCS3: - case MGN_36M: - case MGN_24M: - ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0xa730); - break; - case MGN_VHT2SS_MCS3: - case MGN_VHT2SS_MCS2: - case MGN_VHT2SS_MCS1: - case MGN_VHT1SS_MCS2: - case MGN_VHT1SS_MCS1: - case MGN_MCS11: - case MGN_MCS10: - case MGN_MCS9: - case MGN_MCS2: - case MGN_MCS1: - case MGN_18M: - case MGN_12M: - ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0xa830); - break; - case MGN_VHT2SS_MCS0: - case MGN_VHT1SS_MCS0: - case MGN_MCS0: - case MGN_MCS8: - case MGN_9M: - case MGN_6M: - ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0xa87f); - break; - default: - ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,EDCA_BE); - break; - } - } - } - } - else - { - ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,EDCA_BE); - } - } - else - ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,EDCA_BE); - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("EDCA Turbo on: EDCA_BE:0x%lx\n",EDCA_BE)); - - pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA = TRUE; - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("EDCA_BE_DL : 0x%lx EDCA_BE_UL : 0x%lx EDCA_BE : 0x%lx \n",EDCA_BE_DL,EDCA_BE_UL,EDCA_BE)); - - } - else - { - // Turn Off EDCA turbo here. - // Restore original EDCA according to the declaration of AP. - if(pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA) - { - Adapter->HalFunc.SetHwRegHandler(Adapter, HW_VAR_AC_PARAM, GET_WMM_PARAM_ELE_SINGLE_AC_PARAM(pStaQos->WMMParamEle, AC0_BE) ); - - pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA = FALSE; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Restore EDCA BE: 0x%lx \n",pDM_Odm->WMMEDCA_BE)); - - } - } - -////=============================== -////Set variables for next time. -////=============================== -dm_CheckEdcaTurbo_EXIT: -#if (DM_ODM_SUPPORT_TYPE==ODM_WIN) - pHalData->bIsAnyNonBEPkts = FALSE; - pMgntInfo->lastTxOkCnt = Adapter->TxStats.NumTxBytesUnicast; - pMgntInfo->lastRxOkCnt = Adapter->RxStats.NumRxBytesUnicast; - pMgntInfo->Ext_lastTxOkCnt = pExtAdapter->TxStats.NumTxBytesUnicast; - pMgntInfo->Ext_lastRxOkCnt = pExtAdapter->RxStats.NumRxBytesUnicast; -#elif (DM_ODM_SUPPORT_TYPE==ODM_CE) - precvpriv->bIsAnyNonBEPkts = FALSE; - pxmitpriv->last_tx_bytes = pxmitpriv->tx_bytes; - precvpriv->last_rx_bytes = precvpriv->rx_bytes; -#endif - -} - - -//check if edca turbo is disabled -BOOLEAN -odm_IsEdcaTurboDisable( - IN PDM_ODM_T pDM_Odm -) -{ - PADAPTER Adapter = pDM_Odm->Adapter; - -#if(DM_ODM_SUPPORT_TYPE==ODM_WIN) - PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; - u4Byte IOTPeer=pMgntInfo->IOTPeer; -#elif (DM_ODM_SUPPORT_TYPE==ODM_CE) - struct registry_priv *pregpriv = &Adapter->registrypriv; - struct mlme_ext_priv *pmlmeext = &(Adapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - u4Byte IOTPeer=pmlmeinfo->assoc_AP_vendor; - u1Byte WirelessMode=0xFF; //invalid value - - if(pDM_Odm->pWirelessMode!=NULL) - WirelessMode=*(pDM_Odm->pWirelessMode); - -#endif - - if(pDM_Odm->bBtDisableEdcaTurbo) - { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD, ("EdcaTurboDisable for BT!!\n")); - return TRUE; - } - - if((!(pDM_Odm->SupportAbility& ODM_MAC_EDCA_TURBO ))|| - (pDM_Odm->bWIFITest)|| - (IOTPeer>= HT_IOT_PEER_MAX)) - { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD, ("EdcaTurboDisable\n")); - return TRUE; - } - - -#if (DM_ODM_SUPPORT_TYPE ==ODM_WIN) - // 1. We do not turn on EDCA turbo mode for some AP that has IOT issue - // 2. User may disable EDCA Turbo mode with OID settings. - if(pMgntInfo->IOTAction & HT_IOT_ACT_DISABLE_EDCA_TURBO){ - ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD, ("IOTAction:EdcaTurboDisable\n")); - return TRUE; - } - -#elif(DM_ODM_SUPPORT_TYPE==ODM_CE) - //suggested by Jr.Luke: open TXOP for B/G/BG/A mode 2012-0215 - if((WirelessMode==ODM_WM_B)||(WirelessMode==(ODM_WM_B|ODM_WM_G)||(WirelessMode==ODM_WM_G)||(WirelessMode=ODM_WM_A)) - ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, ODM_Read4Byte(pDM_Odm, ODM_EDCA_BE_PARAM)|0x5E0000); - - if(pDM_Odm->SupportICType==ODM_RTL8192D) { - if ((pregpriv->wifi_spec == 1) || (pmlmeext->cur_wireless_mode == WIRELESS_11B)) { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD, ("92D:EdcaTurboDisable\n")); - return TRUE; - } - } - else - { - if((pregpriv->wifi_spec == 1) || (pmlmeinfo->HT_enable == 0)){ - ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD, ("Others:EdcaTurboDisable\n")); - return TRUE; - } - } - -#endif - - return FALSE; - - -} - -//add iot case here: for MP/CE -VOID -ODM_EdcaParaSelByIot( - IN PDM_ODM_T pDM_Odm, - OUT u4Byte *EDCA_BE_UL, - OUT u4Byte *EDCA_BE_DL - ) -{ - - PADAPTER Adapter = pDM_Odm->Adapter; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - u4Byte IOTPeer=0; - u4Byte ICType=pDM_Odm->SupportICType; - u1Byte WirelessMode=0xFF; //invalid value - u4Byte RFType=pDM_Odm->RFType; - u4Byte IOTPeerSubType=0; - -#if(DM_ODM_SUPPORT_TYPE==ODM_WIN) - PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; - u1Byte TwoPortStatus = (u1Byte)TWO_PORT_STATUS__WITHOUT_ANY_ASSOCIATE; - -#elif(DM_ODM_SUPPORT_TYPE==ODM_CE) - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - #ifdef CONFIG_BT_COEXIST - struct btcoexist_priv *pbtpriv = &(pHalData->bt_coexist); - #endif - u1Byte bbtchange =FALSE; -#endif - - if(pDM_Odm->pWirelessMode!=NULL) - WirelessMode=*(pDM_Odm->pWirelessMode); - -/////////////////////////////////////////////////////////// -////list paramter for different platform -#if (DM_ODM_SUPPORT_TYPE==ODM_WIN) - IOTPeer=pMgntInfo->IOTPeer; - IOTPeerSubType=pMgntInfo->IOTPeerSubtype; - GetTwoPortSharedResource(Adapter,TWO_PORT_SHARED_OBJECT__STATUS,NULL,&TwoPortStatus); - -#elif(DM_ODM_SUPPORT_TYPE==ODM_CE) - IOTPeer=pmlmeinfo->assoc_AP_vendor; - #ifdef CONFIG_BT_COEXIST - if(pbtpriv->BT_Coexist) - { - if( (pbtpriv->BT_EDCA[UP_LINK]!=0) || (pbtpriv->BT_EDCA[DOWN_LINK]!=0)) - bbtchange = TRUE; - } - #endif - -#endif - - if(ICType==ODM_RTL8192D) - { - // Single PHY - if(pDM_Odm->RFType==ODM_2T2R) - { - (*EDCA_BE_UL) = 0x60a42b; //0x5ea42b; - (*EDCA_BE_DL) = 0x60a42b; //0x5ea42b; - - } - else - { - (*EDCA_BE_UL) = 0x6ea42b; - (*EDCA_BE_DL) = 0x6ea42b; - } - - } -////============================ -/// IOT case for MP -////============================ -#if (DM_ODM_SUPPORT_TYPE==ODM_WIN) - else - { - - if(pDM_Odm->SupportInterface==ODM_ITRF_PCIE){ - if((ICType==ODM_RTL8192C)&&(pDM_Odm->RFType==ODM_2T2R)) { - (*EDCA_BE_UL) = 0x60a42b; - (*EDCA_BE_DL) = 0x60a42b; - } - else - { - (*EDCA_BE_UL) = 0x6ea42b; - (*EDCA_BE_DL) = 0x6ea42b; - } - } - } - - if(TwoPortStatus == TWO_PORT_STATUS__EXTENSION_ONLY) - { - (*EDCA_BE_UL) = 0x5ea42b;//Parameter suggested by Scott //edca_setting_UL[ExtAdapter->MgntInfo.IOTPeer]; - (*EDCA_BE_DL) = 0x5ea42b;//Parameter suggested by Scott //edca_setting_DL[ExtAdapter->MgntInfo.IOTPeer]; - } - - #if (INTEL_PROXIMITY_SUPPORT == 1) - if(pMgntInfo->IntelClassModeInfo.bEnableCA == TRUE) - { - (*EDCA_BE_UL) = (*EDCA_BE_DL) = 0xa44f; - } - else - #endif - { - if((!pMgntInfo->bDisableFrameBursting) && - (pMgntInfo->IOTAction & (HT_IOT_ACT_FORCED_ENABLE_BE_TXOP|HT_IOT_ACT_AMSDU_ENABLE))) - {// To check whether we shall force turn on TXOP configuration. - if(!((*EDCA_BE_UL) & 0xffff0000)) - (*EDCA_BE_UL) |= 0x005e0000; // Force TxOP limit to 0x005e for UL. - if(!((*EDCA_BE_DL) & 0xffff0000)) - (*EDCA_BE_DL) |= 0x005e0000; // Force TxOP limit to 0x005e for DL. - } - - //92D txop can't be set to 0x3e for cisco1250 - if((ICType!=ODM_RTL8192D) && (IOTPeer== HT_IOT_PEER_CISCO) &&(WirelessMode==ODM_WM_N24G)) - { - (*EDCA_BE_DL) = edca_setting_DL[IOTPeer]; - (*EDCA_BE_UL) = edca_setting_UL[IOTPeer]; - } - //merge from 92s_92c_merge temp brunch v2445 20120215 - else if((IOTPeer == HT_IOT_PEER_CISCO) &&((WirelessMode==ODM_WM_G)||(WirelessMode==(ODM_WM_B|ODM_WM_G))||(WirelessMode==ODM_WM_A)||(WirelessMode==ODM_WM_B))) - { - (*EDCA_BE_DL) = edca_setting_DL_GMode[IOTPeer]; - } - else if((IOTPeer== HT_IOT_PEER_AIRGO )&& ((WirelessMode==ODM_WM_G)||(WirelessMode==ODM_WM_A))) - { - (*EDCA_BE_DL) = 0xa630; - } - - else if(IOTPeer == HT_IOT_PEER_MARVELL) - { - (*EDCA_BE_DL) = edca_setting_DL[IOTPeer]; - (*EDCA_BE_UL) = edca_setting_UL[IOTPeer]; - } - else if(IOTPeer == HT_IOT_PEER_ATHEROS) - { - // Set DL EDCA for Atheros peer to 0x3ea42b. Suggested by SD3 Wilson for ASUS TP issue. - (*EDCA_BE_DL) = edca_setting_DL[IOTPeer]; - - if(ICType == ODM_RTL8821) - (*EDCA_BE_DL) = 0x5ea630; - - } - } - - if((ICType == ODM_RTL8192D)&&(IOTPeerSubType == HT_IOT_PEER_LINKSYS_E4200_V1)&&((WirelessMode==ODM_WM_N5G))) - { - (*EDCA_BE_DL) = 0x432b; - (*EDCA_BE_UL) = 0x432b; - } - - - - if((ICType==ODM_RTL8812)||(ICType==ODM_RTL8192E)) //add 8812AU/8812AE - { - (*EDCA_BE_UL) = 0x5ea42b; - (*EDCA_BE_DL) = 0x5ea42b; - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("8812A: EDCA_BE_UL=0x%lx EDCA_BE_DL =0x%lx",(*EDCA_BE_UL),(*EDCA_BE_DL))); - } - - // Revised for Atheros DIR-655 IOT issue to improve down link TP, added by Roger, 2013.03.22. - if((ICType == ODM_RTL8723A) && (IOTPeerSubType== HT_IOT_PEER_ATHEROS_DIR655) && - (pMgntInfo->dot11CurrentChannelNumber == 6)) - { - (*EDCA_BE_DL) = 0xa92b; - } - -////============================ -/// IOT case for CE -////============================ -#elif (DM_ODM_SUPPORT_TYPE==ODM_CE) - - if(RFType==ODM_RTL8192D) - { - if((IOTPeer == HT_IOT_PEER_CISCO) &&(WirelessMode==ODM_WM_N24G)) - { - (*EDCA_BE_UL) = EDCAParam[IOTPeer][UP_LINK]; - (*EDCA_BE_DL)=EDCAParam[IOTPeer][DOWN_LINK]; - } - else if((IOTPeer == HT_IOT_PEER_AIRGO) && - ((WirelessMode==ODM_WM_B)||(WirelessMode==(ODM_WM_B|ODM_WM_G)))) - (*EDCA_BE_DL)=0x00a630; - - else if((IOTPeer== HT_IOT_PEER_ATHEROS) && - (WirelessMode&ODM_WM_N5G) && - (Adapter->securitypriv.dot11PrivacyAlgrthm == _AES_ )) - (*EDCA_BE_DL)=0xa42b; - - } - //92C IOT case: - else - { - #ifdef CONFIG_BT_COEXIST - if(bbtchange) - { - (*EDCA_BE_UL) = pbtpriv->BT_EDCA[UP_LINK]; - (*EDCA_BE_DL) = pbtpriv->BT_EDCA[DOWN_LINK]; - } - else - #endif - { - if((IOTPeer == HT_IOT_PEER_CISCO) &&(WirelessMode==ODM_WM_N24G)) - { - (*EDCA_BE_UL) = EDCAParam[IOTPeer][UP_LINK]; - (*EDCA_BE_DL)=EDCAParam[IOTPeer][DOWN_LINK]; - } - else - { - (*EDCA_BE_UL)=EDCAParam[HT_IOT_PEER_UNKNOWN][UP_LINK]; - (*EDCA_BE_DL)=EDCAParam[HT_IOT_PEER_UNKNOWN][DOWN_LINK]; - } - } - if(pDM_Odm->SupportInterface==ODM_ITRF_PCIE){ - if((ICType==ODM_RTL8192C)&&(pDM_Odm->RFType==ODM_2T2R)) - { - (*EDCA_BE_UL) = 0x60a42b; - (*EDCA_BE_DL) = 0x60a42b; - } - else - { - (*EDCA_BE_UL) = 0x6ea42b; - (*EDCA_BE_DL) = 0x6ea42b; - } - } - - } -#endif - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Special: EDCA_BE_UL=0x%lx EDCA_BE_DL =0x%lx",(*EDCA_BE_UL),(*EDCA_BE_DL))); - -} - - -VOID -odm_EdcaChooseTrafficIdx( - IN PDM_ODM_T pDM_Odm, - IN u8Byte cur_tx_bytes, - IN u8Byte cur_rx_bytes, - IN BOOLEAN bBiasOnRx, - OUT BOOLEAN *pbIsCurRDLState - ) -{ - - - if(bBiasOnRx) - { - - if(cur_tx_bytes>(cur_rx_bytes*4)) - { - *pbIsCurRDLState=FALSE; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Uplink Traffic\n ")); - - } - else - { - *pbIsCurRDLState=TRUE; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Balance Traffic\n")); - - } - } - else - { - if(cur_rx_bytes>(cur_tx_bytes*4)) - { - *pbIsCurRDLState=TRUE; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Downlink Traffic\n")); - - } - else - { - *pbIsCurRDLState=FALSE; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Balance Traffic\n")); - } - } - - return ; -} - -#endif - -#if((DM_ODM_SUPPORT_TYPE==ODM_AP)||(DM_ODM_SUPPORT_TYPE==ODM_ADSL)) - -void odm_EdcaParaInit( - IN PDM_ODM_T pDM_Odm - ) -{ - prtl8192cd_priv priv = pDM_Odm->priv; - int mode=priv->pmib->dot11BssType.net_work_type; - - static unsigned int slot_time, VO_TXOP, VI_TXOP, sifs_time; - struct ParaRecord EDCA[4]; - - memset(EDCA, 0, 4*sizeof(struct ParaRecord)); - - sifs_time = 10; - slot_time = 20; - - if (mode & (ODM_WM_N24G|ODM_WM_N5G)) - sifs_time = 16; - - if (mode & (ODM_WM_N24G|ODM_WM_N5G| ODM_WM_G|ODM_WM_A)) - slot_time = 9; - - -#if((defined(RTL_MANUAL_EDCA))&&(DM_ODM_SUPPORT_TYPE==ODM_AP)) - if( priv->pmib->dot11QosEntry.ManualEDCA ) { - if( OPMODE & WIFI_AP_STATE ) - memcpy(EDCA, priv->pmib->dot11QosEntry.AP_manualEDCA, 4*sizeof(struct ParaRecord)); - else - memcpy(EDCA, priv->pmib->dot11QosEntry.STA_manualEDCA, 4*sizeof(struct ParaRecord)); - - #ifdef WIFI_WMM - if (QOS_ENABLE) - ODM_Write4Byte(pDM_Odm, ODM_EDCA_VI_PARAM, (EDCA[VI].TXOPlimit<< 16) | (EDCA[VI].ECWmax<< 12) | (EDCA[VI].ECWmin<< 8) | (sifs_time + EDCA[VI].AIFSN* slot_time)); - else - #endif - ODM_Write4Byte(pDM_Odm, ODM_EDCA_VI_PARAM, (EDCA[BE].TXOPlimit<< 16) | (EDCA[BE].ECWmax<< 12) | (EDCA[BE].ECWmin<< 8) | (sifs_time + EDCA[VI].AIFSN* slot_time)); - - }else - #endif //RTL_MANUAL_EDCA - { - - if(OPMODE & WIFI_AP_STATE) - { - memcpy(EDCA, rtl_ap_EDCA, 2*sizeof(struct ParaRecord)); - - if(mode & (ODM_WM_A|ODM_WM_G|ODM_WM_N24G|ODM_WM_N5G)) - memcpy(&EDCA[VI], &rtl_ap_EDCA[VI_AG], 2*sizeof(struct ParaRecord)); - else - memcpy(&EDCA[VI], &rtl_ap_EDCA[VI], 2*sizeof(struct ParaRecord)); - } - else - { - memcpy(EDCA, rtl_sta_EDCA, 2*sizeof(struct ParaRecord)); - - if(mode & (ODM_WM_A|ODM_WM_G|ODM_WM_N24G|ODM_WM_N5G)) - memcpy(&EDCA[VI], &rtl_sta_EDCA[VI_AG], 2*sizeof(struct ParaRecord)); - else - memcpy(&EDCA[VI], &rtl_sta_EDCA[VI], 2*sizeof(struct ParaRecord)); - } - - #ifdef WIFI_WMM - if (QOS_ENABLE) - ODM_Write4Byte(pDM_Odm, ODM_EDCA_VI_PARAM, (EDCA[VI].TXOPlimit<< 16) | (EDCA[VI].ECWmax<< 12) | (EDCA[VI].ECWmin<< 8) | (sifs_time + EDCA[VI].AIFSN* slot_time)); - else - #endif - -#if (DM_ODM_SUPPORT_TYPE==ODM_AP) - ODM_Write4Byte(pDM_Odm, ODM_EDCA_VI_PARAM, (EDCA[BK].ECWmax<< 12) | (EDCA[BK].ECWmin<< 8) | (sifs_time + EDCA[VI].AIFSN* slot_time)); -#elif(DM_ODM_SUPPORT_TYPE==ODM_ADSL) - ODM_Write4Byte(pDM_Odm, ODM_EDCA_VI_PARAM, (EDCA[BK].ECWmax<< 12) | (EDCA[BK].ECWmin<< 8) | (sifs_time + 2* slot_time)); -#endif - - - } - - ODM_Write4Byte(pDM_Odm, ODM_EDCA_VO_PARAM, (EDCA[VO].TXOPlimit<< 16) | (EDCA[VO].ECWmax<< 12) | (EDCA[VO].ECWmin<< 8) | (sifs_time + EDCA[VO].AIFSN* slot_time)); - ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (EDCA[BE].TXOPlimit<< 16) | (EDCA[BE].ECWmax<< 12) | (EDCA[BE].ECWmin<< 8) | (sifs_time + EDCA[BE].AIFSN* slot_time)); - ODM_Write4Byte(pDM_Odm, ODM_EDCA_BK_PARAM, (EDCA[BK].TXOPlimit<< 16) | (EDCA[BK].ECWmax<< 12) | (EDCA[BK].ECWmin<< 8) | (sifs_time + EDCA[BK].AIFSN* slot_time)); -// ODM_Write1Byte(pDM_Odm,ACMHWCTRL, 0x00); - - priv->pshare->iot_mode_enable = 0; -#if(DM_ODM_SUPPORT_TYPE==ODM_AP) - if (priv->pshare->rf_ft_var.wifi_beq_iot) - priv->pshare->iot_mode_VI_exist = 0; - - #ifdef WMM_VIBE_PRI - priv->pshare->iot_mode_BE_exist = 0; - #endif - - #ifdef LOW_TP_TXOP - priv->pshare->BE_cwmax_enhance = 0; - #endif - -#elif (DM_ODM_SUPPORT_TYPE==ODM_ADSL) - priv->pshare->iot_mode_BE_exist = 0; -#endif - priv->pshare->iot_mode_VO_exist = 0; -} - -BOOLEAN -ODM_ChooseIotMainSTA( - IN PDM_ODM_T pDM_Odm, - IN PSTA_INFO_T pstat - ) -{ - prtl8192cd_priv priv = pDM_Odm->priv; - BOOLEAN bhighTP_found_pstat=FALSE; - - if ((GET_ROOT(priv)->up_time % 2) == 0) { - unsigned int tx_2s_avg = 0; - unsigned int rx_2s_avg = 0; - int i=0, aggReady=0; - unsigned long total_sum = (priv->pshare->current_tx_bytes+priv->pshare->current_rx_bytes); - - pstat->current_tx_bytes += pstat->tx_byte_cnt; - pstat->current_rx_bytes += pstat->rx_byte_cnt; - - if (total_sum != 0) { - if (total_sum <= 100) { - tx_2s_avg = (unsigned int)((pstat->current_tx_bytes*100) / total_sum); - rx_2s_avg = (unsigned int)((pstat->current_rx_bytes*100) / total_sum); - } else { - tx_2s_avg = (unsigned int)(pstat->current_tx_bytes / (total_sum / 100)); - rx_2s_avg = (unsigned int)(pstat->current_rx_bytes / (total_sum / 100)); - } - - } - -#if(DM_ODM_SUPPORT_TYPE==ODM_ADSL) - if (pstat->ht_cap_len) { - if ((tx_2s_avg + rx_2s_avg) >=25 /*50*/) { - - priv->pshare->highTP_found_pstat = pstat; - bhighTP_found_pstat=TRUE; - } - } -#elif(DM_ODM_SUPPORT_TYPE==ODM_AP) - for(i=0; i<8; i++) - aggReady += (pstat->ADDBA_ready[i]); - if (pstat->ht_cap_len && aggReady) - { - if ((tx_2s_avg + rx_2s_avg >= 25)) { - priv->pshare->highTP_found_pstat = pstat; - } - - #ifdef CLIENT_MODE - if (OPMODE & WIFI_STATION_STATE) { -#if (DM_ODM_SUPPORT_TYPE &ODM_AP) && defined(USE_OUT_SRC) - if ((pstat->IOTPeer==HT_IOT_PEER_RALINK) && ((tx_2s_avg + rx_2s_avg) >= 45)) -#else - if(pstat->is_ralink_sta && ((tx_2s_avg + rx_2s_avg) >= 45)) -#endif - priv->pshare->highTP_found_pstat = pstat; - } - #endif - } -#endif - } else { - pstat->current_tx_bytes = pstat->tx_byte_cnt; - pstat->current_rx_bytes = pstat->rx_byte_cnt; - } - - return bhighTP_found_pstat; -} - - -#ifdef WIFI_WMM -VOID -ODM_IotEdcaSwitch( - IN PDM_ODM_T pDM_Odm, - IN unsigned char enable - ) -{ - prtl8192cd_priv priv = pDM_Odm->priv; - int mode=priv->pmib->dot11BssType.net_work_type; - unsigned int slot_time = 20, sifs_time = 10, BE_TXOP = 47, VI_TXOP = 94; - unsigned int vi_cw_max = 4, vi_cw_min = 3, vi_aifs; - -#if (DM_ODM_SUPPORT_TYPE==ODM_AP) - if (!(!priv->pmib->dot11OperationEntry.wifi_specific || - ((OPMODE & WIFI_AP_STATE) && (priv->pmib->dot11OperationEntry.wifi_specific == 2)) - #ifdef CLIENT_MODE - || ((OPMODE & WIFI_STATION_STATE) && (priv->pmib->dot11OperationEntry.wifi_specific == 2)) - #endif - )) - return; -#endif - - if ((mode & (ODM_WM_N24G|ODM_WM_N5G)) && (priv->pshare->ht_sta_num - #ifdef WDS - || ((OPMODE & WIFI_AP_STATE) && priv->pmib->dot11WdsInfo.wdsEnabled && priv->pmib->dot11WdsInfo.wdsNum) - #endif - )) - sifs_time = 16; - - if (mode & (ODM_WM_N24G|ODM_WM_N5G|ODM_WM_G|ODM_WM_A)) { - slot_time = 9; - } - else - { - BE_TXOP = 94; - VI_TXOP = 188; - } - -#if (DM_ODM_SUPPORT_TYPE==ODM_ADSL) - if (priv->pshare->iot_mode_VO_exist) { - // to separate AC_VI and AC_BE to avoid using the same EDCA settings - if (priv->pshare->iot_mode_BE_exist) { - vi_cw_max = 5; - vi_cw_min = 3; - } else { - vi_cw_max = 6; - vi_cw_min = 4; - } - } - vi_aifs = (sifs_time + ((OPMODE & WIFI_AP_STATE)?1:2) * slot_time); - - ODM_Write4Byte(pDM_Odm, ODM_EDCA_VI_PARAM, ((VI_TXOP*(1-priv->pshare->iot_mode_VO_exist)) << 16)| (vi_cw_max << 12) | (vi_cw_min << 8) | vi_aifs); - - -#elif (DM_ODM_SUPPORT_TYPE==ODM_AP) - if ((OPMODE & WIFI_AP_STATE) && priv->pmib->dot11OperationEntry.wifi_specific) { - if (priv->pshare->iot_mode_VO_exist) { - #ifdef WMM_VIBE_PRI - if (priv->pshare->iot_mode_BE_exist) - { - vi_cw_max = 5; - vi_cw_min = 3; - vi_aifs = (sifs_time + ((OPMODE & WIFI_AP_STATE)?1:2) * slot_time); - } - else - #endif - { - vi_cw_max = 6; - vi_cw_min = 4; - vi_aifs = 0x2b; - } - } - else { - vi_aifs = (sifs_time + ((OPMODE & WIFI_AP_STATE)?1:2) * slot_time); - } - - ODM_Write4Byte(pDM_Odm, ODM_EDCA_VI_PARAM, ((VI_TXOP*(1-priv->pshare->iot_mode_VO_exist)) << 16) - | (vi_cw_max << 12) | (vi_cw_min << 8) | vi_aifs); - } -#endif - - - -#if (DM_ODM_SUPPORT_TYPE==ODM_AP) - if (priv->pshare->rf_ft_var.wifi_beq_iot && priv->pshare->iot_mode_VI_exist) - ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (10 << 12) | (4 << 8) | 0x4f); - else if(!enable) -#elif(DM_ODM_SUPPORT_TYPE==ODM_ADSL) - if(!enable) //if iot is disable ,maintain original BEQ PARAM -#endif - ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (((OPMODE & WIFI_AP_STATE)?6:10) << 12) | (4 << 8) - | (sifs_time + 3 * slot_time)); - else - { - int txop_enlarge; - int txop; - unsigned int cw_max; - unsigned int txop_close; - - #if((DM_ODM_SUPPORT_TYPE==ODM_AP)&&(defined LOW_TP_TXOP)) - cw_max = ((priv->pshare->BE_cwmax_enhance) ? 10 : 6); - txop_close = ((priv->pshare->rf_ft_var.low_tp_txop && priv->pshare->rf_ft_var.low_tp_txop_close) ? 1 : 0); - - if(priv->pshare->txop_enlarge == 0xe) //if intel case - txop = (txop_close ? 0 : (BE_TXOP*2)); - else //if other case - txop = (txop_close ? 0: (BE_TXOP*priv->pshare->txop_enlarge)); - #else - cw_max=6; - if((priv->pshare->txop_enlarge==0xe)||(priv->pshare->txop_enlarge==0xd)) - txop=BE_TXOP*2; - else - txop=BE_TXOP*priv->pshare->txop_enlarge; - - #endif - - if (priv->pshare->ht_sta_num - #ifdef WDS - || ((OPMODE & WIFI_AP_STATE) && (mode & (ODM_WM_N24G|ODM_WM_N5G)) && - priv->pmib->dot11WdsInfo.wdsEnabled && priv->pmib->dot11WdsInfo.wdsNum) - #endif - ) - { - - if (priv->pshare->txop_enlarge == 0xe) { - // is intel client, use a different edca value - ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (txop<< 16) | (cw_max<< 12) | (4 << 8) | 0x1f); - priv->pshare->txop_enlarge = 2; - } -#if(DM_ODM_SUPPORT_TYPE==ODM_AP) - #ifndef LOW_TP_TXOP - else if (priv->pshare->txop_enlarge == 0xd) { - // is intel ralink, use a different edca value - ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (txop << 16) | (4 << 12) | (3 << 8) | 0x19); - priv->pshare->txop_enlarge = 2; - } - #endif -#endif - else - { - if (pDM_Odm->RFType==ODM_2T2R) - ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (txop << 16) | - (cw_max << 12) | (4 << 8) | (sifs_time + 3 * slot_time)); - else - #if(DM_ODM_SUPPORT_TYPE==ODM_AP)&&(defined LOW_TP_TXOP) - ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (txop << 16) | - (((priv->pshare->BE_cwmax_enhance) ? 10 : 5) << 12) | (3 << 8) | (sifs_time + 2 * slot_time)); - #else - ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (txop << 16) | - (5 << 12) | (3 << 8) | (sifs_time + 2 * slot_time)); - - #endif - } - } - else - { - #if((DM_ODM_SUPPORT_TYPE==ODM_AP)&&(defined LOW_TP_TXOP)) - ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (BE_TXOP << 16) | (cw_max << 12) | (4 << 8) | (sifs_time + 3 * slot_time)); - #else - #if defined(CONFIG_RTL_8196D) || defined(CONFIG_RTL_8196E) || (defined(CONFIG_RTL_8197D) && !defined(CONFIG_PORT0_EXT_GIGA)) - ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (BE_TXOP*2 << 16) | (cw_max << 12) | (5 << 8) | (sifs_time + 3 * slot_time)); - #else - ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (BE_TXOP*2 << 16) | (cw_max << 12) | (4 << 8) | (sifs_time + 3 * slot_time)); - #endif - - #endif - } - - } -} -#endif - -VOID -odm_IotEngine( - IN PDM_ODM_T pDM_Odm - ) -{ - - struct rtl8192cd_priv *priv=pDM_Odm->priv; - PSTA_INFO_T pstat = NULL; - u4Byte i; - -#ifdef WIFI_WMM - unsigned int switch_turbo = 0; -#endif -//////////////////////////////////////////////////////// -// if EDCA Turbo function is not supported or Manual EDCA Setting -// then return -//////////////////////////////////////////////////////// - if(!(pDM_Odm->SupportAbility&ODM_MAC_EDCA_TURBO)){ - ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("ODM_MAC_EDCA_TURBO NOT SUPPORTED\n")); - return; - } - -#if((DM_ODM_SUPPORT_TYPE==ODM_AP)&& defined(RTL_MANUAL_EDCA) && defined(WIFI_WMM)) - if(priv->pmib->dot11QosEntry.ManualEDCA){ - ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("ODM_MAC_EDCA_TURBO OFF: MANUAL SETTING\n")); - return ; - } -#endif - -#if !(DM_ODM_SUPPORT_TYPE &ODM_AP) - ////////////////////////////////////////////////////// - //find high TP STA every 2s -////////////////////////////////////////////////////// - if ((GET_ROOT(priv)->up_time % 2) == 0) - priv->pshare->highTP_found_pstat==NULL; - -#if 0 - phead = &priv->asoc_list; - plist = phead->next; - while(plist != phead) { - pstat = list_entry(plist, struct stat_info, asoc_list); - - if(ODM_ChooseIotMainSTA(pDM_Odm, pstat)); //find the correct station - break; - if (plist == plist->next) //the last plist - break; - plist = plist->next; - }; -#endif - - //find highTP STA - for(i=0; ipODM_StaInfo[i]; - if(IS_STA_VALID(pstat) && (ODM_ChooseIotMainSTA(pDM_Odm, pstat))) //find the correct station - break; - } - - ////////////////////////////////////////////////////// - //if highTP STA is not found, then return - ////////////////////////////////////////////////////// - if(priv->pshare->highTP_found_pstat==NULL) { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("ODM_MAC_EDCA_TURBO OFF: NO HT STA FOUND\n")); - return; - } -#endif - - pstat=priv->pshare->highTP_found_pstat; - - -#ifdef WIFI_WMM - if (QOS_ENABLE) { - if (!priv->pmib->dot11OperationEntry.wifi_specific - #if(DM_ODM_SUPPORT_TYPE==ODM_AP) - ||((OPMODE & WIFI_AP_STATE) && (priv->pmib->dot11OperationEntry.wifi_specific == 2)) - #elif(DM_ODM_SUPPORT_TYPE==ODM_ADSL) - || (priv->pmib->dot11OperationEntry.wifi_specific == 2) - #endif - ) { - if (priv->pshare->iot_mode_enable && - ((priv->pshare->phw->VO_pkt_count > 50) || - (priv->pshare->phw->VI_pkt_count > 50) || - (priv->pshare->phw->BK_pkt_count > 50))) { - priv->pshare->iot_mode_enable = 0; - switch_turbo++; - } else if ((!priv->pshare->iot_mode_enable) && - ((priv->pshare->phw->VO_pkt_count < 50) && - (priv->pshare->phw->VI_pkt_count < 50) && - (priv->pshare->phw->BK_pkt_count < 50))) { - priv->pshare->iot_mode_enable++; - switch_turbo++; - } - } - - - #if(DM_ODM_SUPPORT_TYPE==ODM_AP) - if ((OPMODE & WIFI_AP_STATE) && priv->pmib->dot11OperationEntry.wifi_specific) - #elif (DM_ODM_SUPPORT_TYPE==ODM_ADSL) - if (priv->pmib->dot11OperationEntry.wifi_specific) - #endif - { - if (!priv->pshare->iot_mode_VO_exist && (priv->pshare->phw->VO_pkt_count > 50)) { - priv->pshare->iot_mode_VO_exist++; - switch_turbo++; - } else if (priv->pshare->iot_mode_VO_exist && (priv->pshare->phw->VO_pkt_count < 50)) { - priv->pshare->iot_mode_VO_exist = 0; - switch_turbo++; - } -#if((DM_ODM_SUPPORT_TYPE==ODM_ADSL)||((DM_ODM_SUPPORT_TYPE==ODM_AP)&&(defined WMM_VIBE_PRI))) - if (priv->pshare->iot_mode_VO_exist) { - //printk("[%s %d] BE_pkt_count=%d\n", __FUNCTION__, __LINE__, priv->pshare->phw->BE_pkt_count); - if (!priv->pshare->iot_mode_BE_exist && (priv->pshare->phw->BE_pkt_count > 250)) { - priv->pshare->iot_mode_BE_exist++; - switch_turbo++; - } else if (priv->pshare->iot_mode_BE_exist && (priv->pshare->phw->BE_pkt_count < 250)) { - priv->pshare->iot_mode_BE_exist = 0; - switch_turbo++; - } - } -#endif - -#if (DM_ODM_SUPPORT_TYPE==ODM_AP) - if (priv->pshare->rf_ft_var.wifi_beq_iot) - { - if (!priv->pshare->iot_mode_VI_exist && (priv->pshare->phw->VI_rx_pkt_count > 50)) { - priv->pshare->iot_mode_VI_exist++; - switch_turbo++; - } else if (priv->pshare->iot_mode_VI_exist && (priv->pshare->phw->VI_rx_pkt_count < 50)) { - priv->pshare->iot_mode_VI_exist = 0; - switch_turbo++; - } - } -#endif - - } - else if (!pstat || pstat->rssi < priv->pshare->rf_ft_var.txop_enlarge_lower) { - if (priv->pshare->txop_enlarge) { - priv->pshare->txop_enlarge = 0; - if (priv->pshare->iot_mode_enable) - switch_turbo++; - } - } - -#if(defined(CLIENT_MODE) && (DM_ODM_SUPPORT_TYPE==ODM_AP)) - if ((OPMODE & WIFI_STATION_STATE) && (priv->pmib->dot11OperationEntry.wifi_specific == 2)) - { - if (priv->pshare->iot_mode_enable && - (((priv->pshare->phw->VO_pkt_count > 50) || - (priv->pshare->phw->VI_pkt_count > 50) || - (priv->pshare->phw->BK_pkt_count > 50)) || - (pstat && (!pstat->ADDBA_ready[0]) & (!pstat->ADDBA_ready[3])))) - { - priv->pshare->iot_mode_enable = 0; - switch_turbo++; - } - else if ((!priv->pshare->iot_mode_enable) && - (((priv->pshare->phw->VO_pkt_count < 50) && - (priv->pshare->phw->VI_pkt_count < 50) && - (priv->pshare->phw->BK_pkt_count < 50)) && - (pstat && (pstat->ADDBA_ready[0] | pstat->ADDBA_ready[3])))) - { - priv->pshare->iot_mode_enable++; - switch_turbo++; - } - } -#endif - - priv->pshare->phw->VO_pkt_count = 0; - priv->pshare->phw->VI_pkt_count = 0; - priv->pshare->phw->BK_pkt_count = 0; - - #if((DM_ODM_SUPPORT_TYPE==ODM_ADSL)||((DM_ODM_SUPPORT_TYPE==ODM_AP)&&(defined WMM_VIBE_PRI))) - priv->pshare->phw->BE_pkt_count = 0; - #endif - - #if(DM_ODM_SUPPORT_TYPE==ODM_AP) - if (priv->pshare->rf_ft_var.wifi_beq_iot) - priv->pshare->phw->VI_rx_pkt_count = 0; - #endif - - } -#endif - - if ((priv->up_time % 2) == 0) { - /* - * decide EDCA content for different chip vendor - */ -#ifdef WIFI_WMM - #if(DM_ODM_SUPPORT_TYPE==ODM_ADSL) - if (QOS_ENABLE && (!priv->pmib->dot11OperationEntry.wifi_specific || (priv->pmib->dot11OperationEntry.wifi_specific == 2) - - #elif(DM_ODM_SUPPORT_TYPE==ODM_AP) - if (QOS_ENABLE && (!priv->pmib->dot11OperationEntry.wifi_specific || - ((OPMODE & WIFI_AP_STATE) && (priv->pmib->dot11OperationEntry.wifi_specific == 2)) - #ifdef CLIENT_MODE - || ((OPMODE & WIFI_STATION_STATE) && (priv->pmib->dot11OperationEntry.wifi_specific == 2)) - #endif - #endif - )) - - { - - if (pstat && pstat->rssi >= priv->pshare->rf_ft_var.txop_enlarge_upper) { -#ifdef LOW_TP_TXOP -#if (DM_ODM_SUPPORT_TYPE &ODM_AP) && defined(USE_OUT_SRC) - if (pstat->IOTPeer==HT_IOT_PEER_INTEL) -#else - if (pstat->is_intel_sta) -#endif - { - if (priv->pshare->txop_enlarge != 0xe) - { - priv->pshare->txop_enlarge = 0xe; - - if (priv->pshare->iot_mode_enable) - switch_turbo++; - } - } - else if (priv->pshare->txop_enlarge != 2) - { - priv->pshare->txop_enlarge = 2; - if (priv->pshare->iot_mode_enable) - switch_turbo++; - } -#else - if (priv->pshare->txop_enlarge != 2) - { -#if (DM_ODM_SUPPORT_TYPE &ODM_AP) && defined(USE_OUT_SRC) - if (pstat->IOTPeer==HT_IOT_PEER_INTEL) -#else - if (pstat->is_intel_sta) -#endif - priv->pshare->txop_enlarge = 0xe; -#if (DM_ODM_SUPPORT_TYPE &ODM_AP) && defined(USE_OUT_SRC) - else if (pstat->IOTPeer==HT_IOT_PEER_RALINK) -#else - else if (pstat->is_ralink_sta) -#endif - priv->pshare->txop_enlarge = 0xd; - else - priv->pshare->txop_enlarge = 2; - - if (priv->pshare->iot_mode_enable) - switch_turbo++; - } -#endif -#if 0 - if (priv->pshare->txop_enlarge != 2) - { - #if(DM_ODM_SUPPORT_TYPE==ODM_AP) - if (pstat->IOTPeer==HT_IOT_PEER_INTEL) - #else - if (pstat->is_intel_sta) - #endif - priv->pshare->txop_enlarge = 0xe; - #if(DM_ODM_SUPPORT_TYPE==ODM_AP) - else if (pstat->IOTPeer==HT_IOT_PEER_RALINK) - priv->pshare->txop_enlarge = 0xd; - #endif - else - priv->pshare->txop_enlarge = 2; - if (priv->pshare->iot_mode_enable) - switch_turbo++; - } -#endif - } - else if (!pstat || pstat->rssi < priv->pshare->rf_ft_var.txop_enlarge_lower) - { - if (priv->pshare->txop_enlarge) { - priv->pshare->txop_enlarge = 0; - if (priv->pshare->iot_mode_enable) - switch_turbo++; - } - } - -#if((DM_ODM_SUPPORT_TYPE==ODM_AP)&&( defined LOW_TP_TXOP)) - // for Intel IOT, need to enlarge CW MAX from 6 to 10 - if (pstat && pstat->is_intel_sta && (((pstat->tx_avarage+pstat->rx_avarage)>>10) < - priv->pshare->rf_ft_var.cwmax_enhance_thd)) - { - if (!priv->pshare->BE_cwmax_enhance && priv->pshare->iot_mode_enable) - { - priv->pshare->BE_cwmax_enhance = 1; - switch_turbo++; - } - } else { - if (priv->pshare->BE_cwmax_enhance) { - priv->pshare->BE_cwmax_enhance = 0; - switch_turbo++; - } - } -#endif - } -#endif - priv->pshare->current_tx_bytes = 0; - priv->pshare->current_rx_bytes = 0; - } - -#if((DM_ODM_SUPPORT_TYPE==ODM_AP)&& defined( SW_TX_QUEUE)) - if ((priv->assoc_num > 1) && (AMPDU_ENABLE)) - { - if (priv->swq_txmac_chg >= priv->pshare->rf_ft_var.swq_en_highthd){ - if ((priv->swq_en == 0)){ - switch_turbo++; - if (priv->pshare->txop_enlarge == 0) - priv->pshare->txop_enlarge = 2; - priv->swq_en = 1; - } - else - { - if ((switch_turbo > 0) && (priv->pshare->txop_enlarge == 0) && (priv->pshare->iot_mode_enable != 0)) - { - priv->pshare->txop_enlarge = 2; - switch_turbo--; - } - } - } - else if(priv->swq_txmac_chg <= priv->pshare->rf_ft_var.swq_dis_lowthd){ - priv->swq_en = 0; - } - else if ((priv->swq_en == 1) && (switch_turbo > 0) && (priv->pshare->txop_enlarge == 0) && (priv->pshare->iot_mode_enable != 0)) { - priv->pshare->txop_enlarge = 2; - switch_turbo--; - } - } -#if ((DM_ODM_SUPPORT_TYPE==ODM_AP)&&(defined CONFIG_RTL_819XD)) - else if( (priv->assoc_num == 1) && (AMPDU_ENABLE)) { - if (pstat) { - int en_thd = 14417920>>(priv->up_time % 2); - if ((priv->swq_en == 0) && (pstat->current_tx_bytes > en_thd) && (pstat->current_rx_bytes > en_thd) ) { //50Mbps - priv->swq_en = 1; - priv->swqen_keeptime = priv->up_time; - } - else if ((priv->swq_en == 1) && ((pstat->tx_avarage < 4587520) || (pstat->rx_avarage < 4587520))) { //35Mbps - priv->swq_en = 0; - priv->swqen_keeptime = 0; - } - } - else { - priv->swq_en = 0; - priv->swqen_keeptime = 0; - } - } -#endif -#endif - -#ifdef WIFI_WMM -#ifdef LOW_TP_TXOP - if ((!priv->pmib->dot11OperationEntry.wifi_specific || (priv->pmib->dot11OperationEntry.wifi_specific == 2)) - && QOS_ENABLE) { - if (switch_turbo || priv->pshare->rf_ft_var.low_tp_txop) { - unsigned int thd_tp; - unsigned char under_thd; - unsigned int curr_tp; - - if (priv->pmib->dot11BssType.net_work_type & (ODM_WM_N24G|ODM_WM_N5G| ODM_WM_G)) - { - // Determine the upper bound throughput threshold. - if (priv->pmib->dot11BssType.net_work_type & (ODM_WM_N24G|ODM_WM_N5G)) { - if (priv->assoc_num && priv->assoc_num != priv->pshare->ht_sta_num) - thd_tp = priv->pshare->rf_ft_var.low_tp_txop_thd_g; - else - thd_tp = priv->pshare->rf_ft_var.low_tp_txop_thd_n; - } - else - thd_tp = priv->pshare->rf_ft_var.low_tp_txop_thd_g; - - // Determine to close txop. - curr_tp = (unsigned int)(priv->ext_stats.tx_avarage>>17) + (unsigned int)(priv->ext_stats.rx_avarage>>17); - if (curr_tp <= thd_tp && curr_tp >= priv->pshare->rf_ft_var.low_tp_txop_thd_low) - under_thd = 1; - else - under_thd = 0; - } - else - { - under_thd = 0; - } - - if (switch_turbo) - { - priv->pshare->rf_ft_var.low_tp_txop_close = under_thd; - priv->pshare->rf_ft_var.low_tp_txop_count = 0; - } - else if (priv->pshare->iot_mode_enable && (priv->pshare->rf_ft_var.low_tp_txop_close != under_thd)) { - priv->pshare->rf_ft_var.low_tp_txop_count++; - if (priv->pshare->rf_ft_var.low_tp_txop_close) { - priv->pshare->rf_ft_var.low_tp_txop_count = priv->pshare->rf_ft_var.low_tp_txop_delay; - } - if (priv->pshare->rf_ft_var.low_tp_txop_count ==priv->pshare->rf_ft_var.low_tp_txop_delay) - - { - priv->pshare->rf_ft_var.low_tp_txop_count = 0; - priv->pshare->rf_ft_var.low_tp_txop_close = under_thd; - switch_turbo++; - } - } - else - { - priv->pshare->rf_ft_var.low_tp_txop_count = 0; - } - } - } -#endif - - if (switch_turbo) - ODM_IotEdcaSwitch( pDM_Odm, priv->pshare->iot_mode_enable ); -#endif -} -#endif +//Remove Edca by Yuchen #if( DM_ODM_SUPPORT_TYPE == ODM_WIN) @@ -10131,3280 +1413,6 @@ ConvertTo_dB( #endif -// -// LukeLee: -// PSD function will be moved to FW in future IC, but now is only implemented in MP platform -// So PSD function will not be incorporated to common ODM -// -#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) - -#define AFH_PSD 1 //0:normal PSD scan, 1: only do 20 pts PSD -#define MODE_40M 0 //0:20M, 1:40M -#define PSD_TH2 3 -#define PSD_CHMIN 20 // Minimum channel number for BT AFH -#define SIR_STEP_SIZE 3 -#define Smooth_Size_1 5 -#define Smooth_TH_1 3 -#define Smooth_Size_2 10 -#define Smooth_TH_2 4 -#define Smooth_Size_3 20 -#define Smooth_TH_3 4 -#define Smooth_Step_Size 5 -#define Adaptive_SIR 1 -//#if(RTL8723_FPGA_VERIFICATION == 1) -//#define PSD_RESCAN 1 -//#else -//#define PSD_RESCAN 4 -//#endif -#define SCAN_INTERVAL 1500 //ms -#define SYN_Length 5 // for 92D - -#define LNA_Low_Gain_1 0x64 -#define LNA_Low_Gain_2 0x5A -#define LNA_Low_Gain_3 0x58 - -#define pw_th_10dB 0x0 -#define pw_th_16dB 0x3 - -#define FA_RXHP_TH1 5000 -#define FA_RXHP_TH2 1500 -#define FA_RXHP_TH3 800 -#define FA_RXHP_TH4 600 -#define FA_RXHP_TH5 500 - -#define Idle_Mode 0 -#define High_TP_Mode 1 -#define Low_TP_Mode 2 - - -VOID -odm_PSDMonitorInit( - IN PDM_ODM_T pDM_Odm) -{ -#if (DEV_BUS_TYPE == RT_PCI_INTERFACE)|(DEV_BUS_TYPE == RT_USB_INTERFACE) - //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - //PSD Monitor Setting - //Which path in ADC/DAC is turnned on for PSD: both I/Q - ODM_SetBBReg(pDM_Odm, ODM_PSDREG, BIT10|BIT11, 0x3); - //Ageraged number: 8 - ODM_SetBBReg(pDM_Odm, ODM_PSDREG, BIT12|BIT13, 0x1); - pDM_Odm->bPSDinProcess = FALSE; - pDM_Odm->bUserAssignLevel = FALSE; - pDM_Odm->bPSDactive = FALSE; - //pDM_Odm->bDMInitialGainEnable=TRUE; //change the initialization to DIGinit - //Set Debug Port - //PHY_SetBBReg(Adapter, 0x908, bMaskDWord, 0x803); - //PHY_SetBBReg(Adapter, 0xB34, bMaskByte0, 0x00); // pause PSD - //PHY_SetBBReg(Adapter, 0xB38, bMaskByte0, 10); //rescan - //PHY_SetBBReg(Adapter, 0xB38, bMaskByte2|bMaskByte3, 100); //interval - - //PlatformSetTimer( Adapter, &pHalData->PSDTriggerTimer, 0); //ms -#endif -} - -VOID -PatchDCTone( - IN PDM_ODM_T pDM_Odm, - pu4Byte PSD_report, - u1Byte initial_gain_psd -) -{ - //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - //PADAPTER pAdapter; - - u4Byte psd_report; - - //2 Switch to CH11 to patch CH9 and CH13 DC tone - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_CHNLBW, 0x3FF, 11); - - if(pDM_Odm->SupportICType== ODM_RTL8192D) - { - if((*(pDM_Odm->pMacPhyMode) == ODM_SMSP)||(*(pDM_Odm->pMacPhyMode) == ODM_DMSP)) - { - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_CHNLBW, 0x3FF, 11); - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x25, 0xfffff, 0x643BC); - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x26, 0xfffff, 0xFC038); - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x27, 0xfffff, 0x77C1A); - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x2B, 0xfffff, 0x41289); - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x2C, 0xfffff, 0x01840); - } - else - { - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x25, 0xfffff, 0x643BC); - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x26, 0xfffff, 0xFC038); - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x27, 0xfffff, 0x77C1A); - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x2B, 0xfffff, 0x41289); - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x2C, 0xfffff, 0x01840); - } - } - - //Ch9 DC tone patch - psd_report = GetPSDData(pDM_Odm, 96, initial_gain_psd); - PSD_report[50] = psd_report; - //Ch13 DC tone patch - psd_report = GetPSDData(pDM_Odm, 32, initial_gain_psd); - PSD_report[70] = psd_report; - - //2 Switch to CH3 to patch CH1 and CH5 DC tone - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_CHNLBW, 0x3FF, 3); - - - if(pDM_Odm->SupportICType==ODM_RTL8192D) - { - if((*(pDM_Odm->pMacPhyMode) == ODM_SMSP)||(*(pDM_Odm->pMacPhyMode) == ODM_DMSP)) - { - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_CHNLBW, 0x3FF, 3); - //PHY_SetRFReg(Adapter, ODM_RF_PATH_B, 0x25, 0xfffff, 0x643BC); - //PHY_SetRFReg(Adapter, ODM_RF_PATH_B, 0x26, 0xfffff, 0xFC038); - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x27, 0xfffff, 0x07C1A); - //PHY_SetRFReg(Adapter, ODM_RF_PATH_B, 0x2B, 0xfffff, 0x61289); - //PHY_SetRFReg(Adapter, ODM_RF_PATH_B, 0x2C, 0xfffff, 0x01C41); - } - else - { - //PHY_SetRFReg(Adapter, ODM_RF_PATH_A, 0x25, 0xfffff, 0x643BC); - //PHY_SetRFReg(Adapter, ODM_RF_PATH_A, 0x26, 0xfffff, 0xFC038); - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x27, 0xfffff, 0x07C1A); - //PHY_SetRFReg(Adapter, ODM_RF_PATH_A, 0x2B, 0xfffff, 0x61289); - //PHY_SetRFReg(Adapter, ODM_RF_PATH_A, 0x2C, 0xfffff, 0x01C41); - } - } - - //Ch1 DC tone patch - psd_report = GetPSDData(pDM_Odm, 96, initial_gain_psd); - PSD_report[10] = psd_report; - //Ch5 DC tone patch - psd_report = GetPSDData(pDM_Odm, 32, initial_gain_psd); - PSD_report[30] = psd_report; - -} - - -VOID -GoodChannelDecision( - PDM_ODM_T pDM_Odm, - pu4Byte PSD_report, - pu1Byte PSD_bitmap, - u1Byte RSSI_BT, - pu1Byte PSD_bitmap_memory) -{ - pRXHP_T pRX_HP_Table = &pDM_Odm->DM_RXHP_Table; - //s4Byte TH1 = SSBT-0x15; // modify TH by Neil Chen - s4Byte TH1= RSSI_BT+0x14; - s4Byte TH2 = RSSI_BT+85; - //u2Byte TH3; -// s4Byte RegB34; - u1Byte bitmap, Smooth_size[3], Smooth_TH[3]; - //u1Byte psd_bit; - u4Byte i,n,j, byte_idx, bit_idx, good_cnt, good_cnt_smoothing, Smooth_Interval[3]; - int start_byte_idx,start_bit_idx,cur_byte_idx, cur_bit_idx,NOW_byte_idx ; - -// RegB34 = PHY_QueryBBReg(Adapter,0xB34, bMaskDWord)&0xFF; - - if((pDM_Odm->SupportICType == ODM_RTL8192C)||(pDM_Odm->SupportICType == ODM_RTL8192D)) - { - TH1 = RSSI_BT + 0x14; - } - - Smooth_size[0]=Smooth_Size_1; - Smooth_size[1]=Smooth_Size_2; - Smooth_size[2]=Smooth_Size_3; - Smooth_TH[0]=Smooth_TH_1; - Smooth_TH[1]=Smooth_TH_2; - Smooth_TH[2]=Smooth_TH_3; - Smooth_Interval[0]=16; - Smooth_Interval[1]=15; - Smooth_Interval[2]=13; - good_cnt = 0; - if(pDM_Odm->SupportICType==ODM_RTL8723A) - { - //2 Threshold - - if(RSSI_BT >=41) - TH1 = 113; - else if(RSSI_BT >=38) // >= -15dBm - TH1 = 105; //0x69 - else if((RSSI_BT >=33)&(RSSI_BT <38)) - TH1 = 99+(RSSI_BT-33); //0x63 - else if((RSSI_BT >=26)&(RSSI_BT<33)) - TH1 = 99-(33-RSSI_BT)+2; //0x5e - else if((RSSI_BT >=24)&(RSSI_BT<26)) - TH1 = 88-((RSSI_BT-24)*3); //0x58 - else if((RSSI_BT >=18)&(RSSI_BT<24)) - TH1 = 77+((RSSI_BT-18)*2); - else if((RSSI_BT >=14)&(RSSI_BT<18)) - TH1 = 63+((RSSI_BT-14)*2); - else if((RSSI_BT >=8)&(RSSI_BT<14)) - TH1 = 58+((RSSI_BT-8)*2); - else if((RSSI_BT >=3)&(RSSI_BT<8)) - TH1 = 52+(RSSI_BT-3); - else - TH1 = 51; - } - - for (i = 0; i< 10; i++) - PSD_bitmap[i] = 0; - - - // Add By Gary - for (i=0; i<80; i++) - pRX_HP_Table->PSD_bitmap_RXHP[i] = 0; - // End - - - - if(pDM_Odm->SupportICType==ODM_RTL8723A) - { - TH1 =TH1-SIR_STEP_SIZE; - } - while (good_cnt < PSD_CHMIN) - { - good_cnt = 0; - if(pDM_Odm->SupportICType==ODM_RTL8723A) - { - if(TH1 ==TH2) - break; - if((TH1+SIR_STEP_SIZE) < TH2) - TH1 += SIR_STEP_SIZE; - else - TH1 = TH2; - } - else - { - if(TH1==(RSSI_BT+0x1E)) - break; - if((TH1+2) < (RSSI_BT+0x1E)) - TH1+=3; - else - TH1 = RSSI_BT+0x1E; - - } - ODM_RT_TRACE(pDM_Odm,COMP_PSD,DBG_LOUD,("PSD: decision threshold is: %d", TH1)); - - for (i = 0; i< 80; i++) - { - if((s4Byte)(PSD_report[i]) < TH1) - { - byte_idx = i / 8; - bit_idx = i -8*byte_idx; - bitmap = PSD_bitmap[byte_idx]; - PSD_bitmap[byte_idx] = bitmap | (u1Byte) (1 << bit_idx); - } - } - -#if DBG - ODM_RT_TRACE(pDM_Odm,COMP_PSD, DBG_LOUD,("PSD: before smoothing\n")); - for(n=0;n<10;n++) - { - //DbgPrint("PSD_bitmap[%u]=%x\n", n, PSD_bitmap[n]); - for (i = 0; i<8; i++) - ODM_RT_TRACE(pDM_Odm,COMP_PSD, DBG_LOUD,("PSD_bitmap[%u] = %d\n", 2402+n*8+i, (PSD_bitmap[n]&BIT(i))>>i)); - } -#endif - - //1 Start of smoothing function - - for (j=0;j<3;j++) - { - start_byte_idx=0; - start_bit_idx=0; - for(n=0; n 7 ) - { - start_byte_idx= start_byte_idx+start_bit_idx/8; - start_bit_idx = start_bit_idx%8; - } - } - - ODM_RT_TRACE( pDM_Odm,COMP_PSD, DBG_LOUD,("PSD: after %u smoothing", j+1)); - for(n=0;n<10;n++) - { - for (i = 0; i<8; i++) - { - ODM_RT_TRACE(pDM_Odm,COMP_PSD, DBG_LOUD,("PSD_bitmap[%u] = %d\n", 2402+n*8+i, (PSD_bitmap[n]&BIT(i))>>i)); - - if ( ((PSD_bitmap[n]&BIT(i))>>i) ==1) //----- Add By Gary - { - pRX_HP_Table->PSD_bitmap_RXHP[8*n+i] = 1; - } // ------end by Gary - } - } - - } - - - good_cnt = 0; - for ( i = 0; i < 10; i++) - { - for (n = 0; n < 8; n++) - if((PSD_bitmap[i]& BIT(n)) != 0) - good_cnt++; - } - ODM_RT_TRACE(pDM_Odm,COMP_PSD, DBG_LOUD,("PSD: good channel cnt = %u",good_cnt)); - } - - //RT_TRACE(COMP_PSD, DBG_LOUD,("PSD: SSBT=%d, TH2=%d, TH1=%d",SSBT,TH2,TH1)); - for (i = 0; i <10; i++) - ODM_RT_TRACE(pDM_Odm,COMP_PSD, DBG_LOUD,("PSD: PSD_bitmap[%u]=%x",i,PSD_bitmap[i])); -/* - //Update bitmap memory - for(i = 0; i < 80; i++) - { - byte_idx = i / 8; - bit_idx = i -8*byte_idx; - psd_bit = (PSD_bitmap[byte_idx] & BIT(bit_idx)) >> bit_idx; - bitmap = PSD_bitmap_memory[i]; - PSD_bitmap_memory[i] = (bitmap << 1) |psd_bit; - } -*/ -} - - - -VOID -odm_PSD_Monitor( - PDM_ODM_T pDM_Odm -) -{ - //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - //PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - - unsigned int pts, start_point, stop_point; - u1Byte initial_gain ; - static u1Byte PSD_bitmap_memory[80], init_memory = 0; - static u1Byte psd_cnt=0; - static u4Byte PSD_report[80], PSD_report_tmp; - static u8Byte lastTxOkCnt=0, lastRxOkCnt=0; - u1Byte H2C_PSD_DATA[5]={0,0,0,0,0}; - static u1Byte H2C_PSD_DATA_last[5] ={0,0,0,0,0}; - u1Byte idx[20]={96,99,102,106,109,112,115,118,122,125, - 0,3,6,10,13,16,19,22,26,29}; - u1Byte n, i, channel, BBReset,tone_idx; - u1Byte PSD_bitmap[10], SSBT=0,initial_gain_psd=0, RSSI_BT=0, initialGainUpper; - s4Byte PSD_skip_start, PSD_skip_stop; - u4Byte CurrentChannel, RXIQI, RxIdleLowPwr, wlan_channel; - u4Byte ReScan, Interval, Is40MHz; - u8Byte curTxOkCnt, curRxOkCnt; - int cur_byte_idx, cur_bit_idx; - PADAPTER Adapter = pDM_Odm->Adapter; - PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; - - if( (*(pDM_Odm->pbScanInProcess)) || - pDM_Odm->bLinkInProcess) - { - if((pDM_Odm->SupportICType==ODM_RTL8723A)&(pDM_Odm->SupportInterface==ODM_ITRF_PCIE)) - { - ODM_SetTimer( pDM_Odm, &pDM_Odm->PSDTimer, 1500); //ms - //psd_cnt=0; - } - return; - } - - if(pDM_Odm->bBtHsOperation) - { - ReScan = 1; - Interval = SCAN_INTERVAL; - } - else - { - ReScan = PSD_RESCAN; - Interval = SCAN_INTERVAL; - } - - //1 Initialization - if(init_memory == 0) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PSD, DBG_LOUD,("Init memory\n")); - for(i = 0; i < 80; i++) - PSD_bitmap_memory[i] = 0xFF; // channel is always good - init_memory = 1; - } - if(psd_cnt == 0) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PSD, DBG_LOUD,("Enter dm_PSD_Monitor\n")); - for(i = 0; i < 80; i++) - PSD_report[i] = 0; - } - - //1 Backup Current Settings - CurrentChannel = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask); -/* - if(pDM_Odm->SupportICType==ODM_RTL8192D) - { - //2 Record Current synthesizer parameters based on current channel - if((*pDM_Odm->MacPhyMode92D == SINGLEMAC_SINGLEPHY)||(*pDM_Odm->MacPhyMode92D == DUALMAC_SINGLEPHY)) - { - SYN_RF25 = ODM_GetRFReg(Adapter, ODM_RF_PATH_B, 0x25, bMaskDWord); - SYN_RF26 = ODM_GetRFReg(Adapter, ODM_RF_PATH_B, 0x26, bMaskDWord); - SYN_RF27 = ODM_GetRFReg(Adapter, ODM_RF_PATH_B, 0x27, bMaskDWord); - SYN_RF2B = ODM_GetRFReg(Adapter, ODM_RF_PATH_B, 0x2B, bMaskDWord); - SYN_RF2C = ODM_GetRFReg(Adapter, ODM_RF_PATH_B, 0x2C, bMaskDWord); - } - else // DualMAC_DualPHY 2G - { - SYN_RF25 = ODM_GetRFReg(Adapter, ODM_RF_PATH_A, 0x25, bMaskDWord); - SYN_RF26 = ODM_GetRFReg(Adapter, ODM_RF_PATH_A, 0x26, bMaskDWord); - SYN_RF27 = ODM_GetRFReg(Adapter, ODM_RF_PATH_A, 0x27, bMaskDWord); - SYN_RF2B = ODM_GetRFReg(Adapter, ODM_RF_PATH_A, 0x2B, bMaskDWord); - SYN_RF2C = ODM_GetRFReg(Adapter, ODM_RF_PATH_A, 0x2C, bMaskDWord); - } - } -*/ - //RXIQI = PHY_QueryBBReg(Adapter, 0xC14, bMaskDWord); - RXIQI = ODM_GetBBReg(pDM_Odm, 0xC14, bMaskDWord); - - //RxIdleLowPwr = (PHY_QueryBBReg(Adapter, 0x818, bMaskDWord)&BIT28)>>28; - RxIdleLowPwr = (ODM_GetBBReg(pDM_Odm, 0x818, bMaskDWord)&BIT28)>>28; - - //2??? - if(CHNL_RUN_ABOVE_40MHZ(pMgntInfo)) - Is40MHz = TRUE; - else - Is40MHz = FALSE; - - ODM_RT_TRACE(pDM_Odm, ODM_COMP_PSD, DBG_LOUD,("PSD Scan Start\n")); - //1 Turn off CCK - //PHY_SetBBReg(Adapter, rFPGA0_RFMOD, BIT24, 0); - ODM_SetBBReg(pDM_Odm, rFPGA0_RFMOD, BIT24, 0); - //1 Turn off TX - //Pause TX Queue - //PlatformEFIOWrite1Byte(Adapter, REG_TXPAUSE, 0xFF); - ODM_Write1Byte(pDM_Odm,REG_TXPAUSE, 0xFF); - - //Force RX to stop TX immediately - //PHY_SetRFReg(Adapter, ODM_RF_PATH_A, RF_AC, bRFRegOffsetMask, 0x32E13); - - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_AC, bRFRegOffsetMask, 0x32E13); - //1 Turn off RX - //Rx AGC off RegC70[0]=0, RegC7C[20]=0 - //PHY_SetBBReg(Adapter, 0xC70, BIT0, 0); - //PHY_SetBBReg(Adapter, 0xC7C, BIT20, 0); - - ODM_SetBBReg(pDM_Odm, 0xC70, BIT0, 0); - ODM_SetBBReg(pDM_Odm, 0xC7C, BIT20, 0); - - - //Turn off CCA - //PHY_SetBBReg(Adapter, 0xC14, bMaskDWord, 0x0); - ODM_SetBBReg(pDM_Odm, 0xC14, bMaskDWord, 0x0); - - //BB Reset - //BBReset = PlatformEFIORead1Byte(Adapter, 0x02); - BBReset = ODM_Read1Byte(pDM_Odm, 0x02); - - //PlatformEFIOWrite1Byte(Adapter, 0x02, BBReset&(~BIT0)); - //PlatformEFIOWrite1Byte(Adapter, 0x02, BBReset|BIT0); - ODM_SetBBReg(pDM_Odm, 0x87C, BIT31, 1); //clock gated to prevent from AGC table mess - ODM_Write1Byte(pDM_Odm, 0x02, BBReset&(~BIT0)); - ODM_Write1Byte(pDM_Odm, 0x02, BBReset|BIT0); - ODM_SetBBReg(pDM_Odm, 0x87C, BIT31, 0); - - //1 Leave RX idle low power - //PHY_SetBBReg(Adapter, 0x818, BIT28, 0x0); - - ODM_SetBBReg(pDM_Odm, 0x818, BIT28, 0x0); - //1 Fix initial gain - //if (IS_HARDWARE_TYPE_8723AE(Adapter)) - //RSSI_BT = pHalData->RSSI_BT; - //else if((IS_HARDWARE_TYPE_8192C(Adapter))||(IS_HARDWARE_TYPE_8192D(Adapter))) // Add by Gary - // RSSI_BT = RSSI_BT_new; - - if((pDM_Odm->SupportICType==ODM_RTL8723A)&(pDM_Odm->SupportInterface==ODM_ITRF_PCIE)) - RSSI_BT=pDM_Odm->RSSI_BT; //need to check C2H to pDM_Odm RSSI BT - - if(RSSI_BT>=47) - RSSI_BT=47; - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PSD, DBG_LOUD,("PSD: RSSI_BT= %d\n", RSSI_BT)); - - if(pDM_Odm->SupportICType==ODM_RTL8723A) - { - //Neil add--2011--10--12 - //2 Initial Gain index - if(RSSI_BT >=35) // >= -15dBm - initial_gain_psd = RSSI_BT*2; - else if((RSSI_BT >=33)&(RSSI_BT<35)) - initial_gain_psd = RSSI_BT*2+6; - else if((RSSI_BT >=24)&(RSSI_BT<33)) - initial_gain_psd = 70-(33-RSSI_BT); - else if((RSSI_BT >=19)&(RSSI_BT<24)) - initial_gain_psd = 64-((24-RSSI_BT)*4); - else if((RSSI_BT >=14)&(RSSI_BT<19)) - initial_gain_psd = 44-((18-RSSI_BT)*2); - else if((RSSI_BT >=8)&(RSSI_BT<14)) - initial_gain_psd = 35-(14-RSSI_BT); - else - initial_gain_psd = 0x1B; - } - else - { - - //need to do - initial_gain_psd = pDM_Odm->RSSI_Min; // PSD report based on RSSI - //} - } - //if(RSSI_BT<0x17) - // RSSI_BT +=3; - //DbgPrint("PSD: RSSI_BT= %d\n", RSSI_BT); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PSD, DBG_LOUD,("PSD: RSSI_BT= %d\n", RSSI_BT)); - - //initialGainUpper = 0x5E; //Modify by neil chen - - if(pDM_Odm->bUserAssignLevel) - { - pDM_Odm->bUserAssignLevel = FALSE; - initialGainUpper = 0x7f; - } - else - { - initialGainUpper = 0x5E; - } - - /* - if (initial_gain_psd < 0x1a) - initial_gain_psd = 0x1a; - if (initial_gain_psd > initialGainUpper) - initial_gain_psd = initialGainUpper; - */ - - //if(pDM_Odm->SupportICType==ODM_RTL8723A) - SSBT = RSSI_BT * 2 +0x3E; - - - //if(IS_HARDWARE_TYPE_8723AE(Adapter)) - // SSBT = RSSI_BT * 2 +0x3E; - //else if((IS_HARDWARE_TYPE_8192C(Adapter))||(IS_HARDWARE_TYPE_8192D(Adapter))) // Add by Gary - //{ - // RSSI_BT = initial_gain_psd; - // SSBT = RSSI_BT; - //} - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PSD, DBG_LOUD,("PSD: SSBT= %d\n", SSBT)); - ODM_RT_TRACE( pDM_Odm,ODM_COMP_PSD, DBG_LOUD,("PSD: initial gain= 0x%x\n", initial_gain_psd)); - //DbgPrint("PSD: SSBT= %d", SSBT); - //need to do - //pMgntInfo->bDMInitialGainEnable = FALSE; - pDM_Odm->bDMInitialGainEnable = FALSE; - initial_gain =(u1Byte) (ODM_GetBBReg(pDM_Odm, 0xc50, bMaskDWord) & 0x7F); - - // make sure the initial gain is under the correct range. - //initial_gain_psd &= 0x7f; - ODM_Write_DIG(pDM_Odm, initial_gain_psd); - //1 Turn off 3-wire - ODM_SetBBReg(pDM_Odm, 0x88c, BIT20|BIT21|BIT22|BIT23, 0xF); - - //pts value = 128, 256, 512, 1024 - pts = 128; - - if(pts == 128) - { - ODM_SetBBReg(pDM_Odm, 0x808, BIT14|BIT15, 0x0); - start_point = 64; - stop_point = 192; - } - else if(pts == 256) - { - ODM_SetBBReg(pDM_Odm, 0x808, BIT14|BIT15, 0x1); - start_point = 128; - stop_point = 384; - } - else if(pts == 512) - { - ODM_SetBBReg(pDM_Odm, 0x808, BIT14|BIT15, 0x2); - start_point = 256; - stop_point = 768; - } - else - { - ODM_SetBBReg(pDM_Odm, 0x808, BIT14|BIT15, 0x3); - start_point = 512; - stop_point = 1536; - } - - -//3 Skip WLAN channels if WLAN busy - - curTxOkCnt = *(pDM_Odm->pNumTxBytesUnicast) - lastTxOkCnt; - curRxOkCnt = *(pDM_Odm->pNumRxBytesUnicast) - lastRxOkCnt; - lastTxOkCnt = *(pDM_Odm->pNumTxBytesUnicast); - lastRxOkCnt = *(pDM_Odm->pNumRxBytesUnicast); - - PSD_skip_start=80; - PSD_skip_stop = 0; - wlan_channel = CurrentChannel & 0x0f; - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PSD,DBG_LOUD,("PSD: current channel: %x, BW:%d \n", wlan_channel, Is40MHz)); - if(pDM_Odm->SupportICType==ODM_RTL8723A) - { - if(pDM_Odm->bBtHsOperation) - { - if(pDM_Odm->bLinked) - { - if(Is40MHz) - { - PSD_skip_start = ((wlan_channel-1)*5 -Is40MHz*10)-2; // Modify by Neil to add 10 chs to mask - PSD_skip_stop = (PSD_skip_start + (1+Is40MHz)*20)+4; - } - else - { - PSD_skip_start = ((wlan_channel-1)*5 -Is40MHz*10)-10; // Modify by Neil to add 10 chs to mask - PSD_skip_stop = (PSD_skip_start + (1+Is40MHz)*20)+18; - } - } - else - { - // mask for 40MHz - PSD_skip_start = ((wlan_channel-1)*5 -Is40MHz*10)-2; // Modify by Neil to add 10 chs to mask - PSD_skip_stop = (PSD_skip_start + (1+Is40MHz)*20)+4; - } - if(PSD_skip_start < 0) - PSD_skip_start = 0; - if(PSD_skip_stop >80) - PSD_skip_stop = 80; - } - else - { - if((curRxOkCnt+curTxOkCnt) > 5) - { - if(Is40MHz) - { - PSD_skip_start = ((wlan_channel-1)*5 -Is40MHz*10)-2; // Modify by Neil to add 10 chs to mask - PSD_skip_stop = (PSD_skip_start + (1+Is40MHz)*20)+4; - } - else - { - PSD_skip_start = ((wlan_channel-1)*5 -Is40MHz*10)-10; // Modify by Neil to add 10 chs to mask - PSD_skip_stop = (PSD_skip_start + (1+Is40MHz)*20)+18; - } - - if(PSD_skip_start < 0) - PSD_skip_start = 0; - if(PSD_skip_stop >80) - PSD_skip_stop = 80; - } - } - } -#if 0 - else - { - if((curRxOkCnt+curTxOkCnt) > 1000) - { - PSD_skip_start = (wlan_channel-1)*5 -Is40MHz*10; - PSD_skip_stop = PSD_skip_start + (1+Is40MHz)*20; - } - } -#endif //Reove RXHP Issue - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PSD,DBG_LOUD,("PSD: Skip tone from %d to %d \n", PSD_skip_start, PSD_skip_stop)); - - for (n=0;n<80;n++) - { - if((n%20)==0) - { - channel = (n/20)*4 + 1; - - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_CHNLBW, 0x3FF, channel); - } - tone_idx = n%20; - if ((n>=PSD_skip_start) && (n PSD_report[n]) - PSD_report[n] = PSD_report_tmp; - - } - } - - PatchDCTone(pDM_Odm, PSD_report, initial_gain_psd); - - //----end - //1 Turn on RX - //Rx AGC on - ODM_SetBBReg(pDM_Odm, 0xC70, BIT0, 1); - ODM_SetBBReg(pDM_Odm, 0xC7C, BIT20, 1); - //CCK on - ODM_SetBBReg(pDM_Odm, rFPGA0_RFMOD, BIT24, 1); - //1 Turn on TX - //Resume TX Queue - - ODM_Write1Byte(pDM_Odm,REG_TXPAUSE, 0x00); - //Turn on 3-wire - ODM_SetBBReg(pDM_Odm, 0x88c, BIT20|BIT21|BIT22|BIT23, 0x0); - //1 Restore Current Settings - //Resume DIG - pDM_Odm->bDMInitialGainEnable = TRUE; - - ODM_Write_DIG(pDM_Odm, initial_gain); - - // restore originl center frequency - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask, CurrentChannel); - - //Turn on CCA - ODM_SetBBReg(pDM_Odm, 0xC14, bMaskDWord, RXIQI); - //Restore RX idle low power - if(RxIdleLowPwr == TRUE) - ODM_SetBBReg(pDM_Odm, 0x818, BIT28, 1); - - psd_cnt++; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PSD, DBG_LOUD,("PSD:psd_cnt = %d \n",psd_cnt)); - if (psd_cnt < ReScan) - ODM_SetTimer(pDM_Odm, &pDM_Odm->PSDTimer, Interval); - else - { - psd_cnt = 0; - for(i=0;i<80;i++) - //DbgPrint("psd_report[%d]= %d \n", 2402+i, PSD_report[i]); - RT_TRACE( COMP_PSD, DBG_LOUD,("psd_report[%d]= %d \n", 2402+i, PSD_report[i])); - - - GoodChannelDecision(pDM_Odm, PSD_report, PSD_bitmap,RSSI_BT, PSD_bitmap_memory); - - if(pDM_Odm->SupportICType==ODM_RTL8723A) - { - cur_byte_idx=0; - cur_bit_idx=0; - - //2 Restore H2C PSD Data to Last Data - H2C_PSD_DATA_last[0] = H2C_PSD_DATA[0]; - H2C_PSD_DATA_last[1] = H2C_PSD_DATA[1]; - H2C_PSD_DATA_last[2] = H2C_PSD_DATA[2]; - H2C_PSD_DATA_last[3] = H2C_PSD_DATA[3]; - H2C_PSD_DATA_last[4] = H2C_PSD_DATA[4]; - - - //2 Translate 80bit channel map to 40bit channel - for ( i=0;i<5;i++) - { - for(n=0;n<8;n++) - { - cur_byte_idx = i*2 + n/4; - cur_bit_idx = (n%4)*2; - if ( ((PSD_bitmap[cur_byte_idx]& BIT(cur_bit_idx)) != 0) && ((PSD_bitmap[cur_byte_idx]& BIT(cur_bit_idx+1)) != 0)) - H2C_PSD_DATA[i] = H2C_PSD_DATA[i] | (u1Byte) (1 << n); - } - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PSD, DBG_LOUD,("H2C_PSD_DATA[%d]=0x%x\n" ,i, H2C_PSD_DATA[i])); - } - - //3 To Compare the difference - for ( i=0;i<5;i++) - { - if(H2C_PSD_DATA[i] !=H2C_PSD_DATA_last[i]) - { - FillH2CCmd(Adapter, H2C_92C_PSD_RESULT, 5, H2C_PSD_DATA); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_PSD, DBG_LOUD,("Need to Update the AFH Map \n")); - break; - } - else - { - if(i==5) - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PSD, DBG_LOUD,("Not need to Update\n")); - } - } - if(pDM_Odm->bBtHsOperation) - { - ODM_SetTimer(pDM_Odm, &pDM_Odm->PSDTimer, 10000); - ODM_RT_TRACE( pDM_Odm,ODM_COMP_PSD, DBG_LOUD,("Leave dm_PSD_Monitor\n")); - } - else - { - ODM_SetTimer(pDM_Odm, &pDM_Odm->PSDTimer, 1500); - ODM_RT_TRACE( pDM_Odm,ODM_COMP_PSD, DBG_LOUD,("Leave dm_PSD_Monitor\n")); - } - } - } -} -/* -//Neil for Get BT RSSI -// Be Triggered by BT C2H CMD -VOID -ODM_PSDGetRSSI( - IN u1Byte RSSI_BT) -{ - - -} - -*/ - -VOID -ODM_PSDMonitor( - IN PDM_ODM_T pDM_Odm - ) -{ - //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - - //if(IS_HARDWARE_TYPE_8723AE(Adapter)) - - if(pDM_Odm->SupportICType == ODM_RTL8723A) //may need to add other IC type - { - if(pDM_Odm->SupportInterface==ODM_ITRF_PCIE) - { - if(pDM_Odm->bBtDisabled) //need to check upper layer connection - { - pDM_Odm->bPSDactive=FALSE; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PSD, DBG_LOUD, ("odm_PSDMonitor, return for BT is disabled!!!\n")); - return; - } - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PSD, DBG_LOUD, ("odm_PSDMonitor\n")); - //{ - pDM_Odm->bPSDinProcess = TRUE; - pDM_Odm->bPSDactive=TRUE; - odm_PSD_Monitor(pDM_Odm); - pDM_Odm->bPSDinProcess = FALSE; - } - } - -} -VOID -odm_PSDMonitorCallback( - PRT_TIMER pTimer -) -{ - PADAPTER Adapter = (PADAPTER)pTimer->Adapter; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - - PlatformScheduleWorkItem(&pHalData->PSDMonitorWorkitem); -} - -VOID -odm_PSDMonitorWorkItemCallback( - IN PVOID pContext - ) -{ - PADAPTER Adapter = (PADAPTER)pContext; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - - ODM_PSDMonitor(pDM_Odm); -} - -// <20130108, Kordan> E.g., With LNA used, we make the Rx power smaller to have a better EVM. (Asked by Willis) -VOID -odm_RFEControl( - IN PDM_ODM_T pDM_Odm, - IN u8Byte RSSIVal - ) -{ - PADAPTER Adapter = (PADAPTER)pDM_Odm->Adapter; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - static u1Byte TRSW_HighPwr = 0; - - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, DBG_LOUD, ("===> odm_RFEControl, RSSI = %d, TRSW_HighPwr = 0x%X, pHalData->RFEType = %d\n", - RSSIVal, TRSW_HighPwr, pHalData->RFEType )); - - if (pHalData->RFEType == 3) { - - pDM_Odm->RSSI_TRSW = RSSIVal; - - if (pDM_Odm->RSSI_TRSW >= pDM_Odm->RSSI_TRSW_H) - { - TRSW_HighPwr = 1; // Switch to - PHY_SetBBReg(Adapter, r_ANTSEL_SW_Jaguar, BIT1|BIT0, 0x1); // Set ANTSW=1/ANTSWB=0 for SW control - PHY_SetBBReg(Adapter, r_ANTSEL_SW_Jaguar, BIT9|BIT8, 0x3); // Set ANTSW=1/ANTSWB=0 for SW control - - } - else if (pDM_Odm->RSSI_TRSW <= pDM_Odm->RSSI_TRSW_L) - { - TRSW_HighPwr = 0; // Switched back - PHY_SetBBReg(Adapter, r_ANTSEL_SW_Jaguar, BIT1|BIT0, 0x1); // Set ANTSW=1/ANTSWB=0 for SW control - PHY_SetBBReg(Adapter, r_ANTSEL_SW_Jaguar, BIT9|BIT8, 0x0); // Set ANTSW=1/ANTSWB=0 for SW control - - } - } - - - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, DBG_LOUD, ("(pDM_Odm->RSSI_TRSW_H, pDM_Odm->RSSI_TRSW_L) = (%d, %d)\n", pDM_Odm->RSSI_TRSW_H, pDM_Odm->RSSI_TRSW_L)); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, DBG_LOUD, ("(RSSIVal, RSSIVal, pDM_Odm->RSSI_TRSW_iso) = (%d, %d, %d)\n", - RSSIVal, pDM_Odm->RSSI_TRSW_iso, pDM_Odm->RSSI_TRSW)); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, DBG_LOUD, ("<=== odm_RFEControl, RSSI = %d, TRSW_HighPwr = 0x%X\n", RSSIVal, TRSW_HighPwr)); -} - -VOID -ODM_MPT_DIG( - IN PDM_ODM_T pDM_Odm - ) -{ - pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; - PFALSE_ALARM_STATISTICS pFalseAlmCnt = &pDM_Odm->FalseAlmCnt; - u1Byte CurrentIGI = (u1Byte)pDM_DigTable->CurIGValue; - u1Byte DIG_Upper = 0x40, DIG_Lower = 0x20, C50, E50; - u8Byte RXOK_cal; - u1Byte IGI_A = 0x20, IGI_B = 0x20; - -#if ODM_FIX_2G_DIG - IGI_A = 0x22; - IGI_B = 0x24; -#endif - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_MP, DBG_LOUD, ("===> ODM_MPT_DIG, pBandType = %d\n", *pDM_Odm->pBandType)); - - odm_FalseAlarmCounterStatistics( pDM_Odm); - pDM_Odm->LastNumQryPhyStatusAll = pDM_Odm->NumQryPhyStatusAll; - pDM_Odm->NumQryPhyStatusAll = pDM_Odm->PhyDbgInfo.NumQryPhyStatusCCK + pDM_Odm->PhyDbgInfo.NumQryPhyStatusOFDM; - RXOK_cal = pDM_Odm->NumQryPhyStatusAll - pDM_Odm->LastNumQryPhyStatusAll; - - if (RXOK_cal == 0) - pDM_Odm->RxPWDBAve_final= 0; - else - pDM_Odm->RxPWDBAve_final= pDM_Odm->RxPWDBAve/RXOK_cal; - - pDM_Odm->RxPWDBAve = 0; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, DBG_LOUD, ("RX OK = %d\n", RXOK_cal)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, DBG_LOUD, ("pDM_Odm->RxPWDBAve_final = %d\n", pDM_Odm->RxPWDBAve_final)); - - // <20130315, Kordan> Except Cameo, we should always trun on 2.4G/5G DIG. - // (Cameo fixes the IGI of 2.4G, so only DIG on 5G. Asked by James.) -#if ODM_FIX_2G_DIG - if (*pDM_Odm->pBandType == BAND_ON_5G){ // for 5G -#else - if (1){ // for both 2G/5G -#endif - pDM_Odm->MPDIG_2G = FALSE; - pDM_Odm->Times_2G = 0; - - if (RXOK_cal >= 70 && pDM_Odm->RxPWDBAve_final<= 30) - { - if (CurrentIGI > 0x24){ - ODM_Write1Byte( pDM_Odm, rA_IGI_Jaguar, 0x24); - ODM_Write1Byte( pDM_Odm, rB_IGI_Jaguar, 0x24); - } - } - else - { - if(pFalseAlmCnt->Cnt_all > 1000){ - CurrentIGI = CurrentIGI + 8; - } - else if(pFalseAlmCnt->Cnt_all > 200){ - CurrentIGI = CurrentIGI + 4; - } - else if (pFalseAlmCnt->Cnt_all > 50){ - CurrentIGI = CurrentIGI + 2; - } - else if (pFalseAlmCnt->Cnt_all < 2){ - CurrentIGI = CurrentIGI - 2; - } - - if (CurrentIGI < DIG_Lower ){ - CurrentIGI = DIG_Lower; - } - else if(CurrentIGI > DIG_Upper){ - CurrentIGI = DIG_Upper; - } - - pDM_DigTable->CurIGValue = CurrentIGI; - - ODM_Write1Byte( pDM_Odm, rA_IGI_Jaguar, (u1Byte)CurrentIGI); - ODM_Write1Byte( pDM_Odm, rB_IGI_Jaguar, (u1Byte)CurrentIGI); - - C50 = ODM_Read1Byte( pDM_Odm, 0xc50); - E50 = ODM_Read1Byte( pDM_Odm, 0xe50); - //pDM_Odm->MPDIG_2G = FALSE; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_MP, DBG_LOUD, ("DIG = (%x, %x), Cnt_all = %d, Cnt_Ofdm_fail = %d, Cnt_Cck_fail = %d\n", C50, E50, pFalseAlmCnt->Cnt_all, pFalseAlmCnt->Cnt_Ofdm_fail, pFalseAlmCnt->Cnt_Cck_fail)); - } - - } - else - { //2G - ODM_RT_TRACE(pDM_Odm,ODM_COMP_MP, DBG_LOUD, ("MPDIG_2G = %d,\n", pDM_Odm->MPDIG_2G)); - - if(pDM_Odm->MPDIG_2G == FALSE){ - ODM_RT_TRACE(pDM_Odm,ODM_COMP_MP, DBG_LOUD, ("===> Fix IGI\n")); - ODM_Write1Byte( pDM_Odm, rA_IGI_Jaguar, (u1Byte)IGI_A); - ODM_Write1Byte( pDM_Odm, rB_IGI_Jaguar, (u1Byte)IGI_B); - } - if (pDM_Odm->Times_2G == 2) - pDM_Odm->MPDIG_2G = TRUE; - pDM_Odm->Times_2G++; - } - ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, DBG_LOUD, ("pDM_Odm->RxPWDBAve_final = %d\n", pDM_Odm->RxPWDBAve_final)); - - if (pDM_Odm->SupportICType == ODM_RTL8812) - odm_RFEControl(pDM_Odm, pDM_Odm->RxPWDBAve_final); - - ODM_SetTimer(pDM_Odm, &pDM_Odm->MPT_DIGTimer, 700); - -} - -VOID -odm_MPT_DIGCallback( - PRT_TIMER pTimer -) -{ - PADAPTER Adapter = (PADAPTER)pTimer->Adapter; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - - - #if DEV_BUS_TYPE==RT_PCI_INTERFACE - #if USE_WORKITEM - PlatformScheduleWorkItem(&pDM_Odm->MPT_DIGWorkitem); - #else - ODM_MPT_DIG(pDM_Odm); - #endif - #else - PlatformScheduleWorkItem(&pDM_Odm->MPT_DIGWorkitem); - #endif - -} - -VOID -odm_MPT_DIGWorkItemCallback( - IN PVOID pContext - ) -{ - PADAPTER Adapter = (PADAPTER)pContext; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - - ODM_MPT_DIG(pDM_Odm); -} - - - - - //cosa debug tool need to modify - -VOID -ODM_PSDDbgControl( - IN PADAPTER Adapter, - IN u4Byte mode, - IN u4Byte btRssi - ) -{ -#if (DEV_BUS_TYPE == RT_PCI_INTERFACE) - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - - ODM_RT_TRACE(pDM_Odm,COMP_PSD, DBG_LOUD, (" Monitor mode=%d, btRssi=%d\n", mode, btRssi)); - if(mode) - { - pDM_Odm->RSSI_BT = (u1Byte)btRssi; - pDM_Odm->bUserAssignLevel = TRUE; - ODM_SetTimer( pDM_Odm, &pDM_Odm->PSDTimer, 0); //ms - } - else - { - ODM_CancelTimer(pDM_Odm, &pDM_Odm->PSDTimer); - } -#endif -} - - -//#if(DEV_BUS_TYPE == RT_PCI_INTERFACE)|(DEV_BUS_TYPE == RT_USB_INTERFACE) - -void odm_RXHPInit( - IN PDM_ODM_T pDM_Odm) -{ -#if (DEV_BUS_TYPE == RT_PCI_INTERFACE)|(DEV_BUS_TYPE == RT_USB_INTERFACE) - pRXHP_T pRX_HP_Table = &pDM_Odm->DM_RXHP_Table; - u1Byte index; - - pRX_HP_Table->RXHP_enable = TRUE; - pRX_HP_Table->RXHP_flag = 0; - pRX_HP_Table->PSD_func_trigger = 0; - pRX_HP_Table->Pre_IGI = 0x20; - pRX_HP_Table->Cur_IGI = 0x20; - pRX_HP_Table->Cur_pw_th = pw_th_10dB; - pRX_HP_Table->Pre_pw_th = pw_th_10dB; - for(index=0; index<80; index++) - pRX_HP_Table->PSD_bitmap_RXHP[index] = 1; - -#if(DEV_BUS_TYPE == RT_USB_INTERFACE) - pRX_HP_Table->TP_Mode = Idle_Mode; -#endif -#endif -} - -void odm_RXHP( - IN PDM_ODM_T pDM_Odm) -{ -#if( DM_ODM_SUPPORT_TYPE & (ODM_WIN)) -#if (DEV_BUS_TYPE == RT_PCI_INTERFACE) | (DEV_BUS_TYPE == RT_USB_INTERFACE) - PADAPTER Adapter = pDM_Odm->Adapter; - PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo); - pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; - pRXHP_T pRX_HP_Table = &pDM_Odm->DM_RXHP_Table; - PFALSE_ALARM_STATISTICS FalseAlmCnt = &(pDM_Odm->FalseAlmCnt); - - u1Byte i, j, sum; - u1Byte Is40MHz; - s1Byte Intf_diff_idx, MIN_Intf_diff_idx = 16; - s4Byte cur_channel; - u1Byte ch_map_intf_5M[17] = {0}; - static u4Byte FA_TH = 0; - static u1Byte psd_intf_flag = 0; - static s4Byte curRssi = 0; - static s4Byte preRssi = 0; - static u1Byte PSDTriggerCnt = 1; - - u1Byte RX_HP_enable = (u1Byte)(ODM_GetBBReg(pDM_Odm, rOFDM0_XAAGCCore2, bMaskDWord)>>31); // for debug!! - -#if(DEV_BUS_TYPE == RT_USB_INTERFACE) - static s8Byte lastTxOkCnt = 0, lastRxOkCnt = 0; - s8Byte curTxOkCnt, curRxOkCnt; - s8Byte curTPOkCnt; - s8Byte TP_Acc3, TP_Acc5; - static s8Byte TP_Buff[5] = {0}; - static u1Byte pre_state = 0, pre_state_flag = 0; - static u1Byte Intf_HighTP_flag = 0, De_counter = 16; - static u1Byte TP_Degrade_flag = 0; -#endif - static u1Byte LatchCnt = 0; - - if(pDM_Odm->SupportICType & (ODM_RTL8723A|ODM_RTL8188E)) - return; - //AGC RX High Power Mode is only applied on 2G band in 92D!!! - if(pDM_Odm->SupportICType == ODM_RTL8192D) - { - if(*(pDM_Odm->pBandType) != ODM_BAND_2_4G) - return; - } - - if(!(pDM_Odm->SupportAbility==ODM_BB_RXHP)) - return; - - - //RX HP ON/OFF - if(RX_HP_enable == 1) - pRX_HP_Table->RXHP_enable = FALSE; - else - pRX_HP_Table->RXHP_enable = TRUE; - - if(pRX_HP_Table->RXHP_enable == FALSE) - { - if(pRX_HP_Table->RXHP_flag == 1) - { - pRX_HP_Table->RXHP_flag = 0; - psd_intf_flag = 0; - } - return; - } - -#if(DEV_BUS_TYPE == RT_USB_INTERFACE) - //2 Record current TP for USB interface - curTxOkCnt = *(pDM_Odm->pNumTxBytesUnicast)-lastTxOkCnt; - curRxOkCnt = *(pDM_Odm->pNumRxBytesUnicast)-lastRxOkCnt; - lastTxOkCnt = *(pDM_Odm->pNumTxBytesUnicast); - lastRxOkCnt = *(pDM_Odm->pNumRxBytesUnicast); - - curTPOkCnt = curTxOkCnt+curRxOkCnt; - TP_Buff[0] = curTPOkCnt; // current TP - TP_Acc3 = PlatformDivision64((TP_Buff[1]+TP_Buff[2]+TP_Buff[3]), 3); - TP_Acc5 = PlatformDivision64((TP_Buff[0]+TP_Buff[1]+TP_Buff[2]+TP_Buff[3]+TP_Buff[4]), 5); - - if(TP_Acc5 < 1000) - pRX_HP_Table->TP_Mode = Idle_Mode; - else if((1000 < TP_Acc5)&&(TP_Acc5 < 3750000)) - pRX_HP_Table->TP_Mode = Low_TP_Mode; - else - pRX_HP_Table->TP_Mode = High_TP_Mode; - - ODM_RT_TRACE(pDM_Odm, ODM_COMP_RXHP, ODM_DBG_LOUD, ("RX HP TP Mode = %d\n", pRX_HP_Table->TP_Mode)); - // Since TP result would be sampled every 2 sec, it needs to delay 4sec to wait PSD processing. - // When LatchCnt = 0, we would Get PSD result. - if(TP_Degrade_flag == 1) - { - LatchCnt--; - if(LatchCnt == 0) - { - TP_Degrade_flag = 0; - } - } - // When PSD function triggered by TP degrade 20%, and Interference Flag = 1 - // Set a De_counter to wait IGI = upper bound. If time is UP, the Interference flag will be pull down. - if(Intf_HighTP_flag == 1) - { - De_counter--; - if(De_counter == 0) - { - Intf_HighTP_flag = 0; - psd_intf_flag = 0; - } - } -#endif - - //2 AGC RX High Power Mode by PSD only applied to STA Mode - //3 NOT applied 1. Ad Hoc Mode. - //3 NOT applied 2. AP Mode - if ((pMgntInfo->mAssoc) && (!pMgntInfo->mIbss) && (!ACTING_AS_AP(Adapter))) - { - Is40MHz = *(pDM_Odm->pBandWidth); - curRssi = pDM_Odm->RSSI_Min; - cur_channel = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_CHNLBW, 0x0fff) & 0x0f; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_RXHP, ODM_DBG_LOUD, ("RXHP RX HP flag = %d\n", pRX_HP_Table->RXHP_flag)); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_RXHP, ODM_DBG_LOUD, ("RXHP FA = %d\n", FalseAlmCnt->Cnt_all)); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_RXHP, ODM_DBG_LOUD, ("RXHP cur RSSI = %d, pre RSSI=%d\n", curRssi, preRssi)); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_RXHP, ODM_DBG_LOUD, ("RXHP current CH = %d\n", cur_channel)); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_RXHP, ODM_DBG_LOUD, ("RXHP Is 40MHz = %d\n", Is40MHz)); - //2 PSD function would be triggered - //3 1. Every 4 sec for PCIE - //3 2. Before TP Mode (Idle TP<4kbps) for USB - //3 3. After TP Mode (High TP) for USB - if((curRssi > 68) && (pRX_HP_Table->RXHP_flag == 0)) // Only RSSI>TH and RX_HP_flag=0 will Do PSD process - { -#if (DEV_BUS_TYPE == RT_USB_INTERFACE) - //2 Before TP Mode ==> PSD would be trigger every 4 sec - if(pRX_HP_Table->TP_Mode == Idle_Mode) //2.1 less wlan traffic <4kbps - { -#endif - if(PSDTriggerCnt == 1) - { - odm_PSD_RXHP(pDM_Odm); - pRX_HP_Table->PSD_func_trigger = 1; - PSDTriggerCnt = 0; - } - else - { - PSDTriggerCnt++; - } -#if(DEV_BUS_TYPE == RT_USB_INTERFACE) - } - //2 After TP Mode ==> Check if TP degrade larger than 20% would trigger PSD function - if(pRX_HP_Table->TP_Mode == High_TP_Mode) - { - if((pre_state_flag == 0)&&(LatchCnt == 0)) - { - // TP var < 5% - if((((curTPOkCnt-TP_Acc3)*20)<(TP_Acc3))&&(((curTPOkCnt-TP_Acc3)*20)>(-TP_Acc3))) - { - pre_state++; - if(pre_state == 3) // hit pre_state condition => consecutive 3 times - { - pre_state_flag = 1; - pre_state = 0; - } - - } - else - { - pre_state = 0; - } - } - //3 If pre_state_flag=1 ==> start to monitor TP degrade 20% - if(pre_state_flag == 1) - { - if(((TP_Acc3-curTPOkCnt)*5)>(TP_Acc3)) // degrade 20% - { - odm_PSD_RXHP(pDM_Odm); - pRX_HP_Table->PSD_func_trigger = 1; - TP_Degrade_flag = 1; - LatchCnt = 2; - pre_state_flag = 0; - } - else if(((TP_Buff[2]-curTPOkCnt)*5)>TP_Buff[2]) - { - odm_PSD_RXHP(pDM_Odm); - pRX_HP_Table->PSD_func_trigger = 1; - TP_Degrade_flag = 1; - LatchCnt = 2; - pre_state_flag = 0; - } - else if(((TP_Buff[3]-curTPOkCnt)*5)>TP_Buff[3]) - { - odm_PSD_RXHP(pDM_Odm); - pRX_HP_Table->PSD_func_trigger = 1; - TP_Degrade_flag = 1; - LatchCnt = 2; - pre_state_flag = 0; - } - } - } -#endif -} - -#if (DEV_BUS_TYPE == RT_USB_INTERFACE) - for (i=0;i<4;i++) - { - TP_Buff[4-i] = TP_Buff[3-i]; - } -#endif - //2 Update PSD bitmap according to PSD report - if((pRX_HP_Table->PSD_func_trigger == 1)&&(LatchCnt == 0)) - { - //2 Separate 80M bandwidth into 16 group with smaller 5M BW. - for (i = 0 ; i < 16 ; i++) - { - sum = 0; - for(j = 0; j < 5 ; j++) - sum += pRX_HP_Table->PSD_bitmap_RXHP[5*i + j]; - - if(sum < 5) - { - ch_map_intf_5M[i] = 1; // interference flag - } - } - //=============just for debug========================= - //for(i=0;i<16;i++) - //DbgPrint("RX HP: ch_map_intf_5M[%d] = %d\n", i, ch_map_intf_5M[i]); - //=============================================== - //2 Mask target channel 5M index - for(i = 0; i < (4+4*Is40MHz) ; i++) - { - ch_map_intf_5M[cur_channel - (1+2*Is40MHz) + i] = 0; - } - - psd_intf_flag = 0; - for(i = 0; i < 16; i++) - { - if(ch_map_intf_5M[i] == 1) - { - psd_intf_flag = 1; // interference is detected!!! - break; - } - } - -#if (DEV_BUS_TYPE == RT_USB_INTERFACE) - if(pRX_HP_Table->TP_Mode!=Idle_Mode) - { - if(psd_intf_flag == 1) // to avoid psd_intf_flag always 1 - { - Intf_HighTP_flag = 1; - De_counter = 32; // 0x1E -> 0x3E needs 32 times by each IGI step =1 - } - } -#endif - ODM_RT_TRACE(pDM_Odm, ODM_COMP_RXHP, ODM_DBG_LOUD, ("RX HP psd_intf_flag = %d\n", psd_intf_flag)); - //2 Distance between target channel and interference - for(i = 0; i < 16; i++) - { - if(ch_map_intf_5M[i] == 1) - { - Intf_diff_idx = ((cur_channel+Is40MHz-(i+1))>0) ? (s1Byte)(cur_channel-2*Is40MHz-(i-2)) : (s1Byte)((i+1)-(cur_channel+2*Is40MHz)); - if(Intf_diff_idx < MIN_Intf_diff_idx) - MIN_Intf_diff_idx = Intf_diff_idx; // the min difference index between interference and target - } - } - ODM_RT_TRACE(pDM_Odm, ODM_COMP_RXHP, ODM_DBG_LOUD, ("RX HP MIN_Intf_diff_idx = %d\n", MIN_Intf_diff_idx)); - //2 Choose False Alarm Threshold - switch (MIN_Intf_diff_idx){ - case 0: - case 1: - case 2: - case 3: - FA_TH = FA_RXHP_TH1; - break; - case 4: // CH5 - case 5: // CH6 - FA_TH = FA_RXHP_TH2; - break; - case 6: // CH7 - case 7: // CH8 - FA_TH = FA_RXHP_TH3; - break; - case 8: // CH9 - case 9: //CH10 - FA_TH = FA_RXHP_TH4; - break; - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - FA_TH = FA_RXHP_TH5; - break; - } - ODM_RT_TRACE(pDM_Odm, ODM_COMP_RXHP, ODM_DBG_LOUD, ("RX HP FA_TH = %d\n", FA_TH)); - pRX_HP_Table->PSD_func_trigger = 0; - } - //1 Monitor RSSI variation to choose the suitable IGI or Exit AGC RX High Power Mode - if(pRX_HP_Table->RXHP_flag == 1) - { - if ((curRssi > 80)&&(preRssi < 80)) - { - pRX_HP_Table->Cur_IGI = LNA_Low_Gain_1; - } - else if ((curRssi < 80)&&(preRssi > 80)) - { - pRX_HP_Table->Cur_IGI = LNA_Low_Gain_2; - } - else if ((curRssi > 72)&&(preRssi < 72)) - { - pRX_HP_Table->Cur_IGI = LNA_Low_Gain_2; - } - else if ((curRssi < 72)&&( preRssi > 72)) - { - pRX_HP_Table->Cur_IGI = LNA_Low_Gain_3; - } - else if (curRssi < 68) //RSSI is NOT large enough!!==> Exit AGC RX High Power Mode - { - pRX_HP_Table->Cur_pw_th = pw_th_10dB; - pRX_HP_Table->RXHP_flag = 0; // Back to Normal DIG Mode - psd_intf_flag = 0; - } - } - else // pRX_HP_Table->RXHP_flag == 0 - { - //1 Decide whether to enter AGC RX High Power Mode - if ((curRssi > 70) && (psd_intf_flag == 1) && (FalseAlmCnt->Cnt_all > FA_TH) && - (pDM_DigTable->CurIGValue == pDM_DigTable->rx_gain_range_max)) - { - if (curRssi > 80) - { - pRX_HP_Table->Cur_IGI = LNA_Low_Gain_1; - } - else if (curRssi > 72) - { - pRX_HP_Table->Cur_IGI = LNA_Low_Gain_2; - } - else - { - pRX_HP_Table->Cur_IGI = LNA_Low_Gain_3; - } - pRX_HP_Table->Cur_pw_th = pw_th_16dB; //RegC54[9:8]=2'b11: to enter AGC Flow 3 - pRX_HP_Table->First_time_enter = TRUE; - pRX_HP_Table->RXHP_flag = 1; // RXHP_flag=1: AGC RX High Power Mode, RXHP_flag=0: Normal DIG Mode - } - } - preRssi = curRssi; - odm_Write_RXHP(pDM_Odm); - } -#endif //#if( DM_ODM_SUPPORT_TYPE & (ODM_WIN)) -#endif //#if (DEV_BUS_TYPE == RT_PCI_INTERFACE) | (DEV_BUS_TYPE == RT_USB_INTERFACE) -} - -void odm_Write_RXHP( - IN PDM_ODM_T pDM_Odm) -{ - pRXHP_T pRX_HP_Table = &pDM_Odm->DM_RXHP_Table; - u4Byte currentIGI; - - if(pRX_HP_Table->Cur_IGI != pRX_HP_Table->Pre_IGI) - { - ODM_SetBBReg(pDM_Odm, rOFDM0_XAAGCCore1, bMaskByte0, pRX_HP_Table->Cur_IGI); - ODM_SetBBReg(pDM_Odm, rOFDM0_XBAGCCore1, bMaskByte0, pRX_HP_Table->Cur_IGI); - } - - if(pRX_HP_Table->Cur_pw_th != pRX_HP_Table->Pre_pw_th) -{ - ODM_SetBBReg(pDM_Odm, rOFDM0_XAAGCCore2, BIT8|BIT9, pRX_HP_Table->Cur_pw_th); // RegC54[9:8]=2'b11: AGC Flow 3 - } - - if(pRX_HP_Table->RXHP_flag == 0) - { - pRX_HP_Table->Cur_IGI = 0x20; - } - else - { - currentIGI = ODM_GetBBReg(pDM_Odm, rOFDM0_XAAGCCore1, bMaskByte0); - if(currentIGI<0x50) - { - ODM_SetBBReg(pDM_Odm, rOFDM0_XAAGCCore1, bMaskByte0, pRX_HP_Table->Cur_IGI); - ODM_SetBBReg(pDM_Odm, rOFDM0_XBAGCCore1, bMaskByte0, pRX_HP_Table->Cur_IGI); - } - } - pRX_HP_Table->Pre_IGI = pRX_HP_Table->Cur_IGI; - pRX_HP_Table->Pre_pw_th = pRX_HP_Table->Cur_pw_th; - -} - -VOID -odm_PSD_RXHP( - IN PDM_ODM_T pDM_Odm -) -{ - pRXHP_T pRX_HP_Table = &pDM_Odm->DM_RXHP_Table; - PADAPTER Adapter = pDM_Odm->Adapter; - PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo); - unsigned int pts, start_point, stop_point, initial_gain ; - static u1Byte PSD_bitmap_memory[80], init_memory = 0; - static u1Byte psd_cnt=0; - static u4Byte PSD_report[80], PSD_report_tmp; - static u8Byte lastTxOkCnt=0, lastRxOkCnt=0; - u1Byte idx[20]={96,99,102,106,109,112,115,118,122,125, - 0,3,6,10,13,16,19,22,26,29}; - u1Byte n, i, channel, BBReset,tone_idx; - u1Byte PSD_bitmap[10]/*, SSBT=0*/,initial_gain_psd=0, RSSI_BT=0, initialGainUpper; - s4Byte PSD_skip_start, PSD_skip_stop; - u4Byte CurrentChannel, RXIQI, RxIdleLowPwr, wlan_channel; - u4Byte ReScan, Interval, Is40MHz; - u8Byte curTxOkCnt, curRxOkCnt; - //--------------2G band synthesizer for 92D switch RF channel using----------------- - u1Byte group_idx=0; - u4Byte SYN_RF25=0, SYN_RF26=0, SYN_RF27=0, SYN_RF2B=0, SYN_RF2C=0; - u4Byte SYN[5] = {0x25, 0x26, 0x27, 0x2B, 0x2C}; // synthesizer RF register for 2G channel - u4Byte SYN_group[3][5] = {{0x643BC, 0xFC038, 0x77C1A, 0x41289, 0x01840}, // For CH1,2,4,9,10.11.12 {0x643BC, 0xFC038, 0x77C1A, 0x41289, 0x01840} - {0x643BC, 0xFC038, 0x07C1A, 0x41289, 0x01840}, // For CH3,13,14 - {0x243BC, 0xFC438, 0x07C1A, 0x4128B, 0x0FC41}}; // For Ch5,6,7,8 - //--------------------- Add by Gary for Debug setting ---------------------- - u1Byte RSSI_BT_new = (u1Byte) ODM_GetBBReg(pDM_Odm, 0xB9C, 0xFF); - u1Byte rssi_ctrl = (u1Byte) ODM_GetBBReg(pDM_Odm, 0xB38, 0xFF); - //--------------------------------------------------------------------- - - if(pMgntInfo->bScanInProgress) - { - return; - } - - ReScan = PSD_RESCAN; - Interval = SCAN_INTERVAL; - - - //1 Initialization - if(init_memory == 0) - { - RT_TRACE( COMP_PSD, DBG_LOUD,("Init memory\n")); - for(i = 0; i < 80; i++) - PSD_bitmap_memory[i] = 0xFF; // channel is always good - init_memory = 1; - } - if(psd_cnt == 0) - { - RT_TRACE(COMP_PSD, DBG_LOUD,("Enter dm_PSD_Monitor\n")); - for(i = 0; i < 80; i++) - PSD_report[i] = 0; - } - - //1 Backup Current Settings - CurrentChannel = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask); - if(pDM_Odm->SupportICType == ODM_RTL8192D) - { - //2 Record Current synthesizer parameters based on current channel - if((*(pDM_Odm->pMacPhyMode)==ODM_SMSP)||(*(pDM_Odm->pMacPhyMode)==ODM_DMSP)) - { - SYN_RF25 = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x25, bMaskDWord); - SYN_RF26 = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x26, bMaskDWord); - SYN_RF27 = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x27, bMaskDWord); - SYN_RF2B = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x2B, bMaskDWord); - SYN_RF2C = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x2C, bMaskDWord); - } - else // DualMAC_DualPHY 2G - { - SYN_RF25 = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x25, bMaskDWord); - SYN_RF26 = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x26, bMaskDWord); - SYN_RF27 = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x27, bMaskDWord); - SYN_RF2B = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x2B, bMaskDWord); - SYN_RF2C = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x2C, bMaskDWord); - } - } - RXIQI = ODM_GetBBReg(pDM_Odm, 0xC14, bMaskDWord); - RxIdleLowPwr = (ODM_GetBBReg(pDM_Odm, 0x818, bMaskDWord)&BIT28)>>28; - Is40MHz = *(pDM_Odm->pBandWidth); - ODM_RT_TRACE(pDM_Odm, COMP_PSD, DBG_LOUD,("PSD Scan Start\n")); - //1 Turn off CCK - ODM_SetBBReg(pDM_Odm, rFPGA0_RFMOD, BIT24, 0); - //1 Turn off TX - //Pause TX Queue - ODM_Write1Byte(pDM_Odm, REG_TXPAUSE, 0xFF); - //Force RX to stop TX immediately - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_AC, bRFRegOffsetMask, 0x32E13); - //1 Turn off RX - //Rx AGC off RegC70[0]=0, RegC7C[20]=0 - ODM_SetBBReg(pDM_Odm, 0xC70, BIT0, 0); - ODM_SetBBReg(pDM_Odm, 0xC7C, BIT20, 0); - //Turn off CCA - ODM_SetBBReg(pDM_Odm, 0xC14, bMaskDWord, 0x0); - //BB Reset - ODM_SetBBReg(pDM_Odm, 0x87C, BIT31, 1); //clock gated to prevent from AGC table mess - BBReset = ODM_Read1Byte(pDM_Odm, 0x02); - ODM_Write1Byte(pDM_Odm, 0x02, BBReset&(~BIT0)); - ODM_Write1Byte(pDM_Odm, 0x02, BBReset|BIT0); - ODM_SetBBReg(pDM_Odm, 0x87C, BIT31, 0); - //1 Leave RX idle low power - ODM_SetBBReg(pDM_Odm, 0x818, BIT28, 0x0); - //1 Fix initial gain - RSSI_BT = RSSI_BT_new; - RT_TRACE(COMP_PSD, DBG_LOUD,("PSD: RSSI_BT= %d\n", RSSI_BT)); - - if(rssi_ctrl == 1) // just for debug!! - initial_gain_psd = RSSI_BT_new; - else - initial_gain_psd = pDM_Odm->RSSI_Min; // PSD report based on RSSI - - RT_TRACE(COMP_PSD, DBG_LOUD,("PSD: RSSI_BT= %d\n", RSSI_BT)); - - initialGainUpper = 0x54; - - RSSI_BT = initial_gain_psd; - //SSBT = RSSI_BT; - - //RT_TRACE( COMP_PSD, DBG_LOUD,("PSD: SSBT= %d\n", SSBT)); - RT_TRACE( COMP_PSD, DBG_LOUD,("PSD: initial gain= 0x%x\n", initial_gain_psd)); - - pDM_Odm->bDMInitialGainEnable = FALSE; - initial_gain = ODM_GetBBReg(pDM_Odm, 0xc50, bMaskDWord) & 0x7F; - //ODM_SetBBReg(pDM_Odm, 0xc50, 0x7F, initial_gain_psd); - ODM_Write_DIG(pDM_Odm, initial_gain_psd); - //1 Turn off 3-wire - ODM_SetBBReg(pDM_Odm, 0x88c, BIT20|BIT21|BIT22|BIT23, 0xF); - - //pts value = 128, 256, 512, 1024 - pts = 128; - - if(pts == 128) - { - ODM_SetBBReg(pDM_Odm, 0x808, BIT14|BIT15, 0x0); - start_point = 64; - stop_point = 192; - } - else if(pts == 256) - { - ODM_SetBBReg(pDM_Odm, 0x808, BIT14|BIT15, 0x1); - start_point = 128; - stop_point = 384; - } - else if(pts == 512) - { - ODM_SetBBReg(pDM_Odm, 0x808, BIT14|BIT15, 0x2); - start_point = 256; - stop_point = 768; - } - else - { - ODM_SetBBReg(pDM_Odm, 0x808, BIT14|BIT15, 0x3); - start_point = 512; - stop_point = 1536; - } - - -//3 Skip WLAN channels if WLAN busy - curTxOkCnt = *(pDM_Odm->pNumTxBytesUnicast) - lastTxOkCnt; - curRxOkCnt = *(pDM_Odm->pNumRxBytesUnicast) - lastRxOkCnt; - lastTxOkCnt = *(pDM_Odm->pNumTxBytesUnicast); - lastRxOkCnt = *(pDM_Odm->pNumRxBytesUnicast); - - PSD_skip_start=80; - PSD_skip_stop = 0; - wlan_channel = CurrentChannel & 0x0f; - - RT_TRACE(COMP_PSD,DBG_LOUD,("PSD: current channel: %x, BW:%d \n", wlan_channel, Is40MHz)); - - if((curRxOkCnt+curTxOkCnt) > 1000) - { - PSD_skip_start = (wlan_channel-1)*5 -Is40MHz*10; - PSD_skip_stop = PSD_skip_start + (1+Is40MHz)*20; - } - - RT_TRACE(COMP_PSD,DBG_LOUD,("PSD: Skip tone from %d to %d \n", PSD_skip_start, PSD_skip_stop)); - - for (n=0;n<80;n++) - { - if((n%20)==0) - { - channel = (n/20)*4 + 1; - if(pDM_Odm->SupportICType == ODM_RTL8192D) - { - switch(channel) - { - case 1: - case 9: - group_idx = 0; - break; - case 5: - group_idx = 2; - break; - case 13: - group_idx = 1; - break; - } - if((*(pDM_Odm->pMacPhyMode)==ODM_SMSP)||(*(pDM_Odm->pMacPhyMode)==ODM_DMSP)) - { - for(i = 0; i < SYN_Length; i++) - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, SYN[i], bMaskDWord, SYN_group[group_idx][i]); - - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_CHNLBW, 0x3FF, channel); - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_CHNLBW, 0x3FF, channel); - } - else // DualMAC_DualPHY 2G - { - for(i = 0; i < SYN_Length; i++) - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, SYN[i], bMaskDWord, SYN_group[group_idx][i]); - - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_CHNLBW, 0x3FF, channel); - } - } - else - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_CHNLBW, 0x3FF, channel); - } - tone_idx = n%20; - if ((n>=PSD_skip_start) && (n PSD_report[n]) - PSD_report[n] = PSD_report_tmp; - - } - } - - PatchDCTone(pDM_Odm, PSD_report, initial_gain_psd); - - //----end - //1 Turn on RX - //Rx AGC on - ODM_SetBBReg(pDM_Odm, 0xC70, BIT0, 1); - ODM_SetBBReg(pDM_Odm, 0xC7C, BIT20, 1); - //CCK on - ODM_SetBBReg(pDM_Odm, rFPGA0_RFMOD, BIT24, 1); - //1 Turn on TX - //Resume TX Queue - ODM_Write1Byte(pDM_Odm, REG_TXPAUSE, 0x00); - //Turn on 3-wire - ODM_SetBBReg(pDM_Odm, 0x88c, BIT20|BIT21|BIT22|BIT23, 0x0); - //1 Restore Current Settings - //Resume DIG - pDM_Odm->bDMInitialGainEnable= TRUE; - //ODM_SetBBReg(pDM_Odm, 0xc50, 0x7F, initial_gain); - ODM_Write_DIG(pDM_Odm,(u1Byte) initial_gain); - // restore originl center frequency - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask, CurrentChannel); - if(pDM_Odm->SupportICType == ODM_RTL8192D) - { - if((*(pDM_Odm->pMacPhyMode)==ODM_SMSP)||(*(pDM_Odm->pMacPhyMode)==ODM_DMSP)) - { - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_CHNLBW, bMaskDWord, CurrentChannel); - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x25, bMaskDWord, SYN_RF25); - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x26, bMaskDWord, SYN_RF26); - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x27, bMaskDWord, SYN_RF27); - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x2B, bMaskDWord, SYN_RF2B); - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x2C, bMaskDWord, SYN_RF2C); - } - else // DualMAC_DualPHY - { - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x25, bMaskDWord, SYN_RF25); - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x26, bMaskDWord, SYN_RF26); - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x27, bMaskDWord, SYN_RF27); - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x2B, bMaskDWord, SYN_RF2B); - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x2C, bMaskDWord, SYN_RF2C); - } - } - //Turn on CCA - ODM_SetBBReg(pDM_Odm, 0xC14, bMaskDWord, RXIQI); - //Restore RX idle low power - if(RxIdleLowPwr == TRUE) - ODM_SetBBReg(pDM_Odm, 0x818, BIT28, 1); - - psd_cnt++; - //gPrint("psd cnt=%d\n", psd_cnt); - ODM_RT_TRACE(pDM_Odm,COMP_PSD, DBG_LOUD,("PSD:psd_cnt = %d \n",psd_cnt)); - if (psd_cnt < ReScan) - { - ODM_SetTimer(pDM_Odm, &pRX_HP_Table->PSDTimer, Interval); //ms - } - else - { - psd_cnt = 0; - for(i=0;i<80;i++) - RT_TRACE( COMP_PSD, DBG_LOUD,("psd_report[%d]= %d \n", 2402+i, PSD_report[i])); - //DbgPrint("psd_report[%d]= %d \n", 2402+i, PSD_report[i]); - - GoodChannelDecision(pDM_Odm, PSD_report, PSD_bitmap,RSSI_BT, PSD_bitmap_memory); - - } - } - -VOID -odm_PSD_RXHPCallback( - PRT_TIMER pTimer -) -{ - PADAPTER Adapter = (PADAPTER)pTimer->Adapter; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - pRXHP_T pRX_HP_Table = &pDM_Odm->DM_RXHP_Table; - -#if DEV_BUS_TYPE==RT_PCI_INTERFACE - #if USE_WORKITEM - ODM_ScheduleWorkItem(&pRX_HP_Table->PSDTimeWorkitem); - #else - odm_PSD_RXHP(pDM_Odm); - #endif -#else - ODM_ScheduleWorkItem(&pRX_HP_Table->PSDTimeWorkitem); -#endif - - } - -VOID -odm_PSD_RXHPWorkitemCallback( - IN PVOID pContext - ) -{ - PADAPTER pAdapter = (PADAPTER)pContext; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - - odm_PSD_RXHP(pDM_Odm); -} - -#endif //#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) - -VOID -odm_PathDiversityInit( - IN PDM_ODM_T pDM_Odm -) -{ - if(!(pDM_Odm->SupportAbility & ODM_BB_PATH_DIV)) - { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_PATH_DIV,ODM_DBG_LOUD,("Return: Not Support PathDiv\n")); - return; - } - -#if RTL8812A_SUPPORT - - if(pDM_Odm->SupportICType & ODM_RTL8812) - ODM_PathDiversityInit_8812A(pDM_Odm); -#endif -} - - -VOID -odm_PathDiversity( - IN PDM_ODM_T pDM_Odm -) -{ - if(!(pDM_Odm->SupportAbility & ODM_BB_PATH_DIV)) - { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_PATH_DIV,ODM_DBG_LOUD,("Return: Not Support PathDiv\n")); - return; - } - -#if RTL8812A_SUPPORT - - if(pDM_Odm->SupportICType & ODM_RTL8812) - ODM_PathDiversity_8812A(pDM_Odm); -#endif -} - - -// -// 2011/12/02 MH Copy from MP oursrc for temporarily test. -// -#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) -VOID -odm_OFDMTXPathDiversity_92C( - IN PADAPTER Adapter) -{ -// HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo); - PRT_WLAN_STA pEntry; - u1Byte i, DefaultRespPath = 0; - s4Byte MinRSSI = 0xFF; - pPD_T pDM_PDTable = &Adapter->DM_PDTable; - pDM_PDTable->OFDMTXPath = 0; - - //1 Default Port - if(pMgntInfo->mAssoc) - { - RT_TRACE( COMP_SWAS, DBG_LOUD, ("odm_OFDMTXPathDiversity_92C: Default port RSSI[0]=%d, RSSI[1]=%d\n", - Adapter->RxStats.RxRSSIPercentage[0], Adapter->RxStats.RxRSSIPercentage[1])); - if(Adapter->RxStats.RxRSSIPercentage[0] > Adapter->RxStats.RxRSSIPercentage[1]) - { - pDM_PDTable->OFDMTXPath = pDM_PDTable->OFDMTXPath & (~BIT0); - MinRSSI = Adapter->RxStats.RxRSSIPercentage[1]; - DefaultRespPath = 0; - RT_TRACE( COMP_SWAS, DBG_LOUD, ("odm_OFDMTXPathDiversity_92C: Default port Select Path-0\n")); - } - else - { - pDM_PDTable->OFDMTXPath = pDM_PDTable->OFDMTXPath | BIT0; - MinRSSI = Adapter->RxStats.RxRSSIPercentage[0]; - DefaultRespPath = 1; - RT_TRACE( COMP_SWAS, DBG_LOUD, ("odm_OFDMTXPathDiversity_92C: Default port Select Path-1\n")); - } - //RT_TRACE( COMP_SWAS, DBG_LOUD, ("pDM_PDTable->OFDMTXPath =0x%x\n",pDM_PDTable->OFDMTXPath)); - } - //1 Extension Port - for(i = 0; i < ODM_ASSOCIATE_ENTRY_NUM; i++) - { - if(IsAPModeExist(Adapter) && GetFirstExtAdapter(Adapter) != NULL) - pEntry = AsocEntry_EnumStation(GetFirstExtAdapter(Adapter), i); - else - pEntry = AsocEntry_EnumStation(GetDefaultAdapter(Adapter), i); - - if(pEntry!=NULL) - { - if(pEntry->bAssociated) - { - RT_TRACE( COMP_SWAS, DBG_LOUD, ("odm_OFDMTXPathDiversity_92C: MACID=%d, RSSI_0=%d, RSSI_1=%d\n", - pEntry->AssociatedMacId, pEntry->rssi_stat.RxRSSIPercentage[0], pEntry->rssi_stat.RxRSSIPercentage[1])); - - if(pEntry->rssi_stat.RxRSSIPercentage[0] > pEntry->rssi_stat.RxRSSIPercentage[1]) - { - pDM_PDTable->OFDMTXPath = pDM_PDTable->OFDMTXPath & ~(BIT(pEntry->AssociatedMacId)); - //pHalData->TXPath = pHalData->TXPath & ~(1<<(pEntry->AssociatedMacId)); - RT_TRACE( COMP_SWAS, DBG_LOUD, ("odm_OFDMTXPathDiversity_92C: MACID=%d Select Path-0\n", pEntry->AssociatedMacId)); - if(pEntry->rssi_stat.RxRSSIPercentage[1] < MinRSSI) - { - MinRSSI = pEntry->rssi_stat.RxRSSIPercentage[1]; - DefaultRespPath = 0; - } - } - else - { - pDM_PDTable->OFDMTXPath = pDM_PDTable->OFDMTXPath | BIT(pEntry->AssociatedMacId); - //pHalData->TXPath = pHalData->TXPath | (1 << (pEntry->AssociatedMacId)); - RT_TRACE( COMP_SWAS, DBG_LOUD, ("odm_OFDMTXPathDiversity_92C: MACID=%d Select Path-1\n", pEntry->AssociatedMacId)); - if(pEntry->rssi_stat.RxRSSIPercentage[0] < MinRSSI) - { - MinRSSI = pEntry->rssi_stat.RxRSSIPercentage[0]; - DefaultRespPath = 1; - } - } - } - } - else - { - break; - } - } - - pDM_PDTable->OFDMDefaultRespPath = DefaultRespPath; -} - - -BOOLEAN -odm_IsConnected_92C( - IN PADAPTER Adapter -) -{ - PRT_WLAN_STA pEntry; - PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo); - u4Byte i; - BOOLEAN bConnected=FALSE; - - if(pMgntInfo->mAssoc) - { - bConnected = TRUE; - } - else - { - for(i = 0; i < ODM_ASSOCIATE_ENTRY_NUM; i++) - { - if(IsAPModeExist(Adapter) && GetFirstExtAdapter(Adapter) != NULL) - pEntry = AsocEntry_EnumStation(GetFirstExtAdapter(Adapter), i); - else - pEntry = AsocEntry_EnumStation(GetDefaultAdapter(Adapter), i); - - if(pEntry!=NULL) - { - if(pEntry->bAssociated) - { - bConnected = TRUE; - break; - } - } - else - { - break; - } - } - } - return bConnected; -} - - -VOID -odm_ResetPathDiversity_92C( - IN PADAPTER Adapter -) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - pPD_T pDM_PDTable = &Adapter->DM_PDTable; - PRT_WLAN_STA pEntry; - u4Byte i,j; - - pHalData->RSSI_test = FALSE; - pDM_PDTable->CCK_Pkt_Cnt = 0; - pDM_PDTable->OFDM_Pkt_Cnt = 0; - pHalData->CCK_Pkt_Cnt =0; - pHalData->OFDM_Pkt_Cnt =0; - - if(pDM_PDTable->CCKPathDivEnable == TRUE) - PHY_SetBBReg(Adapter, rCCK0_AFESetting , 0x0F000000, 0x01); //RX path = PathAB - - for(i=0; i<2; i++) - { - pDM_PDTable->RSSI_CCK_Path_cnt[i]=0; - pDM_PDTable->RSSI_CCK_Path[i] = 0; - } - for(i = 0; i < ODM_ASSOCIATE_ENTRY_NUM; i++) - { - if(IsAPModeExist(Adapter) && GetFirstExtAdapter(Adapter) != NULL) - pEntry = AsocEntry_EnumStation(GetFirstExtAdapter(Adapter), i); - else - pEntry = AsocEntry_EnumStation(GetDefaultAdapter(Adapter), i); - - if(pEntry!=NULL) - { - pEntry->rssi_stat.CCK_Pkt_Cnt = 0; - pEntry->rssi_stat.OFDM_Pkt_Cnt = 0; - for(j=0; j<2; j++) - { - pEntry->rssi_stat.RSSI_CCK_Path_cnt[j] = 0; - pEntry->rssi_stat.RSSI_CCK_Path[j] = 0; - } - } - else - break; - } -} - - -VOID -odm_CCKTXPathDiversity_92C( - IN PADAPTER Adapter -) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo); - PRT_WLAN_STA pEntry; - s4Byte MinRSSI = 0xFF; - u1Byte i, DefaultRespPath = 0; -// BOOLEAN bBModePathDiv = FALSE; - pPD_T pDM_PDTable = &Adapter->DM_PDTable; - - //1 Default Port - if(pMgntInfo->mAssoc) - { - if(pHalData->OFDM_Pkt_Cnt == 0) - { - for(i=0; i<2; i++) - { - if(pDM_PDTable->RSSI_CCK_Path_cnt[i] > 1) //Because the first packet is discarded - pDM_PDTable->RSSI_CCK_Path[i] = pDM_PDTable->RSSI_CCK_Path[i] / (pDM_PDTable->RSSI_CCK_Path_cnt[i]-1); - else - pDM_PDTable->RSSI_CCK_Path[i] = 0; - } - RT_TRACE( COMP_SWAS, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: pDM_PDTable->RSSI_CCK_Path[0]=%d, pDM_PDTable->RSSI_CCK_Path[1]=%d\n", - pDM_PDTable->RSSI_CCK_Path[0], pDM_PDTable->RSSI_CCK_Path[1])); - RT_TRACE( COMP_SWAS, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: pDM_PDTable->RSSI_CCK_Path_cnt[0]=%d, pDM_PDTable->RSSI_CCK_Path_cnt[1]=%d\n", - pDM_PDTable->RSSI_CCK_Path_cnt[0], pDM_PDTable->RSSI_CCK_Path_cnt[1])); - - if(pDM_PDTable->RSSI_CCK_Path[0] > pDM_PDTable->RSSI_CCK_Path[1]) - { - pDM_PDTable->CCKTXPath = pDM_PDTable->CCKTXPath & (~BIT0); - MinRSSI = pDM_PDTable->RSSI_CCK_Path[1]; - DefaultRespPath = 0; - RT_TRACE( COMP_SWAS, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: Default port Select CCK Path-0\n")); - } - else if(pDM_PDTable->RSSI_CCK_Path[0] < pDM_PDTable->RSSI_CCK_Path[1]) - { - pDM_PDTable->CCKTXPath = pDM_PDTable->CCKTXPath | BIT0; - MinRSSI = pDM_PDTable->RSSI_CCK_Path[0]; - DefaultRespPath = 1; - RT_TRACE( COMP_SWAS, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: Default port Select CCK Path-1\n")); - } - else - { - if((pDM_PDTable->RSSI_CCK_Path[0] != 0) && (pDM_PDTable->RSSI_CCK_Path[0] < MinRSSI)) - { - pDM_PDTable->CCKTXPath = pDM_PDTable->CCKTXPath & (~BIT0); - RT_TRACE( COMP_SWAS, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: Default port Select CCK Path-0\n")); - MinRSSI = pDM_PDTable->RSSI_CCK_Path[1]; - DefaultRespPath = 0; - } - else - { - RT_TRACE( COMP_SWAS, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: Default port unchange CCK Path\n")); - } - } - } - else //Follow OFDM decision - { - pDM_PDTable->CCKTXPath = (pDM_PDTable->CCKTXPath & (~BIT0)) | (pDM_PDTable->OFDMTXPath &BIT0); - RT_TRACE( COMP_SWAS, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: Follow OFDM decision, Default port Select CCK Path-%d\n", - pDM_PDTable->CCKTXPath &BIT0)); - } - } - //1 Extension Port - for(i = 0; i < ODM_ASSOCIATE_ENTRY_NUM; i++) - { - if(IsAPModeExist(Adapter) && GetFirstExtAdapter(Adapter) != NULL) - pEntry = AsocEntry_EnumStation(GetFirstExtAdapter(Adapter), i); - else - pEntry = AsocEntry_EnumStation(GetDefaultAdapter(Adapter), i); - - if(pEntry!=NULL) - { - if(pEntry->bAssociated) - { - if(pEntry->rssi_stat.OFDM_Pkt_Cnt == 0) - { - u1Byte j=0; - for(j=0; j<2; j++) - { - if(pEntry->rssi_stat.RSSI_CCK_Path_cnt[j] > 1) - pEntry->rssi_stat.RSSI_CCK_Path[j] = pEntry->rssi_stat.RSSI_CCK_Path[j] / (pEntry->rssi_stat.RSSI_CCK_Path_cnt[j]-1); - else - pEntry->rssi_stat.RSSI_CCK_Path[j] = 0; - } - RT_TRACE( COMP_SWAS, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: MACID=%d, RSSI_CCK0=%d, RSSI_CCK1=%d\n", - pEntry->AssociatedMacId, pEntry->rssi_stat.RSSI_CCK_Path[0], pEntry->rssi_stat.RSSI_CCK_Path[1])); - - if(pEntry->rssi_stat.RSSI_CCK_Path[0] >pEntry->rssi_stat.RSSI_CCK_Path[1]) - { - pDM_PDTable->CCKTXPath = pDM_PDTable->CCKTXPath & ~(BIT(pEntry->AssociatedMacId)); - RT_TRACE( COMP_SWAS, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: MACID=%d Select CCK Path-0\n", pEntry->AssociatedMacId)); - if(pEntry->rssi_stat.RSSI_CCK_Path[1] < MinRSSI) - { - MinRSSI = pEntry->rssi_stat.RSSI_CCK_Path[1]; - DefaultRespPath = 0; - } - } - else if(pEntry->rssi_stat.RSSI_CCK_Path[0] rssi_stat.RSSI_CCK_Path[1]) - { - pDM_PDTable->CCKTXPath = pDM_PDTable->CCKTXPath | BIT(pEntry->AssociatedMacId); - RT_TRACE( COMP_SWAS, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: MACID=%d Select CCK Path-1\n", pEntry->AssociatedMacId)); - if(pEntry->rssi_stat.RSSI_CCK_Path[0] < MinRSSI) - { - MinRSSI = pEntry->rssi_stat.RSSI_CCK_Path[0]; - DefaultRespPath = 1; - } - } - else - { - if((pEntry->rssi_stat.RSSI_CCK_Path[0] != 0) && (pEntry->rssi_stat.RSSI_CCK_Path[0] < MinRSSI)) - { - pDM_PDTable->CCKTXPath = pDM_PDTable->CCKTXPath & ~(BIT(pEntry->AssociatedMacId)); - MinRSSI = pEntry->rssi_stat.RSSI_CCK_Path[1]; - DefaultRespPath = 0; - RT_TRACE( COMP_SWAS, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: MACID=%d Select CCK Path-0\n", pEntry->AssociatedMacId)); - } - else - { - RT_TRACE( COMP_SWAS, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: MACID=%d unchange CCK Path\n", pEntry->AssociatedMacId)); - } - } - } - else //Follow OFDM decision - { - pDM_PDTable->CCKTXPath = (pDM_PDTable->CCKTXPath & (~(BIT(pEntry->AssociatedMacId)))) | (pDM_PDTable->OFDMTXPath & BIT(pEntry->AssociatedMacId)); - RT_TRACE( COMP_SWAS, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: Follow OFDM decision, MACID=%d Select CCK Path-%d\n", - pEntry->AssociatedMacId, (pDM_PDTable->CCKTXPath & BIT(pEntry->AssociatedMacId))>>(pEntry->AssociatedMacId))); - } - } - } - else - { - break; - } - } - - RT_TRACE( COMP_SWAS, DBG_LOUD, ("odm_CCKTXPathDiversity_92C:MinRSSI=%d\n",MinRSSI)); - - if(MinRSSI == 0xFF) - DefaultRespPath = pDM_PDTable->CCKDefaultRespPath; - - pDM_PDTable->CCKDefaultRespPath = DefaultRespPath; -} - - - -VOID -odm_PathDiversityAfterLink_92C( - IN PADAPTER Adapter -) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - pPD_T pDM_PDTable = &Adapter->DM_PDTable; - u1Byte DefaultRespPath=0; - - if((!IS_92C_SERIAL(pHalData->VersionID)) || (pHalData->PathDivCfg != 1) || (pHalData->eRFPowerState == eRfOff)) - { - if(pHalData->PathDivCfg == 0) - { - RT_TRACE( COMP_SWAS, DBG_LOUD, ("No ODM_TXPathDiversity()\n")); - } - else - { - RT_TRACE( COMP_SWAS, DBG_LOUD, ("2T ODM_TXPathDiversity()\n")); - } - return; - } - if(!odm_IsConnected_92C(Adapter)) - { - RT_TRACE( COMP_SWAS, DBG_LOUD, ("ODM_TXPathDiversity(): No Connections\n")); - return; - } - - - if(pDM_PDTable->TrainingState == 0) - { - RT_TRACE( COMP_SWAS, DBG_LOUD, ("ODM_TXPathDiversity() ==>\n")); - odm_OFDMTXPathDiversity_92C(Adapter); - - if((pDM_PDTable->CCKPathDivEnable == TRUE) && (pDM_PDTable->OFDM_Pkt_Cnt < 100)) - { - //RT_TRACE( COMP_SWAS, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: TrainingState=0\n")); - - if(pDM_PDTable->CCK_Pkt_Cnt > 300) - pDM_PDTable->Timer = 20; - else if(pDM_PDTable->CCK_Pkt_Cnt > 100) - pDM_PDTable->Timer = 60; - else - pDM_PDTable->Timer = 250; - RT_TRACE( COMP_SWAS, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: timer=%d\n",pDM_PDTable->Timer)); - - PHY_SetBBReg(Adapter, rCCK0_AFESetting , 0x0F000000, 0x00); // RX path = PathA - pDM_PDTable->TrainingState = 1; - pHalData->RSSI_test = TRUE; - ODM_SetTimer( pDM_Odm, &pDM_Odm->CCKPathDiversityTimer, pDM_PDTable->Timer); //ms - } - else - { - pDM_PDTable->CCKTXPath = pDM_PDTable->OFDMTXPath; - DefaultRespPath = pDM_PDTable->OFDMDefaultRespPath; - RT_TRACE( COMP_SWAS, DBG_LOUD, ("odm_SetRespPath_92C: Skip odm_CCKTXPathDiversity_92C, DefaultRespPath is OFDM\n")); - odm_SetRespPath_92C(Adapter, DefaultRespPath); - odm_ResetPathDiversity_92C(Adapter); - RT_TRACE( COMP_SWAS, DBG_LOUD, ("ODM_TXPathDiversity() <==\n")); - } - } - else if(pDM_PDTable->TrainingState == 1) - { - //RT_TRACE( COMP_SWAS, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: TrainingState=1\n")); - PHY_SetBBReg(Adapter, rCCK0_AFESetting , 0x0F000000, 0x05); // RX path = PathB - pDM_PDTable->TrainingState = 2; - ODM_SetTimer( pDM_Odm, &pDM_Odm->CCKPathDiversityTimer, pDM_PDTable->Timer); //ms - } - else - { - //RT_TRACE( COMP_SWAS, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: TrainingState=2\n")); - pDM_PDTable->TrainingState = 0; - odm_CCKTXPathDiversity_92C(Adapter); - if(pDM_PDTable->OFDM_Pkt_Cnt != 0) - { - DefaultRespPath = pDM_PDTable->OFDMDefaultRespPath; - RT_TRACE( COMP_SWAS, DBG_LOUD, ("odm_SetRespPath_92C: DefaultRespPath is OFDM\n")); - } - else - { - DefaultRespPath = pDM_PDTable->CCKDefaultRespPath; - RT_TRACE( COMP_SWAS, DBG_LOUD, ("odm_SetRespPath_92C: DefaultRespPath is CCK\n")); - } - odm_SetRespPath_92C(Adapter, DefaultRespPath); - odm_ResetPathDiversity_92C(Adapter); - RT_TRACE( COMP_SWAS, DBG_LOUD, ("ODM_TXPathDiversity() <==\n")); - } - -} - - - -VOID -odm_CCKTXPathDiversityCallback( - PRT_TIMER pTimer -) -{ -#if USE_WORKITEM - PADAPTER Adapter = (PADAPTER)pTimer->Adapter; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; -#else - PADAPTER Adapter = (PADAPTER)pTimer->Adapter; -#endif - -#if DEV_BUS_TYPE==RT_PCI_INTERFACE -#if USE_WORKITEM - PlatformScheduleWorkItem(&pDM_Odm->CCKPathDiversityWorkitem); -#else - odm_PathDiversityAfterLink_92C(Adapter); -#endif -#else - PlatformScheduleWorkItem(&pDM_Odm->CCKPathDiversityWorkitem); -#endif - -} - - -VOID -odm_CCKTXPathDiversityWorkItemCallback( - IN PVOID pContext - ) -{ - PADAPTER Adapter = (PADAPTER)pContext; - - odm_CCKTXPathDiversity_92C(Adapter); -} - - -VOID -ODM_CCKPathDiversityChkPerPktRssi( - PADAPTER Adapter, - BOOLEAN bIsDefPort, - BOOLEAN bMatchBSSID, - PRT_WLAN_STA pEntry, - PRT_RFD pRfd, - pu1Byte pDesc - ) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - BOOLEAN bCount = FALSE; - pPD_T pDM_PDTable = &Adapter->DM_PDTable; - //BOOLEAN isCCKrate = RX_HAL_IS_CCK_RATE_92C(pDesc); -#if DEV_BUS_TYPE != RT_SDIO_INTERFACE - BOOLEAN isCCKrate = RX_HAL_IS_CCK_RATE(Adapter, pDesc); -#else //below code would be removed if we have verified SDIO - BOOLEAN isCCKrate = IS_HARDWARE_TYPE_8188E(Adapter) ? RX_HAL_IS_CCK_RATE_88E(pDesc) : RX_HAL_IS_CCK_RATE_92C(pDesc); -#endif - - if((pHalData->PathDivCfg != 1) || (pHalData->RSSI_test == FALSE)) - return; - - if(pHalData->RSSI_target==NULL && bIsDefPort && bMatchBSSID) - bCount = TRUE; - else if(pHalData->RSSI_target!=NULL && pEntry!=NULL && pHalData->RSSI_target==pEntry) - bCount = TRUE; - - if(bCount && isCCKrate) - { - if(pDM_PDTable->TrainingState == 1 ) - { - if(pEntry) - { - if(pEntry->rssi_stat.RSSI_CCK_Path_cnt[0] != 0) - pEntry->rssi_stat.RSSI_CCK_Path[0] += pRfd->Status.RxPWDBAll; - pEntry->rssi_stat.RSSI_CCK_Path_cnt[0]++; - } - else - { - if(pDM_PDTable->RSSI_CCK_Path_cnt[0] != 0) - pDM_PDTable->RSSI_CCK_Path[0] += pRfd->Status.RxPWDBAll; - pDM_PDTable->RSSI_CCK_Path_cnt[0]++; - } - } - else if(pDM_PDTable->TrainingState == 2 ) - { - if(pEntry) - { - if(pEntry->rssi_stat.RSSI_CCK_Path_cnt[1] != 0) - pEntry->rssi_stat.RSSI_CCK_Path[1] += pRfd->Status.RxPWDBAll; - pEntry->rssi_stat.RSSI_CCK_Path_cnt[1]++; - } - else - { - if(pDM_PDTable->RSSI_CCK_Path_cnt[1] != 0) - pDM_PDTable->RSSI_CCK_Path[1] += pRfd->Status.RxPWDBAll; - pDM_PDTable->RSSI_CCK_Path_cnt[1]++; - } - } - } -} - - -BOOLEAN -ODM_PathDiversityBeforeLink92C( - //IN PADAPTER Adapter - IN PDM_ODM_T pDM_Odm - ) -{ -#if (RT_MEM_SIZE_LEVEL != RT_MEM_SIZE_MINIMUM) - PADAPTER Adapter = pDM_Odm->Adapter; - HAL_DATA_TYPE* pHalData = NULL; - PMGNT_INFO pMgntInfo = NULL; - //pSWAT_T pDM_SWAT_Table = &Adapter->DM_SWAT_Table; - pPD_T pDM_PDTable = NULL; - - s1Byte Score = 0; - PRT_WLAN_BSS pTmpBssDesc; - PRT_WLAN_BSS pTestBssDesc; - - u1Byte target_chnl = 0; - u1Byte index; - - if (pDM_Odm->Adapter == NULL) //For BSOD when plug/unplug fast. //By YJ,120413 - { // The ODM structure is not initialized. - return FALSE; - } - pHalData = GET_HAL_DATA(Adapter); - pMgntInfo = &Adapter->MgntInfo; - pDM_PDTable = &Adapter->DM_PDTable; - - // Condition that does not need to use path diversity. - if((!IS_92C_SERIAL(pHalData->VersionID)) || (pHalData->PathDivCfg!=1) || pMgntInfo->AntennaTest ) - { - RT_TRACE(COMP_SWAS, DBG_LOUD, - ("ODM_PathDiversityBeforeLink92C(): No PathDiv Mechanism before link.\n")); - return FALSE; - } - - // Since driver is going to set BB register, it shall check if there is another thread controlling BB/RF. - PlatformAcquireSpinLock(Adapter, RT_RF_STATE_SPINLOCK); - if(pHalData->eRFPowerState!=eRfOn || pMgntInfo->RFChangeInProgress || pMgntInfo->bMediaConnect) - { - PlatformReleaseSpinLock(Adapter, RT_RF_STATE_SPINLOCK); - - RT_TRACE(COMP_SWAS, DBG_LOUD, - ("ODM_PathDiversityBeforeLink92C(): RFChangeInProgress(%x), eRFPowerState(%x)\n", - pMgntInfo->RFChangeInProgress, - pHalData->eRFPowerState)); - - //pDM_SWAT_Table->SWAS_NoLink_State = 0; - pDM_PDTable->PathDiv_NoLink_State = 0; - - return FALSE; - } - else - { - PlatformReleaseSpinLock(Adapter, RT_RF_STATE_SPINLOCK); - } - - //1 Run AntDiv mechanism "Before Link" part. - //if(pDM_SWAT_Table->SWAS_NoLink_State == 0) - if(pDM_PDTable->PathDiv_NoLink_State == 0) - { - //1 Prepare to do Scan again to check current antenna state. - - // Set check state to next step. - //pDM_SWAT_Table->SWAS_NoLink_State = 1; - pDM_PDTable->PathDiv_NoLink_State = 1; - - // Copy Current Scan list. - Adapter->MgntInfo.tmpNumBssDesc = pMgntInfo->NumBssDesc; - PlatformMoveMemory((PVOID)Adapter->MgntInfo.tmpbssDesc, (PVOID)pMgntInfo->bssDesc, sizeof(RT_WLAN_BSS)*MAX_BSS_DESC); - - // Switch Antenna to another one. - if(pDM_PDTable->DefaultRespPath == 0) - { - PHY_SetBBReg(Adapter, rCCK0_AFESetting , 0x0F000000, 0x05); // TRX path = PathB - odm_SetRespPath_92C(Adapter, 1); - pDM_PDTable->OFDMTXPath = 0xFFFFFFFF; - pDM_PDTable->CCKTXPath = 0xFFFFFFFF; - } - else - { - PHY_SetBBReg(Adapter, rCCK0_AFESetting , 0x0F000000, 0x00); // TRX path = PathA - odm_SetRespPath_92C(Adapter, 0); - pDM_PDTable->OFDMTXPath = 0x0; - pDM_PDTable->CCKTXPath = 0x0; - } -#if 0 - - pDM_SWAT_Table->PreAntenna = pDM_SWAT_Table->CurAntenna; - pDM_SWAT_Table->CurAntenna = (pDM_SWAT_Table->CurAntenna==Antenna_A)?Antenna_B:Antenna_A; - - RT_TRACE(COMP_SWAS, DBG_LOUD, - ("ODM_SwAntDivCheckBeforeLink: Change to Ant(%s) for testing.\n", (pDM_SWAT_Table->CurAntenna==Antenna_A)?"A":"B")); - //PHY_SetBBReg(Adapter, rFPGA0_XA_RFInterfaceOE, 0x300, DM_SWAT_Table.CurAntenna); - pDM_SWAT_Table->SWAS_NoLink_BK_Reg860 = ((pDM_SWAT_Table->SWAS_NoLink_BK_Reg860 & 0xfffffcff) | (pDM_SWAT_Table->CurAntenna<<8)); - PHY_SetBBReg(Adapter, rFPGA0_XA_RFInterfaceOE, bMaskDWord, pDM_SWAT_Table->SWAS_NoLink_BK_Reg860); -#endif - - // Go back to scan function again. - RT_TRACE(COMP_SWAS, DBG_LOUD, ("ODM_PathDiversityBeforeLink92C: Scan one more time\n")); - pMgntInfo->ScanStep=0; - target_chnl = odm_SwAntDivSelectScanChnl(Adapter); - odm_SwAntDivConstructScanChnl(Adapter, target_chnl); - PlatformSetTimer(Adapter, &pMgntInfo->ScanTimer, 5); - - return TRUE; - } - else - { - //1 ScanComple() is called after antenna swiched. - //1 Check scan result and determine which antenna is going - //1 to be used. - - for(index=0; indexMgntInfo.tmpNumBssDesc; index++) - { - pTmpBssDesc = &(Adapter->MgntInfo.tmpbssDesc[index]); - pTestBssDesc = &(pMgntInfo->bssDesc[index]); - - if(PlatformCompareMemory(pTestBssDesc->bdBssIdBuf, pTmpBssDesc->bdBssIdBuf, 6)!=0) - { - RT_TRACE(COMP_SWAS, DBG_LOUD, ("ODM_PathDiversityBeforeLink92C(): ERROR!! This shall not happen.\n")); - continue; - } - - if(pTmpBssDesc->RecvSignalPower > pTestBssDesc->RecvSignalPower) - { - RT_TRACE(COMP_SWAS, DBG_LOUD, ("ODM_PathDiversityBeforeLink92C: Compare scan entry: Score++\n")); - RT_PRINT_STR(COMP_SWAS, DBG_LOUD, "SSID: ", pTestBssDesc->bdSsIdBuf, pTestBssDesc->bdSsIdLen); - RT_TRACE(COMP_SWAS, DBG_LOUD, ("Original: %d, Test: %d\n", pTmpBssDesc->RecvSignalPower, pTestBssDesc->RecvSignalPower)); - - Score++; - PlatformMoveMemory(pTestBssDesc, pTmpBssDesc, sizeof(RT_WLAN_BSS)); - } - else if(pTmpBssDesc->RecvSignalPower < pTestBssDesc->RecvSignalPower) - { - RT_TRACE(COMP_SWAS, DBG_LOUD, ("ODM_PathDiversityBeforeLink92C: Compare scan entry: Score--\n")); - RT_PRINT_STR(COMP_SWAS, DBG_LOUD, "SSID: ", pTestBssDesc->bdSsIdBuf, pTestBssDesc->bdSsIdLen); - RT_TRACE(COMP_SWAS, DBG_LOUD, ("Original: %d, Test: %d\n", pTmpBssDesc->RecvSignalPower, pTestBssDesc->RecvSignalPower)); - Score--; - } - - } - - if(pMgntInfo->NumBssDesc!=0 && Score<=0) - { - RT_TRACE(COMP_SWAS, DBG_LOUD, - ("ODM_PathDiversityBeforeLink92C(): DefaultRespPath=%d\n", pDM_PDTable->DefaultRespPath)); - - //pDM_SWAT_Table->PreAntenna = pDM_SWAT_Table->CurAntenna; - } - else - { - RT_TRACE(COMP_SWAS, DBG_LOUD, - ("ODM_PathDiversityBeforeLink92C(): DefaultRespPath=%d\n", pDM_PDTable->DefaultRespPath)); - - if(pDM_PDTable->DefaultRespPath == 0) - { - pDM_PDTable->OFDMTXPath = 0xFFFFFFFF; - pDM_PDTable->CCKTXPath = 0xFFFFFFFF; - odm_SetRespPath_92C(Adapter, 1); - } - else - { - pDM_PDTable->OFDMTXPath = 0x0; - pDM_PDTable->CCKTXPath = 0x0; - odm_SetRespPath_92C(Adapter, 0); - } - PHY_SetBBReg(Adapter, rCCK0_AFESetting , 0x0F000000, 0x01); // RX path = PathAB - - //pDM_SWAT_Table->CurAntenna = pDM_SWAT_Table->PreAntenna; - - //PHY_SetBBReg(Adapter, rFPGA0_XA_RFInterfaceOE, 0x300, DM_SWAT_Table.CurAntenna); - //pDM_SWAT_Table->SWAS_NoLink_BK_Reg860 = ((pDM_SWAT_Table->SWAS_NoLink_BK_Reg860 & 0xfffffcff) | (pDM_SWAT_Table->CurAntenna<<8)); - //PHY_SetBBReg(Adapter, rFPGA0_XA_RFInterfaceOE, bMaskDWord, pDM_SWAT_Table->SWAS_NoLink_BK_Reg860); - } - - // Check state reset to default and wait for next time. - //pDM_SWAT_Table->SWAS_NoLink_State = 0; - pDM_PDTable->PathDiv_NoLink_State = 0; - - return FALSE; - } -#else - return FALSE; -#endif - -} - - -//Neil Chen---2011--06--22 -//----92D Path Diversity----// -//#ifdef PathDiv92D -//================================== -//3 Path Diversity -//================================== -// -// 20100514 Luke/Joseph: -// Add new function for antenna diversity after link. -// This is the main function of antenna diversity after link. -// This function is called in HalDmWatchDog() and ODM_SwAntDivChkAntSwitchCallback(). -// HalDmWatchDog() calls this function with SWAW_STEP_PEAK to initialize the antenna test. -// In SWAW_STEP_PEAK, another antenna and a 500ms timer will be set for testing. -// After 500ms, ODM_SwAntDivChkAntSwitchCallback() calls this function to compare the signal just -// listened on the air with the RSSI of original antenna. -// It chooses the antenna with better RSSI. -// There is also a aged policy for error trying. Each error trying will cost more 5 seconds waiting -// penalty to get next try. -// -// -// 20100503 Joseph: -// Add new function SwAntDivCheck8192C(). -// This is the main function of Antenna diversity function before link. -// Mainly, it just retains last scan result and scan again. -// After that, it compares the scan result to see which one gets better RSSI. -// It selects antenna with better receiving power and returns better scan result. -// - - -// -// 20100514 Luke/Joseph: -// This function is used to gather the RSSI information for antenna testing. -// It selects the RSSI of the peer STA that we want to know. -// -VOID -ODM_PathDivChkPerPktRssi( - PADAPTER Adapter, - BOOLEAN bIsDefPort, - BOOLEAN bMatchBSSID, - PRT_WLAN_STA pEntry, - PRT_RFD pRfd - ) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - BOOLEAN bCount = FALSE; - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; - - if(pHalData->RSSI_target==NULL && bIsDefPort && bMatchBSSID) - bCount = TRUE; - else if(pHalData->RSSI_target!=NULL && pEntry!=NULL && pHalData->RSSI_target==pEntry) - bCount = TRUE; - - if(bCount) - { - //1 RSSI for SW Antenna Switch - if(pDM_SWAT_Table->CurAntenna == MAIN_ANT) - { - pHalData->RSSI_sum_A += pRfd->Status.RxPWDBAll; - pHalData->RSSI_cnt_A++; - } - else - { - pHalData->RSSI_sum_B += pRfd->Status.RxPWDBAll; - pHalData->RSSI_cnt_B++; - - } - } -} - - - -// -// 20100514 Luke/Joseph: -// Add new function to reset antenna diversity state after link. -// -VOID -ODM_PathDivRestAfterLink( - IN PDM_ODM_T pDM_Odm - ) -{ - PADAPTER Adapter=pDM_Odm->Adapter; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; - - pHalData->RSSI_cnt_A = 0; - pHalData->RSSI_cnt_B = 0; - pHalData->RSSI_test = FALSE; - pDM_SWAT_Table->try_flag = 0x0; // NOT 0xff - pDM_SWAT_Table->RSSI_Trying = 0; - pDM_SWAT_Table->SelectAntennaMap=0xAA; - pDM_SWAT_Table->CurAntenna = MAIN_ANT; -} - - -// -// 20100514 Luke/Joseph: -// Callback function for 500ms antenna test trying. -// -VOID -odm_PathDivChkAntSwitchCallback( - PRT_TIMER pTimer -) -{ - PADAPTER Adapter = (PADAPTER)pTimer->Adapter; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - -#if DEV_BUS_TYPE==RT_PCI_INTERFACE - -#if USE_WORKITEM - PlatformScheduleWorkItem(&pDM_Odm->PathDivSwitchWorkitem); -#else - odm_PathDivChkAntSwitch(pDM_Odm); -#endif -#else - PlatformScheduleWorkItem(&pDM_Odm->PathDivSwitchWorkitem); -#endif - -//odm_SwAntDivChkAntSwitch(Adapter, SWAW_STEP_DETERMINE); - -} - - -VOID -odm_PathDivChkAntSwitchWorkitemCallback( - IN PVOID pContext - ) -{ - PADAPTER pAdapter = (PADAPTER)pContext; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - - odm_PathDivChkAntSwitch(pDM_Odm); -} - - - //MAC0_ACCESS_PHY1 - -// 2011-06-22 Neil Chen & Gary Hsin -// Refer to Jr.Luke's SW ANT DIV -// 92D Path Diversity Main function -// refer to 88C software antenna diversity -// -VOID -odm_PathDivChkAntSwitch( - PDM_ODM_T pDM_Odm - //PADAPTER Adapter, - //u1Byte Step -) -{ - PADAPTER Adapter = pDM_Odm->Adapter; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; - - - pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; - s4Byte curRSSI=100, RSSI_A, RSSI_B; - u1Byte nextAntenna=AUX_ANT; - static u8Byte lastTxOkCnt=0, lastRxOkCnt=0; - u8Byte curTxOkCnt, curRxOkCnt; - static u8Byte TXByteCnt_A=0, TXByteCnt_B=0, RXByteCnt_A=0, RXByteCnt_B=0; - u8Byte CurByteCnt=0, PreByteCnt=0; - static u1Byte TrafficLoad = TRAFFIC_LOW; - u1Byte Score_A=0, Score_B=0; - u1Byte i=0x0; - // Neil Chen - static u1Byte pathdiv_para=0x0; - static u1Byte switchfirsttime=0x00; - // u1Byte regB33 = (u1Byte) PHY_QueryBBReg(Adapter, 0xB30,BIT27); - u1Byte regB33 = (u1Byte)ODM_GetBBReg(pDM_Odm, PATHDIV_REG, BIT27); - - - //u1Byte reg637 =0x0; - static u1Byte fw_value=0x0; - //u8Byte curTxOkCnt_tmp, curRxOkCnt_tmp; - PADAPTER BuddyAdapter = Adapter->BuddyAdapter; // another adapter MAC - // Path Diversity //Neil Chen--2011--06--22 - - //u1Byte PathDiv_Trigger = (u1Byte) PHY_QueryBBReg(Adapter, 0xBA0,BIT31); - u1Byte PathDiv_Trigger = (u1Byte) ODM_GetBBReg(pDM_Odm, PATHDIV_TRI,BIT31); - u1Byte PathDiv_Enable = pHalData->bPathDiv_Enable; - - - //DbgPrint("Path Div PG Value:%x \n",PathDiv_Enable); - if((BuddyAdapter==NULL)||(!PathDiv_Enable)||(PathDiv_Trigger)||(pHalData->CurrentBandType == BAND_ON_2_4G)) - { - return; - } - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD,("===================>odm_PathDivChkAntSwitch()\n")); - - // The first time to switch path excluding 2nd, 3rd, ....etc.... - if(switchfirsttime==0) - { - if(regB33==0) - { - pDM_SWAT_Table->CurAntenna = MAIN_ANT; // Default MAC0_5G-->Path A (current antenna) - } - } - - // Condition that does not need to use antenna diversity. - if(pDM_Odm->SupportICType != ODM_RTL8192D) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("odm_PathDiversityMechanims(): No PathDiv Mechanism.\n")); - return; - } - - // Radio off: Status reset to default and return. - if(pHalData->eRFPowerState==eRfOff) - { - //ODM_SwAntDivRestAfterLink(Adapter); - return; - } - - /* - // Handling step mismatch condition. - // Peak step is not finished at last time. Recover the variable and check again. - if( Step != pDM_SWAT_Table->try_flag ) - { - ODM_SwAntDivRestAfterLink(Adapter); - } */ - - if(pDM_SWAT_Table->try_flag == 0xff) - { - // Select RSSI checking target - if(pMgntInfo->mAssoc && !ACTING_AS_AP(Adapter)) - { - // Target: Infrastructure mode AP. - pHalData->RSSI_target = NULL; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("odm_PathDivMechanism(): RSSI_target is DEF AP!\n")); - } - else - { - u1Byte index = 0; - PRT_WLAN_STA pEntry = NULL; - PADAPTER pTargetAdapter = NULL; - - if( pMgntInfo->mIbss || ACTING_AS_AP(Adapter) ) - { - // Target: AP/IBSS peer. - pTargetAdapter = Adapter; - } - else if(IsAPModeExist(Adapter) && GetFirstExtAdapter(Adapter) != NULL) - { - // Target: VWIFI peer. - pTargetAdapter = GetFirstExtAdapter(Adapter); - } - - if(pTargetAdapter != NULL) - { - for(index=0; indexbAssociated) - break; - } - } - } - - if(pEntry == NULL) - { - ODM_PathDivRestAfterLink(pDM_Odm); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("odm_SwAntDivChkAntSwitch(): No Link.\n")); - return; - } - else - { - pHalData->RSSI_target = pEntry; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("odm_SwAntDivChkAntSwitch(): RSSI_target is PEER STA\n")); - } - } - - pHalData->RSSI_cnt_A = 0; - pHalData->RSSI_cnt_B = 0; - pDM_SWAT_Table->try_flag = 0; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("odm_SwAntDivChkAntSwitch(): Set try_flag to 0 prepare for peak!\n")); - return; - } - else - { - // 1st step - curTxOkCnt = Adapter->TxStats.NumTxBytesUnicast - lastTxOkCnt; - curRxOkCnt = Adapter->RxStats.NumRxBytesUnicast - lastRxOkCnt; - lastTxOkCnt = Adapter->TxStats.NumTxBytesUnicast; - lastRxOkCnt = Adapter->RxStats.NumRxBytesUnicast; - - if(pDM_SWAT_Table->try_flag == 1) // Training State - { - if(pDM_SWAT_Table->CurAntenna == MAIN_ANT) - { - TXByteCnt_A += curTxOkCnt; - RXByteCnt_A += curRxOkCnt; - } - else - { - TXByteCnt_B += curTxOkCnt; - RXByteCnt_B += curRxOkCnt; - } - - nextAntenna = (pDM_SWAT_Table->CurAntenna == MAIN_ANT)? AUX_ANT : MAIN_ANT; - pDM_SWAT_Table->RSSI_Trying--; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH DIV=: RSSI_Trying = %d\n",pDM_SWAT_Table->RSSI_Trying)); - if(pDM_SWAT_Table->RSSI_Trying == 0) - { - CurByteCnt = (pDM_SWAT_Table->CurAntenna == MAIN_ANT)? (TXByteCnt_A+RXByteCnt_A) : (TXByteCnt_B+RXByteCnt_B); - PreByteCnt = (pDM_SWAT_Table->CurAntenna == MAIN_ANT)? (TXByteCnt_B+RXByteCnt_B) : (TXByteCnt_A+RXByteCnt_A); - - if(TrafficLoad == TRAFFIC_HIGH) - { - //CurByteCnt = PlatformDivision64(CurByteCnt, 9); - PreByteCnt =PreByteCnt*9; - } - else if(TrafficLoad == TRAFFIC_LOW) - { - //CurByteCnt = PlatformDivision64(CurByteCnt, 2); - PreByteCnt =PreByteCnt*2; - } - if(pHalData->RSSI_cnt_A > 0) - RSSI_A = pHalData->RSSI_sum_A/pHalData->RSSI_cnt_A; - else - RSSI_A = 0; - if(pHalData->RSSI_cnt_B > 0) - RSSI_B = pHalData->RSSI_sum_B/pHalData->RSSI_cnt_B; - else - RSSI_B = 0; - curRSSI = (pDM_SWAT_Table->CurAntenna == MAIN_ANT)? RSSI_A : RSSI_B; - pDM_SWAT_Table->PreRSSI = (pDM_SWAT_Table->CurAntenna == MAIN_ANT)? RSSI_B : RSSI_A; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH DIV=: PreRSSI = %d, CurRSSI = %d\n",pDM_SWAT_Table->PreRSSI, curRSSI)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH DIV=: preAntenna= %s, curAntenna= %s \n", - (pDM_SWAT_Table->PreAntenna == MAIN_ANT?"MAIN":"AUX"), (pDM_SWAT_Table->CurAntenna == MAIN_ANT?"MAIN":"AUX"))); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH DIV=: RSSI_A= %d, RSSI_cnt_A = %d, RSSI_B= %d, RSSI_cnt_B = %d\n", - RSSI_A, pHalData->RSSI_cnt_A, RSSI_B, pHalData->RSSI_cnt_B)); - } - - } - else // try_flag=0 - { - - if(pHalData->RSSI_cnt_A > 0) - RSSI_A = pHalData->RSSI_sum_A/pHalData->RSSI_cnt_A; - else - RSSI_A = 0; - if(pHalData->RSSI_cnt_B > 0) - RSSI_B = pHalData->RSSI_sum_B/pHalData->RSSI_cnt_B; - else - RSSI_B = 0; - curRSSI = (pDM_SWAT_Table->CurAntenna == MAIN_ANT)? RSSI_A : RSSI_B; - pDM_SWAT_Table->PreRSSI = (pDM_SWAT_Table->PreAntenna == MAIN_ANT)? RSSI_A : RSSI_B; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH DIV=: PreRSSI = %d, CurRSSI = %d\n", pDM_SWAT_Table->PreRSSI, curRSSI)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH DIV=: preAntenna= %s, curAntenna= %s \n", - (pDM_SWAT_Table->PreAntenna == MAIN_ANT?"MAIN":"AUX"), (pDM_SWAT_Table->CurAntenna == MAIN_ANT?"MAIN":"AUX"))); - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH DIV=: RSSI_A= %d, RSSI_cnt_A = %d, RSSI_B= %d, RSSI_cnt_B = %d\n", - RSSI_A, pHalData->RSSI_cnt_A, RSSI_B, pHalData->RSSI_cnt_B)); - //RT_TRACE(COMP_SWAS, DBG_LOUD, ("Ekul:curTxOkCnt = %d\n", curTxOkCnt)); - //RT_TRACE(COMP_SWAS, DBG_LOUD, ("Ekul:curRxOkCnt = %d\n", curRxOkCnt)); - } - - //1 Trying State - if((pDM_SWAT_Table->try_flag == 1)&&(pDM_SWAT_Table->RSSI_Trying == 0)) - { - - if(pDM_SWAT_Table->TestMode == TP_MODE) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: TestMode = TP_MODE")); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH= TRY:CurByteCnt = %"i64fmt"d,", CurByteCnt)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH= TRY:PreByteCnt = %"i64fmt"d\n",PreByteCnt)); - if(CurByteCnt < PreByteCnt) - { - if(pDM_SWAT_Table->CurAntenna == MAIN_ANT) - pDM_SWAT_Table->SelectAntennaMap=pDM_SWAT_Table->SelectAntennaMap<<1; - else - pDM_SWAT_Table->SelectAntennaMap=(pDM_SWAT_Table->SelectAntennaMap<<1)+1; - } - else - { - if(pDM_SWAT_Table->CurAntenna == MAIN_ANT) - pDM_SWAT_Table->SelectAntennaMap=(pDM_SWAT_Table->SelectAntennaMap<<1)+1; - else - pDM_SWAT_Table->SelectAntennaMap=pDM_SWAT_Table->SelectAntennaMap<<1; - } - for (i= 0; i<8; i++) - { - if(((pDM_SWAT_Table->SelectAntennaMap>>i)&BIT0) == 1) - Score_A++; - else - Score_B++; - } - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("SelectAntennaMap=%x\n ",pDM_SWAT_Table->SelectAntennaMap)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: Score_A=%d, Score_B=%d\n", Score_A, Score_B)); - - if(pDM_SWAT_Table->CurAntenna == MAIN_ANT) - { - nextAntenna = (Score_A >= Score_B)?MAIN_ANT:AUX_ANT; - } - else - { - nextAntenna = (Score_B >= Score_A)?AUX_ANT:MAIN_ANT; - } - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: nextAntenna=%s\n",(nextAntenna==MAIN_ANT)?"MAIN":"AUX")); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: preAntenna= %s, curAntenna= %s \n", - (pDM_SWAT_Table->PreAntenna == MAIN_ANT?"MAIN":"AUX"), (pDM_SWAT_Table->CurAntenna == MAIN_ANT?"MAIN":"AUX"))); - - if(nextAntenna != pDM_SWAT_Table->CurAntenna) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: Switch back to another antenna")); - } - else - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: current anntena is good\n")); - } - } - - - if(pDM_SWAT_Table->TestMode == RSSI_MODE) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: TestMode = RSSI_MODE")); - pDM_SWAT_Table->SelectAntennaMap=0xAA; - if(curRSSI < pDM_SWAT_Table->PreRSSI) //Current antenna is worse than previous antenna - { - //RT_TRACE(COMP_SWAS, DBG_LOUD, ("SWAS: Switch back to another antenna")); - nextAntenna = (pDM_SWAT_Table->CurAntenna == MAIN_ANT)?AUX_ANT : MAIN_ANT; - } - else // current anntena is good - { - nextAntenna =pDM_SWAT_Table->CurAntenna; - //RT_TRACE(COMP_SWAS, DBG_LOUD, ("SWAS: current anntena is good\n")); - } - } - - pDM_SWAT_Table->try_flag = 0; - pHalData->RSSI_test = FALSE; - pHalData->RSSI_sum_A = 0; - pHalData->RSSI_cnt_A = 0; - pHalData->RSSI_sum_B = 0; - pHalData->RSSI_cnt_B = 0; - TXByteCnt_A = 0; - TXByteCnt_B = 0; - RXByteCnt_A = 0; - RXByteCnt_B = 0; - - } - - //1 Normal State - else if(pDM_SWAT_Table->try_flag == 0) - { - if(TrafficLoad == TRAFFIC_HIGH) - { - if ((curTxOkCnt+curRxOkCnt) > 3750000)//if(PlatformDivision64(curTxOkCnt+curRxOkCnt, 2) > 1875000) - TrafficLoad = TRAFFIC_HIGH; - else - TrafficLoad = TRAFFIC_LOW; - } - else if(TrafficLoad == TRAFFIC_LOW) - { - if ((curTxOkCnt+curRxOkCnt) > 3750000)//if(PlatformDivision64(curTxOkCnt+curRxOkCnt, 2) > 1875000) - TrafficLoad = TRAFFIC_HIGH; - else - TrafficLoad = TRAFFIC_LOW; - } - if(TrafficLoad == TRAFFIC_HIGH) - pDM_SWAT_Table->bTriggerAntennaSwitch = 0; - //RT_TRACE(COMP_SWAS, DBG_LOUD, ("Normal:TrafficLoad = %llu\n", curTxOkCnt+curRxOkCnt)); - - //Prepare To Try Antenna - nextAntenna = (pDM_SWAT_Table->CurAntenna == MAIN_ANT)? AUX_ANT : MAIN_ANT; - pDM_SWAT_Table->try_flag = 1; - pHalData->RSSI_test = TRUE; - if((curRxOkCnt+curTxOkCnt) > 1000) - { -#if DEV_BUS_TYPE==RT_PCI_INTERFACE - pDM_SWAT_Table->RSSI_Trying = 4; -#else - pDM_SWAT_Table->RSSI_Trying = 2; -#endif - pDM_SWAT_Table->TestMode = TP_MODE; - } - else - { - pDM_SWAT_Table->RSSI_Trying = 2; - pDM_SWAT_Table->TestMode = RSSI_MODE; - - } - - //RT_TRACE(COMP_SWAS, DBG_LOUD, ("SWAS: Normal State -> Begin Trying!\n")); - pHalData->RSSI_sum_A = 0; - pHalData->RSSI_cnt_A = 0; - pHalData->RSSI_sum_B = 0; - pHalData->RSSI_cnt_B = 0; - } // end of try_flag=0 - } - - //1 4.Change TRX antenna - if(nextAntenna != pDM_SWAT_Table->CurAntenna) - { - - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: Change TX Antenna!\n ")); - //PHY_SetBBReg(Adapter, rFPGA0_XA_RFInterfaceOE, 0x300, nextAntenna); for 88C - if(nextAntenna==MAIN_ANT) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: Next Antenna is RF PATH A\n ")); - pathdiv_para = 0x02; //02 to switchback to RF path A - fw_value = 0x03; -#if DEV_BUS_TYPE==RT_PCI_INTERFACE - odm_PathDiversity_8192D(pDM_Odm, pathdiv_para); -#else - ODM_FillH2CCmd(Adapter, ODM_H2C_PathDiv,1,(pu1Byte)(&fw_value)); -#endif - } - else if(nextAntenna==AUX_ANT) - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: Next Antenna is RF PATH B\n ")); - if(switchfirsttime==0) // First Time To Enter Path Diversity - { - switchfirsttime=0x01; - pathdiv_para = 0x00; - fw_value=0x00; // to backup RF Path A Releated Registers - -#if DEV_BUS_TYPE==RT_PCI_INTERFACE - odm_PathDiversity_8192D(pDM_Odm, pathdiv_para); -#else - ODM_FillH2CCmd(Adapter, ODM_H2C_PathDiv,1,(pu1Byte)(&fw_value)); - //for(u1Byte n=0; n<80,n++) - //{ - //delay_us(500); - ODM_delay_ms(500); - odm_PathDiversity_8192D(pDM_Odm, pathdiv_para); - - fw_value=0x01; // to backup RF Path A Releated Registers - ODM_FillH2CCmd(Adapter, ODM_H2C_PathDiv,1,(pu1Byte)(&fw_value)); -#endif - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: FIRST TIME To DO PATH SWITCH!\n ")); - } - else - { - pathdiv_para = 0x01; - fw_value = 0x02; -#if DEV_BUS_TYPE==RT_PCI_INTERFACE - odm_PathDiversity_8192D(pDM_Odm, pathdiv_para); -#else - ODM_FillH2CCmd(Adapter, ODM_H2C_PathDiv,1,(pu1Byte)(&fw_value)); -#endif - } - } - // odm_PathDiversity_8192D(Adapter, pathdiv_para); - } - - //1 5.Reset Statistics - pDM_SWAT_Table->PreAntenna = pDM_SWAT_Table->CurAntenna; - pDM_SWAT_Table->CurAntenna = nextAntenna; - pDM_SWAT_Table->PreRSSI = curRSSI; - - //1 6.Set next timer - - if(pDM_SWAT_Table->RSSI_Trying == 0) - return; - - if(pDM_SWAT_Table->RSSI_Trying%2 == 0) - { - if(pDM_SWAT_Table->TestMode == TP_MODE) - { - if(TrafficLoad == TRAFFIC_HIGH) - { -#if DEV_BUS_TYPE==RT_PCI_INTERFACE - ODM_SetTimer( pDM_Odm, &pDM_Odm->PathDivSwitchTimer, 10 ); //ms - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: Test another antenna for 10 ms\n")); -#else - ODM_SetTimer( pDM_Odm, &pDM_Odm->PathDivSwitchTimer, 20 ); //ms - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: Test another antenna for 20 ms\n")); -#endif - } - else if(TrafficLoad == TRAFFIC_LOW) - { - ODM_SetTimer( pDM_Odm, &pDM_Odm->PathDivSwitchTimer, 50 ); //ms - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: Test another antenna for 50 ms\n")); - } - } - else // TestMode == RSSI_MODE - { - ODM_SetTimer( pDM_Odm, &pDM_Odm->PathDivSwitchTimer, 500 ); //ms - ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: Test another antenna for 500 ms\n")); - } - } - else - { - if(pDM_SWAT_Table->TestMode == TP_MODE) - { - if(TrafficLoad == TRAFFIC_HIGH) - -#if DEV_BUS_TYPE==RT_PCI_INTERFACE - ODM_SetTimer( pDM_Odm, &pDM_Odm->PathDivSwitchTimer, 90 ); //ms - //ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: Test another antenna for 90 ms\n")); -#else - ODM_SetTimer( pDM_Odm, &pDM_Odm->PathDivSwitchTimer, 180); //ms -#endif - else if(TrafficLoad == TRAFFIC_LOW) - ODM_SetTimer( pDM_Odm, &pDM_Odm->PathDivSwitchTimer, 100 ); //ms - } - else - ODM_SetTimer( pDM_Odm, &pDM_Odm->PathDivSwitchTimer, 500 ); //ms - } -} - -//================================================== -//3 PathDiv End -//================================================== - -VOID -odm_SetRespPath_92C( - IN PADAPTER Adapter, - IN u1Byte DefaultRespPath - ) -{ - pPD_T pDM_PDTable = &Adapter->DM_PDTable; - - RT_TRACE( COMP_SWAS, DBG_LOUD, ("odm_SetRespPath_92C: Select Response Path=%d\n",DefaultRespPath)); - if(DefaultRespPath != pDM_PDTable->DefaultRespPath) - { - if(DefaultRespPath == 0) - { - PlatformEFIOWrite1Byte(Adapter, 0x6D8, (PlatformEFIORead1Byte(Adapter, 0x6D8)&0xc0)|0x15); - } - else - { - PlatformEFIOWrite1Byte(Adapter, 0x6D8, (PlatformEFIORead1Byte(Adapter, 0x6D8)&0xc0)|0x2A); - } - } - pDM_PDTable->DefaultRespPath = DefaultRespPath; -} - - -VOID -ODM_FillTXPathInTXDESC( - IN PADAPTER Adapter, - IN PRT_TCB pTcb, - IN pu1Byte pDesc -) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - u4Byte TXPath; - pPD_T pDM_PDTable = &Adapter->DM_PDTable; - - //2011.09.05 Add by Luke Lee for path diversity - if(pHalData->PathDivCfg == 1) - { - TXPath = (pDM_PDTable->OFDMTXPath >> pTcb->macId) & BIT0; - //RT_TRACE( COMP_SWAS, DBG_LOUD, ("Fill TXDESC: macID=%d, TXPath=%d\n", pTcb->macId, TXPath)); - //SET_TX_DESC_TX_ANT_CCK(pDesc,TXPath); - if(TXPath == 0) - { - SET_TX_DESC_TX_ANTL_92C(pDesc,1); - SET_TX_DESC_TX_ANT_HT_92C(pDesc,1); - } - else - { - SET_TX_DESC_TX_ANTL_92C(pDesc,2); - SET_TX_DESC_TX_ANT_HT_92C(pDesc,2); - } - TXPath = (pDM_PDTable->CCKTXPath >> pTcb->macId) & BIT0; - if(TXPath == 0) - { - SET_TX_DESC_TX_ANT_CCK_92C(pDesc,1); - } - else - { - SET_TX_DESC_TX_ANT_CCK_92C(pDesc,2); - } - } -} - -//Only for MP //Neil Chen--2012--0502-- -VOID -odm_PathDivInit_92D( -IN PDM_ODM_T pDM_Odm) -{ - pPATHDIV_PARA pathIQK = &pDM_Odm->pathIQK; - - pathIQK->org_2g_RegC14=0x0; - pathIQK->org_2g_RegC4C=0x0; - pathIQK->org_2g_RegC80=0x0; - pathIQK->org_2g_RegC94=0x0; - pathIQK->org_2g_RegCA0=0x0; - pathIQK->org_5g_RegC14=0x0; - pathIQK->org_5g_RegCA0=0x0; - pathIQK->org_5g_RegE30=0x0; - pathIQK->swt_2g_RegC14=0x0; - pathIQK->swt_2g_RegC4C=0x0; - pathIQK->swt_2g_RegC80=0x0; - pathIQK->swt_2g_RegC94=0x0; - pathIQK->swt_2g_RegCA0=0x0; - pathIQK->swt_5g_RegC14=0x0; - pathIQK->swt_5g_RegCA0=0x0; - pathIQK->swt_5g_RegE30=0x0; - -} - -#endif // #if (DM_ODM_SUPPORT_TYPE == ODM_WIN) #if (DM_ODM_SUPPORT_TYPE & (ODM_WIN| ODM_CE)) @@ -13629,7 +1637,7 @@ ODM_SingleDualAntennaDetection( ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x0, 0xFFFFF, 0x50008); //IQK Single tone start - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x80800000); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskH3Bytes, 0x808000); ODM_SetBBReg(pDM_Odm, rIQK_AGC_Pts, bMaskDWord, 0xf9000000); ODM_SetBBReg(pDM_Odm, rIQK_AGC_Pts, bMaskDWord, 0xf8000000); @@ -13683,7 +1691,7 @@ ODM_SingleDualAntennaDetection( } //Close IQK Single Tone function - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskH3Bytes, 0x000000); //1 Return to antanna A if(pDM_Odm->SupportICType & (ODM_RTL8723A|ODM_RTL8192C)) @@ -14109,6 +2117,44 @@ ODM_UpdateInitRateWorkItemCallback( #endif #endif +// +// ODM multi-port consideration, added by Roger, 2013.10.01. +// +VOID +ODM_AsocEntry_Init( + IN PDM_ODM_T pDM_Odm + ) +{ +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + PADAPTER pLoopAdapter = GetDefaultAdapter(pDM_Odm->Adapter); + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pLoopAdapter); + PDM_ODM_T pDM_OutSrc = &pHalData->DM_OutSrc; + u1Byte TotalAssocEntryNum = 0; + u1Byte index = 0; + + + ODM_CmnInfoPtrArrayHook(pDM_OutSrc, ODM_CMNINFO_STA_STATUS, 0, &pLoopAdapter->MgntInfo.DefaultPort[0]); + pLoopAdapter->MgntInfo.DefaultPort[0].MultiPortStationIdx = TotalAssocEntryNum; + + pLoopAdapter = GetNextExtAdapter(pLoopAdapter); + TotalAssocEntryNum +=1; + + while(pLoopAdapter) + { + for (index = 0; index MgntInfo.AsocEntry[index]); + pLoopAdapter->MgntInfo.AsocEntry[index].MultiPortStationIdx = TotalAssocEntryNum+index; + } + + TotalAssocEntryNum+= index; + if(IS_HARDWARE_TYPE_8188E((pDM_Odm->Adapter))) + pLoopAdapter->RASupport = TRUE; + pLoopAdapter = GetNextExtAdapter(pLoopAdapter); + } +#endif +} + #if (DM_ODM_SUPPORT_TYPE == ODM_CE) /* Justin: According to the current RRSI to adjust Response Frame TX power, 2012/11/05 */ void odm_dtc(PDM_ODM_T pDM_Odm) @@ -14196,3 +2242,116 @@ void odm_dtc(PDM_ODM_T pDM_Odm) #endif /* #if (DM_ODM_SUPPORT_TYPE == ODM_CE) */ +VOID +odm_UpdatePowerTrainingState( + IN PDM_ODM_T pDM_Odm + ) +{ +#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) + PFALSE_ALARM_STATISTICS FalseAlmCnt = &(pDM_Odm->FalseAlmCnt); + pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; + u4Byte score = 0; + + if(!(pDM_Odm->SupportAbility & ODM_BB_PWR_TRAIN)) + return; + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_RA_MASK, ODM_DBG_LOUD,("odm_UpdatePowerTrainingState()============>\n")); + pDM_Odm->bChangeState = FALSE; + + // Debug command + if(pDM_Odm->ForcePowerTrainingState) + { + if(pDM_Odm->ForcePowerTrainingState == 1 && !pDM_Odm->bDisablePowerTraining) + { + pDM_Odm->bChangeState = TRUE; + pDM_Odm->bDisablePowerTraining = TRUE; + } + else if(pDM_Odm->ForcePowerTrainingState == 2 && pDM_Odm->bDisablePowerTraining) + { + pDM_Odm->bChangeState = TRUE; + pDM_Odm->bDisablePowerTraining = FALSE; + } + + pDM_Odm->PT_score = 0; + pDM_Odm->PhyDbgInfo.NumQryPhyStatusOFDM = 0; + pDM_Odm->PhyDbgInfo.NumQryPhyStatusCCK = 0; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_RA_MASK, ODM_DBG_LOUD,("odm_UpdatePowerTrainingState(): ForcePowerTrainingState = %d\n", + pDM_Odm->ForcePowerTrainingState)); + return; + } + + if(!pDM_Odm->bLinked) + return; + + // First connect + if((pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_0 == FALSE)) + { + pDM_Odm->PT_score = 0; + pDM_Odm->bChangeState = TRUE; + pDM_Odm->PhyDbgInfo.NumQryPhyStatusOFDM = 0; + pDM_Odm->PhyDbgInfo.NumQryPhyStatusCCK = 0; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_RA_MASK, ODM_DBG_LOUD,("odm_UpdatePowerTrainingState(): First Connect\n")); + return; + } + + // Compute score + if(pDM_Odm->NHM_cnt_0 >= 215) + score = 2; + else if(pDM_Odm->NHM_cnt_0 >= 190) + score = 1; // unknow state + else + { + u4Byte RX_Pkt_Cnt; + + RX_Pkt_Cnt = (u4Byte)(pDM_Odm->PhyDbgInfo.NumQryPhyStatusOFDM) + (u4Byte)(pDM_Odm->PhyDbgInfo.NumQryPhyStatusCCK); + + if((FalseAlmCnt->Cnt_CCA_all > 31 && RX_Pkt_Cnt > 31) && (FalseAlmCnt->Cnt_CCA_all >= RX_Pkt_Cnt)) + { + if((RX_Pkt_Cnt + (RX_Pkt_Cnt >> 1)) <= FalseAlmCnt->Cnt_CCA_all) + score = 0; + else if((RX_Pkt_Cnt + (RX_Pkt_Cnt >> 2)) <= FalseAlmCnt->Cnt_CCA_all) + score = 1; + else + score = 2; + } + ODM_RT_TRACE(pDM_Odm,ODM_COMP_RA_MASK, ODM_DBG_LOUD,("odm_UpdatePowerTrainingState(): RX_Pkt_Cnt = %d, Cnt_CCA_all = %d\n", + RX_Pkt_Cnt, FalseAlmCnt->Cnt_CCA_all)); + } + ODM_RT_TRACE(pDM_Odm,ODM_COMP_RA_MASK, ODM_DBG_LOUD,("odm_UpdatePowerTrainingState(): NumQryPhyStatusOFDM = %d, NumQryPhyStatusCCK = %d\n", + (u4Byte)(pDM_Odm->PhyDbgInfo.NumQryPhyStatusOFDM), (u4Byte)(pDM_Odm->PhyDbgInfo.NumQryPhyStatusCCK))); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_RA_MASK, ODM_DBG_LOUD,("odm_UpdatePowerTrainingState(): NHM_cnt_0 = %d, score = %d\n", + pDM_Odm->NHM_cnt_0, score)); + + // smoothing + pDM_Odm->PT_score = (score << 4) + (pDM_Odm->PT_score>>1) + (pDM_Odm->PT_score>>2); + score = (pDM_Odm->PT_score + 32) >> 6; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_RA_MASK, ODM_DBG_LOUD,("odm_UpdatePowerTrainingState(): PT_score = %d, score after smoothing = %d\n", + pDM_Odm->PT_score, score)); + + // Mode decision + if(score == 2) + { + if(pDM_Odm->bDisablePowerTraining) + { + pDM_Odm->bChangeState = TRUE; + pDM_Odm->bDisablePowerTraining = FALSE; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_RA_MASK, ODM_DBG_LOUD,("odm_UpdatePowerTrainingState(): Change state\n")); + } + ODM_RT_TRACE(pDM_Odm,ODM_COMP_RA_MASK, ODM_DBG_LOUD,("odm_UpdatePowerTrainingState(): Enable Power Training\n")); + } + else if(score == 0) + { + if(!pDM_Odm->bDisablePowerTraining) + { + pDM_Odm->bChangeState = TRUE; + pDM_Odm->bDisablePowerTraining = TRUE; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_RA_MASK, ODM_DBG_LOUD,("odm_UpdatePowerTrainingState(): Change state\n")); + } + ODM_RT_TRACE(pDM_Odm,ODM_COMP_RA_MASK, ODM_DBG_LOUD,("odm_UpdatePowerTrainingState(): Disable Power Training\n")); + } + + pDM_Odm->PhyDbgInfo.NumQryPhyStatusOFDM = 0; + pDM_Odm->PhyDbgInfo.NumQryPhyStatusCCK = 0; +#endif +} + diff --git a/hal/OUTSRC/odm.h b/hal/OUTSRC/odm.h index 5b19860..3c662fa 100644 --- a/hal/OUTSRC/odm.h +++ b/hal/OUTSRC/odm.h @@ -22,6 +22,21 @@ #ifndef __HALDMOUTSRC_H__ #define __HALDMOUTSRC_H__ +//============================================================ +// include files +//============================================================ +#include "odm_DIG.h" +#include "odm_EdcaTurboCheck.h" +#include "odm_PathDiv.h" +#include "odm_DynamicBBPowerSaving.h" +#include "odm_RaInfo.h" +#include "odm_DynamicTxPower.h" +#include "odm_CfoTracking.h" +#include "odm_ACS.h" +#include "odm_NoiseMonitor.h" +#include "odm_PowerTracking.h" +#include "PhyDM_Adaptivity.h" + //============================================================ // Definition //============================================================ @@ -59,19 +74,13 @@ #define RSSI_MODE 1 #define TRAFFIC_LOW 0 #define TRAFFIC_HIGH 1 +#define NONE 0 //============================================================ //3 Tx Power Tracking //3============================================================ -#define DPK_DELTA_MAPPING_NUM 13 -#define index_mapping_HP_NUM 15 -#define OFDM_TABLE_SIZE 43 -#define CCK_TABLE_SIZE 33 -#define TXSCALE_TABLE_SIZE 37 -#define TXPWR_TRACK_TABLE_SIZE 30 -#define DELTA_SWINGIDX_SIZE 30 -#define BAND_NUM 4 + //============================================================ //3 PSD Handler @@ -110,14 +119,6 @@ #define ANTTESTA 0x01 //Ant A will be Testing #define ANTTESTB 0x02 //Ant B will be testing -// LPS define -#define DM_DIG_FA_TH0_LPS 4 //-> 4 in lps -#define DM_DIG_FA_TH1_LPS 15 //-> 15 lps -#define DM_DIG_FA_TH2_LPS 30 //-> 30 lps -#define RSSI_OFFSET_DIG 0x05; - - - //for 8723A Ant Definition--2012--06--07 due to different IC may be different ANT define #define MAIN_ANT 1 //Ant A or Ant Main #define AUX_ANT 2 //AntB or Ant Aux @@ -161,82 +162,11 @@ typedef struct _WLAN_STA{ #endif -typedef struct _Dynamic_Initial_Gain_Threshold_ -{ - u1Byte Dig_Enable_Flag; - u1Byte Dig_Ext_Port_Stage; - - int RssiLowThresh; - int RssiHighThresh; +//Remove DIG by Yuchen - u4Byte FALowThresh; - u4Byte FAHighThresh; +//Remoce BB power saving by Yuchn - u1Byte CurSTAConnectState; - u1Byte PreSTAConnectState; - u1Byte CurMultiSTAConnectState; - - u1Byte PreIGValue; - u1Byte CurIGValue; - u1Byte BT30_CurIGI; - u1Byte BackupIGValue; - - s1Byte BackoffVal; - s1Byte BackoffVal_range_max; - s1Byte BackoffVal_range_min; - u1Byte rx_gain_range_max; - u1Byte rx_gain_range_min; - u1Byte Rssi_val_min; - - u1Byte PreCCK_CCAThres; - u1Byte CurCCK_CCAThres; - u1Byte PreCCKPDState; - u1Byte CurCCKPDState; - - u1Byte LargeFAHit; - u1Byte ForbiddenIGI; - u4Byte Recover_cnt; - - u1Byte DIG_Dynamic_MIN_0; - u1Byte DIG_Dynamic_MIN_1; - BOOLEAN bMediaConnect_0; - BOOLEAN bMediaConnect_1; - - u4Byte AntDiv_RSSI_max; - u4Byte RSSI_max; -}DIG_T,*pDIG_T; - -typedef struct _Dynamic_Power_Saving_ -{ - u1Byte PreCCAState; - u1Byte CurCCAState; - - u1Byte PreRFState; - u1Byte CurRFState; - - int Rssi_val_min; - - u1Byte initialize; - u4Byte Reg874,RegC70,Reg85C,RegA74; - -}PS_T,*pPS_T; - -typedef struct _FALSE_ALARM_STATISTICS{ - u4Byte Cnt_Parity_Fail; - u4Byte Cnt_Rate_Illegal; - u4Byte Cnt_Crc8_fail; - u4Byte Cnt_Mcs_fail; - u4Byte Cnt_Ofdm_fail; - u4Byte Cnt_Cck_fail; - u4Byte Cnt_all; - u4Byte Cnt_Fast_Fsync; - u4Byte Cnt_SB_Search_fail; - u4Byte Cnt_OFDM_CCA; - u4Byte Cnt_CCK_CCA; - u4Byte Cnt_CCA_all; - u4Byte Cnt_BW_USC; //Gary - u4Byte Cnt_BW_LSC; //Gary -}FALSE_ALARM_STATISTICS, *PFALSE_ALARM_STATISTICS; +//Remove DIG by yuchen typedef struct _Dynamic_Primary_CCA{ u1Byte PriCCA_flag; @@ -248,9 +178,7 @@ typedef struct _Dynamic_Primary_CCA{ u1Byte MF_state; }Pri_CCA_T, *pPri_CCA_T; -typedef struct _Rate_Adaptive_Table_{ - u1Byte firstconnect; -}RA_T, *pRA_T; +//Remove RA_T,*pRA_T by RS_James typedef struct _RX_High_Power_ { @@ -316,13 +244,20 @@ typedef struct _SW_Antenna_Switch_ u1Byte SelectAntennaMap; u1Byte RSSI_target; u1Byte reset_idx; + u2Byte Single_Ant_Counter; + u2Byte Dual_Ant_Counter; + u2Byte Aux_FailDetec_Counter; + u2Byte Retry_Counter; // Before link Antenna Switch check u1Byte SWAS_NoLink_State; u4Byte SWAS_NoLink_BK_Reg860; u4Byte SWAS_NoLink_BK_Reg92c; + u4Byte SWAS_NoLink_BK_Reg948; BOOLEAN ANTA_ON; //To indicate Ant A is or not BOOLEAN ANTB_ON; //To indicate Ant B is on or not + BOOLEAN Pre_Aux_FailDetec; + BOOLEAN RSSI_AntDect_bResult; u1Byte Ant5G; u1Byte Ant2G; @@ -341,13 +276,20 @@ typedef struct _SW_Antenna_Switch_ u1Byte Train_time; u1Byte Train_time_flag; RT_TIMER SwAntennaSwitchTimer; +#if (RTL8723B_SUPPORT == 1)||(RTL8821A_SUPPORT == 1) RT_TIMER SwAntennaSwitchTimer_8723B; + u4Byte PktCnt_SWAntDivByCtrlFrame; + BOOLEAN bSWAntDivByCtrlFrame; +#endif + #if (DM_ODM_SUPPORT_TYPE == ODM_WIN) #if USE_WORKITEM RT_WORK_ITEM SwAntennaSwitchWorkitem; +#if (RTL8723B_SUPPORT == 1)||(RTL8821A_SUPPORT == 1) RT_WORK_ITEM SwAntennaSwitchWorkitem_8723B; #endif #endif +#endif /* CE Platform use #ifdef CONFIG_SW_ANTENNA_DIVERSITY _timer SwAntennaSwitchTimer; @@ -382,28 +324,9 @@ typedef struct _SW_Antenna_Switch_ }SWAT_T, *pSWAT_T; //#endif -typedef struct _EDCA_TURBO_ -{ - BOOLEAN bCurrentTurboEDCA; - BOOLEAN bIsCurRDLState; +// Edca Remove by YuChen - #if(DM_ODM_SUPPORT_TYPE == ODM_CE ) - u4Byte prv_traffic_idx; // edca turbo - #endif - -}EDCA_T,*pEDCA_T; - -typedef struct _ODM_RATE_ADAPTIVE -{ - u1Byte Type; // DM_Type_ByFW/DM_Type_ByDriver - u1Byte LdpcThres; // if RSSI > LdpcThres => switch from LPDC to BCC - BOOLEAN bUseLdpc; - BOOLEAN bLowerRtsRate; - u1Byte HighRSSIThresh; // if RSSI > HighRSSIThresh => RATRState is DM_RATR_STA_HIGH - u1Byte LowRSSIThresh; // if RSSI <= LowRSSIThresh => RATRState is DM_RATR_STA_LOW - u1Byte RATRState; // Current RSSI level, DM_RATR_STA_HIGH/DM_RATR_STA_MIDDLE/DM_RATR_STA_LOW - -} ODM_RATE_ADAPTIVE, *PODM_RATE_ADAPTIVE; +//ODM_RATE_ADAPTIVE Remove by RS_James #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) @@ -439,22 +362,6 @@ typedef enum _HT_IOT_PEER }HT_IOT_PEER_E, *PHTIOT_PEER_E; #endif//#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - - -#define IQK_MAC_REG_NUM 4 -#define IQK_ADDA_REG_NUM 16 -#define IQK_BB_REG_NUM_MAX 10 -#if (RTL8192D_SUPPORT==1) -#define IQK_BB_REG_NUM 10 -#else -#define IQK_BB_REG_NUM 9 -#endif -#define HP_THERMAL_NUM 8 - -#define AVG_THERMAL_NUM 8 -#define IQK_Matrix_REG_NUM 8 -#define IQK_Matrix_Settings_NUM 14+24+21 // Channels_2_4G_NUM + Channels_5G_20M_NUM + Channels_5G - #define DM_Type_ByFW 0 #define DM_Type_ByDriver 1 @@ -467,8 +374,12 @@ typedef enum _HT_IOT_PEER #define MAX_PATH_NUM_8723B 1 #define MAX_PATH_NUM_8812A 2 #define MAX_PATH_NUM_8821A 1 +#define MAX_PATH_NUM_8814A 4 +#define MAX_PATH_NUM_8822B 2 + #define IQK_THRESHOLD 8 +#define DPK_THRESHOLD 4 typedef struct _ODM_Phy_Status_Info_ { @@ -513,6 +424,7 @@ typedef struct _ODM_Per_Pkt_Info_ BOOLEAN bPacketMatchBSSID; BOOLEAN bPacketToSelf; BOOLEAN bPacketBeacon; + BOOLEAN bToSelf; }ODM_PACKET_INFO_T,*PODM_PACKET_INFO_T; @@ -520,9 +432,9 @@ typedef struct _ODM_Phy_Dbg_Info_ { //ODM Write,debug info s1Byte RxSNRdB[4]; - u8Byte NumQryPhyStatus; - u8Byte NumQryPhyStatusCCK; - u8Byte NumQryPhyStatusOFDM; + u4Byte NumQryPhyStatus; + u4Byte NumQryPhyStatusCCK; + u4Byte NumQryPhyStatusOFDM; u1Byte NumQryBeaconPkt; //Others s4Byte RxEVM[4]; @@ -600,6 +512,7 @@ typedef struct _ODM_STA_INFO{ u1Byte rate_id; u1Byte rate_SGI; u1Byte rssi_sta_ra; + u1Byte SGI_enable; u1Byte Decision_rate; u1Byte Pre_rate; @@ -659,6 +572,9 @@ typedef enum _ODM_Common_Info_Definition ODM_CMNINFO_BINHCT_TEST, ODM_CMNINFO_BWIFI_TEST, ODM_CMNINFO_SMART_CONCURRENT, + ODM_CMNINFO_DOMAIN_CODE_2G, + ODM_CMNINFO_DOMAIN_CODE_5G, + ODM_CMNINFO_IQKFWOFFLOAD, //-----------HOOK BEFORE REG INIT-----------// @@ -688,9 +604,12 @@ typedef enum _ODM_Common_Info_Definition ODM_CMNINFO_INIT_ON, ODM_CMNINFO_ANT_TEST, ODM_CMNINFO_NET_CLOSED, - ODM_CMNINFO_MP_MODE, //ODM_CMNINFO_RTSTA_AID, // For win driver only? ODM_CMNINFO_FORCED_IGI_LB, + ODM_CMNINFO_P2P_LINK, + ODM_CMNINFO_FCS_MODE, + ODM_CMNINFO_IS1ANTENNA, + ODM_CMNINFO_RFDEFAULTPATH, //--------- POINTER REFERENCE-----------// //------------CALL BY VALUE-------------// @@ -705,12 +624,18 @@ typedef enum _ODM_Common_Info_Definition ODM_CMNINFO_RA_THRESHOLD_HIGH, // u1Byte ODM_CMNINFO_RA_THRESHOLD_LOW, // u1Byte ODM_CMNINFO_RF_ANTENNA_TYPE, // u1Byte - ODM_CMNINFO_BT_DISABLED, + ODM_CMNINFO_BT_ENABLED, ODM_CMNINFO_BT_HS_CONNECT_PROCESS, ODM_CMNINFO_BT_HS_RSSI, ODM_CMNINFO_BT_OPERATION, ODM_CMNINFO_BT_LIMITED_DIG, //Need to Limited Dig or not ODM_CMNINFO_BT_DISABLE_EDCA, +#if(DM_ODM_SUPPORT_TYPE & ODM_AP) // for repeater mode add by YuChen 2014.06. +#ifdef UNIVERSAL_REPEATER + ODM_CMNINFO_VXD_LINK, +#endif +#endif + //------------CALL BY VALUE-------------// // @@ -731,7 +656,7 @@ typedef enum _ODM_Common_Info_Definition typedef enum _ODM_Support_Ability_Definition { // - // BB ODM section BIT 0-15 + // BB ODM section BIT 0-19 // ODM_BB_DIG = BIT0, ODM_BB_RA_MASK = BIT1, @@ -747,13 +672,15 @@ typedef enum _ODM_Support_Ability_Definition ODM_BB_PSD = BIT11, ODM_BB_RXHP = BIT12, ODM_BB_ADAPTIVITY = BIT13, - ODM_BB_DYNAMIC_ATC = BIT14, + ODM_BB_CFO_TRACKING = BIT14, + ODM_BB_NHM_CNT = BIT15, + ODM_BB_PRIMARY_CCA = BIT16, // - // MAC DM section BIT 16-23 + // MAC DM section BIT 20-23 // - ODM_MAC_EDCA_TURBO = BIT16, - ODM_MAC_EARLY_MODE = BIT17, + ODM_MAC_EDCA_TURBO = BIT20, + ODM_MAC_EARLY_MODE = BIT21, // // RF ODM section BIT 24-31 @@ -785,12 +712,15 @@ typedef enum tag_ODM_Support_IC_Type_Definition ODM_RTL8821 = BIT6, ODM_RTL8192E = BIT7, ODM_RTL8723B = BIT8, - ODM_RTL8813A = BIT9, - ODM_RTL8881A = BIT10 + ODM_RTL8814A = BIT9, + ODM_RTL8881A = BIT10, + ODM_RTL8821B = BIT11, + ODM_RTL8822B = BIT12, + ODM_RTL8703B = BIT13 }ODM_IC_TYPE_E; -#define ODM_IC_11N_SERIES (ODM_RTL8192S|ODM_RTL8192C|ODM_RTL8192D|ODM_RTL8723A|ODM_RTL8188E|ODM_RTL8192E|ODM_RTL8723B) -#define ODM_IC_11AC_SERIES (ODM_RTL8812|ODM_RTL8821|ODM_RTL8813A|ODM_RTL8881A) +#define ODM_IC_11N_SERIES (ODM_RTL8192S|ODM_RTL8192C|ODM_RTL8192D|ODM_RTL8723A|ODM_RTL8188E|ODM_RTL8192E|ODM_RTL8723B|ODM_RTL8703B) +#define ODM_IC_11AC_SERIES (ODM_RTL8812|ODM_RTL8821|ODM_RTL8814A|ODM_RTL8881A|ODM_RTL8821B|ODM_RTL8822B) #if (DM_ODM_SUPPORT_TYPE == ODM_AP) #ifdef RTK_AC_SUPPORT @@ -813,6 +743,8 @@ typedef enum tag_ODM_Cut_Version_Definition ODM_CUT_F = 5, ODM_CUT_I = 8, + ODM_CUT_J = 9, + ODM_CUT_K = 10, ODM_CUT_TEST = 15, }ODM_CUT_VERSION_E; @@ -1061,137 +993,10 @@ typedef struct _ODM_RA_Info_ #endif } ODM_RA_INFO_T,*PODM_RA_INFO_T; -typedef struct _IQK_MATRIX_REGS_SETTING{ - BOOLEAN bIQKDone; - s4Byte Value[3][IQK_Matrix_REG_NUM]; - BOOLEAN bBWIqkResultSaved[3]; -}IQK_MATRIX_REGS_SETTING,*PIQK_MATRIX_REGS_SETTING; +//Remove struct PATHDIV_PARA to odm_PathDiv.h -#if (DM_ODM_SUPPORT_TYPE & ODM_WIN) -typedef struct _PathDiv_Parameter_define_ -{ - u4Byte org_5g_RegE30; - u4Byte org_5g_RegC14; - u4Byte org_5g_RegCA0; - u4Byte swt_5g_RegE30; - u4Byte swt_5g_RegC14; - u4Byte swt_5g_RegCA0; - //for 2G IQK information - u4Byte org_2g_RegC80; - u4Byte org_2g_RegC4C; - u4Byte org_2g_RegC94; - u4Byte org_2g_RegC14; - u4Byte org_2g_RegCA0; +//move to PowerTracking.h by YuChen - u4Byte swt_2g_RegC80; - u4Byte swt_2g_RegC4C; - u4Byte swt_2g_RegC94; - u4Byte swt_2g_RegC14; - u4Byte swt_2g_RegCA0; -}PATHDIV_PARA,*pPATHDIV_PARA; -#endif - - -typedef struct ODM_RF_Calibration_Structure -{ - //for tx power tracking - - u4Byte RegA24; // for TempCCK - s4Byte RegE94; - s4Byte RegE9C; - s4Byte RegEB4; - s4Byte RegEBC; - - u1Byte TXPowercount; - BOOLEAN bTXPowerTrackingInit; - BOOLEAN bTXPowerTracking; - u1Byte TxPowerTrackControl; //for mp mode, turn off txpwrtracking as default - u1Byte TM_Trigger; - u1Byte InternalPA5G[2]; //pathA / pathB - - u1Byte ThermalMeter[2]; // ThermalMeter, index 0 for RFIC0, and 1 for RFIC1 - u1Byte ThermalValue; - u1Byte ThermalValue_LCK; - u1Byte ThermalValue_IQK; - u1Byte ThermalValue_DPK; - u1Byte ThermalValue_AVG[AVG_THERMAL_NUM]; - u1Byte ThermalValue_AVG_index; - u1Byte ThermalValue_RxGain; - u1Byte ThermalValue_Crystal; - u1Byte ThermalValue_DPKstore; - u1Byte ThermalValue_DPKtrack; - BOOLEAN TxPowerTrackingInProgress; - - BOOLEAN bReloadtxpowerindex; - u1Byte bRfPiEnable; - u4Byte TXPowerTrackingCallbackCnt; //cosa add for debug - - - //------------------------- Tx power Tracking -------------------------// - u1Byte bCCKinCH14; - u1Byte CCK_index; - u1Byte OFDM_index[MAX_RF_PATH]; - s1Byte PowerIndexOffset[MAX_RF_PATH]; - s1Byte DeltaPowerIndex[MAX_RF_PATH]; - s1Byte DeltaPowerIndexLast[MAX_RF_PATH]; - BOOLEAN bTxPowerChanged; - - u1Byte ThermalValue_HP[HP_THERMAL_NUM]; - u1Byte ThermalValue_HP_index; - IQK_MATRIX_REGS_SETTING IQKMatrixRegSetting[IQK_Matrix_Settings_NUM]; - BOOLEAN bNeedIQK; - BOOLEAN bIQKInProgress; - u1Byte Delta_IQK; - u1Byte Delta_LCK; - s1Byte BBSwingDiff2G, BBSwingDiff5G; // Unit: dB - u1Byte DeltaSwingTableIdx_2GCCKA_P[DELTA_SWINGIDX_SIZE]; - u1Byte DeltaSwingTableIdx_2GCCKA_N[DELTA_SWINGIDX_SIZE]; - u1Byte DeltaSwingTableIdx_2GCCKB_P[DELTA_SWINGIDX_SIZE]; - u1Byte DeltaSwingTableIdx_2GCCKB_N[DELTA_SWINGIDX_SIZE]; - u1Byte DeltaSwingTableIdx_2GA_P[DELTA_SWINGIDX_SIZE]; - u1Byte DeltaSwingTableIdx_2GA_N[DELTA_SWINGIDX_SIZE]; - u1Byte DeltaSwingTableIdx_2GB_P[DELTA_SWINGIDX_SIZE]; - u1Byte DeltaSwingTableIdx_2GB_N[DELTA_SWINGIDX_SIZE]; - u1Byte DeltaSwingTableIdx_5GA_P[BAND_NUM][DELTA_SWINGIDX_SIZE]; - u1Byte DeltaSwingTableIdx_5GA_N[BAND_NUM][DELTA_SWINGIDX_SIZE]; - u1Byte DeltaSwingTableIdx_5GB_P[BAND_NUM][DELTA_SWINGIDX_SIZE]; - u1Byte DeltaSwingTableIdx_5GB_N[BAND_NUM][DELTA_SWINGIDX_SIZE]; - u1Byte DeltaSwingTableIdx_2GA_P_8188E[DELTA_SWINGIDX_SIZE]; - u1Byte DeltaSwingTableIdx_2GA_N_8188E[DELTA_SWINGIDX_SIZE]; - - //--------------------------------------------------------------------// - - //for IQK - u4Byte RegC04; - u4Byte Reg874; - u4Byte RegC08; - u4Byte RegB68; - u4Byte RegB6C; - u4Byte Reg870; - u4Byte Reg860; - u4Byte Reg864; - - BOOLEAN bIQKInitialized; - BOOLEAN bLCKInProgress; - BOOLEAN bAntennaDetected; - u4Byte ADDA_backup[IQK_ADDA_REG_NUM]; - u4Byte IQK_MAC_backup[IQK_MAC_REG_NUM]; - u4Byte IQK_BB_backup_recover[9]; - u4Byte IQK_BB_backup[IQK_BB_REG_NUM]; - - //for APK - u4Byte APKoutput[2][2]; //path A/B; output1_1a/output1_2a - u1Byte bAPKdone; - u1Byte bAPKThermalMeterIgnore; - u1Byte bDPdone; - u1Byte bDPPathAOK; - u1Byte bDPPathBOK; - - u4Byte TxIQC_8723B[2][3][2]; // { {S1: 0xc94, 0xc80, 0xc4c} , {S0: 0xc9c, 0xc88, 0xc4c}} - u4Byte RxIQC_8723B[2][2][2]; // { {S1: 0xc14, 0xca0} , {S0: 0xc14, 0xca0}} - u4Byte TxLOK[2]; - -}ODM_RF_CAL_T,*PODM_RF_CAL_T; // // ODM Dynamic common info value definition // @@ -1202,6 +1007,7 @@ typedef struct _FAST_ANTENNA_TRAINNING_ u1Byte antsel_rx_keep_0; u1Byte antsel_rx_keep_1; u1Byte antsel_rx_keep_2; + u1Byte antsel_rx_keep_3; u4Byte antSumRSSI[7]; u4Byte antRSSIcnt[7]; u4Byte antAveRSSI[7]; @@ -1225,6 +1031,16 @@ typedef struct _FAST_ANTENNA_TRAINNING_ u4Byte OFDM_counter_main; u4Byte OFDM_counter_aux; + + u4Byte CCK_CtrlFrame_Cnt_main; + u4Byte CCK_CtrlFrame_Cnt_aux; + u4Byte OFDM_CtrlFrame_Cnt_main; + u4Byte OFDM_CtrlFrame_Cnt_aux; + u4Byte MainAnt_CtrlFrame_Sum; + u4Byte AuxAnt_CtrlFrame_Sum; + u4Byte MainAnt_CtrlFrame_Cnt; + u4Byte AuxAnt_CtrlFrame_Cnt; + }FAT_T,*pFAT_T; typedef enum _FAT_STATE @@ -1244,6 +1060,7 @@ typedef enum _ANT_DIV_TYPE S0S1_SW_ANTDIV = 0x06 //8723B intrnal switch S0 S1 }ANT_DIV_TYPE_E, *PANT_DIV_TYPE_E; + typedef struct _ODM_PATH_DIVERSITY_ { u1Byte RespTxPath; @@ -1306,10 +1123,9 @@ typedef struct DM_Out_Source_Dynamic_Mechanism_Structure u8Byte DebugComponents; u4Byte DebugLevel; - u8Byte NumQryPhyStatusAll; //CCK + OFDM - u8Byte LastNumQryPhyStatusAll; - u8Byte RxPWDBAve; - u8Byte RxPWDBAve_final; + u4Byte NumQryPhyStatusAll; //CCK + OFDM + u4Byte LastNumQryPhyStatusAll; + u4Byte RxPWDBAve; BOOLEAN MPDIG_2G; //off MPDIG u1Byte Times_2G; @@ -1374,6 +1190,10 @@ typedef struct DM_Out_Source_Dynamic_Mechanism_Structure BOOLEAN bDualMacSmartConcurrent; u4Byte BK_SupportAbility; u1Byte AntDivType; + + u1Byte odm_Regulation2_4G; + u1Byte odm_Regulation5G; + u1Byte IQKFWOffload; //-----------HOOK BEFORE REG INIT-----------// // @@ -1417,9 +1237,14 @@ typedef struct DM_Out_Source_Dynamic_Mechanism_Structure //pMgntInfo->AntennaTest u1Byte *pAntennaTest; BOOLEAN *pbNet_closed; - u1Byte *mp_mode; //u1Byte *pAidMap; u1Byte *pu1ForcedIgiLb; + BOOLEAN *pIsFcsModeEnable; +//--------- For 8723B IQK-----------// + BOOLEAN *pIs1Antenna; + u1Byte *pRFDefaultPath; + // 0:S1, 1:S0 + //--------- POINTER REFERENCE-----------// pu2Byte pForcedDataRate; //------------CALL BY VALUE-------------// @@ -1427,14 +1252,14 @@ typedef struct DM_Out_Source_Dynamic_Mechanism_Structure BOOLEAN bWIFI_Direct; BOOLEAN bWIFI_Display; BOOLEAN bLinked; - BOOLEAN bsta_state; u1Byte RSSI_Min; u1Byte InterfaceIndex; // Add for 92D dual MAC: 0--Mac0 1--Mac1 BOOLEAN bIsMPChip; BOOLEAN bOneEntryOnly; + BOOLEAN mp_mode; // Common info for BTDM - BOOLEAN bBtDisabled; // BT is disabled + BOOLEAN bBtEnabled; // BT is enabled BOOLEAN bBtConnectProcess; // BT HS is under connection progress. u1Byte btHsRssi; // BT HS mode wifi rssi value. BOOLEAN bBtHsOperation; // BT HS mode is under progress @@ -1443,13 +1268,14 @@ typedef struct DM_Out_Source_Dynamic_Mechanism_Structure //------------CALL BY VALUE-------------// u1Byte RSSI_A; u1Byte RSSI_B; + u1Byte RSSI_C; + u1Byte RSSI_D; u8Byte RSSI_TRSW; u8Byte RSSI_TRSW_H; u8Byte RSSI_TRSW_L; u8Byte RSSI_TRSW_iso; u1Byte RxRate; - BOOLEAN StopDIG; BOOLEAN bNoisyState; u1Byte TxRate; u1Byte LinkedInterval; @@ -1478,6 +1304,32 @@ typedef struct DM_Out_Source_Dynamic_Mechanism_Structure u1Byte pre_AntType; u1Byte antdiv_period; u1Byte antdiv_select; + u1Byte NdpaPeriod; + BOOLEAN H2C_RARpt_connect; + + // add by Yu Cehn for adaptivtiy + BOOLEAN adaptivity_flag; + u1Byte tolerance_cnt; + u8Byte NHMCurTxOkcnt; + u8Byte NHMCurRxOkcnt; + u8Byte NHMLastTxOkcnt; + u8Byte NHMLastRxOkcnt; + u1Byte NHMWait; + s1Byte H2L_lb; + s1Byte L2H_lb; + u1Byte Adaptivity_IGI_upper; + u2Byte NHM_cnt_0; + u2Byte NHM_cnt_1; + BOOLEAN Carrier_Sense_enable; + BOOLEAN bFirstLink; + BOOLEAN bCheck; + BOOLEAN EDCCA_enable_state; + BOOLEAN NHM_enable; + BOOLEAN DynamicLinkAdaptivity; + BOOLEAN bAdaOn; + + ODM_NOISE_MONITOR noise_level;//[ODM_MAX_CHANNEL_NUM]; + // //2 Define STA info. // _ODM_STA_INFO // 2012/01/12 MH For MP, we need to reduce one array pointer for default port.?? @@ -1513,17 +1365,21 @@ typedef struct DM_Out_Source_Dynamic_Mechanism_Structure // //ODM Structure // - FAT_T DM_FatTable; - DIG_T DM_DigTable; - PS_T DM_PSTable; - Pri_CCA_T DM_PriCCA; - RXHP_T DM_RXHP_Table; - RA_T DM_RA_Table; - FALSE_ALARM_STATISTICS FalseAlmCnt; - FALSE_ALARM_STATISTICS FlaseAlmCntBuddyAdapter; + FAT_T DM_FatTable; + DIG_T DM_DigTable; + PS_T DM_PSTable; + Pri_CCA_T DM_PriCCA; +#if (DM_ODM_SUPPORT_TYPE & ODM_WIN) + RXHP_T DM_RXHP_Table; +#endif + RA_T DM_RA_Table; + FALSE_ALARM_STATISTICS FalseAlmCnt; + FALSE_ALARM_STATISTICS FlaseAlmCntBuddyAdapter; //#ifdef CONFIG_ANTENNA_DIVERSITY - SWAT_T DM_SWAT_Table; - BOOLEAN RSSI_test; + SWAT_T DM_SWAT_Table; + BOOLEAN RSSI_test; + CFO_TRACKING DM_CfoTrack; + ACS DM_ACS; //#endif #if (DM_ODM_SUPPORT_TYPE & ODM_WIN) @@ -1594,21 +1450,28 @@ typedef struct DM_Out_Source_Dynamic_Mechanism_Structure s1Byte Modify_TxAGC_Value; //Remnat compensate value at TxAGC BOOLEAN Modify_TxAGC_Flag_PathA; BOOLEAN Modify_TxAGC_Flag_PathB; + BOOLEAN Modify_TxAGC_Flag_PathC; + BOOLEAN Modify_TxAGC_Flag_PathD; BOOLEAN Modify_TxAGC_Flag_PathA_CCK; + + s1Byte KfreeOffset[MAX_RF_PATH]; // // Dynamic ATC switch // - BOOLEAN bATCStatus; - BOOLEAN largeCFOHit; - BOOLEAN bIsfreeze; - int CFO_tail[2]; - int CFO_ave_pre; - int CrystalCap; - u1Byte CFOThreshold; - u4Byte packetCount; - u4Byte packetCount_pre; - + +#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) + // + // Power Training + // + BOOLEAN bDisablePowerTraining; + u1Byte ForcePowerTrainingState; + BOOLEAN bChangeState; + u4Byte PT_score; + u8Byte OFDM_RX_Cnt; + u8Byte CCK_RX_Cnt; +#endif + // // ODM system resource. // @@ -1630,6 +1493,10 @@ typedef struct DM_Out_Source_Dynamic_Mechanism_Structure #endif #endif + #if (BEAMFORMING_SUPPORT == 1) + RT_BEAMFORMING_INFO BeamformingInfo; + #endif + #if(DM_ODM_SUPPORT_TYPE & ODM_WIN) #if (RT_PLATFORM != PLATFORM_LINUX) @@ -1725,88 +1592,7 @@ typedef enum _RT_STATUS{ //3 DIG //3=========================================================== -typedef enum tag_Dynamic_Init_Gain_Operation_Type_Definition -{ - DIG_TYPE_THRESH_HIGH = 0, - DIG_TYPE_THRESH_LOW = 1, - DIG_TYPE_BACKOFF = 2, - DIG_TYPE_RX_GAIN_MIN = 3, - DIG_TYPE_RX_GAIN_MAX = 4, - DIG_TYPE_ENABLE = 5, - DIG_TYPE_DISABLE = 6, - DIG_OP_TYPE_MAX -}DM_DIG_OP_E; -/* -typedef enum tag_CCK_Packet_Detection_Threshold_Type_Definition -{ - CCK_PD_STAGE_LowRssi = 0, - CCK_PD_STAGE_HighRssi = 1, - CCK_PD_STAGE_MAX = 3, -}DM_CCK_PDTH_E; - -typedef enum tag_DIG_EXT_PORT_ALGO_Definition -{ - DIG_EXT_PORT_STAGE_0 = 0, - DIG_EXT_PORT_STAGE_1 = 1, - DIG_EXT_PORT_STAGE_2 = 2, - DIG_EXT_PORT_STAGE_3 = 3, - DIG_EXT_PORT_STAGE_MAX = 4, -}DM_DIG_EXT_PORT_ALG_E; - -typedef enum tag_DIG_Connect_Definition -{ - DIG_STA_DISCONNECT = 0, - DIG_STA_CONNECT = 1, - DIG_STA_BEFORE_CONNECT = 2, - DIG_MultiSTA_DISCONNECT = 3, - DIG_MultiSTA_CONNECT = 4, - DIG_CONNECT_MAX -}DM_DIG_CONNECT_E; - - -#define DM_MultiSTA_InitGainChangeNotify(Event) {DM_DigTable.CurMultiSTAConnectState = Event;} - -#define DM_MultiSTA_InitGainChangeNotify_CONNECT(_ADAPTER) \ - DM_MultiSTA_InitGainChangeNotify(DIG_MultiSTA_CONNECT) - -#define DM_MultiSTA_InitGainChangeNotify_DISCONNECT(_ADAPTER) \ - DM_MultiSTA_InitGainChangeNotify(DIG_MultiSTA_DISCONNECT) -*/ -#define DM_DIG_THRESH_HIGH 40 -#define DM_DIG_THRESH_LOW 35 - -#define DM_FALSEALARM_THRESH_LOW 400 -#define DM_FALSEALARM_THRESH_HIGH 1000 - -#define DM_DIG_MAX_NIC 0x3e -#define DM_DIG_MIN_NIC 0x1e //0x22//0x1c - -#define DM_DIG_MAX_AP 0x32 -#define DM_DIG_MIN_AP 0x20 - -#define DM_DIG_MAX_NIC_HP 0x46 -#define DM_DIG_MIN_NIC_HP 0x2e - -#define DM_DIG_MAX_AP_HP 0x42 -#define DM_DIG_MIN_AP_HP 0x30 - -//vivi 92c&92d has different definition, 20110504 -//this is for 92c -#ifdef CONFIG_SPECIAL_SETTING_FOR_FUNAI_TV -#define DM_DIG_FA_TH0 0x80//0x20 -#else -#define DM_DIG_FA_TH0 0x200//0x20 -#endif -#define DM_DIG_FA_TH1 0x300//0x100 -#define DM_DIG_FA_TH2 0x400//0x200 -//this is for 92d -#define DM_DIG_FA_TH0_92D 0x100 -#define DM_DIG_FA_TH1_92D 0x400 -#define DM_DIG_FA_TH2_92D 0x600 - -#define DM_DIG_BACKOFF_MAX 12 -#define DM_DIG_BACKOFF_MIN -4 -#define DM_DIG_BACKOFF_DEFAULT 10 +//Remove DIG by Yuchen //3=========================================================== //3 AGC RX High Power Mode @@ -1829,20 +1615,8 @@ typedef enum tag_DIG_Connect_Definition //3 Dynamic Tx Power //3=========================================================== //Dynamic Tx Power Control Threshold -#define TX_POWER_NEAR_FIELD_THRESH_LVL2 74 -#define TX_POWER_NEAR_FIELD_THRESH_LVL1 67 -#define TX_POWER_NEAR_FIELD_THRESH_AP 0x3F -#define TxHighPwrLevel_Normal 0 -#define TxHighPwrLevel_Level1 1 -#define TxHighPwrLevel_Level2 2 -#define TxHighPwrLevel_BT1 3 -#define TxHighPwrLevel_BT2 4 -#define TxHighPwrLevel_15 5 -#define TxHighPwrLevel_35 6 -#define TxHighPwrLevel_50 7 -#define TxHighPwrLevel_70 8 -#define TxHighPwrLevel_100 9 +//Remove By YuChen //3=========================================================== //3 Tx Power Tracking @@ -1856,24 +1630,12 @@ typedef enum tag_DIG_Connect_Definition //3=========================================================== //3 Rate Adaptive //3=========================================================== -#define DM_RATR_STA_INIT 0 -#define DM_RATR_STA_HIGH 1 -#define DM_RATR_STA_MIDDLE 2 -#define DM_RATR_STA_LOW 3 +//Remove to odm_RaInfo.h by RS_James //3=========================================================== //3 BB Power Save //3=========================================================== - -//3=========================================================== -//3 Dynamic ATC switch -//3=========================================================== -#define ATC_Status_Off 0x0 // enable -#define ATC_Status_On 0x1 // disable -#define CFO_Threshold_Xtal 10 // kHz -#define CFO_Threshold_ATC 80 // kHz - typedef enum tag_1R_CCA_Type_Definition { CCA_1R =0, @@ -1905,20 +1667,7 @@ typedef enum tag_SW_Antenna_Switch_Definition // // Extern Global Variables. // -extern u4Byte OFDMSwingTable[OFDM_TABLE_SIZE]; -extern u1Byte CCKSwingTable_Ch1_Ch13[CCK_TABLE_SIZE][8]; -extern u1Byte CCKSwingTable_Ch14 [CCK_TABLE_SIZE][8]; - -extern u4Byte OFDMSwingTable_New[OFDM_TABLE_SIZE]; -extern u1Byte CCKSwingTable_Ch1_Ch13_New[CCK_TABLE_SIZE][8]; -extern u1Byte CCKSwingTable_Ch14_New [CCK_TABLE_SIZE][8]; - -extern u4Byte TxScalingTable_Jaguar[TXSCALE_TABLE_SIZE]; - -// <20121018, Kordan> In case fail to read TxPowerTrack.txt, we use the table of 88E as the default table. -static u1Byte DeltaSwingTableIdx_2GA_P_8188E[] = {0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9}; -static u1Byte DeltaSwingTableIdx_2GA_N_8188E[] = {0, 0, 0, 2, 2, 3, 3, 4, 4, 4, 4, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 11}; - +//remove PT by YuChen // // check Sta pointer valid or not // @@ -1937,35 +1686,18 @@ static u1Byte DeltaSwingTableIdx_2GA_N_8188E[] = {0, 0, 0, 2, 2, 3, 3, 4, 4, 4, #define SWAW_STEP_PEAK 0 #define SWAW_STEP_DETERMINE 1 -VOID ODM_Write_DIG(IN PDM_ODM_T pDM_Odm, IN u1Byte CurrentIGI); -VOID ODM_Write_CCK_CCA_Thres(IN PDM_ODM_T pDM_Odm, IN u1Byte CurCCK_CCAThres); - -VOID -ODM_SetAntenna( - IN PDM_ODM_T pDM_Odm, - IN u1Byte Antenna); +//Remove DIG by yuchen + + + + +//Remove BB power saving by Yuchen -#define dm_RF_Saving ODM_RF_Saving -void ODM_RF_Saving( IN PDM_ODM_T pDM_Odm, - IN u1Byte bForceInNormal ); -#define SwAntDivRestAfterLink ODM_SwAntDivRestAfterLink -VOID ODM_SwAntDivRestAfterLink( IN PDM_ODM_T pDM_Odm); -#define dm_CheckTXPowerTracking ODM_TXPowerTrackingCheck -VOID -ODM_TXPowerTrackingCheck( - IN PDM_ODM_T pDM_Odm - ); -BOOLEAN -ODM_RAStateCheck( - IN PDM_ODM_T pDM_Odm, - IN s4Byte RSSI, - IN BOOLEAN bForceUpdate, - OUT pu1Byte pRATRState - ); +//ODM_RAStateCheck() Remove by RS_James #if(DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_AP|ODM_ADSL)) //============================================================ @@ -1975,12 +1707,9 @@ ODM_RAStateCheck( //void ODM_ChangeDynamicInitGainThresh(IN PADAPTER pAdapter, // IN INT32 DM_Type, // IN INT32 DM_Value); -VOID -ODM_ChangeDynamicInitGainThresh( - IN PDM_ODM_T pDM_Odm, - IN u4Byte DM_Type, - IN u4Byte DM_Value - ); + +//Remove DIG by yuchen + BOOLEAN ODM_CheckPowerStatus( @@ -1988,62 +1717,12 @@ ODM_CheckPowerStatus( ); -#if (DM_ODM_SUPPORT_TYPE != ODM_ADSL) -VOID -ODM_RateAdaptiveStateApInit( - IN PADAPTER Adapter , - IN PRT_WLAN_STA pEntry - ); -#endif -#define AP_InitRateAdaptiveState ODM_RateAdaptiveStateApInit - - -#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) -#ifdef WIFI_WMM -VOID -ODM_IotEdcaSwitch( - IN PDM_ODM_T pDM_Odm, - IN unsigned char enable - ); -#endif - -BOOLEAN -ODM_ChooseIotMainSTA( - IN PDM_ODM_T pDM_Odm, - IN PSTA_INFO_T pstat - ); -#endif - -#if(DM_ODM_SUPPORT_TYPE==ODM_AP) -#ifdef HW_ANT_SWITCH -u1Byte -ODM_Diversity_AntennaSelect( - IN PDM_ODM_T pDM_Odm, - IN u1Byte *data -); -#endif -#endif - -#define SwAntDivResetBeforeLink ODM_SwAntDivResetBeforeLink -VOID ODM_SwAntDivResetBeforeLink(IN PDM_ODM_T pDM_Odm); - -#define SwAntDivCheckBeforeLink ODM_SwAntDivCheckBeforeLink - -BOOLEAN -ODM_SwAntDivCheckBeforeLink( - IN PDM_ODM_T pDM_Odm - ); +//Remove ODM_RateAdaptiveStateApInit() by RS_James +//Remove Edca by YuChen #endif -#define dm_SWAW_RSSI_Check ODM_SwAntDivChkPerPktRssi -VOID ODM_SwAntDivChkPerPktRssi( - IN PDM_ODM_T pDM_Odm, - IN u1Byte StationID, - IN PODM_PHY_INFO_T pPhyInfo - ); - #if((DM_ODM_SUPPORT_TYPE==ODM_WIN)||(DM_ODM_SUPPORT_TYPE==ODM_CE)) u4Byte ConvertTo_dB(u4Byte Value); @@ -2056,57 +1735,7 @@ GetPSDData( #endif -#if (DM_ODM_SUPPORT_TYPE == ODM_CE) - -VOID -odm_DIGbyRSSI_LPS( - IN PDM_ODM_T pDM_Odm - ); - -u4Byte ODM_Get_Rate_Bitmap( - IN PDM_ODM_T pDM_Odm, - IN u4Byte macid, - IN u4Byte ra_mask, - IN u1Byte rssi_level); - -#endif - - -#if(DM_ODM_SUPPORT_TYPE & (ODM_WIN)) -#define dm_PSDMonitorCallback odm_PSDMonitorCallback -VOID odm_PSDMonitorCallback(PRT_TIMER pTimer); - -VOID -odm_PSDMonitorWorkItemCallback( - IN PVOID pContext - ); - -VOID -ODM_MPT_DIG( - IN PDM_ODM_T pDM_Odm -); - -VOID -PatchDCTone( - IN PDM_ODM_T pDM_Odm, - pu4Byte PSD_report, - u1Byte initial_gain_psd -); -VOID -ODM_PSDMonitor( - IN PDM_ODM_T pDM_Odm - ); -VOID odm_PSD_Monitor(PDM_ODM_T pDM_Odm); -VOID odm_PSDMonitorInit(PDM_ODM_T pDM_Odm); - -VOID -ODM_PSDDbgControl( - IN PADAPTER Adapter, - IN u4Byte mode, - IN u4Byte btRssi - ); - -#endif // DM_ODM_SUPPORT_TYPE +//Remove ODM_Get_Rate_Bitmap() by RS_James #if (BEAMFORMING_SUPPORT == 1) @@ -2117,9 +1746,15 @@ Beamforming_GetEntryBeamCapByMacId( ); #endif +VOID +ODM_DMInit( + IN PDM_ODM_T pDM_Odm +); - -VOID ODM_DMInit( IN PDM_ODM_T pDM_Odm); +VOID +ODM_DMReset( + IN PDM_ODM_T pDM_Odm + ); VOID ODM_DMWatchdog( @@ -2180,11 +1815,6 @@ ODM_ResetIQKResult( VOID ODM_InitAllWorkItems(IN PDM_ODM_T pDM_Odm ); VOID ODM_FreeAllWorkItems(IN PDM_ODM_T pDM_Odm ); -VOID odm_PathDivChkAntSwitch(PDM_ODM_T pDM_Odm); -VOID ODM_PathDivRestAfterLink( - IN PDM_ODM_T pDM_Odm - ); - //===========================================// // Neil Chen----2011--06--15-- @@ -2199,17 +1829,7 @@ VOID ODM_PathDivRestAfterLink( //#define PATHDIV_ENABLE 1 -//VOID odm_PathDivChkAntSwitch(PADAPTER Adapter,u1Byte Step); -VOID ODM_PathDivRestAfterLink( - IN PDM_ODM_T pDM_Odm - ); - -#define dm_PathDiv_RSSI_Check ODM_PathDivChkPerPktRssi -VOID ODM_PathDivChkPerPktRssi(PADAPTER Adapter, - BOOLEAN bIsDefPort, - BOOLEAN bMatchBSSID, - PRT_WLAN_STA pEntry, - PRT_RFD pRfd ); +//#define dm_PathDiv_RSSI_Check ODM_PathDivChkPerPktRssi u8Byte PlatformDivision64( @@ -2230,12 +1850,7 @@ PlatformDivision64( //3 PathDiV End //==================================================== -#define PathDivCheckBeforeLink8192C ODM_PathDiversityBeforeLink92C -BOOLEAN -ODM_PathDiversityBeforeLink92C( - //IN PADAPTER Adapter - IN PDM_ODM_T pDM_Odm - ); +//#define PathDivCheckBeforeLink8192C ODM_PathDiversityBeforeLink92C #define DM_ChangeDynamicInitGainThresh ODM_ChangeDynamicInitGainThresh //void ODM_ChangeDynamicInitGainThresh(IN PADAPTER pAdapter, @@ -2243,18 +1858,6 @@ ODM_PathDiversityBeforeLink92C( // IN INT32 DM_Value); // - -VOID -ODM_CCKPathDiversityChkPerPktRssi( - PADAPTER Adapter, - BOOLEAN bIsDefPort, - BOOLEAN bMatchBSSID, - PRT_WLAN_STA pEntry, - PRT_RFD pRfd, - pu1Byte pDesc - ); - - typedef enum tag_DIG_Connect_Definition { DIG_STA_DISCONNECT = 0, @@ -2266,16 +1869,6 @@ typedef enum tag_DIG_Connect_Definition }DM_DIG_CONNECT_E; -VOID -ODM_FillTXPathInTXDESC( - IN PADAPTER Adapter, - IN PRT_TCB pTcb, - IN pu1Byte pDesc -); - - -#define dm_SWAW_RSSI_Check ODM_SwAntDivChkPerPktRssi - // // 2012/01/12 MH Check afapter status. Temp fix BSOD. // @@ -2295,21 +1888,10 @@ ODM_FillTXPathInTXDESC( IS_HARDWARE_TYPE_8723A(_Adapter) ? odm_TXPowerTrackingCallback_ThermalMeter_8723A(_Adapter) :\ ODM_TXPowerTrackingCallback_ThermalMeter(_Adapter) -VOID -ODM_SetTxAntByTxInfo_88C_92D( - IN PDM_ODM_T pDM_Odm, - IN pu1Byte pDesc, - IN u1Byte macId - ); + #endif // #if (DM_ODM_SUPPORT_TYPE == ODM_WIN) -VOID -ODM_AntselStatistics_88C( - IN PDM_ODM_T pDM_Odm, - IN u1Byte MacId, - IN u4Byte PWDBAll, - IN BOOLEAN isCCKrate -); + #if( DM_ODM_SUPPORT_TYPE & (ODM_WIN |ODM_CE)) @@ -2324,12 +1906,6 @@ ODM_SingleDualAntennaDetection( IN u1Byte mode ); -VOID -ODM_DynamicATCSwitch( - IN PDM_ODM_T pDM_Odm -); - - #endif // #if((DM_ODM_SUPPORT_TYPE==ODM_WIN)||(DM_ODM_SUPPORT_TYPE==ODM_CE)) VOID ODM_UpdateNoisyState( @@ -2352,11 +1928,25 @@ ODM_UpdateInitRate( ); VOID -ODM_DynamicARFBSelect( - IN PDM_ODM_T pDM_Odm, - IN u1Byte rate, - IN BOOLEAN Collision_State - ); +ODM_InitializeTimer( + IN PDM_ODM_T pDM_Odm, + IN PRT_TIMER pTimer, + IN RT_TIMER_CALL_BACK CallBackFunc, + IN PVOID pContext, + IN const char* szID +); + +VOID +ODM_CancelAllTimers( + IN PDM_ODM_T pDM_Odm +); + +VOID +ODM_ReleaseAllTimers( + IN PDM_ODM_T pDM_Odm +); + +//Remove ODM_DynamicARFBSelect() by RS_James #if (DM_ODM_SUPPORT_TYPE == ODM_CE) void odm_dtc(PDM_ODM_T pDM_Odm); diff --git a/hal/OUTSRC/odm_ACS.c b/hal/OUTSRC/odm_ACS.c new file mode 100644 index 0000000..9215947 --- /dev/null +++ b/hal/OUTSRC/odm_ACS.c @@ -0,0 +1,213 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA + * + * + ******************************************************************************/ + +//============================================================ +// include files +//============================================================ +#include "Mp_Precomp.h" +#include "odm_precomp.h" + + +u1Byte +ODM_GetAutoChannelSelectResult( + IN PVOID pDM_VOID, + IN u1Byte Band +) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + PACS pACS = &pDM_Odm->DM_ACS; + +#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) + if(Band == ODM_BAND_2_4G) + { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_ACS, ODM_DBG_LOUD, ("[ACS] ODM_GetAutoChannelSelectResult(): CleanChannel_2G(%d)\n", pACS->CleanChannel_2G)); + return (u1Byte)pACS->CleanChannel_2G; + } + else + { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_ACS, ODM_DBG_LOUD, ("[ACS] ODM_GetAutoChannelSelectResult(): CleanChannel_5G(%d)\n", pACS->CleanChannel_5G)); + return (u1Byte)pACS->CleanChannel_5G; + } +#else + return (u1Byte)pACS->CleanChannel_2G; +#endif + +} + +VOID +odm_AutoChannelSelectSetting( + IN PVOID pDM_VOID, + IN BOOLEAN IsEnable +) +{ +#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + u2Byte period = 0x2710;// 40ms in default + u2Byte NHMType = 0x7; + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_ACS, ODM_DBG_LOUD, ("odm_AutoChannelSelectSetting()=========> \n")); + + if(IsEnable) + {//20 ms + period = 0x1388; + NHMType = 0x1; + } + + if(pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) + { + //PHY parameters initialize for ac series + ODM_Write2Byte(pDM_Odm, ODM_REG_NHM_TIMER_11AC+2, period); //0x990[31:16]=0x2710 Time duration for NHM unit: 4us, 0x2710=40ms + //ODM_SetBBReg(pDM_Odm, ODM_REG_NHM_TH9_TH10_11AC, BIT8|BIT9|BIT10, NHMType); //0x994[9:8]=3 enable CCX + } + else if (pDM_Odm->SupportICType & ODM_IC_11N_SERIES) + { + //PHY parameters initialize for n series + ODM_Write2Byte(pDM_Odm, ODM_REG_NHM_TIMER_11N+2, period); //0x894[31:16]=0x2710 Time duration for NHM unit: 4us, 0x2710=40ms + //ODM_SetBBReg(pDM_Odm, ODM_REG_NHM_TH9_TH10_11N, BIT10|BIT9|BIT8, NHMType); //0x890[9:8]=3 enable CCX + } +#endif +} + +VOID +odm_AutoChannelSelectInit( + IN PVOID pDM_VOID +) +{ +#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + PACS pACS = &pDM_Odm->DM_ACS; + u1Byte i; + + if(!(pDM_Odm->SupportAbility & ODM_BB_NHM_CNT)) + return; + + if(pACS->bForceACSResult) + return; + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_ACS, ODM_DBG_LOUD, ("odm_AutoChannelSelectInit()=========> \n")); + + pACS->CleanChannel_2G = 1; + pACS->CleanChannel_5G = 36; + + for (i = 0; i < ODM_MAX_CHANNEL_2G; ++i) + { + pACS->Channel_Info_2G[0][i] = 0; + pACS->Channel_Info_2G[1][i] = 0; + } + + if(pDM_Odm->SupportICType & (ODM_IC_11AC_SERIES|ODM_RTL8192D)) + { + for (i = 0; i < ODM_MAX_CHANNEL_5G; ++i) + { + pACS->Channel_Info_5G[0][i] = 0; + pACS->Channel_Info_5G[1][i] = 0; + } + } +#endif +} + +VOID +odm_AutoChannelSelectReset( + IN PVOID pDM_VOID +) +{ +#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + PACS pACS = &pDM_Odm->DM_ACS; + + if(!(pDM_Odm->SupportAbility & ODM_BB_NHM_CNT)) + return; + + if(pACS->bForceACSResult) + return; + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_ACS, ODM_DBG_LOUD, ("odm_AutoChannelSelectReset()=========> \n")); + + odm_AutoChannelSelectSetting(pDM_Odm,TRUE);// for 20ms measurement + Phydm_NHMCounterStatisticsReset(pDM_Odm); +#endif +} + +VOID +odm_AutoChannelSelect( + IN PVOID pDM_VOID, + IN u1Byte Channel +) +{ +#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + PACS pACS = &pDM_Odm->DM_ACS; + u1Byte ChannelIDX = 0, SearchIDX = 0; + u2Byte MaxScore=0; + + if(!(pDM_Odm->SupportAbility & ODM_BB_NHM_CNT)) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_AutoChannelSelect(): Return: SupportAbility ODM_BB_NHM_CNT is disabled\n")); + return; + } + + if(pACS->bForceACSResult) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_AutoChannelSelect(): Force 2G clean channel = %d, 5G clean channel = %d\n", + pACS->CleanChannel_2G, pACS->CleanChannel_5G)); + return; + } + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_ACS, ODM_DBG_LOUD, ("odm_AutoChannelSelect(): Channel = %d=========> \n", Channel)); + + Phydm_GetNHMCounterStatistics(pDM_Odm); + odm_AutoChannelSelectSetting(pDM_Odm,FALSE); + + if(Channel >=1 && Channel <=14) + { + ChannelIDX = Channel - 1; + pACS->Channel_Info_2G[1][ChannelIDX]++; + + if(pACS->Channel_Info_2G[1][ChannelIDX] >= 2) + pACS->Channel_Info_2G[0][ChannelIDX] = (pACS->Channel_Info_2G[0][ChannelIDX] >> 1) + + (pACS->Channel_Info_2G[0][ChannelIDX] >> 2) + (pDM_Odm->NHM_cnt_0>>2); + else + pACS->Channel_Info_2G[0][ChannelIDX] = pDM_Odm->NHM_cnt_0; + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_ACS, ODM_DBG_LOUD, ("odm_AutoChannelSelect(): NHM_cnt_0 = %d \n", pDM_Odm->NHM_cnt_0)); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_ACS, ODM_DBG_LOUD, ("odm_AutoChannelSelect(): Channel_Info[0][%d] = %d, Channel_Info[1][%d] = %d\n", ChannelIDX, pACS->Channel_Info_2G[0][ChannelIDX], ChannelIDX, pACS->Channel_Info_2G[1][ChannelIDX])); + + for(SearchIDX = 0; SearchIDX < ODM_MAX_CHANNEL_2G; SearchIDX++) + { + if(pACS->Channel_Info_2G[1][SearchIDX] != 0) + { + if(pACS->Channel_Info_2G[0][SearchIDX] >= MaxScore) + { + MaxScore = pACS->Channel_Info_2G[0][SearchIDX]; + pACS->CleanChannel_2G = SearchIDX+1; + } + } + } + ODM_RT_TRACE(pDM_Odm, ODM_COMP_ACS, ODM_DBG_LOUD, ("(1)odm_AutoChannelSelect(): 2G: CleanChannel_2G = %d, MaxScore = %d \n", + pACS->CleanChannel_2G, MaxScore)); + + } + else if(Channel >= 36) + { + // Need to do + pACS->CleanChannel_5G = Channel; + } +#endif +} diff --git a/hal/OUTSRC/odm_ACS.h b/hal/OUTSRC/odm_ACS.h new file mode 100644 index 0000000..f0b178c --- /dev/null +++ b/hal/OUTSRC/odm_ACS.h @@ -0,0 +1,60 @@ +/****************************************************************************** + * + * 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 __ODMACS_H__ +#define __ODMACS_H__ + + +#define ODM_MAX_CHANNEL_2G 14 +#define ODM_MAX_CHANNEL_5G 24 + +typedef struct _ACS_ +{ + BOOLEAN bForceACSResult; + u1Byte CleanChannel_2G; + u1Byte CleanChannel_5G; + u2Byte Channel_Info_2G[2][ODM_MAX_CHANNEL_2G]; //Channel_Info[1]: Channel Score, Channel_Info[2]:Channel_Scan_Times + u2Byte Channel_Info_5G[2][ODM_MAX_CHANNEL_5G]; +}ACS, *PACS; + + +VOID +odm_AutoChannelSelectInit( + IN PVOID pDM_VOID +); + +VOID +odm_AutoChannelSelectReset( + IN PVOID pDM_VOID +); + +VOID +odm_AutoChannelSelect( + IN PVOID pDM_VOID, + IN u1Byte Channel +); + +u1Byte +ODM_GetAutoChannelSelectResult( + IN PVOID pDM_VOID, + IN u1Byte Band +); + +#endif \ No newline at end of file diff --git a/hal/OUTSRC/odm_AntDiv.c b/hal/OUTSRC/odm_AntDiv.c index 4b361e2..e3593c1 100644 --- a/hal/OUTSRC/odm_AntDiv.c +++ b/hal/OUTSRC/odm_AntDiv.c @@ -22,8 +22,81 @@ // include files //============================================================ +#include "Mp_Precomp.h" #include "odm_precomp.h" +//====================================================== +// when antenna test utility is on or some testing need to disable antenna diversity +// call this function to disable all ODM related mechanisms which will switch antenna. +//====================================================== +VOID +ODM_StopAntennaSwitchDm( + IN PDM_ODM_T pDM_Odm + ) +{ + // disable ODM antenna diversity + pDM_Odm->SupportAbility &= ~ODM_BB_ANT_DIV; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("STOP Antenna Diversity \n")); +} + +VOID +ODM_SetAntConfig( + IN PDM_ODM_T pDM_Odm, + IN u1Byte antSetting // 0=A, 1=B, 2=C, .... + ) +{ + if(pDM_Odm->SupportICType == ODM_RTL8723B) + { + if(antSetting == 0) // ant A + ODM_SetBBReg(pDM_Odm, 0x948, bMaskDWord, 0x00000000); + else if(antSetting == 1) + ODM_SetBBReg(pDM_Odm, 0x948, bMaskDWord, 0x00000280); + } +} + +//====================================================== + + +VOID +ODM_SwAntDivRestAfterLink( + IN PDM_ODM_T pDM_Odm + ) +{ + pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; + pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; + u4Byte i; + + if(pDM_Odm->SupportICType == ODM_RTL8723A) + { + pDM_SWAT_Table->RSSI_cnt_A = 0; + pDM_SWAT_Table->RSSI_cnt_B = 0; + pDM_Odm->RSSI_test = FALSE; + pDM_SWAT_Table->try_flag = 0xff; + pDM_SWAT_Table->RSSI_Trying = 0; + pDM_SWAT_Table->SelectAntennaMap=0xAA; + + } + else if(pDM_Odm->SupportICType & (ODM_RTL8723B|ODM_RTL8821)) + { + pDM_Odm->RSSI_test = FALSE; + pDM_SWAT_Table->try_flag = 0xff; + pDM_SWAT_Table->RSSI_Trying = 0; + pDM_SWAT_Table->Double_chk_flag= 0; + + pDM_FatTable->RxIdleAnt=MAIN_ANT; + + for (i=0; iMainAnt_Sum[i] = 0; + pDM_FatTable->AuxAnt_Sum[i] = 0; + pDM_FatTable->MainAnt_Cnt[i] = 0; + pDM_FatTable->AuxAnt_Cnt[i] = 0; + } + + } +} + + #if (defined(CONFIG_HW_ANTENNA_DIVERSITY)) VOID odm_AntDiv_on_off( IN PDM_ODM_T pDM_Odm ,IN u1Byte swch) @@ -33,22 +106,29 @@ odm_AntDiv_on_off( IN PDM_ODM_T pDM_Odm ,IN u1Byte swch) if(pDM_Odm->SupportICType & ODM_N_ANTDIV_SUPPORT) { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("(( Turn %s )) N-Series AntDiv Function\n",(swch==ANTDIV_ON)?"ON" : "OFF")); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("(( Turn %s )) N-Series HW-AntDiv block\n",(swch==ANTDIV_ON)?"ON" : "OFF")); ODM_SetBBReg(pDM_Odm, 0xc50 , BIT7, swch); //OFDM AntDiv function block enable - ODM_SetBBReg(pDM_Odm, 0xa00 , BIT15, swch); //CCK AntDiv function block enable + if( pDM_Odm->AntDivType != S0S1_SW_ANTDIV) + ODM_SetBBReg(pDM_Odm, 0xa00 , BIT15, swch); //CCK AntDiv function block enable } else if(pDM_Odm->SupportICType & ODM_AC_ANTDIV_SUPPORT) { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("(( Turn %s )) AC-Series AntDiv Function\n",(swch==ANTDIV_ON)?"ON" : "OFF")); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("(( Turn %s )) AC-Series HW-AntDiv block\n",(swch==ANTDIV_ON)?"ON" : "OFF")); if(pDM_Odm->SupportICType == ODM_RTL8812) { ODM_SetBBReg(pDM_Odm, 0xc50 , BIT7, swch); //OFDM AntDiv function block enable - ODM_SetBBReg(pDM_Odm, 0xa00 , BIT15, swch); //CCK AntDiv function block enable + //ODM_SetBBReg(pDM_Odm, 0xa00 , BIT15, swch); //CCK AntDiv function block enable } else { ODM_SetBBReg(pDM_Odm, 0x8D4 , BIT24, swch); //OFDM AntDiv function block enable - ODM_SetBBReg(pDM_Odm, 0x800 , BIT25, swch); //CCK AntDiv function block enable + + if( (pDM_Odm->CutVersion >= ODM_CUT_C) && (pDM_Odm->SupportICType == ODM_RTL8821) && ( pDM_Odm->AntDivType != S0S1_SW_ANTDIV)) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("(( Turn %s )) CCK HW-AntDiv block\n",(swch==ANTDIV_ON)?"ON" : "OFF")); + ODM_SetBBReg(pDM_Odm, 0x800 , BIT25, swch); + ODM_SetBBReg(pDM_Odm, 0xA00 , BIT15, swch); //CCK AntDiv function block enable + } } } } @@ -59,15 +139,17 @@ ODM_UpdateRxIdleAnt(IN PDM_ODM_T pDM_Odm, IN u1Byte Ant) pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; u4Byte DefaultAnt, OptionalAnt,value32; - #if (DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_WIN)) - PADAPTER pAdapter = pDM_Odm->Adapter; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - #endif + //#if (DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_WIN)) + //PADAPTER pAdapter = pDM_Odm->Adapter; + //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + //#endif if(pDM_FatTable->RxIdleAnt != Ant) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ Update Rx-Idle-Ant ] RxIdleAnt =%s\n",(Ant==MAIN_ANT)?"MAIN_ANT":"AUX_ANT")); - pDM_FatTable->RxIdleAnt = Ant; + + if(!(pDM_Odm->SupportICType & ODM_RTL8723B)) + pDM_FatTable->RxIdleAnt = Ant; if(Ant == MAIN_ANT) { @@ -86,32 +168,52 @@ ODM_UpdateRxIdleAnt(IN PDM_ODM_T pDM_Odm, IN u1Byte Ant) { ODM_SetBBReg(pDM_Odm, 0xB38 , BIT5|BIT4|BIT3, DefaultAnt); //Default RX ODM_SetBBReg(pDM_Odm, 0xB38 , BIT8|BIT7|BIT6, OptionalAnt);//Optional RX + ODM_SetBBReg(pDM_Odm, 0x860, BIT14|BIT13|BIT12, DefaultAnt);//Default TX + } + else if(pDM_Odm->SupportICType==ODM_RTL8723B) + { + value32 = ODM_GetBBReg(pDM_Odm, 0x948, 0xFFF); + + if (value32 !=0x280) + ODM_UpdateRxIdleAnt_8723B(pDM_Odm, Ant, DefaultAnt, OptionalAnt); + else + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ Update Rx-Idle-Ant ] 8723B: Fail to set RX antenna due to 0x948 = 0x280\n")); } else { ODM_SetBBReg(pDM_Odm, 0x864 , BIT5|BIT4|BIT3, DefaultAnt); //Default RX ODM_SetBBReg(pDM_Odm, 0x864 , BIT8|BIT7|BIT6, OptionalAnt); //Optional RX - - if(pDM_Odm->SupportICType == ODM_RTL8723B) - { - value32 = ODM_GetBBReg(pDM_Odm, 0x948, 0xFFF); - - if (value32 !=0x280) - ODM_SetBBReg(pDM_Odm, 0x948 , BIT9, DefaultAnt); - - rtw_hal_set_tx_power_level(pAdapter, pHalData->CurrentChannel); - } - - } - ODM_SetBBReg(pDM_Odm, 0x860, BIT14|BIT13|BIT12, DefaultAnt); //Default TX + ODM_SetBBReg(pDM_Odm, 0x860, BIT14|BIT13|BIT12, DefaultAnt); //Default TX + } } else if(pDM_Odm->SupportICType & ODM_AC_ANTDIV_SUPPORT) { - ODM_SetBBReg(pDM_Odm, 0xC08 , BIT21|BIT20|BIT19, DefaultAnt); //Default RX - ODM_SetBBReg(pDM_Odm, 0xC08 , BIT24|BIT23|BIT22, OptionalAnt);//Optional RX - ODM_SetBBReg(pDM_Odm, 0xC08 , BIT27|BIT26|BIT25, DefaultAnt); //Default TX + u2Byte value16 = ODM_Read2Byte(pDM_Odm, ODM_REG_TRMUX_11AC+2); + // + // 2014/01/14 MH/Luke.Lee Add direct write for register 0xc0a to prevnt + // incorrect 0xc08 bit0-15 .We still not know why it is changed. + // + value16 &= ~(BIT11|BIT10|BIT9|BIT8|BIT7|BIT6|BIT5|BIT4|BIT3); + value16 |= ((u2Byte)DefaultAnt <<3); + value16 |= ((u2Byte)OptionalAnt <<6); + value16 |= ((u2Byte)DefaultAnt <<9); + ODM_Write2Byte(pDM_Odm, ODM_REG_TRMUX_11AC+2, value16); + /* + ODM_SetBBReg(pDM_Odm, ODM_REG_TRMUX_11AC , BIT21|BIT20|BIT19, DefaultAnt); //Default RX + ODM_SetBBReg(pDM_Odm, ODM_REG_TRMUX_11AC , BIT24|BIT23|BIT22, OptionalAnt);//Optional RX + ODM_SetBBReg(pDM_Odm, ODM_REG_TRMUX_11AC , BIT27|BIT26|BIT25, DefaultAnt); //Default TX + */ } - ODM_SetMACReg(pDM_Odm, 0x6D8 , BIT10|BIT9|BIT8, DefaultAnt); //PathA Resp Tx + + if(pDM_Odm->SupportICType==ODM_RTL8188E) + { + ODM_SetMACReg(pDM_Odm, 0x6D8 , BIT7|BIT6, DefaultAnt); //PathA Resp Tx + } + else + { + ODM_SetMACReg(pDM_Odm, 0x6D8 , BIT10|BIT9|BIT8, DefaultAnt); //PathA Resp Tx + } + } else// pDM_FatTable->RxIdleAnt == Ant { @@ -163,12 +265,13 @@ odm_RX_HWAntDiv_Init_88E( pDM_Odm->AntType = ODM_AUTO_ANT; - #if (MP_DRIVER == 1) + if(pDM_Odm->mp_mode == TRUE) + { pDM_Odm->AntDivType = CGCS_RX_SW_ANTDIV; ODM_SetBBReg(pDM_Odm, ODM_REG_IGI_A_11N , BIT7, 0); // disable HW AntDiv ODM_SetBBReg(pDM_Odm, ODM_REG_LNA_SWITCH_11N , BIT31, 1); // 1:CG, 0:CS return; - #endif + } ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***8188E AntDiv_Init => AntDivType=[CGCS_RX_HW_ANTDIV]\n")); @@ -186,8 +289,7 @@ odm_RX_HWAntDiv_Init_88E( ODM_SetBBReg(pDM_Odm, ODM_REG_BB_PWR_SAV4_11N , BIT7, 1); //Fix CCK PHY status report issue ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_ANTDIV_PARA2_11N , BIT4, 1); //CCK complete HW AntDiv within 64 samples - ODM_SetBBReg(pDM_Odm, ODM_REG_ANT_MAPPING1_11N , 0xFFFF, 0x0102); //antenna mapping table - + ODM_SetBBReg(pDM_Odm, ODM_REG_ANT_MAPPING1_11N , 0xFFFF, 0x0001); //antenna mapping table } VOID @@ -197,12 +299,13 @@ odm_TRX_HWAntDiv_Init_88E( { u4Byte value32; - #if (MP_DRIVER == 1) + if(pDM_Odm->mp_mode == TRUE) + { pDM_Odm->AntDivType = CGCS_RX_SW_ANTDIV; ODM_SetBBReg(pDM_Odm, ODM_REG_IGI_A_11N , BIT7, 0); // disable HW AntDiv ODM_SetBBReg(pDM_Odm, ODM_REG_RX_ANT_CTRL_11N , BIT5|BIT4|BIT3, 0); //Default RX (0/1) return; - #endif + } ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***8188E AntDiv_Init => AntDivType=[CG_TRX_HW_ANTDIV (SPDT)]\n")); @@ -227,7 +330,7 @@ odm_TRX_HWAntDiv_Init_88E( ODM_SetBBReg(pDM_Odm, ODM_REG_RX_DEFUALT_A_11N , BIT13|BIT12|BIT11, 2); //Reg858[13:11]=3'b010 } else //MPchip - ODM_SetBBReg(pDM_Odm, ODM_REG_ANT_MAPPING1_11N , bMaskDWord, 0x0201); //Reg914=3'b010, Reg915=3'b001 + ODM_SetBBReg(pDM_Odm, ODM_REG_ANT_MAPPING1_11N , bMaskDWord, 0x0001); //Reg914=3'b010, Reg915=3'b001 } VOID @@ -241,10 +344,11 @@ odm_Smart_HWAntDiv_Init_88E( ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***8188E AntDiv_Init => AntDivType=[CG_TRX_SMART_ANTDIV]\n")); -#if (MP_DRIVER == 1) + if(pDM_Odm->mp_mode == TRUE) + { ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("pDM_Odm->AntDivType: %d\n", pDM_Odm->AntDivType)); return; -#endif + } for(i=0; i<6; i++) { @@ -346,14 +450,15 @@ odm_RX_HWAntDiv_Init_92E( ) { -#if (MP_DRIVER == 1) + if(pDM_Odm->mp_mode == TRUE) + { //pDM_Odm->AntDivType = CGCS_RX_SW_ANTDIV; odm_AntDiv_on_off(pDM_Odm, ANTDIV_OFF); ODM_SetBBReg(pDM_Odm, 0xc50 , BIT8, 0); //r_rxdiv_enable_anta Regc50[8]=1'b0 0: control by c50[9] ODM_SetBBReg(pDM_Odm, 0xc50 , BIT9, 1); // 1:CG, 0:CS return; -#endif - + } + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***8192E AntDiv_Init => AntDivType=[CGCS_RX_HW_ANTDIV]\n")); //Pin Settings @@ -380,13 +485,14 @@ odm_TRX_HWAntDiv_Init_92E( ) { -#if (MP_DRIVER == 1) + if(pDM_Odm->mp_mode == TRUE) + { //pDM_Odm->AntDivType = CGCS_RX_SW_ANTDIV; odm_AntDiv_on_off(pDM_Odm, ANTDIV_OFF); ODM_SetBBReg(pDM_Odm, 0xc50 , BIT8, 0); //r_rxdiv_enable_anta Regc50[8]=1'b0 0: control by c50[9] ODM_SetBBReg(pDM_Odm, 0xc50 , BIT9, 1); // 1:CG, 0:CS return; -#endif + } #if (DM_ODM_SUPPORT_TYPE & ODM_AP) pDM_Odm->antdiv_rssi=0; @@ -528,8 +634,108 @@ odm_S0S1_SWAntDiv_Init_8723B( ODM_SetBBReg(pDM_Odm, 0x80C , BIT21, 0); //TX Ant by Reg } -#endif //#if (RTL8723B_SUPPORT == 1) +VOID +odm_S0S1_SWAntDiv_Reset_8723B( + IN PDM_ODM_T pDM_Odm +) +{ + pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; + pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; + + pDM_FatTable->bBecomeLinked =FALSE; + pDM_SWAT_Table->try_flag = 0xff; + pDM_SWAT_Table->Double_chk_flag = 0; + pDM_SWAT_Table->TrafficLoad = TRAFFIC_LOW; + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_S0S1_SWAntDiv_Reset_8723B(): pDM_FatTable->bBecomeLinked = %d\n", pDM_FatTable->bBecomeLinked)); +} + +VOID +ODM_UpdateRxIdleAnt_8723B( + IN PDM_ODM_T pDM_Odm, + IN u1Byte Ant, + IN u4Byte DefaultAnt, + IN u4Byte OptionalAnt +) +{ + pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; + PADAPTER pAdapter = pDM_Odm->Adapter; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + u1Byte count=0; + u1Byte u1Temp; + u1Byte H2C_Parameter; + u4Byte value32; + + if(!pDM_Odm->bLinked) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ Update Rx-Idle-Ant ] 8723B: Fail to set RX antenna due to no link\n")); + return; + } + + // Send H2C command to FW + // Enable wifi calibration + H2C_Parameter = TRUE; + ODM_FillH2CCmd(pDM_Odm, ODM_H2C_WIFI_CALIBRATION, 1, &H2C_Parameter); + + // Check if H2C command sucess or not (0x1e6) + u1Temp = ODM_Read1Byte(pDM_Odm, 0x1e6); + while((u1Temp != 0x1) && (count < 100)) + { + ODM_delay_us(10); + u1Temp = ODM_Read1Byte(pDM_Odm, 0x1e6); + count++; + } + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ Update Rx-Idle-Ant ] 8723B: H2C command status = %d, count = %d\n", u1Temp, count)); + + if(u1Temp == 0x1) + { + // Check if BT is doing IQK (0x1e7) + count = 0; + u1Temp = ODM_Read1Byte(pDM_Odm, 0x1e7); + while((!(u1Temp & BIT0)) && (count < 100)) + { + ODM_delay_us(50); + u1Temp = ODM_Read1Byte(pDM_Odm, 0x1e7); + count++; + } + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ Update Rx-Idle-Ant ] 8723B: BT IQK status = %d, count = %d\n", u1Temp, count)); + + if(u1Temp & BIT0) + { + ODM_SetBBReg(pDM_Odm, 0x948 , BIT6, 0x1); + ODM_SetBBReg(pDM_Odm, 0x948 , BIT9, DefaultAnt); + ODM_SetBBReg(pDM_Odm, 0x864 , BIT5|BIT4|BIT3, DefaultAnt); //Default RX + ODM_SetBBReg(pDM_Odm, 0x864 , BIT8|BIT7|BIT6, OptionalAnt); //Optional RX + ODM_SetBBReg(pDM_Odm, 0x860, BIT14|BIT13|BIT12, DefaultAnt); //Default TX + pDM_FatTable->RxIdleAnt = Ant; + + // Set TX AGC by S0/S1 + // Need to consider Linux driver +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + pAdapter->HalFunc.SetTxPowerLevelHandler(pAdapter, pHalData->CurrentChannel); +#elif(DM_ODM_SUPPORT_TYPE == ODM_CE) + rtw_hal_set_tx_power_level(pAdapter, pHalData->CurrentChannel); +#endif + + // Set IQC by S0/S1 + ODM_SetIQCbyRFpath(pDM_Odm,DefaultAnt); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ Update Rx-Idle-Ant ] 8723B: Sucess to set RX antenna\n")); + } + else + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ Update Rx-Idle-Ant ] 8723B: Fail to set RX antenna due to BT IQK\n")); + } + else + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ Update Rx-Idle-Ant ] 8723B: Fail to set RX antenna due to H2C command fail\n")); + + // Send H2C command to FW + // Disable wifi calibration + H2C_Parameter = FALSE; + ODM_FillH2CCmd(pDM_Odm, ODM_H2C_WIFI_CALIBRATION, 1, &H2C_Parameter); + +} + +#endif //#if (RTL8723B_SUPPORT == 1) #if (RTL8821A_SUPPORT == 1) VOID @@ -583,7 +789,8 @@ odm_TRX_HWAntDiv_Init_8821A( ODM_SetBBReg(pDM_Odm, 0xA74 , BIT7, 1); //patch for clk from 88M to 80M ODM_SetBBReg(pDM_Odm, 0xA0C , BIT4, 1); //do 64 samples - ODM_SetBBReg(pDM_Odm, 0x800 , BIT25, 0); //CCK AntDiv function block enable + ODM_SetBBReg(pDM_Odm, 0x800 , BIT25, 0); //ANTSEL_CCK sent to the smart_antenna circuit + ODM_SetBBReg(pDM_Odm, 0xA00 , BIT15, 0); //CCK AntDiv function block enable //BT Coexistence ODM_SetBBReg(pDM_Odm, 0xCAC , BIT9, 1); //keep antsel_map when GNT_BT = 1 @@ -596,9 +803,7 @@ odm_TRX_HWAntDiv_Init_8821A( //response TX ant by RX ant ODM_SetMACReg(pDM_Odm, 0x668 , BIT3, 1); - //2 [--For HW Bug Setting] - if(pDM_Odm->AntType == ODM_AUTO_ANT) - ODM_SetBBReg(pDM_Odm, 0x800 , BIT25, 0); //CCK AntDiv function block enable + } @@ -656,7 +861,8 @@ odm_S0S1_SWAntDiv_Init_8821A( ODM_SetBBReg(pDM_Odm, 0xA74 , BIT7, 1); //patch for clk from 88M to 80M ODM_SetBBReg(pDM_Odm, 0xA0C , BIT4, 1); //do 64 samples - ODM_SetBBReg(pDM_Odm, 0x800 , BIT25, 0); //CCK AntDiv function block enable + ODM_SetBBReg(pDM_Odm, 0x800 , BIT25, 0); //ANTSEL_CCK sent to the smart_antenna circuit + ODM_SetBBReg(pDM_Odm, 0xA00 , BIT15, 0); //CCK AntDiv function block enable //BT Coexistence ODM_SetBBReg(pDM_Odm, 0xCAC , BIT9, 1); //keep antsel_map when GNT_BT = 1 @@ -669,10 +875,6 @@ odm_S0S1_SWAntDiv_Init_8821A( //response TX ant by RX ant ODM_SetMACReg(pDM_Odm, 0x668 , BIT3, 1); - //2 [--For HW Bug Setting] - if(pDM_Odm->AntType == ODM_AUTO_ANT) - ODM_SetBBReg(pDM_Odm, 0x800 , BIT25, 0); //CCK AntDiv function block enable - ODM_SetBBReg(pDM_Odm, 0x900 , BIT18, 0); @@ -818,16 +1020,16 @@ odm_HW_AntDiv( { ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[Linked !!!]\n")); odm_AntDiv_on_off(pDM_Odm, ANTDIV_ON); - if(pDM_Odm->SupportICType == ODM_RTL8821 ) - ODM_SetBBReg(pDM_Odm, 0x800 , BIT25, 0); //CCK AntDiv function disable + //if(pDM_Odm->SupportICType == ODM_RTL8821 ) + //ODM_SetBBReg(pDM_Odm, 0x800 , BIT25, 0); //CCK AntDiv function disable - #if(DM_ODM_SUPPORT_TYPE == ODM_AP) - else if(pDM_Odm->SupportICType == ODM_RTL8881 ) - ODM_SetBBReg(pDM_Odm, 0x800 , BIT25, 0); //CCK AntDiv function disable - #endif + //#if(DM_ODM_SUPPORT_TYPE == ODM_AP) + //else if(pDM_Odm->SupportICType == ODM_RTL8881 ) + // ODM_SetBBReg(pDM_Odm, 0x800 , BIT25, 0); //CCK AntDiv function disable + //#endif - else if(pDM_Odm->SupportICType == ODM_RTL8723B ||pDM_Odm->SupportICType == ODM_RTL8812) - ODM_SetBBReg(pDM_Odm, 0xA00 , BIT15, 0); //CCK AntDiv function disable + //else if(pDM_Odm->SupportICType == ODM_RTL8723B ||pDM_Odm->SupportICType == ODM_RTL8812) + //ODM_SetBBReg(pDM_Odm, 0xA00 , BIT15, 0); //CCK AntDiv function disable pDM_FatTable->bBecomeLinked = pDM_Odm->bLinked; @@ -863,10 +1065,10 @@ odm_HW_AntDiv( TargetAnt=AUX_ANT; } */ - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("*** SupportICType=[%u] \n",pDM_Odm->SupportICType)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("*** Main_Cnt = (( %u )) , Main_RSSI= (( %u )) \n", pDM_FatTable->MainAnt_Cnt[i], Main_RSSI)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("*** Aux_Cnt = (( %u )) , Aux_RSSI = (( %u )) \n", pDM_FatTable->AuxAnt_Cnt[i] , Aux_RSSI )); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("*** MAC ID:[ %u ] , TargetAnt = (( %s )) \n", i ,( TargetAnt ==MAIN_ANT)?"MAIN_ANT":"AUX_ANT")); + //ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("*** SupportICType=[%lu] \n",pDM_Odm->SupportICType)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("*** Main_Cnt = (( %d )) , Main_RSSI= (( %d )) \n", pDM_FatTable->MainAnt_Cnt[i], Main_RSSI)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("*** Aux_Cnt = (( %d )) , Aux_RSSI = (( %d )) \n", pDM_FatTable->AuxAnt_Cnt[i] , Aux_RSSI )); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("*** MAC ID:[ %d ] , TargetAnt = (( %s )) \n", i ,( TargetAnt ==MAIN_ANT)?"MAIN_ANT":"AUX_ANT")); ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("*** Phy_AntSel_A=[ %d, %d, %d] \n",((pDM_Odm->DM_FatTable.antsel_rx_keep_0)&BIT2)>>2, ((pDM_Odm->DM_FatTable.antsel_rx_keep_0)&BIT1) >>1, ((pDM_Odm->DM_FatTable.antsel_rx_keep_0)&BIT0))); @@ -934,7 +1136,10 @@ odm_HW_AntDiv( panic_printk("*** RxIdleAnt = (( %s )) \n \n", ( RxIdleAnt ==MAIN_ANT)?"MAIN_ANT":"AUX_ANT"); #endif - pDM_DigTable->AntDiv_RSSI_max = AntDivMaxRSSI; + if(AntDivMaxRSSI == 0) + pDM_DigTable->AntDiv_RSSI_max = pDM_Odm->RSSI_Min; + else + pDM_DigTable->AntDiv_RSSI_max = AntDivMaxRSSI; pDM_DigTable->RSSI_max = MaxRSSI; } @@ -950,11 +1155,11 @@ odm_S0S1_SwAntDiv( u4Byte i,MinMaxRSSI=0xFF, LocalMaxRSSI,LocalMinRSSI; u4Byte Main_RSSI, Aux_RSSI; u1Byte reset_period=10, SWAntDiv_threshold=35; - u1Byte HighTraffic_TrainTime_U=0x32,HighTraffic_TrainTime_L,Train_time_temp; - u1Byte LowTraffic_TrainTime_U=200,LowTraffic_TrainTime_L; - u1Byte RxIdleAnt, TargetAnt, nextAnt; + u1Byte HighTraffic_TrainTime_U=0x32,HighTraffic_TrainTime_L=0,Train_time_temp; + u1Byte LowTraffic_TrainTime_U=200,LowTraffic_TrainTime_L=0; pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; + u1Byte RxIdleAnt = pDM_SWAT_Table->PreAntenna, TargetAnt, nextAnt=0; PSTA_INFO_T pEntry=NULL; //static u1Byte reset_idx; u4Byte value32; @@ -985,18 +1190,17 @@ odm_S0S1_SwAntDiv( value32 = ODM_GetBBReg(pDM_Odm, 0x864, BIT5|BIT4|BIT3); if (value32==0x0) - ODM_UpdateRxIdleAnt(pDM_Odm, MAIN_ANT); + ODM_UpdateRxIdleAnt_8723B(pDM_Odm, MAIN_ANT, ANT1_2G, ANT2_2G); else if (value32==0x1) - ODM_UpdateRxIdleAnt(pDM_Odm, AUX_ANT); + ODM_UpdateRxIdleAnt_8723B(pDM_Odm, AUX_ANT, ANT2_2G, ANT1_2G); - ODM_SetBBReg(pDM_Odm, 0x948 , BIT6, 0x1); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Set REG 948[6]=0x1 , Set REG 864[5:3]=0x%x \n",value32 )); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("8723B: First link! Force antenna to %s\n",(value32 == 0x0?"MAIN":"AUX") )); } pDM_SWAT_Table->lastTxOkCnt = 0; pDM_SWAT_Table->lastRxOkCnt =0; - TxCntOffset = Adapter->TxStats.NumTxBytesUnicast; - RxCntOffset = Adapter->RxStats.NumRxBytesUnicast; + TxCntOffset = *(pDM_Odm->pNumTxBytesUnicast); + RxCntOffset = *(pDM_Odm->pNumRxBytesUnicast); pDM_FatTable->bBecomeLinked = pDM_Odm->bLinked; } @@ -1032,10 +1236,10 @@ odm_S0S1_SwAntDiv( { //---trafic decision--- - curTxOkCnt = Adapter->TxStats.NumTxBytesUnicast - pDM_SWAT_Table->lastTxOkCnt - TxCntOffset; - curRxOkCnt =Adapter->RxStats.NumRxBytesUnicast - pDM_SWAT_Table->lastRxOkCnt - RxCntOffset; - pDM_SWAT_Table->lastTxOkCnt = Adapter->TxStats.NumTxBytesUnicast; - pDM_SWAT_Table->lastRxOkCnt = Adapter->RxStats.NumRxBytesUnicast; + curTxOkCnt = *(pDM_Odm->pNumTxBytesUnicast) - pDM_SWAT_Table->lastTxOkCnt - TxCntOffset; + curRxOkCnt = *(pDM_Odm->pNumRxBytesUnicast) - pDM_SWAT_Table->lastRxOkCnt - RxCntOffset; + pDM_SWAT_Table->lastTxOkCnt = *(pDM_Odm->pNumTxBytesUnicast); + pDM_SWAT_Table->lastRxOkCnt = *(pDM_Odm->pNumRxBytesUnicast); if (curTxOkCnt > 1875000 || curRxOkCnt > 1875000)//if(PlatformDivision64(curTxOkCnt+curRxOkCnt, 2) > 1875000) ( 1.875M * 8bit ) / 2= 7.5M bits /sec ) { @@ -1169,8 +1373,8 @@ odm_S0S1_SwAntDiv( else pDM_SWAT_Table->RSSI_Trying = 1; + odm_S0S1_SwAntDivByCtrlFrame(pDM_Odm, SWAW_STEP_PEAK); ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("[set try_flag=1] Normal State: Begin Trying!! \n")); - } else if(pDM_SWAT_Table->try_flag == 1 && pDM_SWAT_Table->Double_chk_flag== 0) @@ -1182,6 +1386,8 @@ odm_S0S1_SwAntDiv( //1 Decision State if((pDM_SWAT_Table->try_flag == 1)&&(pDM_SWAT_Table->RSSI_Trying == 0) ) { + BOOLEAN bByCtrlFrame = FALSE; + u8Byte pkt_cnt_total = 0; for (i=0; iAuxAnt_Sum[i] = 0; pDM_FatTable->MainAnt_Cnt[i] = 0; pDM_FatTable->AuxAnt_Cnt[i] = 0; - pDM_FatTable->CCK_counter_main=0; - pDM_FatTable->CCK_counter_aux=0; - pDM_FatTable->OFDM_counter_main=0; - pDM_FatTable->OFDM_counter_aux=0; - } + + if(pDM_SWAT_Table->bSWAntDivByCtrlFrame) + { + odm_S0S1_SwAntDivByCtrlFrame(pDM_Odm, SWAW_STEP_DETERMINE); + bByCtrlFrame = TRUE; + } + + pkt_cnt_total = pDM_FatTable->CCK_counter_main + pDM_FatTable->CCK_counter_aux + + pDM_FatTable->OFDM_counter_main + pDM_FatTable->OFDM_counter_aux; + pDM_FatTable->CCK_counter_main=0; + pDM_FatTable->CCK_counter_aux=0; + pDM_FatTable->OFDM_counter_main=0; + pDM_FatTable->OFDM_counter_aux=0; + ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("Control frame packet counter = %d, Data frame packet counter = %llu\n", + pDM_SWAT_Table->PktCnt_SWAntDivByCtrlFrame, pkt_cnt_total)); + + if(MinMaxRSSI == 0xff || ((pkt_cnt_total < (pDM_SWAT_Table->PktCnt_SWAntDivByCtrlFrame >> 1)) && pDM_Odm->PhyDbgInfo.NumQryBeaconPkt < 2)) + { + MinMaxRSSI = 0; + ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("Check RSSI of control frame because MinMaxRSSI == 0xff\n")); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("bByCtrlFrame = %d\n", bByCtrlFrame)); + + if(bByCtrlFrame) + { + Main_RSSI = (pDM_FatTable->MainAnt_CtrlFrame_Cnt!=0)?(pDM_FatTable->MainAnt_CtrlFrame_Sum/pDM_FatTable->MainAnt_CtrlFrame_Cnt):0; + Aux_RSSI = (pDM_FatTable->AuxAnt_CtrlFrame_Cnt!=0)?(pDM_FatTable->AuxAnt_CtrlFrame_Sum/pDM_FatTable->AuxAnt_CtrlFrame_Cnt):0; + + if(pDM_FatTable->MainAnt_CtrlFrame_Cnt<=1 && pDM_FatTable->CCK_CtrlFrame_Cnt_main>=1) + Main_RSSI=0; + + if(pDM_FatTable->AuxAnt_CtrlFrame_Cnt<=1 && pDM_FatTable->CCK_CtrlFrame_Cnt_aux>=1) + Aux_RSSI=0; + + if (Main_RSSI != 0 || Aux_RSSI != 0) + { + RxIdleAnt = (Main_RSSI==Aux_RSSI)?pDM_SWAT_Table->PreAntenna:((Main_RSSI>=Aux_RSSI)?MAIN_ANT:AUX_ANT); + LocalMaxRSSI = (Main_RSSI>=Aux_RSSI) ? Main_RSSI : Aux_RSSI; + LocalMinRSSI = (Main_RSSI>=Aux_RSSI) ? Aux_RSSI : Main_RSSI; + if((LocalMaxRSSI-LocalMinRSSI)>8) + pDM_SWAT_Table->Train_time_flag=3; + else if((LocalMaxRSSI-LocalMinRSSI)>5) + pDM_SWAT_Table->Train_time_flag=2; + else if((LocalMaxRSSI-LocalMinRSSI)>2) + pDM_SWAT_Table->Train_time_flag=1; + else + pDM_SWAT_Table->Train_time_flag=0; + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("Control frame: Main_RSSI = %d, Aux_RSSI = %d\n", Main_RSSI, Aux_RSSI)); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("RxIdleAnt decided by control frame = %s\n", (RxIdleAnt == MAIN_ANT?"MAIN":"AUX"))); + } + } + } pDM_FatTable->MinMaxRSSI=MinMaxRSSI; pDM_SWAT_Table->try_flag = 0; @@ -1286,6 +1539,9 @@ odm_S0S1_SwAntDiv( } else { + if(pDM_FatTable->MinMaxRSSI < SWAntDiv_threshold) + pDM_SWAT_Table->reset_idx=reset_period; + pDM_SWAT_Table->PreAntenna =RxIdleAnt; ODM_UpdateRxIdleAnt(pDM_Odm, RxIdleAnt ); ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("[reset try_flag = 0] Training accomplished !!!] \n\n\n")); @@ -1348,19 +1604,149 @@ ODM_SW_AntDiv_WorkitemCallback( //DbgPrint("SW_antdiv_Workitem_Callback"); odm_S0S1_SwAntDiv(&pHalData->DM_OutSrc, SWAW_STEP_DETERMINE); } -#endif //#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) -#if (DM_ODM_SUPPORT_TYPE == ODM_CE) +#elif (DM_ODM_SUPPORT_TYPE == ODM_CE) + +VOID +ODM_SW_AntDiv_WorkitemCallback( + IN PVOID pContext + ) +{ + PADAPTER pAdapter = (PADAPTER)pContext; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + + //DbgPrint("SW_antdiv_Workitem_Callback"); + odm_S0S1_SwAntDiv(&pHalData->odmpriv, SWAW_STEP_DETERMINE); +} + VOID ODM_SW_AntDiv_Callback(void *FunctionContext) { PDM_ODM_T pDM_Odm= (PDM_ODM_T)FunctionContext; PADAPTER padapter = pDM_Odm->Adapter; + + if(padapter->net_closed == _TRUE) return; - //odm_S0S1_SwAntDiv(pDM_Odm, SWAW_STEP_DETERMINE); + +#if 0 // Can't do I/O in timer callback + odm_S0S1_SwAntDiv(pDM_Odm, SWAW_STEP_DETERMINE); +#else + rtw_run_in_thread_cmd(padapter, ODM_SW_AntDiv_WorkitemCallback, padapter); +#endif } -#endif //#if (DM_ODM_SUPPORT_TYPE == ODM_CE) + +#endif + + +#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) +VOID +odm_S0S1_SwAntDivByCtrlFrame( + IN PDM_ODM_T pDM_Odm, + IN u1Byte Step + ) +{ + pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; + pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; + + switch(Step) + { + case SWAW_STEP_PEAK: + pDM_SWAT_Table->PktCnt_SWAntDivByCtrlFrame = 0; + pDM_SWAT_Table->bSWAntDivByCtrlFrame = TRUE; + pDM_FatTable->MainAnt_CtrlFrame_Cnt = 0; + pDM_FatTable->AuxAnt_CtrlFrame_Cnt = 0; + pDM_FatTable->MainAnt_CtrlFrame_Sum = 0; + pDM_FatTable->AuxAnt_CtrlFrame_Sum = 0; + pDM_FatTable->CCK_CtrlFrame_Cnt_main = 0; + pDM_FatTable->CCK_CtrlFrame_Cnt_aux = 0; + pDM_FatTable->OFDM_CtrlFrame_Cnt_main = 0; + pDM_FatTable->OFDM_CtrlFrame_Cnt_aux = 0; + ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("odm_S0S1_SwAntDivForAPMode(): Start peak and reset counter\n")); + break; + case SWAW_STEP_DETERMINE: + pDM_SWAT_Table->bSWAntDivByCtrlFrame = FALSE; + ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("odm_S0S1_SwAntDivForAPMode(): Stop peak\n")); + break; + default: + pDM_SWAT_Table->bSWAntDivByCtrlFrame = FALSE; + break; + } +} + +VOID +odm_AntselStatisticsOfCtrlFrame( + IN PDM_ODM_T pDM_Odm, + IN u1Byte antsel_tr_mux, + IN u4Byte RxPWDBAll +) +{ + pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; + + if(antsel_tr_mux == ANT1_2G) + { + pDM_FatTable->MainAnt_CtrlFrame_Sum+=RxPWDBAll; + pDM_FatTable->MainAnt_CtrlFrame_Cnt++; + } + else + { + pDM_FatTable->AuxAnt_CtrlFrame_Sum+=RxPWDBAll; + pDM_FatTable->AuxAnt_CtrlFrame_Cnt++; + } +} + +VOID +odm_S0S1_SwAntDivByCtrlFrame_ProcessRSSI( + IN PDM_ODM_T pDM_Odm, + IN PODM_PHY_INFO_T pPhyInfo, + IN PODM_PACKET_INFO_T pPktinfo + ) +{ + pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; + pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; + BOOLEAN isCCKrate; + + if(!(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV)) + return; + + if(pDM_Odm->AntDivType != S0S1_SW_ANTDIV) + return; + + // In try state + if(!pDM_SWAT_Table->bSWAntDivByCtrlFrame) + return; + + // No HW error and match receiver address + if(!pPktinfo->bToSelf) + return; + + pDM_SWAT_Table->PktCnt_SWAntDivByCtrlFrame++; + isCCKrate = ((pPktinfo->DataRate >= DESC_RATE1M ) && (pPktinfo->DataRate <= DESC_RATE11M ))?TRUE :FALSE; + + if(isCCKrate) + { + pDM_FatTable->antsel_rx_keep_0 = (pDM_FatTable->RxIdleAnt == MAIN_ANT) ? ANT1_2G : ANT2_2G; + + if(pDM_FatTable->antsel_rx_keep_0==ANT1_2G) + pDM_FatTable->CCK_CtrlFrame_Cnt_main++; + else + pDM_FatTable->CCK_CtrlFrame_Cnt_aux++; + + odm_AntselStatisticsOfCtrlFrame(pDM_Odm, pDM_FatTable->antsel_rx_keep_0, pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A]); + } + else + { + if(pDM_FatTable->antsel_rx_keep_0==ANT1_2G) + pDM_FatTable->OFDM_CtrlFrame_Cnt_main++; + else + pDM_FatTable->OFDM_CtrlFrame_Cnt_aux++; + + odm_AntselStatisticsOfCtrlFrame(pDM_Odm, pDM_FatTable->antsel_rx_keep_0, pPhyInfo->RxPWDBAll); + } +} +#endif //#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + + #endif //#if (RTL8723B_SUPPORT == 1) @@ -1610,6 +1996,17 @@ odm_FastAntTrainingWorkItemCallback( #endif +VOID +ODM_AntDivReset( + IN PDM_ODM_T pDM_Odm + ) +{ + //2 [--8723B---] +#if (RTL8723B_SUPPORT == 1) + if(pDM_Odm->SupportICType == ODM_RTL8723B) + odm_S0S1_SWAntDiv_Reset_8723B(pDM_Odm); +#endif +} VOID ODM_AntDivInit( @@ -1883,7 +2280,7 @@ ODM_AntDiv( { #if (BEAMFORMING_SUPPORT == 1) - BEAMFORMING_CAP BeamformCap = (pAdapter->MgntInfo.BeamformingInfo.BeamformCap); + BEAMFORMING_CAP BeamformCap = (pDM_Odm->BeamformingInfo.BeamformCap); if( BeamformCap & BEAMFORMEE_CAP ) // BFmee On && Div On -> Div Off { @@ -2017,12 +2414,15 @@ ODM_AntDiv( #if (RTL8821A_SUPPORT == 1) else if(pDM_Odm->SupportICType == ODM_RTL8821) { - if(pDM_Odm->bBtDisabled) //BT disabled + if(!pDM_Odm->bBtEnabled) //BT disabled { if(pDM_Odm->AntDivType == S0S1_SW_ANTDIV) { pDM_Odm->AntDivType=CG_TRX_HW_ANTDIV; - ODM_SetBBReg(pDM_Odm, 0x8D4 , BIT24, 1); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,(" [S0S1_SW_ANTDIV] -> [CG_TRX_HW_ANTDIV]\n")); + //ODM_SetBBReg(pDM_Odm, 0x8D4 , BIT24, 1); + if(pDM_FatTable->bBecomeLinked ==TRUE) + odm_AntDiv_on_off(pDM_Odm, ANTDIV_ON); } } else //BT enabled @@ -2030,7 +2430,9 @@ ODM_AntDiv( if(pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV) { pDM_Odm->AntDivType=S0S1_SW_ANTDIV; - ODM_SetBBReg(pDM_Odm, 0x8D4 , BIT24, 0); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,(" [CG_TRX_HW_ANTDIV] -> [S0S1_SW_ANTDIV]\n")); + //ODM_SetBBReg(pDM_Odm, 0x8D4 , BIT24, 0); + odm_AntDiv_on_off(pDM_Odm, ANTDIV_OFF); } } @@ -2152,7 +2554,6 @@ pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; } else { - if(pDM_FatTable->antsel_rx_keep_0==ANT1_2G) pDM_FatTable->OFDM_counter_main++; else// if(pDM_FatTable->antsel_rx_keep_0==ANT2_2G) @@ -2185,29 +2586,29 @@ ODM_SetTxAntByTxInfo( if(pDM_Odm->SupportICType == ODM_RTL8723B) { -#if (RTL8723B_SUPPORT == 1) + #if (RTL8723B_SUPPORT == 1) SET_TX_DESC_ANTSEL_A_8723B(pDesc, pDM_FatTable->antsel_a[macId]); //ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[8723B] SetTxAntByTxInfo_WIN: MacID=%d, antsel_tr_mux=3'b%d%d%d\n", //macId, pDM_FatTable->antsel_c[macId], pDM_FatTable->antsel_b[macId], pDM_FatTable->antsel_a[macId])); -#endif + #endif } else if(pDM_Odm->SupportICType == ODM_RTL8821) { -#if (RTL8821A_SUPPORT == 1) + #if (RTL8821A_SUPPORT == 1) SET_TX_DESC_ANTSEL_A_8812(pDesc, pDM_FatTable->antsel_a[macId]); //ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[8821A] SetTxAntByTxInfo_WIN: MacID=%d, antsel_tr_mux=3'b%d%d%d\n", //macId, pDM_FatTable->antsel_c[macId], pDM_FatTable->antsel_b[macId], pDM_FatTable->antsel_a[macId])); -#endif + #endif } else if(pDM_Odm->SupportICType == ODM_RTL8188E) { -#if (RTL8188E_SUPPORT == 1) + #if (RTL8188E_SUPPORT == 1) SET_TX_DESC_ANTSEL_A_88E(pDesc, pDM_FatTable->antsel_a[macId]); SET_TX_DESC_ANTSEL_B_88E(pDesc, pDM_FatTable->antsel_b[macId]); SET_TX_DESC_ANTSEL_C_88E(pDesc, pDM_FatTable->antsel_c[macId]); //ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[8188E] SetTxAntByTxInfo_WIN: MacID=%d, antsel_tr_mux=3'b%d%d%d\n", //macId, pDM_FatTable->antsel_c[macId], pDM_FatTable->antsel_b[macId], pDM_FatTable->antsel_a[macId])); -#endif + #endif } else if(pDM_Odm->SupportICType == ODM_RTL8192E) { @@ -2259,10 +2660,190 @@ ODM_SetTxAntByTxInfo( } #endif -#else -VOID ODM_AntDivInit( IN PDM_ODM_T pDM_Odm ){} -VOID ODM_AntDiv( IN PDM_ODM_T pDM_Odm){} +VOID +ODM_AntDiv_Config( + IN PDM_ODM_T pDM_Odm + ) +{ + pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; +#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN)) + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("WIN Config Antenna Diversity\n")); + if(pDM_Odm->SupportICType==ODM_RTL8723B) + { + if((!pDM_Odm->DM_SWAT_Table.ANTA_ON || !pDM_Odm->DM_SWAT_Table.ANTB_ON)) + pDM_Odm->SupportAbility &= ~(ODM_BB_ANT_DIV); + } +#elif (DM_ODM_SUPPORT_TYPE & (ODM_CE)) + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("CE Config Antenna Diversity\n")); + //if(pDM_Odm->SupportICType & ODM_ANTDIV_SUPPORT) + //{ + //pDM_Odm->SupportAbility |= ODM_BB_ANT_DIV; + //} + + if(pDM_Odm->SupportICType==ODM_RTL8723B) + { + pDM_Odm->AntDivType = S0S1_SW_ANTDIV; + } + +#elif (DM_ODM_SUPPORT_TYPE & (ODM_AP)) + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("AP Config Antenna Diversity\n")); + + //2 [ NOT_SUPPORT_ANTDIV ] + #if(defined(CONFIG_NOT_SUPPORT_ANTDIV)) + pDM_Odm->SupportAbility &= ~(ODM_BB_ANT_DIV); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ Disable AntDiv function] : Not Support 2.4G & 5G Antenna Diversity\n")); + + //2 [ 2G&5G_SUPPORT_ANTDIV ] + #elif(defined(CONFIG_2G5G_SUPPORT_ANTDIV)) + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ Enable AntDiv function] : 2.4G & 5G Support Antenna Diversity Simultaneously \n")); + pDM_FatTable->AntDiv_2G_5G = (ODM_ANTDIV_2G|ODM_ANTDIV_5G); + + if(pDM_Odm->SupportICType & ODM_ANTDIV_SUPPORT) + pDM_Odm->SupportAbility |= ODM_BB_ANT_DIV; + if(*pDM_Odm->pBandType == ODM_BAND_5G ) + { + #if ( defined(CONFIG_5G_CGCS_RX_DIVERSITY) ) + pDM_Odm->AntDivType = CGCS_RX_HW_ANTDIV; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 5G] : AntDiv Type = CGCS_RX_HW_ANTDIV\n")); + panic_printk("[ 5G] : AntDiv Type = CGCS_RX_HW_ANTDIV\n"); + #elif( defined(CONFIG_5G_CG_TRX_DIVERSITY) ) + pDM_Odm->AntDivType = CG_TRX_HW_ANTDIV; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 5G] : AntDiv Type = CG_TRX_HW_ANTDIV\n")); + panic_printk("[ 5G] : AntDiv Type = CG_TRX_HW_ANTDIV\n"); + #elif( defined(CONFIG_5G_CG_SMART_ANT_DIVERSITY) ) + pDM_Odm->AntDivType = CG_TRX_SMART_ANTDIV; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 5G] : AntDiv Type = CG_SMART_ANTDIV\n")); + #elif( defined(CONFIG_5G_S0S1_SW_ANT_DIVERSITY) ) + pDM_Odm->AntDivType = S0S1_SW_ANTDIV; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 5G] : AntDiv Type = S0S1_SW_ANTDIV\n")); + #endif + } + else if(*pDM_Odm->pBandType == ODM_BAND_2_4G ) + { + #if ( defined(CONFIG_2G_CGCS_RX_DIVERSITY) ) + pDM_Odm->AntDivType = CGCS_RX_HW_ANTDIV; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 2.4G] : AntDiv Type = CGCS_RX_HW_ANTDIV\n")); + #elif( defined(CONFIG_2G_CG_TRX_DIVERSITY) ) + pDM_Odm->AntDivType = CG_TRX_HW_ANTDIV; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 2.4G] : AntDiv Type = CG_TRX_HW_ANTDIV\n")); + #elif( defined(CONFIG_2G_CG_SMART_ANT_DIVERSITY) ) + pDM_Odm->AntDivType = CG_TRX_SMART_ANTDIV; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 2.4G] : AntDiv Type = CG_SMART_ANTDIV\n")); + #elif( defined(CONFIG_2G_S0S1_SW_ANT_DIVERSITY) ) + pDM_Odm->AntDivType = S0S1_SW_ANTDIV; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 2.4G] : AntDiv Type = S0S1_SW_ANTDIV\n")); + #endif + } + + //2 [ 5G_SUPPORT_ANTDIV ] + #elif(defined(CONFIG_5G_SUPPORT_ANTDIV)) + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ Enable AntDiv function] : Only 5G Support Antenna Diversity\n")); + panic_printk("[ Enable AntDiv function] : Only 5G Support Antenna Diversity\n"); + pDM_FatTable->AntDiv_2G_5G = (ODM_ANTDIV_5G); + if(*pDM_Odm->pBandType == ODM_BAND_5G ) + { + if(pDM_Odm->SupportICType & ODM_ANTDIV_5G_SUPPORT_IC) + pDM_Odm->SupportAbility |= ODM_BB_ANT_DIV; + #if ( defined(CONFIG_5G_CGCS_RX_DIVERSITY) ) + pDM_Odm->AntDivType = CGCS_RX_HW_ANTDIV; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 5G] : AntDiv Type = CGCS_RX_HW_ANTDIV\n")); + panic_printk("[ 5G] : AntDiv Type = CGCS_RX_HW_ANTDIV\n"); + #elif( defined(CONFIG_5G_CG_TRX_DIVERSITY) ) + pDM_Odm->AntDivType = CG_TRX_HW_ANTDIV; + panic_printk("[ 5G] : AntDiv Type = CG_TRX_HW_ANTDIV\n"); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 5G] : AntDiv Type = CG_TRX_HW_ANTDIV\n")); + #elif( defined(CONFIG_5G_CG_SMART_ANT_DIVERSITY) ) + pDM_Odm->AntDivType = CG_TRX_SMART_ANTDIV; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 5G] : AntDiv Type = CG_SMART_ANTDIV\n")); + #elif( defined(CONFIG_5G_S0S1_SW_ANT_DIVERSITY) ) + pDM_Odm->AntDivType = S0S1_SW_ANTDIV; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 5G] : AntDiv Type = S0S1_SW_ANTDIV\n")); + #endif + } + else if(*pDM_Odm->pBandType == ODM_BAND_2_4G ) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("Not Support 2G AntDivType\n")); + pDM_Odm->SupportAbility &= ~(ODM_BB_ANT_DIV); + } + + //2 [ 2G_SUPPORT_ANTDIV ] + #elif(defined(CONFIG_2G_SUPPORT_ANTDIV)) + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ Enable AntDiv function] : Only 2.4G Support Antenna Diversity\n")); + pDM_FatTable->AntDiv_2G_5G = (ODM_ANTDIV_2G); + if(*pDM_Odm->pBandType == ODM_BAND_2_4G ) + { + if(pDM_Odm->SupportICType & ODM_ANTDIV_2G_SUPPORT_IC) + pDM_Odm->SupportAbility |= ODM_BB_ANT_DIV; + #if ( defined(CONFIG_2G_CGCS_RX_DIVERSITY) ) + pDM_Odm->AntDivType = CGCS_RX_HW_ANTDIV; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 2.4G] : AntDiv Type = CGCS_RX_HW_ANTDIV\n")); + #elif( defined(CONFIG_2G_CG_TRX_DIVERSITY) ) + pDM_Odm->AntDivType = CG_TRX_HW_ANTDIV; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 2.4G] : AntDiv Type = CG_TRX_HW_ANTDIV\n")); + #elif( defined(CONFIG_2G_CG_SMART_ANT_DIVERSITY) ) + pDM_Odm->AntDivType = CG_TRX_SMART_ANTDIV; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 2.4G] : AntDiv Type = CG_SMART_ANTDIV\n")); + #elif( defined(CONFIG_2G_S0S1_SW_ANT_DIVERSITY) ) + pDM_Odm->AntDivType = S0S1_SW_ANTDIV; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 2.4G] : AntDiv Type = S0S1_SW_ANTDIV\n")); + #endif + } + else if(*pDM_Odm->pBandType == ODM_BAND_5G ) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("Not Support 5G AntDivType\n")); + pDM_Odm->SupportAbility &= ~(ODM_BB_ANT_DIV); + } + #endif +#endif + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SupportAbility = (( %x ))\n", pDM_Odm->SupportAbility )); + +} + + +VOID +ODM_AntDivTimers( + IN PDM_ODM_T pDM_Odm, + IN u1Byte state + ) +{ + if(state==INIT_ANTDIV_TIMMER) + { + #if (RTL8723B_SUPPORT == 1)||(RTL8821A_SUPPORT == 1) + ODM_InitializeTimer(pDM_Odm,&pDM_Odm->DM_SWAT_Table.SwAntennaSwitchTimer_8723B, + (RT_TIMER_CALL_BACK)ODM_SW_AntDiv_Callback, NULL, "SwAntennaSwitchTimer_8723B"); + #elif (RTL8188E_SUPPORT == 1) + #if (DM_ODM_SUPPORT_TYPE == ODM_AP) + ODM_InitializeTimer(pDM_Odm,&pDM_Odm->FastAntTrainingTimer, + (RT_TIMER_CALL_BACK)odm_FastAntTrainingCallback, NULL, "FastAntTrainingTimer"); + #endif + #endif + } + else if(state==CANCEL_ANTDIV_TIMMER) + { + #if (RTL8723B_SUPPORT == 1)||(RTL8821A_SUPPORT == 1) + ODM_CancelTimer(pDM_Odm,&pDM_Odm->DM_SWAT_Table.SwAntennaSwitchTimer_8723B); + #elif (RTL8188E_SUPPORT == 1) + #if (DM_ODM_SUPPORT_TYPE == ODM_AP) + ODM_CancelTimer(pDM_Odm,&pDM_Odm->FastAntTrainingTimer); + #endif + #endif + } + else if(state==RELEASE_ANTDIV_TIMMER) + { + #if (RTL8723B_SUPPORT == 1)||(RTL8821A_SUPPORT == 1) + ODM_ReleaseTimer(pDM_Odm,&pDM_Odm->DM_SWAT_Table.SwAntennaSwitchTimer_8723B); + #elif (RTL8188E_SUPPORT == 1) + #if (DM_ODM_SUPPORT_TYPE == ODM_AP) + ODM_ReleaseTimer(pDM_Odm,&pDM_Odm->FastAntTrainingTimer); + #endif + #endif + } + +} #endif //#if (defined(CONFIG_HW_ANTENNA_DIVERSITY)) diff --git a/hal/OUTSRC/odm_AntDiv.h b/hal/OUTSRC/odm_AntDiv.h index 832ee6b..168161b 100644 --- a/hal/OUTSRC/odm_AntDiv.h +++ b/hal/OUTSRC/odm_AntDiv.h @@ -42,6 +42,8 @@ #define ODM_AC_ANTDIV_SUPPORT (ODM_RTL8821|ODM_RTL8881A|ODM_RTL8812) #define ODM_SMART_ANT_SUPPORT (ODM_RTL8188E|ODM_RTL8192E) +#define ODM_OLD_IC_ANTDIV_SUPPORT (ODM_RTL8723A|ODM_RTL8192C|ODM_RTL8192D) + #define ODM_ANTDIV_2G_SUPPORT_IC (ODM_RTL8188E|ODM_RTL8192E|ODM_RTL8723B|ODM_RTL8881A) #define ODM_ANTDIV_5G_SUPPORT_IC (ODM_RTL8821|ODM_RTL8881A|ODM_RTL8812) #define ODM_ANTDIV_2G BIT0 @@ -50,15 +52,24 @@ #define ANTDIV_ON 1 #define ANTDIV_OFF 0 -VOID -ODM_AntDivInit( - IN PDM_ODM_T pDM_Odm -); +#define INIT_ANTDIV_TIMMER 0 +#define CANCEL_ANTDIV_TIMMER 1 +#define RELEASE_ANTDIV_TIMMER 2 VOID -ODM_AntDiv( - IN PDM_ODM_T pDM_Odm -); +ODM_StopAntennaSwitchDm( + IN PDM_ODM_T pDM_Odm + ); +VOID +ODM_SetAntConfig( + IN PDM_ODM_T pDM_Odm, + IN u1Byte antSetting // 0=A, 1=B, 2=C, .... + ); + + + +#define SwAntDivRestAfterLink ODM_SwAntDivRestAfterLink +VOID ODM_SwAntDivRestAfterLink( IN PDM_ODM_T pDM_Odm); #if (defined(CONFIG_HW_ANTENNA_DIVERSITY)) @@ -68,6 +79,14 @@ ODM_UpdateRxIdleAnt( IN u1Byte Ant ); +VOID +odm_AntselStatistics( + IN PDM_ODM_T pDM_Odm, + IN u1Byte antsel_tr_mux, + IN u4Byte MacId, + IN u4Byte RxPWDBAll +); + #if (RTL8723B_SUPPORT == 1)||(RTL8821A_SUPPORT == 1) #if (DM_ODM_SUPPORT_TYPE == ODM_WIN) VOID @@ -77,13 +96,39 @@ ODM_SW_AntDiv_Callback( VOID ODM_SW_AntDiv_WorkitemCallback( - IN PVOID pContext -); -#endif //#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) -#if (DM_ODM_SUPPORT_TYPE == ODM_CE) + IN PVOID pContext + ); + + +#elif (DM_ODM_SUPPORT_TYPE == ODM_CE) + VOID ODM_SW_AntDiv_Callback(void *FunctionContext); -#endif //#if (DM_ODM_SUPPORT_TYPE == ODM_CE) + +#endif + +#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) +VOID +odm_S0S1_SwAntDivByCtrlFrame( + IN PDM_ODM_T pDM_Odm, + IN u1Byte Step + ); + +VOID +odm_AntselStatisticsOfCtrlFrame( + IN PDM_ODM_T pDM_Odm, + IN u1Byte antsel_tr_mux, + IN u4Byte RxPWDBAll +); + +VOID +odm_S0S1_SwAntDivByCtrlFrame_ProcessRSSI( + IN PDM_ODM_T pDM_Odm, + IN PODM_PHY_INFO_T pPhyInfo, + IN PODM_PACKET_INFO_T pPktinfo + ); + +#endif //#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) #endif #if(RTL8188E_SUPPORT == 1 || RTL8192E_SUPPORT == 1) @@ -105,6 +150,21 @@ odm_FastAntTrainingWorkItemCallback( #endif #endif +VOID +ODM_AntDivInit( + IN PDM_ODM_T pDM_Odm +); + +VOID +ODM_AntDivReset( + IN PDM_ODM_T pDM_Odm +); + +VOID +ODM_AntDiv( + IN PDM_ODM_T pDM_Odm +); + VOID ODM_Process_RSSIForAntDiv( IN OUT PDM_ODM_T pDM_Odm, @@ -132,5 +192,26 @@ ODM_SetTxAntByTxInfo( #endif + +VOID +ODM_AntDiv_Config( + IN PDM_ODM_T pDM_Odm +); + + +VOID +ODM_UpdateRxIdleAnt_8723B( + IN PDM_ODM_T pDM_Odm, + IN u1Byte Ant, + IN u4Byte DefaultAnt, + IN u4Byte OptionalAnt +); + +VOID +ODM_AntDivTimers( + IN PDM_ODM_T pDM_Odm, + IN u1Byte state +); + #endif //#if (defined(CONFIG_HW_ANTENNA_DIVERSITY)) #endif //#ifndef __ODMANTDIV_H__ diff --git a/hal/OUTSRC/odm_CfoTracking.c b/hal/OUTSRC/odm_CfoTracking.c new file mode 100644 index 0000000..4f724e9 --- /dev/null +++ b/hal/OUTSRC/odm_CfoTracking.c @@ -0,0 +1,357 @@ +/****************************************************************************** + * + * 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" + +VOID +odm_SetCrystalCap( + IN PVOID pDM_VOID, + IN u1Byte CrystalCap +) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + PCFO_TRACKING pCfoTrack = &pDM_Odm->DM_CfoTrack; + BOOLEAN bEEPROMCheck; +#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) + PADAPTER Adapter = pDM_Odm->Adapter; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + + bEEPROMCheck = (pHalData->EEPROMVersion >= 0x01)?TRUE:FALSE; +#else + bEEPROMCheck = TRUE; +#endif + + if(pCfoTrack->CrystalCap == CrystalCap) + return; + + pCfoTrack->CrystalCap = CrystalCap; + + if(pDM_Odm->SupportICType & ODM_RTL8192D) + { + ODM_SetBBReg(pDM_Odm, REG_AFE_XTAL_CTRL, 0x000000F0, CrystalCap & 0x0F); + ODM_SetBBReg(pDM_Odm, REG_AFE_PLL_CTRL, 0xF0000000, ((CrystalCap & 0xF0) >> 4)); + } + else if(pDM_Odm->SupportICType & ODM_RTL8188E) + { + // write 0x24[22:17] = 0x24[16:11] = CrystalCap + CrystalCap = CrystalCap & 0x3F; + ODM_SetBBReg(pDM_Odm, REG_AFE_XTAL_CTRL, 0x007ff800, (CrystalCap | (CrystalCap << 6))); + } + else if(pDM_Odm->SupportICType & ODM_RTL8812) + { + // write 0x2C[30:25] = 0x2C[24:19] = CrystalCap + CrystalCap = CrystalCap & 0x3F; + ODM_SetBBReg(pDM_Odm, REG_MAC_PHY_CTRL, 0x7FF80000, (CrystalCap | (CrystalCap << 6))); + } + else if (((pDM_Odm->SupportICType & ODM_RTL8723A) && bEEPROMCheck) || + (pDM_Odm->SupportICType & ODM_RTL8723B) ||(pDM_Odm->SupportICType & ODM_RTL8192E) || + (pDM_Odm->SupportICType & ODM_RTL8821)) + { + // 0x2C[23:18] = 0x2C[17:12] = CrystalCap + CrystalCap = CrystalCap & 0x3F; + ODM_SetBBReg(pDM_Odm, REG_MAC_PHY_CTRL, 0x00FFF000, (CrystalCap | (CrystalCap << 6))); + } + else if(pDM_Odm->SupportICType & ODM_RTL8821B) + { + // write 0x28[6:1] = 0x24[30:25] = CrystalCap + CrystalCap = CrystalCap & 0x3F; + ODM_SetBBReg(pDM_Odm, REG_AFE_XTAL_CTRL, 0x7E000000, CrystalCap); + ODM_SetBBReg(pDM_Odm, REG_AFE_PLL_CTRL, 0x7E, CrystalCap); + } + else if(pDM_Odm->SupportICType & ODM_RTL8814A) + { + // write 0x2C[26:21] = 0x2C[20:15] = CrystalCap + CrystalCap = CrystalCap & 0x3F; + ODM_SetBBReg(pDM_Odm, REG_MAC_PHY_CTRL, 0x07FF8000, (CrystalCap | (CrystalCap << 6))); + } + else + { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("odm_SetCrystalCap(): Use default setting.\n")); + ODM_SetBBReg(pDM_Odm, REG_MAC_PHY_CTRL, 0xFFF000, (CrystalCap | (CrystalCap << 6))); + } + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("odm_SetCrystalCap(): CrystalCap = 0x%x\n", CrystalCap)); +} + +u1Byte +odm_GetDefaultCrytaltalCap( + IN PVOID pDM_VOID +) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + u1Byte CrystalCap = 0x20; + +#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) + PADAPTER Adapter = pDM_Odm->Adapter; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + + CrystalCap = pHalData->CrystalCap; +#else + prtl8192cd_priv priv = pDM_Odm->priv; + + if(priv->pmib->dot11RFEntry.xcap > 0) + CrystalCap = priv->pmib->dot11RFEntry.xcap; +#endif + + CrystalCap = CrystalCap & 0x3f; + + return CrystalCap; +} + +VOID +odm_SetATCStatus( + IN PVOID pDM_VOID, + IN BOOLEAN ATCStatus +) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + PCFO_TRACKING pCfoTrack = &pDM_Odm->DM_CfoTrack; + + if(pCfoTrack->bATCStatus == ATCStatus) + return; + + ODM_SetBBReg(pDM_Odm, ODM_REG(BB_ATC,pDM_Odm), ODM_BIT(BB_ATC,pDM_Odm), ATCStatus); + pCfoTrack->bATCStatus = ATCStatus; +} + +BOOLEAN +odm_GetATCStatus( + IN PVOID pDM_VOID +) +{ + BOOLEAN ATCStatus; + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + + ATCStatus = (BOOLEAN)ODM_GetBBReg(pDM_Odm, ODM_REG(BB_ATC,pDM_Odm), ODM_BIT(BB_ATC,pDM_Odm)); + return ATCStatus; +} + +VOID +ODM_CfoTrackingReset( + IN PVOID pDM_VOID +) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + PCFO_TRACKING pCfoTrack = &pDM_Odm->DM_CfoTrack; + u1Byte CrystalCap; + + pCfoTrack->DefXCap = odm_GetDefaultCrytaltalCap(pDM_Odm); + pCfoTrack->bAdjust = TRUE; + +#if(DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) + odm_SetCrystalCap(pDM_Odm, pCfoTrack->DefXCap); + odm_SetATCStatus(pDM_Odm, TRUE); +#else + if(pCfoTrack->CrystalCap > pCfoTrack->DefXCap) + { + for(CrystalCap = pCfoTrack->CrystalCap; CrystalCap >= pCfoTrack->DefXCap; CrystalCap--) + odm_SetCrystalCap(pDM_Odm, CrystalCap); + } + else + { + for(CrystalCap = pCfoTrack->CrystalCap; CrystalCap <= pCfoTrack->DefXCap; CrystalCap++) + odm_SetCrystalCap(pDM_Odm, CrystalCap); + } +#endif +} + +VOID +ODM_CfoTrackingInit( + IN PVOID pDM_VOID +) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + PCFO_TRACKING pCfoTrack = &pDM_Odm->DM_CfoTrack; + + pCfoTrack->DefXCap = pCfoTrack->CrystalCap = odm_GetDefaultCrytaltalCap(pDM_Odm); + pCfoTrack->bATCStatus = odm_GetATCStatus(pDM_Odm); + pCfoTrack->bAdjust = TRUE; + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking_init()=========> \n")); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking_init(): bATCStatus = %d, CrystalCap = 0x%x \n",pCfoTrack->bATCStatus, pCfoTrack->DefXCap)); +} + +VOID +ODM_CfoTracking( + IN PVOID pDM_VOID +) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + PCFO_TRACKING pCfoTrack = &pDM_Odm->DM_CfoTrack; + int CFO_kHz_A, CFO_kHz_B, CFO_ave = 0; + int CFO_ave_diff; + int CrystalCap = (int)pCfoTrack->CrystalCap; + u1Byte Adjust_Xtal = 1; + + //4 Support ability + if(!(pDM_Odm->SupportAbility & ODM_BB_CFO_TRACKING)) + { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking(): Return: SupportAbility ODM_BB_CFO_TRACKING is disabled\n")); + return; + } + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking()=========> \n")); + + if(!pDM_Odm->bLinked || !pDM_Odm->bOneEntryOnly) + { + //4 No link or more than one entry + ODM_CfoTrackingReset(pDM_Odm); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking(): Reset: bLinked = %d, bOneEntryOnly = %d\n", + pDM_Odm->bLinked, pDM_Odm->bOneEntryOnly)); + } + else + { + //3 1. CFO Tracking + //4 1.1 No new packet + if(pCfoTrack->packetCount == pCfoTrack->packetCount_pre) + { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking(): packet counter doesn't change\n")); + return; + } + pCfoTrack->packetCount_pre = pCfoTrack->packetCount; + + //4 1.2 Calculate CFO + CFO_kHz_A = (int)(pCfoTrack->CFO_tail[0] * 3125) / 1280; + CFO_kHz_B = (int)(pCfoTrack->CFO_tail[1] * 3125) / 1280; + + if(pDM_Odm->RFType < ODM_2T2R) + CFO_ave = CFO_kHz_A; + else + CFO_ave = (int)(CFO_kHz_A + CFO_kHz_B) >> 1; + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking(): CFO_kHz_A = %dkHz, CFO_kHz_B = %dkHz, CFO_ave = %dkHz\n", + CFO_kHz_A, CFO_kHz_B, CFO_ave)); + + //4 1.3 Avoid abnormal large CFO + CFO_ave_diff = (pCfoTrack->CFO_ave_pre >= CFO_ave)?(pCfoTrack->CFO_ave_pre - CFO_ave):(CFO_ave - pCfoTrack->CFO_ave_pre); + if(CFO_ave_diff > 20 && pCfoTrack->largeCFOHit == 0 && !pCfoTrack->bAdjust) + { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking(): first large CFO hit\n")); + pCfoTrack->largeCFOHit = 1; + return; + } + else + pCfoTrack->largeCFOHit = 0; + pCfoTrack->CFO_ave_pre = CFO_ave; + + //4 1.4 Dynamic Xtal threshold + if(pCfoTrack->bAdjust == FALSE) + { + if(CFO_ave > CFO_TH_XTAL_HIGH || CFO_ave < (-CFO_TH_XTAL_HIGH)) + pCfoTrack->bAdjust = TRUE; + } + else + { + if(CFO_ave < CFO_TH_XTAL_LOW && CFO_ave > (-CFO_TH_XTAL_LOW)) + pCfoTrack->bAdjust = FALSE; + } + +#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) + //4 1.5 BT case: Disable CFO tracking + if(pDM_Odm->bBtEnabled) + { + pCfoTrack->bAdjust = FALSE; + odm_SetCrystalCap(pDM_Odm, pCfoTrack->DefXCap); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking(): Disable CFO tracking for BT!!\n")); + } + + //4 1.6 Big jump + if(pCfoTrack->bAdjust) + { + if(CFO_ave > CFO_TH_XTAL_LOW) + Adjust_Xtal = Adjust_Xtal + ((CFO_ave - CFO_TH_XTAL_LOW) >> 2); + else if(CFO_ave < (-CFO_TH_XTAL_LOW)) + Adjust_Xtal = Adjust_Xtal + ((CFO_TH_XTAL_LOW - CFO_ave) >> 2); + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking(): Crystal cap offset = %d\n", Adjust_Xtal)); + } +#endif + + //4 1.7 Adjust Crystal Cap. + if(pCfoTrack->bAdjust) + { + if(CFO_ave > CFO_TH_XTAL_LOW) + CrystalCap = CrystalCap + Adjust_Xtal; + else if(CFO_ave < (-CFO_TH_XTAL_LOW)) + CrystalCap = CrystalCap - Adjust_Xtal; + + if(CrystalCap > 0x3f) + CrystalCap = 0x3f; + else if (CrystalCap < 0) + CrystalCap = 0; + + odm_SetCrystalCap(pDM_Odm, (u1Byte)CrystalCap); + } + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking(): Crystal cap = 0x%x, Default Crystal cap = 0x%x\n", + pCfoTrack->CrystalCap, pCfoTrack->DefXCap)); + +#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) + if(pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) + return; + + //3 2. Dynamic ATC switch + if(CFO_ave < CFO_TH_ATC && CFO_ave > -CFO_TH_ATC) + { + odm_SetATCStatus(pDM_Odm, FALSE); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking(): Disable ATC!!\n")); + } + else + { + odm_SetATCStatus(pDM_Odm, TRUE); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking(): Enable ATC!!\n")); + } +#endif + } +} + +VOID +ODM_ParsingCFO( + IN PVOID pDM_VOID, + IN PVOID pPktinfo_VOID, + IN s1Byte* pcfotail + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + PODM_PACKET_INFO_T pPktinfo = (PODM_PACKET_INFO_T)pPktinfo_VOID; + PCFO_TRACKING pCfoTrack = &pDM_Odm->DM_CfoTrack; + u1Byte i; + + if(!(pDM_Odm->SupportAbility & ODM_BB_CFO_TRACKING)) + return; + +#if(DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) + if(pPktinfo->bPacketMatchBSSID) +#else + if(pPktinfo->StationID != 0) +#endif + { + //3 Update CFO report for path-A & path-B + // Only paht-A and path-B have CFO tail and short CFO + for(i = ODM_RF_PATH_A; i <= ODM_RF_PATH_B; i++) + { + pCfoTrack->CFO_tail[i] = (int)pcfotail[i]; + } + + //3 Update packet counter + if(pCfoTrack->packetCount == 0xffffffff) + pCfoTrack->packetCount = 0; + else + pCfoTrack->packetCount++; + } +} + diff --git a/hal/OUTSRC/odm_CfoTracking.h b/hal/OUTSRC/odm_CfoTracking.h new file mode 100644 index 0000000..48ead72 --- /dev/null +++ b/hal/OUTSRC/odm_CfoTracking.h @@ -0,0 +1,66 @@ +/****************************************************************************** + * + * 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 __ODMCFOTRACK_H__ +#define __ODMCFOTRACK_H__ + +#define CFO_TH_XTAL_HIGH 20 // kHz +#define CFO_TH_XTAL_LOW 10 // kHz +#define CFO_TH_ATC 80 // kHz + +typedef struct _CFO_TRACKING_ +{ + BOOLEAN bATCStatus; + BOOLEAN largeCFOHit; + BOOLEAN bAdjust; + u1Byte CrystalCap; + u1Byte DefXCap; + int CFO_tail[2]; + int CFO_ave_pre; + u4Byte packetCount; + u4Byte packetCount_pre; + + BOOLEAN bForceXtalCap; + BOOLEAN bReset; +}CFO_TRACKING, *PCFO_TRACKING; + +VOID +ODM_CfoTrackingReset( + IN PVOID pDM_VOID +); + +VOID +ODM_CfoTrackingInit( + IN PVOID pDM_VOID +); + +VOID +ODM_CfoTracking( + IN PVOID pDM_VOID +); + +VOID +ODM_ParsingCFO( + IN PVOID pDM_VOID, + IN PVOID pPktinfo_VOID, + IN s1Byte* pcfotail +); + +#endif \ No newline at end of file diff --git a/hal/OUTSRC/odm_DIG.c b/hal/OUTSRC/odm_DIG.c new file mode 100644 index 0000000..c8ebeec --- /dev/null +++ b/hal/OUTSRC/odm_DIG.c @@ -0,0 +1,2006 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA + * + * + ******************************************************************************/ + +//============================================================ +// include files +//============================================================ +#include "Mp_Precomp.h" +#include "odm_precomp.h" + + +VOID +ODM_ChangeDynamicInitGainThresh( + IN PVOID pDM_VOID, + IN u4Byte DM_Type, + IN u4Byte DM_Value + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; + + if (DM_Type == DIG_TYPE_THRESH_HIGH) + { + pDM_DigTable->RssiHighThresh = DM_Value; + } + else if (DM_Type == DIG_TYPE_THRESH_LOW) + { + pDM_DigTable->RssiLowThresh = DM_Value; + } + else if (DM_Type == DIG_TYPE_ENABLE) + { + pDM_DigTable->Dig_Enable_Flag = TRUE; + } + else if (DM_Type == DIG_TYPE_DISABLE) + { + pDM_DigTable->Dig_Enable_Flag = FALSE; + } + else if (DM_Type == DIG_TYPE_BACKOFF) + { + if(DM_Value > 30) + DM_Value = 30; + pDM_DigTable->BackoffVal = (u1Byte)DM_Value; + } + else if(DM_Type == DIG_TYPE_RX_GAIN_MIN) + { + if(DM_Value == 0) + DM_Value = 0x1; + pDM_DigTable->rx_gain_range_min = (u1Byte)DM_Value; + } + else if(DM_Type == DIG_TYPE_RX_GAIN_MAX) + { + if(DM_Value > 0x50) + DM_Value = 0x50; + pDM_DigTable->rx_gain_range_max = (u1Byte)DM_Value; + } +} // DM_ChangeDynamicInitGainThresh // + +int +getIGIForDiff(int value_IGI) +{ + #define ONERCCA_LOW_TH 0x30 + #define ONERCCA_LOW_DIFF 8 + + if (value_IGI < ONERCCA_LOW_TH) { + if ((ONERCCA_LOW_TH - value_IGI) < ONERCCA_LOW_DIFF) + return ONERCCA_LOW_TH; + else + return value_IGI + ONERCCA_LOW_DIFF; + } else { + return value_IGI; + } +} + +VOID +ODM_Write_DIG( + IN PVOID pDM_VOID, + IN u1Byte CurrentIGI + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; + + if(pDM_DigTable->bStopDIG) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("Stop Writing IGI\n")); + return; + } + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_TRACE, ("ODM_REG(IGI_A,pDM_Odm)=0x%x, ODM_BIT(IGI,pDM_Odm)=0x%x \n", + ODM_REG(IGI_A,pDM_Odm),ODM_BIT(IGI,pDM_Odm))); + + if(pDM_DigTable->CurIGValue != CurrentIGI) + { + //1 Check initial gain by upper bound + if(!pDM_DigTable->bPSDInProgress) + { + if(CurrentIGI > pDM_DigTable->rx_gain_range_max) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_TRACE, ("CurrentIGI(0x%02x) is larger than upper bound !!\n",CurrentIGI)); + CurrentIGI = pDM_DigTable->rx_gain_range_max; + } + + } + + //1 Set IGI value + if(pDM_Odm->SupportPlatform & (ODM_WIN|ODM_CE)) + { + ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_A,pDM_Odm), ODM_BIT(IGI,pDM_Odm), CurrentIGI); + + if(pDM_Odm->RFType > ODM_1T1R) + ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_B,pDM_Odm), ODM_BIT(IGI,pDM_Odm), CurrentIGI); + + if((pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) && (pDM_Odm->RFType > ODM_2T2R)) + { + ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_C,pDM_Odm), ODM_BIT(IGI,pDM_Odm), CurrentIGI); + ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_D,pDM_Odm), ODM_BIT(IGI,pDM_Odm), CurrentIGI); + } + } + else if(pDM_Odm->SupportPlatform & (ODM_AP|ODM_ADSL)) + { + switch(*(pDM_Odm->pOnePathCCA)) + { + case ODM_CCA_2R: + ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_A,pDM_Odm), ODM_BIT(IGI,pDM_Odm), CurrentIGI); + + if(pDM_Odm->RFType > ODM_1T1R) + ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_B,pDM_Odm), ODM_BIT(IGI,pDM_Odm), CurrentIGI); + + if((pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) && (pDM_Odm->RFType > ODM_2T2R)) + { + ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_C,pDM_Odm), ODM_BIT(IGI,pDM_Odm), CurrentIGI); + ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_D,pDM_Odm), ODM_BIT(IGI,pDM_Odm), CurrentIGI); + } + break; + case ODM_CCA_1R_A: + ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_A,pDM_Odm), ODM_BIT(IGI,pDM_Odm), CurrentIGI); + if(pDM_Odm->RFType != ODM_1T1R) + ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_B,pDM_Odm), ODM_BIT(IGI,pDM_Odm), getIGIForDiff(CurrentIGI)); + break; + case ODM_CCA_1R_B: + ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_A,pDM_Odm), ODM_BIT(IGI,pDM_Odm), getIGIForDiff(CurrentIGI)); + if(pDM_Odm->RFType != ODM_1T1R) + ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_B,pDM_Odm), ODM_BIT(IGI,pDM_Odm), CurrentIGI); + break; + } + } + pDM_DigTable->CurIGValue = CurrentIGI; + } + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_TRACE, ("CurrentIGI(0x%02x). \n",CurrentIGI)); + +} + +VOID +odm_PauseDIG( + IN PVOID pDM_VOID, + IN ODM_Pause_DIG_TYPE PauseType, + IN u1Byte IGIValue +) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_PauseDIG()=========>\n")); + +#if (DM_ODM_SUPPORT_TYPE & ODM_WIN) + if(*pDM_DigTable->pbP2pLinkInProgress) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_PauseDIG(): P2P in progress !!\n")); + return; + } +#endif + + if(!pDM_DigTable->bPauseDIG && (!(pDM_Odm->SupportAbility & ODM_BB_DIG) || !(pDM_Odm->SupportAbility & ODM_BB_FA_CNT))) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_PauseDIG(): Return: SupportAbility ODM_BB_DIG or ODM_BB_FA_CNT is disabled\n")); + return; + } + + switch(PauseType) + { + //1 Pause DIG + case ODM_PAUSE_DIG: + //2 Disable DIG + ODM_CmnInfoUpdate(pDM_Odm, ODM_CMNINFO_ABILITY, pDM_Odm->SupportAbility & (~ODM_BB_DIG)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_PauseDIG(): Pause DIG !!\n")); + + //2 Backup IGI value + if(!pDM_DigTable->bPauseDIG) + { + pDM_DigTable->IGIBackup = pDM_DigTable->CurIGValue; + pDM_DigTable->bPauseDIG = TRUE; + } + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_PauseDIG(): Backup IGI = 0x%x\n", pDM_DigTable->IGIBackup)); + + //2 Write new IGI value + ODM_Write_DIG(pDM_Odm, IGIValue); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_PauseDIG(): Write new IGI = 0x%x\n", IGIValue)); + break; + + //1 Resume DIG + case ODM_RESUME_DIG: + if(pDM_DigTable->bPauseDIG) + { + //2 Write backup IGI value + ODM_Write_DIG(pDM_Odm, pDM_DigTable->IGIBackup); + pDM_DigTable->bPauseDIG = FALSE; + pDM_DigTable->bIgnoreDIG = TRUE; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_PauseDIG(): Write original IGI = 0x%x\n", pDM_DigTable->IGIBackup)); + + //2 Enable DIG + ODM_CmnInfoUpdate(pDM_Odm, ODM_CMNINFO_ABILITY, pDM_Odm->SupportAbility | ODM_BB_DIG); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_PauseDIG(): Resume DIG !!\n")); + } + break; + + default: + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_PauseDIG(): Wrong type !!\n")); + break; + } +} + +BOOLEAN +odm_DigAbort( + IN PVOID pDM_VOID + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; + +#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + prtl8192cd_priv priv = pDM_Odm->priv; +#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN) + PADAPTER pAdapter = pDM_Odm->Adapter; + pRXHP_T pRX_HP_Table = &pDM_Odm->DM_RXHP_Table; +#endif + + //SupportAbility + if(!(pDM_Odm->SupportAbility & ODM_BB_FA_CNT)) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Return: SupportAbility ODM_BB_FA_CNT is disabled\n")); + return TRUE; + } + + //SupportAbility + if(!(pDM_Odm->SupportAbility & ODM_BB_DIG)) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Return: SupportAbility ODM_BB_DIG is disabled\n")); + return TRUE; + } + + //ScanInProcess + if(*(pDM_Odm->pbScanInProcess)) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Return: In Scan Progress \n")); + return TRUE; + } + + if(pDM_DigTable->bIgnoreDIG) + { + pDM_DigTable->bIgnoreDIG = FALSE; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Return: Ignore DIG \n")); + return TRUE; + } + + //add by Neil Chen to avoid PSD is processing + if(pDM_Odm->bDMInitialGainEnable == FALSE) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Return: PSD is Processing \n")); + return TRUE; + } + +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + #if OS_WIN_FROM_WIN7(OS_VERSION) + if(IsAPModeExist( pAdapter) && pAdapter->bInHctTest) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Return: Is AP mode or In HCT Test \n")); + return TRUE; + } + #endif + + if(pDM_Odm->bBtHsOperation) + { + odm_DigForBtHsMode(pDM_Odm); + } + + if(!(pDM_Odm->SupportICType &(ODM_RTL8723A|ODM_RTL8188E))) + { + if(pRX_HP_Table->RXHP_flag == 1) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Return: In RXHP Operation \n")); + return TRUE; + } + } +#elif (DM_ODM_SUPPORT_TYPE == ODM_CE) + #ifdef CONFIG_SPECIAL_SETTING_FOR_FUNAI_TV + if((pDM_Odm->bLinked) && (pDM_Odm->Adapter->registrypriv.force_igi !=0)) + { + printk("pDM_Odm->RSSI_Min=%d \n",pDM_Odm->RSSI_Min); + ODM_Write_DIG(pDM_Odm,pDM_Odm->Adapter->registrypriv.force_igi); + return TRUE; + } + #endif +#else + if (!(priv->up_time > 5)) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Return: Not In DIG Operation Period \n")); + return TRUE; + } +#endif + + return FALSE; +} + +VOID +odm_DIGInit( + IN PVOID pDM_VOID + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; + PFALSE_ALARM_STATISTICS FalseAlmCnt = &(pDM_Odm->FalseAlmCnt); + + pDM_DigTable->bStopDIG = FALSE; + pDM_DigTable->bPauseDIG = FALSE; + pDM_DigTable->bIgnoreDIG = FALSE; + pDM_DigTable->bPSDInProgress = FALSE; + pDM_DigTable->CurIGValue = (u1Byte) ODM_GetBBReg(pDM_Odm, ODM_REG(IGI_A,pDM_Odm), ODM_BIT(IGI,pDM_Odm)); + pDM_DigTable->RssiLowThresh = DM_DIG_THRESH_LOW; + pDM_DigTable->RssiHighThresh = DM_DIG_THRESH_HIGH; + pDM_DigTable->FALowThresh = DM_FALSEALARM_THRESH_LOW; + pDM_DigTable->FAHighThresh = DM_FALSEALARM_THRESH_HIGH; + pDM_DigTable->BackoffVal = DM_DIG_BACKOFF_DEFAULT; + pDM_DigTable->BackoffVal_range_max = DM_DIG_BACKOFF_MAX; + pDM_DigTable->BackoffVal_range_min = DM_DIG_BACKOFF_MIN; + pDM_DigTable->PreCCK_CCAThres = 0xFF; + pDM_DigTable->CurCCK_CCAThres = 0x83; + pDM_DigTable->ForbiddenIGI = DM_DIG_MIN_NIC; + pDM_DigTable->LargeFAHit = 0; + pDM_DigTable->Recover_cnt = 0; + pDM_DigTable->bMediaConnect_0 = FALSE; + pDM_DigTable->bMediaConnect_1 = FALSE; + + //To Initialize pDM_Odm->bDMInitialGainEnable == FALSE to avoid DIG error + pDM_Odm->bDMInitialGainEnable = TRUE; + +#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + pDM_DigTable->DIG_Dynamic_MIN_0 = 0x25; + pDM_DigTable->DIG_Dynamic_MIN_1 = 0x25; + + // For AP\ ADSL modified DIG + pDM_DigTable->bTpTarget = FALSE; + pDM_DigTable->bNoiseEst = TRUE; + pDM_DigTable->IGIOffset_A = 0; + pDM_DigTable->IGIOffset_B = 0; + pDM_DigTable->TpTrainTH_min = 0; + + // For RTL8881A + FalseAlmCnt->Cnt_Ofdm_fail_pre = 0; + + //Dyanmic EDCCA + if(pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) + { + ODM_SetBBReg(pDM_Odm, 0xC50, 0xFFFF0000, 0xfafd); + } +#else + pDM_DigTable->DIG_Dynamic_MIN_0 = DM_DIG_MIN_NIC; + pDM_DigTable->DIG_Dynamic_MIN_1 = DM_DIG_MIN_NIC; + + //To Initi BT30 IGI + pDM_DigTable->BT30_CurIGI=0x32; + + #if (DM_ODM_SUPPORT_TYPE & ODM_WIN) + *pDM_DigTable->pbP2pLinkInProgress= FALSE; + #endif +#endif + + if(pDM_Odm->BoardType & (ODM_BOARD_EXT_PA|ODM_BOARD_EXT_LNA)) + { + pDM_DigTable->rx_gain_range_max = DM_DIG_MAX_NIC; + pDM_DigTable->rx_gain_range_min = DM_DIG_MIN_NIC; + } + else + { + pDM_DigTable->rx_gain_range_max = DM_DIG_MAX_NIC; + pDM_DigTable->rx_gain_range_min = DM_DIG_MIN_NIC; + } + +} + + +VOID +odm_DIG( + IN PVOID pDM_VOID + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; +#if (DM_ODM_SUPPORT_TYPE & ODM_WIN) + PADAPTER pAdapter = pDM_Odm->Adapter; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pDM_Odm->Adapter); +#elif (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + prtl8192cd_priv priv = pDM_Odm->priv; + PSTA_INFO_T pEntry; +#endif + + // Common parameters + pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; + PFALSE_ALARM_STATISTICS pFalseAlmCnt = &pDM_Odm->FalseAlmCnt; + BOOLEAN FirstConnect,FirstDisConnect; + u1Byte DIG_MaxOfMin, DIG_Dynamic_MIN; + u1Byte dm_dig_max, dm_dig_min; + u1Byte CurrentIGI = pDM_DigTable->CurIGValue; + u1Byte offset; + u4Byte dm_FA_thres[3]; + u1Byte Adap_IGI_Upper = 0; + u4Byte TxTp = 0, RxTp = 0; + BOOLEAN bDFSBand = FALSE; + BOOLEAN bPerformance = TRUE, bFirstTpTarget = FALSE, bFirstCoverage = FALSE; +#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + u4Byte TpTrainTH_MIN = DM_DIG_TP_Target_TH0; + static u1Byte TimeCnt = 0; + u1Byte i; +#endif + + if(odm_DigAbort(pDM_Odm) == TRUE) + return; + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG()===========================>\n\n")); + + if(pDM_Odm->adaptivity_flag == TRUE) + Adap_IGI_Upper = pDM_Odm->Adaptivity_IGI_upper; + + + //1 Update status + if(pDM_Odm->SupportICType == ODM_RTL8192D) + { + if(*(pDM_Odm->pMacPhyMode) == ODM_DMSP) + { + if(*(pDM_Odm->pbMasterOfDMSP)) + { + DIG_Dynamic_MIN = pDM_DigTable->DIG_Dynamic_MIN_0; + FirstConnect = (pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_0 == FALSE); + FirstDisConnect = (!pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_0 == TRUE); + } + else + { + DIG_Dynamic_MIN = pDM_DigTable->DIG_Dynamic_MIN_1; + FirstConnect = (pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_1 == FALSE); + FirstDisConnect = (!pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_1 == TRUE); + } + } + else + { + if(*(pDM_Odm->pBandType) == ODM_BAND_5G) + { + DIG_Dynamic_MIN = pDM_DigTable->DIG_Dynamic_MIN_0; + FirstConnect = (pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_0 == FALSE); + FirstDisConnect = (!pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_0 == TRUE); + } + else + { + DIG_Dynamic_MIN = pDM_DigTable->DIG_Dynamic_MIN_1; + FirstConnect = (pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_1 == FALSE); + FirstDisConnect = (!pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_1 == TRUE); + } + } + } + else + { + DIG_Dynamic_MIN = pDM_DigTable->DIG_Dynamic_MIN_0; + FirstConnect = (pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_0 == FALSE); + FirstDisConnect = (!pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_0 == TRUE); + } + +#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + //1 Noise Floor Estimate + //pDM_DigTable->bNoiseEst = (FirstConnect)?TRUE:pDM_DigTable->bNoiseEst; + //odm_InbandNoiseCalculate (pDM_Odm); + + //1 Mode decision + if(pDM_Odm->bLinked) + { + //2 Calculate total TP + for (i=0; ipODM_StaInfo[i]; + if(IS_STA_VALID(pEntry)) + { + RxTp += (u4Byte)(pEntry->rx_byte_cnt_LowMAW>>7); + TxTp += (u4Byte)(pEntry->tx_byte_cnt_LowMAW>>7); //Kbps + } + } + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): TX TP = %dkbps, RX TP = %dkbps\n", TxTp, RxTp)); + } + + switch(pDM_Odm->priv->pshare->rf_ft_var.dig_cov_enable) + { + case 0: + { + bPerformance = TRUE; + break; + } + case 1: + { + bPerformance = FALSE; + break; + } + case 2: + { + if(pDM_Odm->bLinked) + { + if(pDM_DigTable->TpTrainTH_min > DM_DIG_TP_Target_TH0) + TpTrainTH_MIN = pDM_DigTable->TpTrainTH_min; + + if(pDM_DigTable->TpTrainTH_min > DM_DIG_TP_Target_TH1) + TpTrainTH_MIN = DM_DIG_TP_Target_TH1; + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): TP training mode lower bound = %dkbps\n", TpTrainTH_MIN)); + + //2 Decide DIG mode by total TP + if((TxTp + RxTp) > DM_DIG_TP_Target_TH1) // change to performance mode + { + bFirstTpTarget = (!pDM_DigTable->bTpTarget)?TRUE:FALSE; + pDM_DigTable->bTpTarget = TRUE; + bPerformance = TRUE; + } + else if((TxTp + RxTp) < TpTrainTH_MIN) // change to coverage mode + { + bFirstCoverage = (pDM_DigTable->bTpTarget)?TRUE:FALSE; + + if(TimeCnt < DM_DIG_TP_Training_Period) + { + pDM_DigTable->bTpTarget = FALSE; + bPerformance = FALSE; + TimeCnt++; + } + else + { + pDM_DigTable->bTpTarget = TRUE; + bPerformance = TRUE; + bFirstTpTarget = TRUE; + TimeCnt = 0; + } + } + else // remain previous mode + { + bPerformance = pDM_DigTable->bTpTarget; + + if(!bPerformance) + { + if(TimeCnt < DM_DIG_TP_Training_Period) + TimeCnt++; + else + { + pDM_DigTable->bTpTarget = TRUE; + bPerformance = TRUE; + bFirstTpTarget = TRUE; + TimeCnt = 0; + } + } + } + + if(!bPerformance) + pDM_DigTable->TpTrainTH_min = RxTp + TxTp; + + } + else + { + bPerformance = FALSE; + pDM_DigTable->TpTrainTH_min = 0; + } + break; + } + default: + bPerformance = TRUE; + } + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("====== DIG mode = %d ======\n", pDM_Odm->priv->pshare->rf_ft_var.dig_cov_enable)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("====== bPerformance = %d ======\n", bPerformance)); +#endif + + //1 Boundary Decision + if((pDM_Odm->SupportICType & ODM_RTL8192C) && (pDM_Odm->BoardType & (ODM_BOARD_EXT_LNA | ODM_BOARD_EXT_PA))) + { + //2 High power case + if(pDM_Odm->SupportPlatform & (ODM_AP|ODM_ADSL)) + { + dm_dig_max = DM_DIG_MAX_AP_HP; + dm_dig_min = DM_DIG_MIN_AP_HP; + } + else + { + dm_dig_max = DM_DIG_MAX_NIC_HP; + dm_dig_min = DM_DIG_MIN_NIC_HP; + } + DIG_MaxOfMin = DM_DIG_MAX_AP_HP; + } + else + { +#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + //2 For AP\ADSL + if(!bPerformance) + { + dm_dig_max = DM_DIG_MAX_AP_COVERAGR; + dm_dig_min = DM_DIG_MIN_AP_COVERAGE; + DIG_MaxOfMin = DM_DIG_MAX_OF_MIN_COVERAGE; + } + else + { + dm_dig_max = DM_DIG_MAX_AP; + dm_dig_min = DM_DIG_MIN_AP; + DIG_MaxOfMin = DM_DIG_MAX_OF_MIN; + } + + //4 DFS band + if (((*pDM_Odm->pChannel>= 52) &&(*pDM_Odm->pChannel <= 64)) || + ((*pDM_Odm->pChannel >= 100) && (*pDM_Odm->pChannel <= 140))) + { + bDFSBand = TRUE; + dm_dig_min = DM_DIG_MIN_AP_DFS; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): ====== In DFS band ======\n")); + } + + //4 TX2path + if (priv->pmib->dot11RFEntry.tx2path && !bDFSBand && (*(pDM_Odm->pWirelessMode) == ODM_WM_B)) + dm_dig_max = 0x2A; + +#if RTL8192E_SUPPORT +#ifdef HIGH_POWER_EXT_LNA + if ((pDM_Odm->SupportICType & (ODM_RTL8192E)) && (pDM_Odm->ExtLNA)) + dm_dig_max = 0x42; +#endif +#endif + +#else + //2 For WIN\CE + if(pDM_Odm->SupportICType >= ODM_RTL8188E) + dm_dig_max = 0x5A; + else + dm_dig_max = DM_DIG_MAX_NIC; + + if(pDM_Odm->SupportICType != ODM_RTL8821) + dm_dig_min = DM_DIG_MIN_NIC; + else + dm_dig_min = 0x1C; + + DIG_MaxOfMin = DM_DIG_MAX_AP; +#endif + } + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Absolutly upper bound = 0x%x, lower bound = 0x%x\n",dm_dig_max, dm_dig_min)); + +#if (DM_ODM_SUPPORT_TYPE & ODM_WIN) + // for P2P case + if(0 < *pDM_Odm->pu1ForcedIgiLb) + { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): P2P case: Force IGI lb to: %u !!!!!!\n", *pDM_Odm->pu1ForcedIgiLb)); + dm_dig_min = *pDM_Odm->pu1ForcedIgiLb; + dm_dig_max = (dm_dig_min <= dm_dig_max) ? (dm_dig_max) : (dm_dig_min + 1); + } +#endif + + //1 Adjust boundary by RSSI + if(pDM_Odm->bLinked && bPerformance) + { + //2 Modify DIG upper bound +#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + offset = 15; +#else + //4 Modify DIG upper bound for 92E, 8723A\B, 8821 & 8812 BT + if((pDM_Odm->SupportICType & (ODM_RTL8192E|ODM_RTL8723B|ODM_RTL8812|ODM_RTL8821|ODM_RTL8723A)) && (pDM_Odm->bBtLimitedDig==1)) + { + offset = 10; + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Coex. case: Force upper bound to RSSI + %d !!!!!!\n", offset)); + } + else + offset = 15; +#endif + + if((pDM_Odm->RSSI_Min + offset) > dm_dig_max ) + pDM_DigTable->rx_gain_range_max = dm_dig_max; + else if((pDM_Odm->RSSI_Min + offset) < dm_dig_min ) + pDM_DigTable->rx_gain_range_max = dm_dig_min; + else + pDM_DigTable->rx_gain_range_max = pDM_Odm->RSSI_Min + offset; + +#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) + //2 Modify DIG lower bound + //if(pDM_Odm->bOneEntryOnly) + { + if(pDM_Odm->RSSI_Min < dm_dig_min) + DIG_Dynamic_MIN = dm_dig_min; + else if (pDM_Odm->RSSI_Min > DIG_MaxOfMin) + DIG_Dynamic_MIN = DIG_MaxOfMin; + else + DIG_Dynamic_MIN = pDM_Odm->RSSI_Min; + } +#else + { + //4 For AP +#ifdef __ECOS + HAL_REORDER_BARRIER(); +#else + rmb(); +#endif + if (bDFSBand) + { + DIG_Dynamic_MIN = dm_dig_min; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): DFS band: Force lower bound to 0x%x after link !!!!!!\n", dm_dig_min)); + } + else + { + if(pDM_Odm->RSSI_Min < dm_dig_min) + DIG_Dynamic_MIN = dm_dig_min; + else if (pDM_Odm->RSSI_Min > DIG_MaxOfMin) + DIG_Dynamic_MIN = DIG_MaxOfMin; + else + DIG_Dynamic_MIN = pDM_Odm->RSSI_Min; + } + } +#endif + } + else + { +#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + if(bPerformance && bDFSBand) + { + pDM_DigTable->rx_gain_range_max = 0x28; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): DFS band: Force upper bound to 0x%x before link !!!!!!\n", pDM_DigTable->rx_gain_range_max)); + } + else +#endif + { + pDM_DigTable->rx_gain_range_max = DM_DIG_MAX_OF_MIN; + } + DIG_Dynamic_MIN = dm_dig_min; + } + + //1 Force Lower Bound for AntDiv + if(pDM_Odm->bLinked && !pDM_Odm->bOneEntryOnly) + { + if((pDM_Odm->SupportICType & ODM_ANTDIV_SUPPORT) && (pDM_Odm->SupportAbility & ODM_BB_ANT_DIV)) + { + if(pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV || pDM_Odm->AntDivType == CG_TRX_SMART_ANTDIV ||pDM_Odm->AntDivType == S0S1_SW_ANTDIV) + { + if(pDM_DigTable->AntDiv_RSSI_max > DIG_MaxOfMin) + DIG_Dynamic_MIN = DIG_MaxOfMin; + else + DIG_Dynamic_MIN = (u1Byte) pDM_DigTable->AntDiv_RSSI_max; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_DIG(): Antenna diversity case: Force lower bound to 0x%x !!!!!!\n", DIG_Dynamic_MIN)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_DIG(): Antenna diversity case: RSSI_max = 0x%x !!!!!!\n", pDM_DigTable->AntDiv_RSSI_max)); + } + } + } + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Adjust boundary by RSSI Upper bound = 0x%x, Lower bound = 0x%x\n", + pDM_DigTable->rx_gain_range_max, DIG_Dynamic_MIN)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Link status: bLinked = %d, RSSI = %d, bFirstConnect = %d, bFirsrDisConnect = %d\n\n", + pDM_Odm->bLinked, pDM_Odm->RSSI_Min, FirstConnect, FirstDisConnect)); + + //1 Modify DIG lower bound, deal with abnormal case + //2 Abnormal false alarm case +#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + if(bDFSBand) + { + pDM_DigTable->rx_gain_range_min = DIG_Dynamic_MIN; + } + else +#endif + { + if(!pDM_Odm->bLinked) + { + pDM_DigTable->rx_gain_range_min = DIG_Dynamic_MIN; + + if(FirstDisConnect) + pDM_DigTable->ForbiddenIGI = DIG_Dynamic_MIN; + } + else + pDM_DigTable->rx_gain_range_min = odm_ForbiddenIGICheck(pDM_Odm, DIG_Dynamic_MIN, CurrentIGI); + } + + //2 Abnormal # beacon case +#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) + if(pDM_Odm->bLinked && !FirstConnect) + { + if((pDM_Odm->PhyDbgInfo.NumQryBeaconPkt < 5) && (pDM_Odm->bsta_state)) + { + pDM_DigTable->rx_gain_range_min = dm_dig_min; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Abnrormal #beacon (%d) case in STA mode: Force lower bound to 0x%x !!!!!!\n\n", + pDM_Odm->PhyDbgInfo.NumQryBeaconPkt, pDM_DigTable->rx_gain_range_min)); + } + } +#endif + + //2 Abnormal lower bound case + if(pDM_DigTable->rx_gain_range_min > pDM_DigTable->rx_gain_range_max) + { + pDM_DigTable->rx_gain_range_min = pDM_DigTable->rx_gain_range_max; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Abnrormal lower bound case: Force lower bound to 0x%x !!!!!!\n\n",pDM_DigTable->rx_gain_range_min)); + } + + + //1 False alarm threshold decision + odm_FAThresholdCheck(pDM_Odm, bDFSBand, bPerformance, RxTp, TxTp, dm_FA_thres); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): False alarm threshold = %d, %d, %d \n\n", dm_FA_thres[0], dm_FA_thres[1], dm_FA_thres[2])); + + //1 Adjust initial gain by false alarm + if(pDM_Odm->bLinked && bPerformance) + { + //2 After link + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Adjust IGI after link\n")); + + if(bFirstTpTarget || (FirstConnect && bPerformance)) + { + pDM_DigTable->LargeFAHit = 0; + +#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + if(bDFSBand) + { + if(pDM_Odm->RSSI_Min > 0x28) + CurrentIGI = 0x28; + else + CurrentIGI = pDM_Odm->RSSI_Min; + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): DFS band: One-shot to 0x28 upmost!!!!!!\n")); + } + else +#endif + { + if(pDM_Odm->RSSI_Min < DIG_MaxOfMin) + { + if(CurrentIGI < pDM_Odm->RSSI_Min) + CurrentIGI = pDM_Odm->RSSI_Min; + } + else + { + if(CurrentIGI < DIG_MaxOfMin) + CurrentIGI = DIG_MaxOfMin; + } + +#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) + if(pDM_Odm->SupportICType == ODM_RTL8812) + ODM_ConfigBBWithHeaderFile(pDM_Odm, CONFIG_BB_AGC_TAB_DIFF); +#endif + } + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): First connect case: IGI does on-shot to 0x%x\n", CurrentIGI)); + + } + else + { + if(pFalseAlmCnt->Cnt_all > dm_FA_thres[2]) + CurrentIGI = CurrentIGI + 4; + else if (pFalseAlmCnt->Cnt_all > dm_FA_thres[1]) + CurrentIGI = CurrentIGI + 2; + else if(pFalseAlmCnt->Cnt_all < dm_FA_thres[0]) + CurrentIGI = CurrentIGI - 2; + + //4 Abnormal # beacon case +#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) + if((pDM_Odm->PhyDbgInfo.NumQryBeaconPkt < 5) && (pFalseAlmCnt->Cnt_all < DM_DIG_FA_TH1) && (pDM_Odm->bsta_state)) + { + CurrentIGI = pDM_DigTable->rx_gain_range_min; + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Abnormal #beacon (%d) case: IGI does one-shot to 0x%x\n", + pDM_Odm->PhyDbgInfo.NumQryBeaconPkt, CurrentIGI)); + } +#endif + } + } + else + { + //2 Before link + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Adjust IGI before link\n")); + + if(FirstDisConnect || bFirstCoverage) + { + CurrentIGI = dm_dig_min; + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): First disconnect case: IGI does on-shot to lower bound\n")); + } + else + { + if(pFalseAlmCnt->Cnt_all > dm_FA_thres[2]) + CurrentIGI = CurrentIGI + 4; + else if (pFalseAlmCnt->Cnt_all > dm_FA_thres[1]) + CurrentIGI = CurrentIGI + 2; + else if(pFalseAlmCnt->Cnt_all < dm_FA_thres[0]) + CurrentIGI = CurrentIGI - 2; + } + } + + //1 Check initial gain by upper/lower bound + if(CurrentIGI < pDM_DigTable->rx_gain_range_min) + CurrentIGI = pDM_DigTable->rx_gain_range_min; + + if(CurrentIGI > pDM_DigTable->rx_gain_range_max) + CurrentIGI = pDM_DigTable->rx_gain_range_max; + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): CurIGValue=0x%x, TotalFA = %d\n\n", CurrentIGI, pFalseAlmCnt->Cnt_all)); + + //1 Force upper bound and lower bound for adaptivity + if(pDM_Odm->SupportAbility & ODM_BB_ADAPTIVITY && pDM_Odm->adaptivity_flag == TRUE) + { + if(CurrentIGI > Adap_IGI_Upper) + CurrentIGI = Adap_IGI_Upper; + + if(pDM_Odm->IGI_LowerBound != 0) + { + if(CurrentIGI < pDM_Odm->IGI_LowerBound) + CurrentIGI = pDM_Odm->IGI_LowerBound; + } + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Adaptivity case: Force upper bound to 0x%x !!!!!!\n", Adap_IGI_Upper)); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Adaptivity case: Force lower bound to 0x%x !!!!!!\n\n", pDM_Odm->IGI_LowerBound)); + } + + + //1 High power RSSI threshold +#if (DM_ODM_SUPPORT_TYPE & ODM_WIN) + if((pDM_Odm->SupportICType == ODM_RTL8723A)&& (pHalData->UndecoratedSmoothedPWDB > DM_DIG_HIGH_PWR_THRESHOLD)) + { + // High power IGI lower bound + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): UndecoratedSmoothedPWDB(%#x)\n", pHalData->UndecoratedSmoothedPWDB)); + if(CurrentIGI < DM_DIG_HIGH_PWR_IGI_LOWER_BOUND) + { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): CurIGValue(%#x)\n", pDM_DigTable->CurIGValue)); + //pDM_DigTable->CurIGValue = DM_DIG_HIGH_PWR_IGI_LOWER_BOUND; + CurrentIGI=DM_DIG_HIGH_PWR_IGI_LOWER_BOUND; + } + } + if((pDM_Odm->SupportICType & ODM_RTL8723A) && IS_WIRELESS_MODE_G(pAdapter)) + { + if(pHalData->UndecoratedSmoothedPWDB > 0x28) + { + if(CurrentIGI < DM_DIG_Gmode_HIGH_PWR_IGI_LOWER_BOUND) + { + //pDM_DigTable->CurIGValue = DM_DIG_Gmode_HIGH_PWR_IGI_LOWER_BOUND; + CurrentIGI = DM_DIG_Gmode_HIGH_PWR_IGI_LOWER_BOUND; + } + } + } +#endif + + //1 Update status +#if (RTL8192D_SUPPORT==1) + if(pDM_Odm->SupportICType == ODM_RTL8192D) + { + //sherry delete DualMacSmartConncurrent 20110517 + if(*(pDM_Odm->pMacPhyMode) == ODM_DMSP) + { + ODM_Write_DIG_DMSP(pDM_Odm, CurrentIGI);//ODM_Write_DIG_DMSP(pDM_Odm, pDM_DigTable->CurIGValue); + if(*(pDM_Odm->pbMasterOfDMSP)) + { + pDM_DigTable->bMediaConnect_0 = pDM_Odm->bLinked; + pDM_DigTable->DIG_Dynamic_MIN_0 = DIG_Dynamic_MIN; + } + else + { + pDM_DigTable->bMediaConnect_1 = pDM_Odm->bLinked; + pDM_DigTable->DIG_Dynamic_MIN_1 = DIG_Dynamic_MIN; + } + } + else + { + ODM_Write_DIG(pDM_Odm, CurrentIGI);//ODM_Write_DIG(pDM_Odm, pDM_DigTable->CurIGValue); + if(*(pDM_Odm->pBandType) == ODM_BAND_5G) + { + pDM_DigTable->bMediaConnect_0 = pDM_Odm->bLinked; + pDM_DigTable->DIG_Dynamic_MIN_0 = DIG_Dynamic_MIN; + } + else + { + pDM_DigTable->bMediaConnect_1 = pDM_Odm->bLinked; + pDM_DigTable->DIG_Dynamic_MIN_1 = DIG_Dynamic_MIN; + } + } + } + else +#endif + { +#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) + if(pDM_Odm->bBtHsOperation) + { + if(pDM_Odm->bLinked) + { + if(pDM_DigTable->BT30_CurIGI > (CurrentIGI)) + ODM_Write_DIG(pDM_Odm, CurrentIGI); + else + ODM_Write_DIG(pDM_Odm, pDM_DigTable->BT30_CurIGI); + + pDM_DigTable->bMediaConnect_0 = pDM_Odm->bLinked; + pDM_DigTable->DIG_Dynamic_MIN_0 = DIG_Dynamic_MIN; + } + else + { + if(pDM_Odm->bLinkInProcess) + ODM_Write_DIG(pDM_Odm, 0x1c); + else if(pDM_Odm->bBtConnectProcess) + ODM_Write_DIG(pDM_Odm, 0x28); + else + ODM_Write_DIG(pDM_Odm, pDM_DigTable->BT30_CurIGI);//ODM_Write_DIG(pDM_Odm, pDM_DigTable->CurIGValue); + } + } + else // BT is not using +#endif + { + ODM_Write_DIG(pDM_Odm, CurrentIGI);//ODM_Write_DIG(pDM_Odm, pDM_DigTable->CurIGValue); + pDM_DigTable->bMediaConnect_0 = pDM_Odm->bLinked; + pDM_DigTable->DIG_Dynamic_MIN_0 = DIG_Dynamic_MIN; + } + } +} + +VOID +odm_DIGbyRSSI_LPS( + IN PVOID pDM_VOID + ) +{ +#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + PFALSE_ALARM_STATISTICS pFalseAlmCnt = &pDM_Odm->FalseAlmCnt; + +#if (DM_ODM_SUPPORT_TYPE & ODM_CE) +#if 0 //and 2.3.5 coding rule + struct mlme_priv *pmlmepriv = &(pAdapter->mlmepriv); + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + struct dm_priv *pdmpriv = &pHalData->dmpriv; +#endif +#endif + + u1Byte RSSI_Lower=DM_DIG_MIN_NIC; //0x1E or 0x1C + u1Byte CurrentIGI=pDM_Odm->RSSI_Min; + + CurrentIGI=CurrentIGI+RSSI_OFFSET_DIG; + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIGbyRSSI_LPS()==>\n")); + + // Using FW PS mode to make IGI + //Adjust by FA in LPS MODE + if(pFalseAlmCnt->Cnt_all> DM_DIG_FA_TH2_LPS) + CurrentIGI = CurrentIGI+4; + else if (pFalseAlmCnt->Cnt_all > DM_DIG_FA_TH1_LPS) + CurrentIGI = CurrentIGI+2; + else if(pFalseAlmCnt->Cnt_all < DM_DIG_FA_TH0_LPS) + CurrentIGI = CurrentIGI-2; + + + //Lower bound checking + + //RSSI Lower bound check + if((pDM_Odm->RSSI_Min-10) > DM_DIG_MIN_NIC) + RSSI_Lower =(pDM_Odm->RSSI_Min-10); + else + RSSI_Lower =DM_DIG_MIN_NIC; + + //Upper and Lower Bound checking + if(CurrentIGI > DM_DIG_MAX_NIC) + CurrentIGI=DM_DIG_MAX_NIC; + else if(CurrentIGI < RSSI_Lower) + CurrentIGI =RSSI_Lower; + + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIGbyRSSI_LPS(): pFalseAlmCnt->Cnt_all = %d\n",pFalseAlmCnt->Cnt_all)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIGbyRSSI_LPS(): pDM_Odm->RSSI_Min = %d\n",pDM_Odm->RSSI_Min)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIGbyRSSI_LPS(): CurrentIGI = 0x%x\n",CurrentIGI)); + + ODM_Write_DIG(pDM_Odm, CurrentIGI);//ODM_Write_DIG(pDM_Odm, pDM_DigTable->CurIGValue); +#endif +} + +VOID +odm_DigForBtHsMode( + IN PVOID pDM_VOID + ) +{ +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + pDIG_T pDM_DigTable=&pDM_Odm->DM_DigTable; + u1Byte digForBtHs=0; + u1Byte digUpBound=0x5a; + + if(pDM_Odm->bBtConnectProcess) + { + if(pDM_Odm->SupportICType&(ODM_RTL8723A)) + digForBtHs = 0x28; + else + digForBtHs = 0x22; + } + else + { + // + // Decide DIG value by BT HS RSSI. + // + digForBtHs = pDM_Odm->btHsRssi+4; + + //DIG Bound + if(pDM_Odm->SupportICType&(ODM_RTL8723A)) + digUpBound = 0x3e; + + if(digForBtHs > digUpBound) + digForBtHs = digUpBound; + if(digForBtHs < 0x1c) + digForBtHs = 0x1c; + + // update Current IGI + pDM_DigTable->BT30_CurIGI = digForBtHs; + } + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DigForBtHsMode() : set DigValue=0x%x\n", digForBtHs)); +#endif +} + + +//3============================================================ +//3 FASLE ALARM CHECK +//3============================================================ + +VOID +odm_FalseAlarmCounterStatistics( + IN PVOID pDM_VOID + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + PFALSE_ALARM_STATISTICS FalseAlmCnt = &(pDM_Odm->FalseAlmCnt); + u4Byte ret_value; + +#if (DM_ODM_SUPPORT_TYPE == ODM_AP) +//Mark there, and check this in odm_DMWatchDog +#if 0 //(DM_ODM_SUPPORT_TYPE == ODM_AP) + prtl8192cd_priv priv = pDM_Odm->priv; + if( (priv->auto_channel != 0) && (priv->auto_channel != 2) ) + return; +#endif +#endif + +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + if((pDM_Odm->SupportICType == ODM_RTL8192D) && + (*(pDM_Odm->pMacPhyMode)==ODM_DMSP)&& ////modify by Guo.Mingzhi 2011-12-29 + (!(*(pDM_Odm->pbMasterOfDMSP)))) + { + odm_FalseAlarmCounterStatistics_ForSlaveOfDMSP(pDM_Odm); + return; + } +#endif + + if(!(pDM_Odm->SupportAbility & ODM_BB_FA_CNT)) + return; + + if(pDM_Odm->SupportICType & ODM_IC_11N_SERIES) + { + + //hold ofdm counter + ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_HOLDC_11N, BIT31, 1); //hold page C counter + ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RSTD_11N, BIT31, 1); //hold page D counter + + ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_OFDM_FA_TYPE1_11N, bMaskDWord); + FalseAlmCnt->Cnt_Fast_Fsync = (ret_value&0xffff); + FalseAlmCnt->Cnt_SB_Search_fail = ((ret_value&0xffff0000)>>16); + + ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_OFDM_FA_TYPE2_11N, bMaskDWord); + FalseAlmCnt->Cnt_OFDM_CCA = (ret_value&0xffff); + FalseAlmCnt->Cnt_Parity_Fail = ((ret_value&0xffff0000)>>16); + + ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_OFDM_FA_TYPE3_11N, bMaskDWord); + FalseAlmCnt->Cnt_Rate_Illegal = (ret_value&0xffff); + FalseAlmCnt->Cnt_Crc8_fail = ((ret_value&0xffff0000)>>16); + + ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_OFDM_FA_TYPE4_11N, bMaskDWord); + FalseAlmCnt->Cnt_Mcs_fail = (ret_value&0xffff); + + FalseAlmCnt->Cnt_Ofdm_fail = FalseAlmCnt->Cnt_Parity_Fail + FalseAlmCnt->Cnt_Rate_Illegal + + FalseAlmCnt->Cnt_Crc8_fail + FalseAlmCnt->Cnt_Mcs_fail + + FalseAlmCnt->Cnt_Fast_Fsync + FalseAlmCnt->Cnt_SB_Search_fail; + +#if (RTL8188E_SUPPORT==1) + if(pDM_Odm->SupportICType == ODM_RTL8188E) + { + ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_SC_CNT_11N, bMaskDWord); + FalseAlmCnt->Cnt_BW_LSC = (ret_value&0xffff); + FalseAlmCnt->Cnt_BW_USC = ((ret_value&0xffff0000)>>16); + } +#endif + +#if (RTL8192D_SUPPORT==1) + if(pDM_Odm->SupportICType == ODM_RTL8192D) + { + odm_GetCCKFalseAlarm_92D(pDM_Odm); + } + else +#endif + { + //hold cck counter + ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT12, 1); + ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT14, 1); + + ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_CCK_FA_LSB_11N, bMaskByte0); + FalseAlmCnt->Cnt_Cck_fail = ret_value; + + ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_CCK_FA_MSB_11N, bMaskByte3); + FalseAlmCnt->Cnt_Cck_fail += (ret_value& 0xff)<<8; + + ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_CCK_CCA_CNT_11N, bMaskDWord); + FalseAlmCnt->Cnt_CCK_CCA = ((ret_value&0xFF)<<8) |((ret_value&0xFF00)>>8); + } + + FalseAlmCnt->Cnt_all = ( FalseAlmCnt->Cnt_Fast_Fsync + + FalseAlmCnt->Cnt_SB_Search_fail + + FalseAlmCnt->Cnt_Parity_Fail + + FalseAlmCnt->Cnt_Rate_Illegal + + FalseAlmCnt->Cnt_Crc8_fail + + FalseAlmCnt->Cnt_Mcs_fail + + FalseAlmCnt->Cnt_Cck_fail); + + FalseAlmCnt->Cnt_CCA_all = FalseAlmCnt->Cnt_OFDM_CCA + FalseAlmCnt->Cnt_CCK_CCA; + +#if (RTL8192C_SUPPORT==1) + if(pDM_Odm->SupportICType == ODM_RTL8192C) + odm_ResetFACounter_92C(pDM_Odm); +#endif + +#if (RTL8192D_SUPPORT==1) + if(pDM_Odm->SupportICType == ODM_RTL8192D) + odm_ResetFACounter_92D(pDM_Odm); +#endif + + if(pDM_Odm->SupportICType >=ODM_RTL8723A) + { + //reset false alarm counter registers + ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RSTC_11N, BIT31, 1); + ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RSTC_11N, BIT31, 0); + ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RSTD_11N, BIT27, 1); + ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RSTD_11N, BIT27, 0); + + //update ofdm counter + ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_HOLDC_11N, BIT31, 0); //update page C counter + ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RSTD_11N, BIT31, 0); //update page D counter + + //reset CCK CCA counter + ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT13|BIT12, 0); + ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT13|BIT12, 2); + //reset CCK FA counter + ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT15|BIT14, 0); + ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT15|BIT14, 2); + } + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Enter odm_FalseAlarmCounterStatistics\n")); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_Fast_Fsync=%d, Cnt_SB_Search_fail=%d\n", + FalseAlmCnt->Cnt_Fast_Fsync, FalseAlmCnt->Cnt_SB_Search_fail)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_Parity_Fail=%d, Cnt_Rate_Illegal=%d\n", + FalseAlmCnt->Cnt_Parity_Fail, FalseAlmCnt->Cnt_Rate_Illegal)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_Crc8_fail=%d, Cnt_Mcs_fail=%d\n", + FalseAlmCnt->Cnt_Crc8_fail, FalseAlmCnt->Cnt_Mcs_fail)); + } + else if(pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) + { + u4Byte CCKenable; + u4Byte Cnt_Ofdm_fail_temp = 0; + + //read OFDM FA counter + FalseAlmCnt->Cnt_Ofdm_fail = ODM_GetBBReg(pDM_Odm, ODM_REG_OFDM_FA_11AC, bMaskLWord); + FalseAlmCnt->Cnt_Cck_fail = ODM_GetBBReg(pDM_Odm, ODM_REG_CCK_FA_11AC, bMaskLWord); + + //read CCK/OFDM CCA counter + ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_CCK_CCA_CNT_11AC, bMaskDWord); + FalseAlmCnt->Cnt_OFDM_CCA = (ret_value & 0xffff0000) >> 16; + FalseAlmCnt->Cnt_CCK_CCA = ret_value & 0xffff; + + // For 8881A + if(pDM_Odm->SupportICType == ODM_RTL8881A) + { + if(FalseAlmCnt->Cnt_Ofdm_fail >= FalseAlmCnt->Cnt_Ofdm_fail_pre) + { + Cnt_Ofdm_fail_temp = FalseAlmCnt->Cnt_Ofdm_fail_pre; + FalseAlmCnt->Cnt_Ofdm_fail_pre = FalseAlmCnt->Cnt_Ofdm_fail; + FalseAlmCnt->Cnt_Ofdm_fail = FalseAlmCnt->Cnt_Ofdm_fail - Cnt_Ofdm_fail_temp; + } + else + FalseAlmCnt->Cnt_Ofdm_fail_pre = FalseAlmCnt->Cnt_Ofdm_fail; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_Ofdm_fail=%d\n", FalseAlmCnt->Cnt_Ofdm_fail_pre)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_Ofdm_fail_pre=%d\n", Cnt_Ofdm_fail_temp)); + + // Reset FA counter by enable/disable OFDM + if(FalseAlmCnt->Cnt_Ofdm_fail_pre >= 0x7fff) + { + // reset OFDM + ODM_SetBBReg(pDM_Odm, ODM_REG_BB_RX_PATH_11AC, BIT29,0); + ODM_SetBBReg(pDM_Odm, ODM_REG_BB_RX_PATH_11AC, BIT29,1); + FalseAlmCnt->Cnt_Ofdm_fail_pre = 0; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Reset false alarm counter\n")); + } + } + + // reset OFDM FA coutner + ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RST_11AC, BIT17, 1); + ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RST_11AC, BIT17, 0); + + // reset CCK FA counter + ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11AC, BIT15, 0); + ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11AC, BIT15, 1); + + // reset CCA counter + ODM_SetBBReg(pDM_Odm, ODM_REG_RST_RPT_11AC, BIT0, 1); + ODM_SetBBReg(pDM_Odm, ODM_REG_RST_RPT_11AC, BIT0, 0); + + CCKenable = ODM_GetBBReg(pDM_Odm, ODM_REG_BB_RX_PATH_11AC, BIT28); + if(CCKenable)//if(*pDM_Odm->pBandType == ODM_BAND_2_4G) + { + FalseAlmCnt->Cnt_all = FalseAlmCnt->Cnt_Ofdm_fail + FalseAlmCnt->Cnt_Cck_fail; + FalseAlmCnt->Cnt_CCA_all = FalseAlmCnt->Cnt_CCK_CCA + FalseAlmCnt->Cnt_OFDM_CCA; + } + else + { + FalseAlmCnt->Cnt_all = FalseAlmCnt->Cnt_Ofdm_fail; + FalseAlmCnt->Cnt_CCA_all = FalseAlmCnt->Cnt_OFDM_CCA; + } + + } + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_OFDM_CCA=%d\n", FalseAlmCnt->Cnt_OFDM_CCA)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_CCK_CCA=%d\n", FalseAlmCnt->Cnt_CCK_CCA)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_CCA_all=%d\n", FalseAlmCnt->Cnt_CCA_all)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_Ofdm_fail=%d\n", FalseAlmCnt->Cnt_Ofdm_fail)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_Cck_fail=%d\n", FalseAlmCnt->Cnt_Cck_fail)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_Ofdm_fail=%d\n", FalseAlmCnt->Cnt_Ofdm_fail)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Total False Alarm=%d\n", FalseAlmCnt->Cnt_all)); +} + + +VOID +odm_FAThresholdCheck( + IN PVOID pDM_VOID, + IN BOOLEAN bDFSBand, + IN BOOLEAN bPerformance, + IN u4Byte RxTp, + IN u4Byte TxTp, + OUT u4Byte* dm_FA_thres + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + + if(pDM_Odm->bLinked && (bPerformance||bDFSBand)) + { + if(pDM_Odm->SupportICType == ODM_RTL8192D) + { + // 8192D special case + dm_FA_thres[0] = DM_DIG_FA_TH0_92D; + dm_FA_thres[1] = DM_DIG_FA_TH1_92D; + dm_FA_thres[2] = DM_DIG_FA_TH2_92D; + } +#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + else if(pDM_Odm->SupportPlatform & (ODM_AP|ODM_ADSL)) + { + // For AP + if((RxTp>>2) > TxTp && RxTp < 10000 && RxTp > 500) // 10Mbps & 0.5Mbps + { + dm_FA_thres[0] = 0x080; + dm_FA_thres[1] = 0x100; + dm_FA_thres[2] = 0x200; + } + else + { + dm_FA_thres[0] = 0x100; + dm_FA_thres[1] = 0x200; + dm_FA_thres[2] = 0x300; + } + } +#else + else if(pDM_Odm->SupportICType == ODM_RTL8723A && pDM_Odm->bBtLimitedDig) + { + // 8723A BT special case + dm_FA_thres[0] = DM_DIG_FA_TH0; + dm_FA_thres[1] = 0x250; + dm_FA_thres[2] = 0x300; + } +#endif + else + { + // For NIC + dm_FA_thres[0] = DM_DIG_FA_TH0; + dm_FA_thres[1] = DM_DIG_FA_TH1; + dm_FA_thres[2] = DM_DIG_FA_TH2; + } + } + else + { +#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + if(bDFSBand) + { + // For DFS band and no link + dm_FA_thres[0] = 250; + dm_FA_thres[1] = 1000; + dm_FA_thres[2] = 2000; + } + else +#endif + { + dm_FA_thres[0] = 2000; + dm_FA_thres[1] = 4000; + dm_FA_thres[2] = 5000; + } + } + return; +} + +u1Byte +odm_ForbiddenIGICheck( + IN PVOID pDM_VOID, + IN u1Byte DIG_Dynamic_MIN, + IN u1Byte CurrentIGI + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; + PFALSE_ALARM_STATISTICS pFalseAlmCnt = &(pDM_Odm->FalseAlmCnt); + u1Byte rx_gain_range_min = pDM_DigTable->rx_gain_range_min; + + if(pFalseAlmCnt->Cnt_all > 10000) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Abnormally false alarm case. \n")); + + if(pDM_DigTable->LargeFAHit != 3) + pDM_DigTable->LargeFAHit++; + + if(pDM_DigTable->ForbiddenIGI < CurrentIGI)//if(pDM_DigTable->ForbiddenIGI < pDM_DigTable->CurIGValue) + { + pDM_DigTable->ForbiddenIGI = CurrentIGI;//pDM_DigTable->ForbiddenIGI = pDM_DigTable->CurIGValue; + pDM_DigTable->LargeFAHit = 1; + } + + if(pDM_DigTable->LargeFAHit >= 3) + { + if((pDM_DigTable->ForbiddenIGI + 2) > pDM_DigTable->rx_gain_range_max) + rx_gain_range_min = pDM_DigTable->rx_gain_range_max; + else + rx_gain_range_min = (pDM_DigTable->ForbiddenIGI + 2); + pDM_DigTable->Recover_cnt = 1800; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Abnormally false alarm case: Recover_cnt = %d \n", pDM_DigTable->Recover_cnt)); + } + } + else + { + if(pDM_DigTable->Recover_cnt != 0) + { + pDM_DigTable->Recover_cnt --; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Normal Case: Recover_cnt = %d \n", pDM_DigTable->Recover_cnt)); + } + else + { + if(pDM_DigTable->LargeFAHit < 3) + { + if((pDM_DigTable->ForbiddenIGI - 2) < DIG_Dynamic_MIN) //DM_DIG_MIN) + { + pDM_DigTable->ForbiddenIGI = DIG_Dynamic_MIN; //DM_DIG_MIN; + rx_gain_range_min = DIG_Dynamic_MIN; //DM_DIG_MIN; + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Normal Case: At Lower Bound\n")); + } + else + { + pDM_DigTable->ForbiddenIGI -= 2; + rx_gain_range_min = (pDM_DigTable->ForbiddenIGI + 2); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Normal Case: Approach Lower Bound\n")); + } + } + else + { + pDM_DigTable->LargeFAHit = 0; + } + } + } + + return rx_gain_range_min; + +} + +VOID +odm_InbandNoiseCalculate ( + IN PVOID pDM_VOID + ) +{ +#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; + u1Byte IGIBackup, TimeCnt = 0, ValidCnt = 0; + BOOLEAN bTimeout = TRUE; + s1Byte sNoise_A, sNoise_B; + s4Byte NoiseRpt_A = 0,NoiseRpt_B = 0; + u4Byte tmp = 0; + static u1Byte failCnt = 0; + + if(!(pDM_Odm->SupportICType & (ODM_RTL8192E))) + return; + + if(pDM_Odm->RFType == ODM_1T1R || *(pDM_Odm->pOnePathCCA) != ODM_CCA_2R) + return; + + if(!pDM_DigTable->bNoiseEst) + return; + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_InbandNoiseEstimate()========>\n")); + + //1 Set initial gain. + IGIBackup = pDM_DigTable->CurIGValue; + pDM_DigTable->IGIOffset_A = 0; + pDM_DigTable->IGIOffset_B = 0; + ODM_Write_DIG(pDM_Odm, 0x24); + + //1 Update idle time power report + if(pDM_Odm->SupportICType & ODM_IC_11N_SERIES) + ODM_SetBBReg(pDM_Odm, ODM_REG_TX_ANT_CTRL_11N, BIT25, 0x0); + + delay_ms(2); + + //1 Get noise power level + while(1) + { + //2 Read Noise Floor Report + if(pDM_Odm->SupportICType & ODM_IC_11N_SERIES) + tmp = ODM_GetBBReg(pDM_Odm, 0x8f8, bMaskLWord); + + sNoise_A = (s1Byte)(tmp & 0xff); + sNoise_B = (s1Byte)((tmp & 0xff00)>>8); + + //ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("sNoise_A = %d, sNoise_B = %d\n",sNoise_A, sNoise_B)); + + if((sNoise_A < 20 && sNoise_A >= -70) && (sNoise_B < 20 && sNoise_B >= -70)) + { + ValidCnt++; + NoiseRpt_A += sNoise_A; + NoiseRpt_B += sNoise_B; + //ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("sNoise_A = %d, sNoise_B = %d\n",sNoise_A, sNoise_B)); + } + + TimeCnt++; + bTimeout = (TimeCnt >= 150)?TRUE:FALSE; + + if(ValidCnt == 20 || bTimeout) + break; + + delay_ms(2); + + } + + //1 Keep idle time power report + if(pDM_Odm->SupportICType & ODM_IC_11N_SERIES) + ODM_SetBBReg(pDM_Odm, ODM_REG_TX_ANT_CTRL_11N, BIT25, 0x1); + + //1 Recover IGI + ODM_Write_DIG(pDM_Odm, IGIBackup); + + //1 Calculate Noise Floor + if(ValidCnt != 0) + { + NoiseRpt_A /= (ValidCnt<<1); + NoiseRpt_B /= (ValidCnt<<1); + } + + if(bTimeout) + { + NoiseRpt_A = 0; + NoiseRpt_B = 0; + + failCnt ++; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("Noise estimate fail time = %d\n", failCnt)); + + if(failCnt == 3) + { + failCnt = 0; + pDM_DigTable->bNoiseEst = FALSE; + } + } + else + { + NoiseRpt_A = -110 + 0x24 + NoiseRpt_A -6; + NoiseRpt_B = -110 + 0x24 + NoiseRpt_B -6; + pDM_DigTable->bNoiseEst = FALSE; + failCnt = 0; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("NoiseRpt_A = %d, NoiseRpt_B = %d\n", NoiseRpt_A, NoiseRpt_B)); + } + + //1 Calculate IGI Offset + if(NoiseRpt_A > NoiseRpt_B) + { + pDM_DigTable->IGIOffset_A = NoiseRpt_A - NoiseRpt_B; + pDM_DigTable->IGIOffset_B = 0; + } + else + { + pDM_DigTable->IGIOffset_A = 0; + pDM_DigTable->IGIOffset_B = NoiseRpt_B - NoiseRpt_A; + } + +#endif + return; +} + +//3============================================================ +//3 CCK Packet Detect Threshold +//3============================================================ + +VOID +odm_PauseCCKPacketDetection( + IN PVOID pDM_VOID, + IN ODM_Pause_CCKPD_TYPE PauseType, + IN u1Byte CCKPDThreshold +) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; + static BOOLEAN bPaused = FALSE; + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CCK_PD, ODM_DBG_LOUD, ("odm_PauseCCKPacketDetection()=========>\n")); + +#if (DM_ODM_SUPPORT_TYPE & ODM_WIN) + if(*pDM_DigTable->pbP2pLinkInProgress) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CCK_PD, ODM_DBG_LOUD, ("P2P in progress !!\n")); + return; + } +#endif + + if(!bPaused && (!(pDM_Odm->SupportAbility & ODM_BB_CCK_PD) || !(pDM_Odm->SupportAbility & ODM_BB_FA_CNT))) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CCK_PD, ODM_DBG_LOUD, ("Return: SupportAbility ODM_BB_CCK_PD or ODM_BB_FA_CNT is disabled\n")); + return; + } + + switch(PauseType) + { + //1 Pause CCK Packet Detection Threshold + case ODM_PAUSE_CCKPD: + //2 Disable DIG + ODM_CmnInfoUpdate(pDM_Odm, ODM_CMNINFO_ABILITY, pDM_Odm->SupportAbility & (~ODM_BB_CCK_PD)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CCK_PD, ODM_DBG_LOUD, ("Pause CCK packet detection threshold !!\n")); + + //2 Backup CCK Packet Detection Threshold value + if(!bPaused) + { + pDM_DigTable->CCKPDBackup = pDM_DigTable->CurCCK_CCAThres; + bPaused = TRUE; + } + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CCK_PD, ODM_DBG_LOUD, ("Backup CCK packet detection tgreshold = %d\n", pDM_DigTable->CCKPDBackup)); + + //2 Write new CCK Packet Detection Threshold value + ODM_Write_CCK_CCA_Thres(pDM_Odm, CCKPDThreshold); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CCK_PD, ODM_DBG_LOUD, ("Write new CCK packet detection tgreshold = %d\n", CCKPDThreshold)); + break; + + //1 Resume CCK Packet Detection Threshold + case ODM_RESUME_CCKPD: + if(bPaused) + { + //2 Write backup CCK Packet Detection Threshold value + ODM_Write_CCK_CCA_Thres(pDM_Odm, pDM_DigTable->CCKPDBackup); + bPaused = FALSE; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CCK_PD, ODM_DBG_LOUD, ("Write original CCK packet detection tgreshold = %d\n", pDM_DigTable->CCKPDBackup)); + + //2 Enable CCK Packet Detection Threshold + ODM_CmnInfoUpdate(pDM_Odm, ODM_CMNINFO_ABILITY, pDM_Odm->SupportAbility | ODM_BB_CCK_PD); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CCK_PD, ODM_DBG_LOUD, ("Resume CCK packet detection threshold !!\n")); + } + break; + + default: + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CCK_PD, ODM_DBG_LOUD, ("Wrong type !!\n")); + break; + } + return; +} + + +VOID +odm_CCKPacketDetectionThresh( + IN PVOID pDM_VOID + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + PFALSE_ALARM_STATISTICS FalseAlmCnt = &(pDM_Odm->FalseAlmCnt); + u1Byte CurCCK_CCAThres; + + +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) +//modify by Guo.Mingzhi 2011-12-29 + if (pDM_Odm->bDualMacSmartConcurrent == TRUE) +// if (pDM_Odm->bDualMacSmartConcurrent == FALSE) + return; + if(pDM_Odm->bBtHsOperation) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CCK_PD, ODM_DBG_LOUD, ("odm_CCKPacketDetectionThresh() write 0xcd for BT HS mode!!\n")); + ODM_Write_CCK_CCA_Thres(pDM_Odm, 0xcd); + return; + } +#endif + + if((!(pDM_Odm->SupportAbility & ODM_BB_CCK_PD)) ||(!(pDM_Odm->SupportAbility & ODM_BB_FA_CNT))) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CCK_PD, ODM_DBG_LOUD, ("odm_CCKPacketDetectionThresh() return==========\n")); + return; + } + +#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) + if(pDM_Odm->ExtLNA) + return; +#endif + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CCK_PD, ODM_DBG_LOUD, ("odm_CCKPacketDetectionThresh() ==========>\n")); + + if(pDM_Odm->bLinked) + { + if(pDM_Odm->RSSI_Min > 25) + CurCCK_CCAThres = 0xcd; + else if((pDM_Odm->RSSI_Min <= 25) && (pDM_Odm->RSSI_Min > 10)) + CurCCK_CCAThres = 0x83; + else + { + if(FalseAlmCnt->Cnt_Cck_fail > 1000) + CurCCK_CCAThres = 0x83; + else + CurCCK_CCAThres = 0x40; + } + } + else + { + if(FalseAlmCnt->Cnt_Cck_fail > 1000) + CurCCK_CCAThres = 0x83; + else + CurCCK_CCAThres = 0x40; + } + +#if (RTL8192D_SUPPORT==1) + if((pDM_Odm->SupportICType == ODM_RTL8192D) && (*pDM_Odm->pBandType == ODM_BAND_2_4G)) + ODM_Write_CCK_CCA_Thres_92D(pDM_Odm, CurCCK_CCAThres); + else +#endif + ODM_Write_CCK_CCA_Thres(pDM_Odm, CurCCK_CCAThres); + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CCK_PD, ODM_DBG_LOUD, ("odm_CCKPacketDetectionThresh() CurCCK_CCAThres = 0x%x\n",CurCCK_CCAThres)); +} + +VOID +ODM_Write_CCK_CCA_Thres( + IN PVOID pDM_VOID, + IN u1Byte CurCCK_CCAThres + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; + + if(pDM_DigTable->CurCCK_CCAThres!=CurCCK_CCAThres) //modify by Guo.Mingzhi 2012-01-03 + { + ODM_Write1Byte(pDM_Odm, ODM_REG(CCK_CCA,pDM_Odm), CurCCK_CCAThres); + } + pDM_DigTable->PreCCK_CCAThres = pDM_DigTable->CurCCK_CCAThres; + pDM_DigTable->CurCCK_CCAThres = CurCCK_CCAThres; +} + +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + +// <20130108, Kordan> E.g., With LNA used, we make the Rx power smaller to have a better EVM. (Asked by Willis) +VOID +odm_RFEControl( + IN PDM_ODM_T pDM_Odm, + IN u8Byte RSSIVal + ) +{ + PADAPTER Adapter = (PADAPTER)pDM_Odm->Adapter; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + static u1Byte TRSW_HighPwr = 0; + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("===> odm_RFEControl, RSSI = %d, TRSW_HighPwr = 0x%X, pHalData->RFEType = %d\n", + RSSIVal, TRSW_HighPwr, pHalData->RFEType )); + + if (pHalData->RFEType == 3) { + + pDM_Odm->RSSI_TRSW = RSSIVal; + + if (pDM_Odm->RSSI_TRSW >= pDM_Odm->RSSI_TRSW_H) + { + TRSW_HighPwr = 1; // Switch to + PHY_SetBBReg(Adapter, r_ANTSEL_SW_Jaguar, BIT1|BIT0, 0x1); // Set ANTSW=1/ANTSWB=0 for SW control + PHY_SetBBReg(Adapter, r_ANTSEL_SW_Jaguar, BIT9|BIT8, 0x3); // Set ANTSW=1/ANTSWB=0 for SW control + + } + else if (pDM_Odm->RSSI_TRSW <= pDM_Odm->RSSI_TRSW_L) + { + TRSW_HighPwr = 0; // Switched back + PHY_SetBBReg(Adapter, r_ANTSEL_SW_Jaguar, BIT1|BIT0, 0x1); // Set ANTSW=1/ANTSWB=0 for SW control + PHY_SetBBReg(Adapter, r_ANTSEL_SW_Jaguar, BIT9|BIT8, 0x0); // Set ANTSW=1/ANTSWB=0 for SW control + + } + } + + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("(pDM_Odm->RSSI_TRSW_H, pDM_Odm->RSSI_TRSW_L) = (%d, %d)\n", pDM_Odm->RSSI_TRSW_H, pDM_Odm->RSSI_TRSW_L)); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("(RSSIVal, RSSIVal, pDM_Odm->RSSI_TRSW_iso) = (%d, %d, %d)\n", + RSSIVal, pDM_Odm->RSSI_TRSW_iso, pDM_Odm->RSSI_TRSW)); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("<=== odm_RFEControl, RSSI = %d, TRSW_HighPwr = 0x%X\n", RSSIVal, TRSW_HighPwr)); +} + +VOID +odm_MPT_DIGWorkItemCallback( + IN PVOID pContext + ) +{ + PADAPTER Adapter = (PADAPTER)pContext; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + + ODM_MPT_DIG(pDM_Odm); +} + +VOID +odm_MPT_DIGCallback( + PRT_TIMER pTimer +) +{ + PADAPTER Adapter = (PADAPTER)pTimer->Adapter; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + + + #if DEV_BUS_TYPE==RT_PCI_INTERFACE + #if USE_WORKITEM + PlatformScheduleWorkItem(&pDM_Odm->MPT_DIGWorkitem); + #else + ODM_MPT_DIG(pDM_Odm); + #endif + #else + PlatformScheduleWorkItem(&pDM_Odm->MPT_DIGWorkitem); + #endif + +} + +#endif + +#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) +VOID +odm_MPT_DIGCallback( + IN PVOID pDM_VOID +) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; +#if USE_WORKITEM + PlatformScheduleWorkItem(&pDM_Odm->MPT_DIGWorkitem); +#else + ODM_MPT_DIG(pDM_Odm); +#endif +} +#endif + +#if (DM_ODM_SUPPORT_TYPE != ODM_CE) +VOID +odm_MPT_Write_DIG( + IN PVOID pDM_VOID, + IN u1Byte CurIGValue +) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; + + ODM_Write1Byte( pDM_Odm, ODM_REG(IGI_A,pDM_Odm), CurIGValue); + + if(pDM_Odm->RFType > ODM_1T1R) + ODM_Write1Byte( pDM_Odm, ODM_REG(IGI_B,pDM_Odm), CurIGValue); + + if((pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) && (pDM_Odm->RFType > ODM_2T2R)) + { + ODM_Write1Byte( pDM_Odm, ODM_REG(IGI_C,pDM_Odm), CurIGValue); + ODM_Write1Byte( pDM_Odm, ODM_REG(IGI_D,pDM_Odm), CurIGValue); + } + + pDM_DigTable->CurIGValue = CurIGValue; + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("CurIGValue = 0x%x\n", CurIGValue)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("pDM_Odm->RFType = 0x%x\n", pDM_Odm->RFType)); +} + +VOID +ODM_MPT_DIG( + IN PVOID pDM_VOID + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; + PFALSE_ALARM_STATISTICS pFalseAlmCnt = &pDM_Odm->FalseAlmCnt; + u1Byte CurrentIGI = pDM_DigTable->CurIGValue; + u1Byte DIG_Upper = 0x40, DIG_Lower = 0x20; + u4Byte RXOK_cal; + u4Byte RxPWDBAve_final; + u1Byte IGI_A = 0x20, IGI_B = 0x20; + +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + + #if ODM_FIX_2G_DIG + IGI_A = 0x22; + IGI_B = 0x24; + #endif + +#else + if (!(pDM_Odm->priv->pshare->rf_ft_var.mp_specific && pDM_Odm->priv->pshare->mp_dig_on)) + return; + + if (*pDM_Odm->pBandType == ODM_BAND_5G) + DIG_Lower = 0x22; +#endif + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("===> ODM_MPT_DIG, pBandType = %d\n", *pDM_Odm->pBandType)); + +#if (ODM_FIX_2G_DIG || (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))) + if (*pDM_Odm->pBandType == ODM_BAND_5G || (pDM_Odm->SupportICType & ODM_RTL8814A)) // for 5G or 8814 +#else + if (1) // for both 2G/5G +#endif + { + odm_FalseAlarmCounterStatistics(pDM_Odm); + + RXOK_cal = pDM_Odm->PhyDbgInfo.NumQryPhyStatusCCK + pDM_Odm->PhyDbgInfo.NumQryPhyStatusOFDM; + RxPWDBAve_final = (RXOK_cal != 0)?pDM_Odm->RxPWDBAve/RXOK_cal:0; + + pDM_Odm->PhyDbgInfo.NumQryPhyStatusCCK = 0; + pDM_Odm->PhyDbgInfo.NumQryPhyStatusOFDM = 0; + pDM_Odm->RxPWDBAve = 0; + pDM_Odm->MPDIG_2G = FALSE; + +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + pDM_Odm->Times_2G = 0; +#endif + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("RX OK = %d\n", RXOK_cal)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("RSSI = %d\n", RxPWDBAve_final)); + + if (RXOK_cal >= 70 && RxPWDBAve_final <= 40) + { + if (CurrentIGI > 0x24) + odm_MPT_Write_DIG(pDM_Odm, 0x24); + } + else + { + if(pFalseAlmCnt->Cnt_all > 1000){ + CurrentIGI = CurrentIGI + 8; + } + else if(pFalseAlmCnt->Cnt_all > 200){ + CurrentIGI = CurrentIGI + 4; + } + else if (pFalseAlmCnt->Cnt_all > 50){ + CurrentIGI = CurrentIGI + 2; + } + else if (pFalseAlmCnt->Cnt_all < 2){ + CurrentIGI = CurrentIGI - 2; + } + + if (CurrentIGI < DIG_Lower ){ + CurrentIGI = DIG_Lower; + } + + if(CurrentIGI > DIG_Upper){ + CurrentIGI = DIG_Upper; + } + + odm_MPT_Write_DIG(pDM_Odm, CurrentIGI); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("DIG = 0x%x, Cnt_all = %d, Cnt_Ofdm_fail = %d, Cnt_Cck_fail = %d\n", + CurrentIGI, pFalseAlmCnt->Cnt_all, pFalseAlmCnt->Cnt_Ofdm_fail, pFalseAlmCnt->Cnt_Cck_fail)); + } + } + else + { + if(pDM_Odm->MPDIG_2G == FALSE) + { + if((pDM_Odm->SupportPlatform & ODM_WIN) && !(pDM_Odm->SupportICType & ODM_RTL8814A)) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("===> Fix IGI\n")); + ODM_Write1Byte( pDM_Odm, ODM_REG(IGI_A,pDM_Odm), IGI_A); + ODM_Write1Byte( pDM_Odm, ODM_REG(IGI_B,pDM_Odm), IGI_B); + pDM_DigTable->CurIGValue = IGI_B; + } + else + odm_MPT_Write_DIG(pDM_Odm, IGI_A); + } + +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + pDM_Odm->Times_2G++; + + if (pDM_Odm->Times_2G == 3) +#endif + { + pDM_Odm->MPDIG_2G = TRUE; + } + } + +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + if (pDM_Odm->SupportICType == ODM_RTL8812) + odm_RFEControl(pDM_Odm, RxPWDBAve_final); +#endif + + ODM_SetTimer(pDM_Odm, &pDM_Odm->MPT_DIGTimer, 700); +} +#endif diff --git a/hal/OUTSRC/odm_DIG.h b/hal/OUTSRC/odm_DIG.h new file mode 100644 index 0000000..3a63844 --- /dev/null +++ b/hal/OUTSRC/odm_DIG.h @@ -0,0 +1,339 @@ +/****************************************************************************** + * + * 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 __ODMDIG_H__ +#define __ODMDIG_H__ + +typedef struct _Dynamic_Initial_Gain_Threshold_ +{ + BOOLEAN bStopDIG; // for debug + BOOLEAN bPauseDIG; + BOOLEAN bIgnoreDIG; + BOOLEAN bPSDInProgress; + + u1Byte Dig_Enable_Flag; + u1Byte Dig_Ext_Port_Stage; + + int RssiLowThresh; + int RssiHighThresh; + + u4Byte FALowThresh; + u4Byte FAHighThresh; + + u1Byte CurSTAConnectState; + u1Byte PreSTAConnectState; + u1Byte CurMultiSTAConnectState; + + u1Byte PreIGValue; + u1Byte CurIGValue; + u1Byte BackupIGValue; //MP DIG + u1Byte BT30_CurIGI; + u1Byte IGIBackup; + + s1Byte BackoffVal; + s1Byte BackoffVal_range_max; + s1Byte BackoffVal_range_min; + u1Byte rx_gain_range_max; + u1Byte rx_gain_range_min; + u1Byte Rssi_val_min; + + u1Byte PreCCK_CCAThres; + u1Byte CurCCK_CCAThres; + u1Byte PreCCKPDState; + u1Byte CurCCKPDState; + u1Byte CCKPDBackup; + + u1Byte LargeFAHit; + u1Byte ForbiddenIGI; + u4Byte Recover_cnt; + + u1Byte DIG_Dynamic_MIN_0; + u1Byte DIG_Dynamic_MIN_1; + BOOLEAN bMediaConnect_0; + BOOLEAN bMediaConnect_1; + + u4Byte AntDiv_RSSI_max; + u4Byte RSSI_max; + + u1Byte *pbP2pLinkInProgress; + +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + BOOLEAN bTpTarget; + BOOLEAN bNoiseEst; + u4Byte TpTrainTH_min; + u1Byte IGIOffset_A; + u1Byte IGIOffset_B; +#endif +}DIG_T,*pDIG_T; + +typedef struct _FALSE_ALARM_STATISTICS{ + u4Byte Cnt_Parity_Fail; + u4Byte Cnt_Rate_Illegal; + u4Byte Cnt_Crc8_fail; + u4Byte Cnt_Mcs_fail; + u4Byte Cnt_Ofdm_fail; + u4Byte Cnt_Ofdm_fail_pre; //For RTL8881A + u4Byte Cnt_Cck_fail; + u4Byte Cnt_all; + u4Byte Cnt_Fast_Fsync; + u4Byte Cnt_SB_Search_fail; + u4Byte Cnt_OFDM_CCA; + u4Byte Cnt_CCK_CCA; + u4Byte Cnt_CCA_all; + u4Byte Cnt_BW_USC; //Gary + u4Byte Cnt_BW_LSC; //Gary +}FALSE_ALARM_STATISTICS, *PFALSE_ALARM_STATISTICS; + +typedef enum tag_Dynamic_Init_Gain_Operation_Type_Definition +{ + DIG_TYPE_THRESH_HIGH = 0, + DIG_TYPE_THRESH_LOW = 1, + DIG_TYPE_BACKOFF = 2, + DIG_TYPE_RX_GAIN_MIN = 3, + DIG_TYPE_RX_GAIN_MAX = 4, + DIG_TYPE_ENABLE = 5, + DIG_TYPE_DISABLE = 6, + DIG_OP_TYPE_MAX +}DM_DIG_OP_E; + +typedef enum tag_ODM_PauseDIG_Type { + ODM_PAUSE_DIG = BIT0, + ODM_RESUME_DIG = BIT1 +} ODM_Pause_DIG_TYPE; + +typedef enum tag_ODM_PauseCCKPD_Type { + ODM_PAUSE_CCKPD = BIT0, + ODM_RESUME_CCKPD = BIT1 +} ODM_Pause_CCKPD_TYPE; + +/* +typedef enum tag_CCK_Packet_Detection_Threshold_Type_Definition +{ + CCK_PD_STAGE_LowRssi = 0, + CCK_PD_STAGE_HighRssi = 1, + CCK_PD_STAGE_MAX = 3, +}DM_CCK_PDTH_E; + +typedef enum tag_DIG_EXT_PORT_ALGO_Definition +{ + DIG_EXT_PORT_STAGE_0 = 0, + DIG_EXT_PORT_STAGE_1 = 1, + DIG_EXT_PORT_STAGE_2 = 2, + DIG_EXT_PORT_STAGE_3 = 3, + DIG_EXT_PORT_STAGE_MAX = 4, +}DM_DIG_EXT_PORT_ALG_E; + +typedef enum tag_DIG_Connect_Definition +{ + DIG_STA_DISCONNECT = 0, + DIG_STA_CONNECT = 1, + DIG_STA_BEFORE_CONNECT = 2, + DIG_MultiSTA_DISCONNECT = 3, + DIG_MultiSTA_CONNECT = 4, + DIG_CONNECT_MAX +}DM_DIG_CONNECT_E; + + +#define DM_MultiSTA_InitGainChangeNotify(Event) {DM_DigTable.CurMultiSTAConnectState = Event;} + +#define DM_MultiSTA_InitGainChangeNotify_CONNECT(_ADAPTER) \ + DM_MultiSTA_InitGainChangeNotify(DIG_MultiSTA_CONNECT) + +#define DM_MultiSTA_InitGainChangeNotify_DISCONNECT(_ADAPTER) \ + DM_MultiSTA_InitGainChangeNotify(DIG_MultiSTA_DISCONNECT) +*/ +#define DM_DIG_THRESH_HIGH 40 +#define DM_DIG_THRESH_LOW 35 + +#define DM_FALSEALARM_THRESH_LOW 400 +#define DM_FALSEALARM_THRESH_HIGH 1000 + +#define DM_DIG_MAX_NIC 0x3e +#define DM_DIG_MIN_NIC 0x1e //0x22//0x1c +#define DM_DIG_MAX_OF_MIN_NIC 0x3e + +#define DM_DIG_MAX_AP 0x3e +#define DM_DIG_MIN_AP 0x1c +#define DM_DIG_MAX_OF_MIN 0x2A //0x32 +#define DM_DIG_MIN_AP_DFS 0x20 + +#define DM_DIG_MAX_NIC_HP 0x46 +#define DM_DIG_MIN_NIC_HP 0x2e + +#define DM_DIG_MAX_AP_HP 0x42 +#define DM_DIG_MIN_AP_HP 0x30 + +#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) +#define DM_DIG_MAX_AP_COVERAGR 0x26 +#define DM_DIG_MIN_AP_COVERAGE 0x1c +#define DM_DIG_MAX_OF_MIN_COVERAGE 0x22 + +#define DM_DIG_TP_Target_TH0 500 +#define DM_DIG_TP_Target_TH1 1000 +#define DM_DIG_TP_Training_Period 10 +#endif + +//vivi 92c&92d has different definition, 20110504 +//this is for 92c +#if (DM_ODM_SUPPORT_TYPE & ODM_CE) + #ifdef CONFIG_SPECIAL_SETTING_FOR_FUNAI_TV + #define DM_DIG_FA_TH0 0x80//0x20 + #else + #define DM_DIG_FA_TH0 0x200//0x20 + #endif +#else + #define DM_DIG_FA_TH0 0x200//0x20 +#endif + +#define DM_DIG_FA_TH1 0x300 +#define DM_DIG_FA_TH2 0x400 +//this is for 92d +#define DM_DIG_FA_TH0_92D 0x100 +#define DM_DIG_FA_TH1_92D 0x400 +#define DM_DIG_FA_TH2_92D 0x600 + +#define DM_DIG_BACKOFF_MAX 12 +#define DM_DIG_BACKOFF_MIN -4 +#define DM_DIG_BACKOFF_DEFAULT 10 + +#define DM_DIG_FA_TH0_LPS 4 //-> 4 in lps +#define DM_DIG_FA_TH1_LPS 15 //-> 15 lps +#define DM_DIG_FA_TH2_LPS 30 //-> 30 lps +#define RSSI_OFFSET_DIG 0x05 + +VOID +ODM_ChangeDynamicInitGainThresh( + IN PVOID pDM_VOID, + IN u4Byte DM_Type, + IN u4Byte DM_Value + ); + +VOID +ODM_Write_DIG( + IN PVOID pDM_VOID, + IN u1Byte CurrentIGI + ); + +VOID +odm_PauseDIG( + IN PVOID pDM_VOID, + IN ODM_Pause_DIG_TYPE PauseType, + IN u1Byte IGIValue + ); + +VOID +odm_DIGInit( + IN PVOID pDM_VOID + ); + +VOID +odm_DIG( + IN PVOID pDM_VOID + ); + +VOID +odm_DIGbyRSSI_LPS( + IN PVOID pDM_VOID + ); + +VOID +odm_DigForBtHsMode( + IN PVOID pDM_VOID + ); + +VOID +odm_FalseAlarmCounterStatistics( + IN PVOID pDM_VOID + ); + +VOID +odm_FAThresholdCheck( + IN PVOID pDM_VOID, + IN BOOLEAN bDFSBand, + IN BOOLEAN bPerformance, + IN u4Byte RxTp, + IN u4Byte TxTp, + OUT u4Byte* dm_FA_thres + ); + +u1Byte +odm_ForbiddenIGICheck( + IN PVOID pDM_VOID, + IN u1Byte DIG_Dynamic_MIN, + IN u1Byte CurrentIGI + ); + +VOID +odm_InbandNoiseCalculate ( + IN PVOID pDM_VOID + ); + +BOOLEAN +odm_DigAbort( + IN PVOID pDM_VOID + ); + +VOID +odm_PauseCCKPacketDetection( + IN PVOID pDM_VOID, + IN ODM_Pause_CCKPD_TYPE PauseType, + IN u1Byte CCKPDThreshold + ); + +VOID +odm_CCKPacketDetectionThresh( + IN PVOID pDM_VOID + ); + +VOID +ODM_Write_CCK_CCA_Thres( + IN PVOID pDM_VOID, + IN u1Byte CurCCK_CCAThres + ); + +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) +VOID +odm_MPT_DIGCallback( + PRT_TIMER pTimer +); + +VOID +odm_MPT_DIGWorkItemCallback( + IN PVOID pContext + ); + +#endif + +#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) +VOID +odm_MPT_DIGCallback( + IN PVOID pDM_VOID +); +#endif + +#if (DM_ODM_SUPPORT_TYPE != ODM_CE) +VOID +ODM_MPT_DIG( + IN PVOID pDM_VOID +); +#endif + + +#endif diff --git a/hal/OUTSRC/odm_DynamicBBPowerSaving.c b/hal/OUTSRC/odm_DynamicBBPowerSaving.c new file mode 100644 index 0000000..f3a6bae --- /dev/null +++ b/hal/OUTSRC/odm_DynamicBBPowerSaving.c @@ -0,0 +1,218 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA + * + * + ******************************************************************************/ + +//============================================================ +// include files +//============================================================ +#include "Mp_Precomp.h" +#include "odm_precomp.h" + +VOID +odm_DynamicBBPowerSavingInit( + IN PVOID pDM_VOID + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + pPS_T pDM_PSTable = &pDM_Odm->DM_PSTable; + + pDM_PSTable->PreCCAState = CCA_MAX; + pDM_PSTable->CurCCAState = CCA_MAX; + pDM_PSTable->PreRFState = RF_MAX; + pDM_PSTable->CurRFState = RF_MAX; + pDM_PSTable->Rssi_val_min = 0; + pDM_PSTable->initialize = 0; +} + + +VOID +odm_DynamicBBPowerSaving( + IN PVOID pDM_VOID + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; +#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) + + if (pDM_Odm->SupportICType != ODM_RTL8723A) + return; + if(!(pDM_Odm->SupportAbility & ODM_BB_PWR_SAVE)) + return; + if(!(pDM_Odm->SupportPlatform & (ODM_WIN|ODM_CE))) + return; + + //1 2.Power Saving for 92C + if((pDM_Odm->SupportICType == ODM_RTL8192C) &&(pDM_Odm->RFType == ODM_2T2R)) + { + odm_1R_CCA(pDM_Odm); + } + + // 20100628 Joseph: Turn off BB power save for 88CE because it makesthroughput unstable. + // 20100831 Joseph: Turn ON BB power save again after modifying AGC delay from 900ns ot 600ns. + //1 3.Power Saving for 88C + else + { + ODM_RF_Saving(pDM_Odm, FALSE); + } +#endif // #if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + +} + +VOID +odm_1R_CCA( + IN PVOID pDM_VOID + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + pPS_T pDM_PSTable = &pDM_Odm->DM_PSTable; + + if(pDM_Odm->RSSI_Min!= 0xFF) + { + + if(pDM_PSTable->PreCCAState == CCA_2R) + { + if(pDM_Odm->RSSI_Min >= 35) + pDM_PSTable->CurCCAState = CCA_1R; + else + pDM_PSTable->CurCCAState = CCA_2R; + + } + else{ + if(pDM_Odm->RSSI_Min <= 30) + pDM_PSTable->CurCCAState = CCA_2R; + else + pDM_PSTable->CurCCAState = CCA_1R; + } + } + else{ + pDM_PSTable->CurCCAState=CCA_MAX; + } + + if(pDM_PSTable->PreCCAState != pDM_PSTable->CurCCAState) + { + if(pDM_PSTable->CurCCAState == CCA_1R) + { + if( pDM_Odm->RFType ==ODM_2T2R ) + { + ODM_SetBBReg(pDM_Odm, 0xc04 , bMaskByte0, 0x13); + //PHY_SetBBReg(pAdapter, 0xe70, bMaskByte3, 0x20); + } + else + { + ODM_SetBBReg(pDM_Odm, 0xc04 , bMaskByte0, 0x23); + //PHY_SetBBReg(pAdapter, 0xe70, 0x7fc00000, 0x10c); // Set RegE70[30:22] = 9b'100001100 + } + } + else + { + ODM_SetBBReg(pDM_Odm, 0xc04 , bMaskByte0, 0x33); + //PHY_SetBBReg(pAdapter,0xe70, bMaskByte3, 0x63); + } + pDM_PSTable->PreCCAState = pDM_PSTable->CurCCAState; + } +} + +void +ODM_RF_Saving( + IN PVOID pDM_VOID, + IN u1Byte bForceInNormal + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; +#if (DM_ODM_SUPPORT_TYPE != ODM_AP) + pPS_T pDM_PSTable = &pDM_Odm->DM_PSTable; + u1Byte Rssi_Up_bound = 30 ; + u1Byte Rssi_Low_bound = 25; +#if (DM_ODM_SUPPORT_TYPE == ODM_CE) + if(pDM_Odm->PatchID == 40 ) //RT_CID_819x_FUNAI_TV + { + Rssi_Up_bound = 50 ; + Rssi_Low_bound = 45; + } +#endif + if(pDM_PSTable->initialize == 0){ + + pDM_PSTable->Reg874 = (ODM_GetBBReg(pDM_Odm, 0x874, bMaskDWord)&0x1CC000)>>14; + pDM_PSTable->RegC70 = (ODM_GetBBReg(pDM_Odm, 0xc70, bMaskDWord)&BIT3)>>3; + pDM_PSTable->Reg85C = (ODM_GetBBReg(pDM_Odm, 0x85c, bMaskDWord)&0xFF000000)>>24; + pDM_PSTable->RegA74 = (ODM_GetBBReg(pDM_Odm, 0xa74, bMaskDWord)&0xF000)>>12; + //Reg818 = PHY_QueryBBReg(pAdapter, 0x818, bMaskDWord); + pDM_PSTable->initialize = 1; + } + + if(!bForceInNormal) + { + if(pDM_Odm->RSSI_Min != 0xFF) + { + if(pDM_PSTable->PreRFState == RF_Normal) + { + if(pDM_Odm->RSSI_Min >= Rssi_Up_bound) + pDM_PSTable->CurRFState = RF_Save; + else + pDM_PSTable->CurRFState = RF_Normal; + } + else{ + if(pDM_Odm->RSSI_Min <= Rssi_Low_bound) + pDM_PSTable->CurRFState = RF_Normal; + else + pDM_PSTable->CurRFState = RF_Save; + } + } + else + pDM_PSTable->CurRFState=RF_MAX; + } + else + { + pDM_PSTable->CurRFState = RF_Normal; + } + + if(pDM_PSTable->PreRFState != pDM_PSTable->CurRFState) + { + if(pDM_PSTable->CurRFState == RF_Save) + { + // 8723 RSSI report will be wrong. Set 0x874[5]=1 when enter BB power saving mode. + // Suggested by SD3 Yu-Nan. 2011.01.20. + if(pDM_Odm->SupportICType == ODM_RTL8723A) + { + ODM_SetBBReg(pDM_Odm, 0x874 , BIT5, 0x1); //Reg874[5]=1b'1 + } + ODM_SetBBReg(pDM_Odm, 0x874 , 0x1C0000, 0x2); //Reg874[20:18]=3'b010 + ODM_SetBBReg(pDM_Odm, 0xc70, BIT3, 0); //RegC70[3]=1'b0 + ODM_SetBBReg(pDM_Odm, 0x85c, 0xFF000000, 0x63); //Reg85C[31:24]=0x63 + ODM_SetBBReg(pDM_Odm, 0x874, 0xC000, 0x2); //Reg874[15:14]=2'b10 + ODM_SetBBReg(pDM_Odm, 0xa74, 0xF000, 0x3); //RegA75[7:4]=0x3 + ODM_SetBBReg(pDM_Odm, 0x818, BIT28, 0x0); //Reg818[28]=1'b0 + ODM_SetBBReg(pDM_Odm, 0x818, BIT28, 0x1); //Reg818[28]=1'b1 + } + else + { + ODM_SetBBReg(pDM_Odm, 0x874 , 0x1CC000, pDM_PSTable->Reg874); + ODM_SetBBReg(pDM_Odm, 0xc70, BIT3, pDM_PSTable->RegC70); + ODM_SetBBReg(pDM_Odm, 0x85c, 0xFF000000, pDM_PSTable->Reg85C); + ODM_SetBBReg(pDM_Odm, 0xa74, 0xF000, pDM_PSTable->RegA74); + ODM_SetBBReg(pDM_Odm,0x818, BIT28, 0x0); + + if(pDM_Odm->SupportICType == ODM_RTL8723A) + { + ODM_SetBBReg(pDM_Odm,0x874 , BIT5, 0x0); //Reg874[5]=1b'0 + } + } + pDM_PSTable->PreRFState =pDM_PSTable->CurRFState; + } +#endif +} \ No newline at end of file diff --git a/hal/OUTSRC/odm_DynamicBBPowerSaving.h b/hal/OUTSRC/odm_DynamicBBPowerSaving.h new file mode 100644 index 0000000..2fdcd6e --- /dev/null +++ b/hal/OUTSRC/odm_DynamicBBPowerSaving.h @@ -0,0 +1,61 @@ +/****************************************************************************** + * + * 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 __ODMDYNAMICBBPOWERSAVING_H__ +#define __ODMDYNAMICBBPOWERSAVING_H__ + +typedef struct _Dynamic_Power_Saving_ +{ + u1Byte PreCCAState; + u1Byte CurCCAState; + + u1Byte PreRFState; + u1Byte CurRFState; + + int Rssi_val_min; + + u1Byte initialize; + u4Byte Reg874,RegC70,Reg85C,RegA74; + +}PS_T,*pPS_T; + +#define dm_RF_Saving ODM_RF_Saving + +void ODM_RF_Saving( + IN PVOID pDM_VOID, + IN u1Byte bForceInNormal + ); + +VOID +odm_DynamicBBPowerSavingInit( + IN PVOID pDM_VOID + ); + +VOID +odm_DynamicBBPowerSaving( + IN PVOID pDM_VOID + ); + +VOID +odm_1R_CCA( + IN PVOID pDM_VOID + ); + +#endif \ No newline at end of file diff --git a/hal/OUTSRC/odm_DynamicTxPower.c b/hal/OUTSRC/odm_DynamicTxPower.c new file mode 100644 index 0000000..96716d2 --- /dev/null +++ b/hal/OUTSRC/odm_DynamicTxPower.c @@ -0,0 +1,882 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA + * + * + ******************************************************************************/ + +//============================================================ +// include files +//============================================================ +#include "Mp_Precomp.h" +#include "odm_precomp.h" + +VOID +odm_DynamicTxPowerInit( + IN PVOID pDM_VOID + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + PADAPTER Adapter = pDM_Odm->Adapter; + PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + + #if DEV_BUS_TYPE==RT_USB_INTERFACE + if(RT_GetInterfaceSelection(Adapter) == INTF_SEL1_USB_High_Power) + { + odm_DynamicTxPowerSavePowerIndex(pDM_Odm); + pMgntInfo->bDynamicTxPowerEnable = TRUE; + } + else + #else + //so 92c pci do not need dynamic tx power? vivi check it later + if(IS_HARDWARE_TYPE_8192D(Adapter)) + pMgntInfo->bDynamicTxPowerEnable = TRUE; + else + pMgntInfo->bDynamicTxPowerEnable = FALSE; + #endif + + + pHalData->LastDTPLvl = TxHighPwrLevel_Normal; + pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; +#elif (DM_ODM_SUPPORT_TYPE == ODM_CE) + PADAPTER Adapter = pDM_Odm->Adapter; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + struct dm_priv *pdmpriv = &pHalData->dmpriv; + pdmpriv->bDynamicTxPowerEnable = _FALSE; + + #if (RTL8192C_SUPPORT==1) + #ifdef CONFIG_USB_HCI + + #ifdef CONFIG_INTEL_PROXIM + if((pHalData->BoardType == BOARD_USB_High_PA)||(Adapter->proximity.proxim_support==_TRUE)) + #else + if(pHalData->BoardType == BOARD_USB_High_PA) + #endif + + { + //odm_SavePowerIndex(Adapter); + odm_DynamicTxPowerSavePowerIndex(pDM_Odm); + pdmpriv->bDynamicTxPowerEnable = _TRUE; + } + else + #else + pdmpriv->bDynamicTxPowerEnable = _FALSE; + #endif + #endif + + pdmpriv->LastDTPLvl = TxHighPwrLevel_Normal; + pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; + +#endif + +} + +VOID +odm_DynamicTxPowerSavePowerIndex( + IN PVOID pDM_VOID + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; +#if (DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_WIN)) + u1Byte index; + u4Byte Power_Index_REG[6] = {0xc90, 0xc91, 0xc92, 0xc98, 0xc99, 0xc9a}; + +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + PADAPTER Adapter = pDM_Odm->Adapter; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + for(index = 0; index< 6; index++) + pHalData->PowerIndex_backup[index] = PlatformEFIORead1Byte(Adapter, Power_Index_REG[index]); +#elif (DM_ODM_SUPPORT_TYPE == ODM_CE) + PADAPTER Adapter = pDM_Odm->Adapter; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + struct dm_priv *pdmpriv = &pHalData->dmpriv; + for(index = 0; index< 6; index++) + pdmpriv->PowerIndex_backup[index] = rtw_read8(Adapter, Power_Index_REG[index]); +#endif +#endif +} + +VOID +odm_DynamicTxPowerRestorePowerIndex( + IN PVOID pDM_VOID + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; +#if (DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_WIN)) + u1Byte index; + PADAPTER Adapter = pDM_Odm->Adapter; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + u4Byte Power_Index_REG[6] = {0xc90, 0xc91, 0xc92, 0xc98, 0xc99, 0xc9a}; +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + for(index = 0; index< 6; index++) + PlatformEFIOWrite1Byte(Adapter, Power_Index_REG[index], pHalData->PowerIndex_backup[index]); +#elif(DM_ODM_SUPPORT_TYPE == ODM_CE) + struct dm_priv *pdmpriv = &pHalData->dmpriv; + for(index = 0; index< 6; index++) + rtw_write8(Adapter, Power_Index_REG[index], pdmpriv->PowerIndex_backup[index]); +#endif +#endif +} + +VOID +odm_DynamicTxPowerWritePowerIndex( + IN PVOID pDM_VOID, + IN u1Byte Value) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + u1Byte index; + u4Byte Power_Index_REG[6] = {0xc90, 0xc91, 0xc92, 0xc98, 0xc99, 0xc9a}; + + for(index = 0; index< 6; index++) + //PlatformEFIOWrite1Byte(Adapter, Power_Index_REG[index], Value); + ODM_Write1Byte(pDM_Odm, Power_Index_REG[index], Value); + +} + + +VOID +odm_DynamicTxPower( + IN PVOID pDM_VOID + ) +{ + // + // For AP/ADSL use prtl8192cd_priv + // For CE/NIC use PADAPTER + // + //PADAPTER pAdapter = pDM_Odm->Adapter; +// prtl8192cd_priv priv = pDM_Odm->priv; + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + if (!(pDM_Odm->SupportAbility & ODM_BB_DYNAMIC_TXPWR)) + return; + // + // 2011/09/29 MH In HW integration first stage, we provide 4 different handle to operate + // at the same time. In the stage2/3, we need to prive universal interface and merge all + // HW dynamic mechanism. + // + switch (pDM_Odm->SupportPlatform) + { + case ODM_WIN: + case ODM_CE: + odm_DynamicTxPowerNIC(pDM_Odm); + break; + case ODM_AP: + odm_DynamicTxPowerAP(pDM_Odm); + break; + + case ODM_ADSL: + //odm_DIGAP(pDM_Odm); + break; + } + + +} + + +VOID +odm_DynamicTxPowerNIC( + IN PVOID pDM_VOID + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + + if (!(pDM_Odm->SupportAbility & ODM_BB_DYNAMIC_TXPWR)) + return; + +#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) + + if(pDM_Odm->SupportICType == ODM_RTL8192C) + { + odm_DynamicTxPower_92C(pDM_Odm); + } + else if(pDM_Odm->SupportICType == ODM_RTL8192D) + { + odm_DynamicTxPower_92D(pDM_Odm); + } + else if (pDM_Odm->SupportICType == ODM_RTL8821) + { +#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN)) + PADAPTER Adapter = pDM_Odm->Adapter; + PMGNT_INFO pMgntInfo = GetDefaultMgntInfo(Adapter); + + if (pMgntInfo->RegRspPwr == 1) + { + if(pDM_Odm->RSSI_Min > 60) + { + ODM_SetMACReg(pDM_Odm, ODM_REG_RESP_TX_11AC, BIT20|BIT19|BIT18, 1); // Resp TXAGC offset = -3dB + + } + else if(pDM_Odm->RSSI_Min < 55) + { + ODM_SetMACReg(pDM_Odm, ODM_REG_RESP_TX_11AC, BIT20|BIT19|BIT18, 0); // Resp TXAGC offset = 0dB + } + } +#endif + } +#endif +} + +VOID +odm_DynamicTxPowerAP( + IN PVOID pDM_VOID + + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; +#if (DM_ODM_SUPPORT_TYPE == ODM_AP) + +//#if ((RTL8192C_SUPPORT==1) || (RTL8192D_SUPPORT==1) || (RTL8188E_SUPPORT==1) || (RTL8812E_SUPPORT==1)) + + + prtl8192cd_priv priv = pDM_Odm->priv; + s4Byte i; + s2Byte pwr_thd = TX_POWER_NEAR_FIELD_THRESH_AP; + + if(!priv->pshare->rf_ft_var.tx_pwr_ctrl) + return; + +#if ((RTL8812E_SUPPORT==1) || (RTL8881A_SUPPORT==1)) + if (pDM_Odm->SupportICType & (ODM_RTL8812 | ODM_RTL8881A)) + pwr_thd = TX_POWER_NEAR_FIELD_THRESH_8812; +#endif + +#if defined(CONFIG_RTL_92D_SUPPORT) || defined(CONFIG_RTL_92C_SUPPORT) + if(CHIP_VER_92X_SERIES(priv)) + { +#ifdef HIGH_POWER_EXT_PA + if(pDM_Odm->ExtPA) + tx_power_control(priv); +#endif + } +#endif + /* + * Check if station is near by to use lower tx power + */ + + if ((priv->up_time % 3) == 0 ) { + int disable_pwr_ctrl = ((pDM_Odm->FalseAlmCnt.Cnt_all > 1000 ) || ((pDM_Odm->FalseAlmCnt.Cnt_all > 300 ) && ((RTL_R8(0xc50) & 0x7f) >= 0x32))) ? 1 : 0; + + for(i=0; ipODM_StaInfo[i]; + if(IS_STA_VALID(pstat) ) { + if(disable_pwr_ctrl) + pstat->hp_level = 0; + else if ((pstat->hp_level == 0) && (pstat->rssi > pwr_thd)) + pstat->hp_level = 1; + else if ((pstat->hp_level == 1) && (pstat->rssi < (pwr_thd-8))) + pstat->hp_level = 0; + } + } + +#if defined(CONFIG_WLAN_HAL_8192EE) + if (GET_CHIP_VER(priv) == VERSION_8192E) { + if( !disable_pwr_ctrl && (pDM_Odm->RSSI_Min != 0xff) ) { + if(pDM_Odm->RSSI_Min > pwr_thd) + RRSR_power_control_11n(priv, 1 ); + else if(pDM_Odm->RSSI_Min < (pwr_thd-8)) + RRSR_power_control_11n(priv, 0 ); + } else { + RRSR_power_control_11n(priv, 0 ); + } + } +#endif + } +//#endif + +#endif +} + + +VOID +odm_DynamicTxPower_92C( + IN PVOID pDM_VOID + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + PADAPTER Adapter = pDM_Odm->Adapter; + PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + s4Byte UndecoratedSmoothedPWDB; + + // 2012/01/12 MH According to Luke's suggestion, only high power will support the feature. + if (pDM_Odm->ExtPA == FALSE) + return; + + // STA not connected and AP not connected + if((!pMgntInfo->bMediaConnect) && + (pHalData->EntryMinUndecoratedSmoothedPWDB == 0)) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("Not connected to any \n")); + pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; + + //the LastDTPlvl should reset when disconnect, + //otherwise the tx power level wouldn't change when disconnect and connect again. + // Maddest 20091220. + pHalData->LastDTPLvl=TxHighPwrLevel_Normal; + return; + } + +#if (INTEL_PROXIMITY_SUPPORT == 1) + // Intel set fixed tx power + if(pMgntInfo->IntelProximityModeInfo.PowerOutput > 0) + { + switch(pMgntInfo->IntelProximityModeInfo.PowerOutput){ + case 1: + pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_100; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("TxHighPwrLevel_100\n")); + break; + case 2: + pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_70; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("TxHighPwrLevel_70\n")); + break; + case 3: + pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_50; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("TxHighPwrLevel_50\n")); + break; + case 4: + pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_35; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("TxHighPwrLevel_35\n")); + break; + case 5: + pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_15; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("TxHighPwrLevel_15\n")); + break; + default: + pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_100; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("TxHighPwrLevel_100\n")); + break; + } + } + else +#endif + { + if( (pMgntInfo->bDynamicTxPowerEnable != TRUE) || + pMgntInfo->IOTAction & HT_IOT_ACT_DISABLE_HIGH_POWER) + { + pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; + } + else + { + if(pMgntInfo->bMediaConnect) // Default port + { + if(ACTING_AS_AP(Adapter) || ACTING_AS_IBSS(Adapter)) + { + UndecoratedSmoothedPWDB = pHalData->EntryMinUndecoratedSmoothedPWDB; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("AP Client PWDB = 0x%x \n", UndecoratedSmoothedPWDB)); + } + else + { + UndecoratedSmoothedPWDB = pHalData->UndecoratedSmoothedPWDB; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("STA Default Port PWDB = 0x%x \n", UndecoratedSmoothedPWDB)); + } + } + else // associated entry pwdb + { + UndecoratedSmoothedPWDB = pHalData->EntryMinUndecoratedSmoothedPWDB; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("AP Ext Port PWDB = 0x%x \n", UndecoratedSmoothedPWDB)); + } + + if(UndecoratedSmoothedPWDB >= TX_POWER_NEAR_FIELD_THRESH_LVL2) + { + pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Level2; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("TxHighPwrLevel_Level1 (TxPwr=0x0)\n")); + } + else if((UndecoratedSmoothedPWDB < (TX_POWER_NEAR_FIELD_THRESH_LVL2-3)) && + (UndecoratedSmoothedPWDB >= TX_POWER_NEAR_FIELD_THRESH_LVL1) ) + { + pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Level1; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("TxHighPwrLevel_Level1 (TxPwr=0x10)\n")); + } + else if(UndecoratedSmoothedPWDB < (TX_POWER_NEAR_FIELD_THRESH_LVL1-5)) + { + pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("TxHighPwrLevel_Normal\n")); + } + } + } + if( pHalData->DynamicTxHighPowerLvl != pHalData->LastDTPLvl ) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("PHY_SetTxPowerLevel8192C() Channel = %d \n" , pHalData->CurrentChannel)); + PHY_SetTxPowerLevel8192C(Adapter, pHalData->CurrentChannel); + if( (pHalData->DynamicTxHighPowerLvl == TxHighPwrLevel_Normal) && + (pHalData->LastDTPLvl == TxHighPwrLevel_Level1 || pHalData->LastDTPLvl == TxHighPwrLevel_Level2)) //TxHighPwrLevel_Normal + odm_DynamicTxPowerRestorePowerIndex(pDM_Odm); + else if(pHalData->DynamicTxHighPowerLvl == TxHighPwrLevel_Level1) + odm_DynamicTxPowerWritePowerIndex(pDM_Odm, 0x14); + else if(pHalData->DynamicTxHighPowerLvl == TxHighPwrLevel_Level2) + odm_DynamicTxPowerWritePowerIndex(pDM_Odm, 0x10); + } + pHalData->LastDTPLvl = pHalData->DynamicTxHighPowerLvl; + + +#elif (DM_ODM_SUPPORT_TYPE == ODM_CE) + + #if (RTL8192C_SUPPORT==1) + PADAPTER Adapter = pDM_Odm->Adapter; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + struct dm_priv *pdmpriv = &pHalData->dmpriv; + struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv); + struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv; + int UndecoratedSmoothedPWDB; + + if(!pdmpriv->bDynamicTxPowerEnable) + return; + +#ifdef CONFIG_INTEL_PROXIM + if(Adapter->proximity.proxim_on== _TRUE){ + struct proximity_priv *prox_priv=Adapter->proximity.proximity_priv; + // Intel set fixed tx power + printk("\n %s Adapter->proximity.proxim_on=%d prox_priv->proxim_modeinfo->power_output=%d \n",__FUNCTION__,Adapter->proximity.proxim_on,prox_priv->proxim_modeinfo->power_output); + if(prox_priv!=NULL){ + if(prox_priv->proxim_modeinfo->power_output> 0) + { + switch(prox_priv->proxim_modeinfo->power_output) + { + case 1: + pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_100; + printk("TxHighPwrLevel_100\n"); + break; + case 2: + pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_70; + printk("TxHighPwrLevel_70\n"); + break; + case 3: + pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_50; + printk("TxHighPwrLevel_50\n"); + break; + case 4: + pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_35; + printk("TxHighPwrLevel_35\n"); + break; + case 5: + pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_15; + printk("TxHighPwrLevel_15\n"); + break; + default: + pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_100; + printk("TxHighPwrLevel_100\n"); + break; + } + } + } + } + else +#endif + { + // STA not connected and AP not connected + if((check_fwstate(pmlmepriv, _FW_LINKED) != _TRUE) && + (pdmpriv->EntryMinUndecoratedSmoothedPWDB == 0)) + { + //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("Not connected to any \n")); + pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; + + //the LastDTPlvl should reset when disconnect, + //otherwise the tx power level wouldn't change when disconnect and connect again. + // Maddest 20091220. + pdmpriv->LastDTPLvl=TxHighPwrLevel_Normal; + return; + } + + if(check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) // Default port + { + #if 0 + //todo: AP Mode + if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == _TRUE) || + (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == _TRUE)) + { + UndecoratedSmoothedPWDB = pdmpriv->EntryMinUndecoratedSmoothedPWDB; + //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("AP Client PWDB = 0x%x \n", UndecoratedSmoothedPWDB)); + } + else + { + UndecoratedSmoothedPWDB = pdmpriv->UndecoratedSmoothedPWDB; + //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("STA Default Port PWDB = 0x%x \n", UndecoratedSmoothedPWDB)); + } + #else + UndecoratedSmoothedPWDB = pdmpriv->EntryMinUndecoratedSmoothedPWDB; + #endif + } + else // associated entry pwdb + { + UndecoratedSmoothedPWDB = pdmpriv->EntryMinUndecoratedSmoothedPWDB; + //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("AP Ext Port PWDB = 0x%x \n", UndecoratedSmoothedPWDB)); + } + + if(UndecoratedSmoothedPWDB >= TX_POWER_NEAR_FIELD_THRESH_LVL2) + { + pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Level2; + //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("TxHighPwrLevel_Level1 (TxPwr=0x0)\n")); + } + else if((UndecoratedSmoothedPWDB < (TX_POWER_NEAR_FIELD_THRESH_LVL2-3)) && + (UndecoratedSmoothedPWDB >= TX_POWER_NEAR_FIELD_THRESH_LVL1) ) + { + pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Level1; + //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("TxHighPwrLevel_Level1 (TxPwr=0x10)\n")); + } + else if(UndecoratedSmoothedPWDB < (TX_POWER_NEAR_FIELD_THRESH_LVL1-5)) + { + pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; + //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("TxHighPwrLevel_Normal\n")); + } + } + if( (pdmpriv->DynamicTxHighPowerLvl != pdmpriv->LastDTPLvl) ) + { + PHY_SetTxPowerLevel8192C(Adapter, pHalData->CurrentChannel); + if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Normal) // HP1 -> Normal or HP2 -> Normal + odm_DynamicTxPowerRestorePowerIndex(pDM_Odm); + else if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level1) + odm_DynamicTxPowerWritePowerIndex(pDM_Odm, 0x14); + else if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level2) + odm_DynamicTxPowerWritePowerIndex(pDM_Odm, 0x10); + } + pdmpriv->LastDTPLvl = pdmpriv->DynamicTxHighPowerLvl; + #endif +#endif // #if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + +} + + +VOID +odm_DynamicTxPower_92D( + IN PVOID pDM_VOID + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + PADAPTER Adapter = pDM_Odm->Adapter; + PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + s4Byte UndecoratedSmoothedPWDB; + + PADAPTER BuddyAdapter = Adapter->BuddyAdapter; + BOOLEAN bGetValueFromBuddyAdapter = dm_DualMacGetParameterFromBuddyAdapter(Adapter); + u1Byte HighPowerLvlBackForMac0 = TxHighPwrLevel_Level1; + + // 2012/01/12 MH According to Luke's suggestion, only high power will support the feature. + if (pDM_Odm->ExtPA == FALSE) + return; + + // If dynamic high power is disabled. + if( (pMgntInfo->bDynamicTxPowerEnable != TRUE) || + pMgntInfo->IOTAction & HT_IOT_ACT_DISABLE_HIGH_POWER) + { + pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; + return; + } + + // STA not connected and AP not connected + if((!pMgntInfo->bMediaConnect) && + (pHalData->EntryMinUndecoratedSmoothedPWDB == 0)) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("Not connected to any \n")); + pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; + + //the LastDTPlvl should reset when disconnect, + //otherwise the tx power level wouldn't change when disconnect and connect again. + // Maddest 20091220. + pHalData->LastDTPLvl=TxHighPwrLevel_Normal; + return; + } + + if(pMgntInfo->bMediaConnect) // Default port + { + if(ACTING_AS_AP(Adapter) || pMgntInfo->mIbss) + { + UndecoratedSmoothedPWDB = pHalData->EntryMinUndecoratedSmoothedPWDB; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("AP Client PWDB = 0x%x \n", UndecoratedSmoothedPWDB)); + } + else + { + UndecoratedSmoothedPWDB = pHalData->UndecoratedSmoothedPWDB; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("STA Default Port PWDB = 0x%x \n", UndecoratedSmoothedPWDB)); + } + } + else // associated entry pwdb + { + UndecoratedSmoothedPWDB = pHalData->EntryMinUndecoratedSmoothedPWDB; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("AP Ext Port PWDB = 0x%x \n", UndecoratedSmoothedPWDB)); + } + + if(IS_HARDWARE_TYPE_8192D(Adapter) && GET_HAL_DATA(Adapter)->CurrentBandType == 1){ + if(UndecoratedSmoothedPWDB >= 0x33) + { + pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Level2; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("5G:TxHighPwrLevel_Level2 (TxPwr=0x0)\n")); + } + else if((UndecoratedSmoothedPWDB <0x33) && + (UndecoratedSmoothedPWDB >= 0x2b) ) + { + pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Level1; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("5G:TxHighPwrLevel_Level1 (TxPwr=0x10)\n")); + } + else if(UndecoratedSmoothedPWDB < 0x2b) + { + pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("5G:TxHighPwrLevel_Normal\n")); + } + + } + else + + { + if(UndecoratedSmoothedPWDB >= TX_POWER_NEAR_FIELD_THRESH_LVL2) + { + pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Level1; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("TxHighPwrLevel_Level1 (TxPwr=0x0)\n")); + } + else if((UndecoratedSmoothedPWDB < (TX_POWER_NEAR_FIELD_THRESH_LVL2-3)) && + (UndecoratedSmoothedPWDB >= TX_POWER_NEAR_FIELD_THRESH_LVL1) ) + { + pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Level1; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("TxHighPwrLevel_Level1 (TxPwr=0x10)\n")); + } + else if(UndecoratedSmoothedPWDB < (TX_POWER_NEAR_FIELD_THRESH_LVL1-5)) + { + pHalData->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("TxHighPwrLevel_Normal\n")); + } + + } + +//sherry delete flag 20110517 + if(bGetValueFromBuddyAdapter) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR,DBG_LOUD,("dm_DynamicTxPower() mac 0 for mac 1 \n")); + if(Adapter->DualMacDMSPControl.bChangeTxHighPowerLvlForAnotherMacOfDMSP) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR,DBG_LOUD,("dm_DynamicTxPower() change value \n")); + HighPowerLvlBackForMac0 = pHalData->DynamicTxHighPowerLvl; + pHalData->DynamicTxHighPowerLvl = Adapter->DualMacDMSPControl.CurTxHighLvlForAnotherMacOfDMSP; + PHY_SetTxPowerLevel8192C(Adapter, pHalData->CurrentChannel); + pHalData->DynamicTxHighPowerLvl = HighPowerLvlBackForMac0; + Adapter->DualMacDMSPControl.bChangeTxHighPowerLvlForAnotherMacOfDMSP = FALSE; + } + } + + if( (pHalData->DynamicTxHighPowerLvl != pHalData->LastDTPLvl) ) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("PHY_SetTxPowerLevel8192S() Channel = %d \n" , pHalData->CurrentChannel)); + if(Adapter->DualMacSmartConcurrent == TRUE) + { + if(BuddyAdapter == NULL) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR,DBG_LOUD,("dm_DynamicTxPower() BuddyAdapter == NULL case \n")); + if(!Adapter->bSlaveOfDMSP) + { + PHY_SetTxPowerLevel8192C(Adapter, pHalData->CurrentChannel); + } + } + else + { + if(pHalData->MacPhyMode92D == DUALMAC_SINGLEPHY) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR,DBG_LOUD,("dm_DynamicTxPower() BuddyAdapter DMSP \n")); + if(Adapter->bSlaveOfDMSP) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR,DBG_LOUD,("dm_DynamicTxPower() bslave case \n")); + BuddyAdapter->DualMacDMSPControl.bChangeTxHighPowerLvlForAnotherMacOfDMSP = TRUE; + BuddyAdapter->DualMacDMSPControl.CurTxHighLvlForAnotherMacOfDMSP = pHalData->DynamicTxHighPowerLvl; + } + else + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR,DBG_LOUD,("dm_DynamicTxPower() master case \n")); + if(!bGetValueFromBuddyAdapter) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR,DBG_LOUD,("dm_DynamicTxPower() mac 0 for mac 0 \n")); + PHY_SetTxPowerLevel8192C(Adapter, pHalData->CurrentChannel); + } + } + } + else + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_DYNAMIC_TXPWR,DBG_LOUD,("dm_DynamicTxPower() BuddyAdapter DMDP\n")); + PHY_SetTxPowerLevel8192C(Adapter, pHalData->CurrentChannel); + } + } + } + else + { + PHY_SetTxPowerLevel8192C(Adapter, pHalData->CurrentChannel); + } + + } + pHalData->LastDTPLvl = pHalData->DynamicTxHighPowerLvl; +#elif (DM_ODM_SUPPORT_TYPE == ODM_CE) +#if (RTL8192D_SUPPORT==1) + PADAPTER Adapter = pDM_Odm->Adapter; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv); + + struct dm_priv *pdmpriv = &pHalData->dmpriv; + DM_ODM_T *podmpriv = &pHalData->odmpriv; + int UndecoratedSmoothedPWDB; + #if (RTL8192D_EASY_SMART_CONCURRENT == 1) + PADAPTER BuddyAdapter = Adapter->BuddyAdapter; + BOOLEAN bGetValueFromBuddyAdapter = DualMacGetParameterFromBuddyAdapter(Adapter); + u8 HighPowerLvlBackForMac0 = TxHighPwrLevel_Level1; + #endif + + // If dynamic high power is disabled. + if( (pdmpriv->bDynamicTxPowerEnable != _TRUE) || + (!(podmpriv->SupportAbility& ODM_BB_DYNAMIC_TXPWR)) ) + { + pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; + return; + } + + // STA not connected and AP not connected + if((check_fwstate(pmlmepriv, _FW_LINKED) != _TRUE) && + (pdmpriv->EntryMinUndecoratedSmoothedPWDB == 0)) + { + //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("Not connected to any \n")); + pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; + //the LastDTPlvl should reset when disconnect, + //otherwise the tx power level wouldn't change when disconnect and connect again. + // Maddest 20091220. + pdmpriv->LastDTPLvl=TxHighPwrLevel_Normal; + return; + } + + if(check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) // Default port + { + #if 0 + //todo: AP Mode + if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == _TRUE) || + (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == _TRUE)) + { + UndecoratedSmoothedPWDB = pdmpriv->EntryMinUndecoratedSmoothedPWDB; + //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("AP Client PWDB = 0x%x \n", UndecoratedSmoothedPWDB)); + } + else + { + UndecoratedSmoothedPWDB = pdmpriv->UndecoratedSmoothedPWDB; + //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("STA Default Port PWDB = 0x%x \n", UndecoratedSmoothedPWDB)); + } + #else + UndecoratedSmoothedPWDB = pdmpriv->EntryMinUndecoratedSmoothedPWDB; + #endif + } + else // associated entry pwdb + { + UndecoratedSmoothedPWDB = pdmpriv->EntryMinUndecoratedSmoothedPWDB; + //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("AP Ext Port PWDB = 0x%x \n", UndecoratedSmoothedPWDB)); + } +#if TX_POWER_FOR_5G_BAND == 1 + if(pHalData->CurrentBandType92D == BAND_ON_5G){ + if(UndecoratedSmoothedPWDB >= 0x33) + { + pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Level2; + //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("5G:TxHighPwrLevel_Level2 (TxPwr=0x0)\n")); + } + else if((UndecoratedSmoothedPWDB <0x33) && + (UndecoratedSmoothedPWDB >= 0x2b) ) + { + pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Level1; + //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("5G:TxHighPwrLevel_Level1 (TxPwr=0x10)\n")); + } + else if(UndecoratedSmoothedPWDB < 0x2b) + { + pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; + //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("5G:TxHighPwrLevel_Normal\n")); + } + } + else +#endif + { + if(UndecoratedSmoothedPWDB >= TX_POWER_NEAR_FIELD_THRESH_LVL2) + { + pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Level2; + //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("TxHighPwrLevel_Level1 (TxPwr=0x0)\n")); + } + else if((UndecoratedSmoothedPWDB < (TX_POWER_NEAR_FIELD_THRESH_LVL2-3)) && + (UndecoratedSmoothedPWDB >= TX_POWER_NEAR_FIELD_THRESH_LVL1) ) + { + pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Level1; + //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("TxHighPwrLevel_Level1 (TxPwr=0x10)\n")); + } + else if(UndecoratedSmoothedPWDB < (TX_POWER_NEAR_FIELD_THRESH_LVL1-5)) + { + pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; + //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("TxHighPwrLevel_Normal\n")); + } + } +#if (RTL8192D_EASY_SMART_CONCURRENT == 1) + if(bGetValueFromBuddyAdapter) + { + //ODM_RT_TRACE(pDM_Odm,COMP_MLME,DBG_LOUD,("dm_DynamicTxPower() mac 0 for mac 1 \n")); + if(Adapter->DualMacDMSPControl.bChangeTxHighPowerLvlForAnotherMacOfDMSP) + { + //ODM_RT_TRACE(pDM_Odm,COMP_MLME,DBG_LOUD,("dm_DynamicTxPower() change value \n")); + HighPowerLvlBackForMac0 = pHalData->DynamicTxHighPowerLvl; + pHalData->DynamicTxHighPowerLvl = Adapter->DualMacDMSPControl.CurTxHighLvlForAnotherMacOfDMSP; + PHY_SetTxPowerLevel8192D(Adapter, pHalData->CurrentChannel); + pHalData->DynamicTxHighPowerLvl = HighPowerLvlBackForMac0; + Adapter->DualMacDMSPControl.bChangeTxHighPowerLvlForAnotherMacOfDMSP = _FALSE; + } + } +#endif + + if( (pdmpriv->DynamicTxHighPowerLvl != pdmpriv->LastDTPLvl) ) + { + //ODM_RT_TRACE(pDM_Odm,COMP_HIPWR, DBG_LOUD, ("PHY_SetTxPowerLevel8192S() Channel = %d \n" , pHalData->CurrentChannel)); +#if (RTL8192D_EASY_SMART_CONCURRENT == 1) + if(BuddyAdapter == NULL) + { + //ODM_RT_TRACE(pDM_Odm,COMP_MLME,DBG_LOUD,("dm_DynamicTxPower() BuddyAdapter == NULL case \n")); + if(!Adapter->bSlaveOfDMSP) + { + PHY_SetTxPowerLevel8192D(Adapter, pHalData->CurrentChannel); + } + } + else + { + if(pHalData->MacPhyMode92D == DUALMAC_SINGLEPHY) + { + //ODM_RT_TRACE(pDM_Odm,COMP_MLME,DBG_LOUD,("dm_DynamicTxPower() BuddyAdapter DMSP \n")); + if(Adapter->bSlaveOfDMSP) + { + //ODM_RT_TRACE(pDM_Odm,COMP_MLME,DBG_LOUD,("dm_DynamicTxPower() bslave case \n")); + BuddyAdapter->DualMacDMSPControl.bChangeTxHighPowerLvlForAnotherMacOfDMSP = _TRUE; + BuddyAdapter->DualMacDMSPControl.CurTxHighLvlForAnotherMacOfDMSP = pHalData->DynamicTxHighPowerLvl; + } + else + { + //ODM_RT_TRACE(pDM_Odm,COMP_MLME,DBG_LOUD,("dm_DynamicTxPower() master case \n")); + if(!bGetValueFromBuddyAdapter) + { + //ODM_RT_TRACE(pDM_Odm,COMP_MLME,DBG_LOUD,("dm_DynamicTxPower() mac 0 for mac 0 \n")); + PHY_SetTxPowerLevel8192D(Adapter, pHalData->CurrentChannel); + } + } + } + else + { + //ODM_RT_TRACE(pDM_Odm,COMP_MLME,DBG_LOUD,("dm_DynamicTxPower() BuddyAdapter DMDP\n")); + PHY_SetTxPowerLevel8192D(Adapter, pHalData->CurrentChannel); + } + } +#else + PHY_SetTxPowerLevel8192D(Adapter, pHalData->CurrentChannel); +#endif + } + pdmpriv->LastDTPLvl = pdmpriv->DynamicTxHighPowerLvl; +#endif +#endif // #if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + +} + diff --git a/hal/OUTSRC/odm_DynamicTxPower.h b/hal/OUTSRC/odm_DynamicTxPower.h new file mode 100644 index 0000000..67221e5 --- /dev/null +++ b/hal/OUTSRC/odm_DynamicTxPower.h @@ -0,0 +1,87 @@ +/****************************************************************************** + * + * 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 __ODMDYNAMICTXPOWER_H__ +#define __ODMDYNAMICTXPOWER_H__ + +#define TX_POWER_NEAR_FIELD_THRESH_LVL2 74 +#define TX_POWER_NEAR_FIELD_THRESH_LVL1 67 +#define TX_POWER_NEAR_FIELD_THRESH_AP 0x3F +#define TX_POWER_NEAR_FIELD_THRESH_8812 60 + +#define TxHighPwrLevel_Normal 0 +#define TxHighPwrLevel_Level1 1 +#define TxHighPwrLevel_Level2 2 +#define TxHighPwrLevel_BT1 3 +#define TxHighPwrLevel_BT2 4 +#define TxHighPwrLevel_15 5 +#define TxHighPwrLevel_35 6 +#define TxHighPwrLevel_50 7 +#define TxHighPwrLevel_70 8 +#define TxHighPwrLevel_100 9 + +VOID +odm_DynamicTxPowerInit( + IN PVOID pDM_VOID + ); + +VOID +odm_DynamicTxPowerRestorePowerIndex( + IN PVOID pDM_VOID + ); + +VOID +odm_DynamicTxPowerNIC( + IN PVOID pDM_VOID + ); + +#if(DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) +VOID +odm_DynamicTxPowerSavePowerIndex( + IN PVOID pDM_VOID + ); + +VOID +odm_DynamicTxPowerWritePowerIndex( + IN PVOID pDM_VOID, + IN u1Byte Value); + +VOID +odm_DynamicTxPower_92C( + IN PVOID pDM_VOID + ); + +VOID +odm_DynamicTxPower_92D( + IN PVOID pDM_VOID + ); +#endif + +VOID +odm_DynamicTxPower( + IN PVOID pDM_VOID + ); + +VOID +odm_DynamicTxPowerAP( + IN PVOID pDM_VOID + ); + +#endif diff --git a/hal/OUTSRC/odm_EdcaTurboCheck.c b/hal/OUTSRC/odm_EdcaTurboCheck.c new file mode 100644 index 0000000..1756923 --- /dev/null +++ b/hal/OUTSRC/odm_EdcaTurboCheck.c @@ -0,0 +1,1915 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA + * + * + ******************************************************************************/ + +//============================================================ +// include files +//============================================================ +#include "Mp_Precomp.h" +#include "odm_precomp.h" + +VOID +ODM_EdcaTurboInit( + IN PVOID pDM_VOID) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; +#if ((DM_ODM_SUPPORT_TYPE == ODM_AP)||(DM_ODM_SUPPORT_TYPE==ODM_ADSL)) + odm_EdcaParaInit(pDM_Odm); +#elif (DM_ODM_SUPPORT_TYPE==ODM_WIN) + PADAPTER Adapter = NULL; + HAL_DATA_TYPE *pHalData = NULL; + + if(pDM_Odm->Adapter==NULL) { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("EdcaTurboInit fail!!!\n")); + return; + } + + Adapter=pDM_Odm->Adapter; + pHalData=GET_HAL_DATA(Adapter); + + pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA = FALSE; + pDM_Odm->DM_EDCA_Table.bIsCurRDLState = FALSE; + pHalData->bIsAnyNonBEPkts = FALSE; + +#elif(DM_ODM_SUPPORT_TYPE==ODM_CE) + PADAPTER Adapter = pDM_Odm->Adapter; + pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA = FALSE; + pDM_Odm->DM_EDCA_Table.bIsCurRDLState = FALSE; + Adapter->recvpriv.bIsAnyNonBEPkts =FALSE; + +#endif + ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Orginial VO PARAM: 0x%x\n",ODM_Read4Byte(pDM_Odm,ODM_EDCA_VO_PARAM))); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Orginial VI PARAM: 0x%x\n",ODM_Read4Byte(pDM_Odm,ODM_EDCA_VI_PARAM))); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Orginial BE PARAM: 0x%x\n",ODM_Read4Byte(pDM_Odm,ODM_EDCA_BE_PARAM))); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Orginial BK PARAM: 0x%x\n",ODM_Read4Byte(pDM_Odm,ODM_EDCA_BK_PARAM))); + + +} // ODM_InitEdcaTurbo + +VOID +odm_EdcaTurboCheck( + IN PVOID pDM_VOID + ) +{ + // + // For AP/ADSL use prtl8192cd_priv + // For CE/NIC use PADAPTER + // + + // + // 2011/09/29 MH In HW integration first stage, we provide 4 different handle to operate + // at the same time. In the stage2/3, we need to prive universal interface and merge all + // HW dynamic mechanism. + // + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("odm_EdcaTurboCheck========================>\n")); + + if(!(pDM_Odm->SupportAbility& ODM_MAC_EDCA_TURBO )) + return; + + switch (pDM_Odm->SupportPlatform) + { + case ODM_WIN: + +#if(DM_ODM_SUPPORT_TYPE==ODM_WIN) + odm_EdcaTurboCheckMP(pDM_Odm); +#endif + break; + + case ODM_CE: +#if(DM_ODM_SUPPORT_TYPE==ODM_CE) + odm_EdcaTurboCheckCE(pDM_Odm); +#endif + break; + + case ODM_AP: + case ODM_ADSL: + +#if ((DM_ODM_SUPPORT_TYPE == ODM_AP)||(DM_ODM_SUPPORT_TYPE==ODM_ADSL)) + odm_IotEngine(pDM_Odm); +#endif + break; + } + ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("<========================odm_EdcaTurboCheck\n")); + +} // odm_CheckEdcaTurbo + +#if(DM_ODM_SUPPORT_TYPE==ODM_CE) + + +VOID +odm_EdcaTurboCheckCE( + IN PVOID pDM_VOID + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + PADAPTER Adapter = pDM_Odm->Adapter; + u32 EDCA_BE_UL = 0x5ea42b;//Parameter suggested by Scott //edca_setting_UL[pMgntInfo->IOTPeer]; + u32 EDCA_BE_DL = 0x5ea42b;//Parameter suggested by Scott //edca_setting_DL[pMgntInfo->IOTPeer]; + u32 ICType=pDM_Odm->SupportICType; + u32 IOTPeer=0; + u8 WirelessMode=0xFF; //invalid value + u32 trafficIndex; + u32 edca_param; + u64 cur_tx_bytes = 0; + u64 cur_rx_bytes = 0; + u8 bbtchange = _FALSE; + u8 bBiasOnRx = _FALSE; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(Adapter); + struct xmit_priv *pxmitpriv = &(Adapter->xmitpriv); + struct recv_priv *precvpriv = &(Adapter->recvpriv); + struct registry_priv *pregpriv = &Adapter->registrypriv; + struct mlme_ext_priv *pmlmeext = &(Adapter->mlmeextpriv); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + + if(pDM_Odm->bLinked != _TRUE) + { + precvpriv->bIsAnyNonBEPkts = _FALSE; + return; + } + + if ((pregpriv->wifi_spec == 1) )//|| (pmlmeinfo->HT_enable == 0)) + { + precvpriv->bIsAnyNonBEPkts = _FALSE; + return; + } + + if(pDM_Odm->pWirelessMode!=NULL) + WirelessMode=*(pDM_Odm->pWirelessMode); + + IOTPeer = pmlmeinfo->assoc_AP_vendor; + + if (IOTPeer >= HT_IOT_PEER_MAX) + { + precvpriv->bIsAnyNonBEPkts = _FALSE; + return; + } + + if( (pDM_Odm->SupportICType == ODM_RTL8192C) || + (pDM_Odm->SupportICType == ODM_RTL8723A) || + (pDM_Odm->SupportICType == ODM_RTL8188E)) + { + if((IOTPeer == HT_IOT_PEER_RALINK)||(IOTPeer == HT_IOT_PEER_ATHEROS)) + bBiasOnRx = _TRUE; + } + + // Check if the status needs to be changed. + if((bbtchange) || (!precvpriv->bIsAnyNonBEPkts) ) + { + cur_tx_bytes = pdvobjpriv->traffic_stat.cur_tx_bytes; + cur_rx_bytes = pdvobjpriv->traffic_stat.cur_rx_bytes; + + //traffic, TX or RX + if(bBiasOnRx) + { + if (cur_tx_bytes > (cur_rx_bytes << 2)) + { // Uplink TP is present. + trafficIndex = UP_LINK; + } + else + { // Balance TP is present. + trafficIndex = DOWN_LINK; + } + } + else + { + if (cur_rx_bytes > (cur_tx_bytes << 2)) + { // Downlink TP is present. + trafficIndex = DOWN_LINK; + } + else + { // Balance TP is present. + trafficIndex = UP_LINK; + } + } + + //if ((pDM_Odm->DM_EDCA_Table.prv_traffic_idx != trafficIndex) || (!pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA)) + { + if(ICType==ODM_RTL8192D) + { + // Single PHY + if(pDM_Odm->RFType==ODM_2T2R) + { + EDCA_BE_UL = 0x60a42b; //0x5ea42b; + EDCA_BE_DL = 0x60a42b; //0x5ea42b; + } + else + { + EDCA_BE_UL = 0x6ea42b; + EDCA_BE_DL = 0x6ea42b; + } + } + else + { + if(pDM_Odm->SupportInterface==ODM_ITRF_PCIE) { + if((ICType==ODM_RTL8192C)&&(pDM_Odm->RFType==ODM_2T2R)) { + EDCA_BE_UL = 0x60a42b; + EDCA_BE_DL = 0x60a42b; + } + else + { + EDCA_BE_UL = 0x6ea42b; + EDCA_BE_DL = 0x6ea42b; + } + } + } + + //92D txop can't be set to 0x3e for cisco1250 + if((ICType!=ODM_RTL8192D) && (IOTPeer== HT_IOT_PEER_CISCO) &&(WirelessMode==ODM_WM_N24G)) + { + EDCA_BE_DL = edca_setting_DL[IOTPeer]; + EDCA_BE_UL = edca_setting_UL[IOTPeer]; + } + //merge from 92s_92c_merge temp brunch v2445 20120215 + else if((IOTPeer == HT_IOT_PEER_CISCO) &&((WirelessMode==ODM_WM_G)||(WirelessMode==(ODM_WM_B|ODM_WM_G))||(WirelessMode==ODM_WM_A)||(WirelessMode==ODM_WM_B))) + { + EDCA_BE_DL = edca_setting_DL_GMode[IOTPeer]; + } + else if((IOTPeer== HT_IOT_PEER_AIRGO )&& ((WirelessMode==ODM_WM_G)||(WirelessMode==ODM_WM_A))) + { + EDCA_BE_DL = 0xa630; + } + else if(IOTPeer == HT_IOT_PEER_MARVELL) + { + EDCA_BE_DL = edca_setting_DL[IOTPeer]; + EDCA_BE_UL = edca_setting_UL[IOTPeer]; + } + else if(IOTPeer == HT_IOT_PEER_ATHEROS) + { + // Set DL EDCA for Atheros peer to 0x3ea42b. Suggested by SD3 Wilson for ASUS TP issue. + EDCA_BE_DL = edca_setting_DL[IOTPeer]; + } + + if((ICType==ODM_RTL8812)||(ICType==ODM_RTL8821)||(ICType==ODM_RTL8192E)) //add 8812AU/8812AE + { + EDCA_BE_UL = 0x5ea42b; + EDCA_BE_DL = 0x5ea42b; + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("8812A: EDCA_BE_UL=0x%x EDCA_BE_DL =0x%x",EDCA_BE_UL,EDCA_BE_DL)); + } + + if (trafficIndex == DOWN_LINK) + edca_param = EDCA_BE_DL; + else + edca_param = EDCA_BE_UL; + + rtw_write32(Adapter, REG_EDCA_BE_PARAM, edca_param); + + pDM_Odm->DM_EDCA_Table.prv_traffic_idx = trafficIndex; + } + + pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA = _TRUE; + } + else + { + // + // Turn Off EDCA turbo here. + // Restore original EDCA according to the declaration of AP. + // + if(pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA) + { + rtw_write32(Adapter, REG_EDCA_BE_PARAM, pHalData->AcParam_BE); + pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA = _FALSE; + } + } + +} + + +#elif(DM_ODM_SUPPORT_TYPE==ODM_WIN) +VOID +odm_EdcaTurboCheckMP( + IN PVOID pDM_VOID + ) +{ + + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + PADAPTER Adapter = pDM_Odm->Adapter; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + + PADAPTER pDefaultAdapter = GetDefaultAdapter(Adapter); + PADAPTER pExtAdapter = GetFirstExtAdapter(Adapter);//NULL; + PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; + PSTA_QOS pStaQos = Adapter->MgntInfo.pStaQos; + //[Win7 Count Tx/Rx statistic for Extension Port] odm_CheckEdcaTurbo's Adapter is always Default. 2009.08.20, by Bohn + u8Byte Ext_curTxOkCnt = 0; + u8Byte Ext_curRxOkCnt = 0; + //For future Win7 Enable Default Port to modify AMPDU size dynamically, 2009.08.20, Bohn. + u1Byte TwoPortStatus = (u1Byte)TWO_PORT_STATUS__WITHOUT_ANY_ASSOCIATE; + + // Keep past Tx/Rx packet count for RT-to-RT EDCA turbo. + u8Byte curTxOkCnt = 0; + u8Byte curRxOkCnt = 0; + u4Byte EDCA_BE_UL = 0x5ea42b;//Parameter suggested by Scott //edca_setting_UL[pMgntInfo->IOTPeer]; + u4Byte EDCA_BE_DL = 0x5ea42b;//Parameter suggested by Scott //edca_setting_DL[pMgntInfo->IOTPeer]; + u4Byte EDCA_BE = 0x5ea42b; + u1Byte IOTPeer=0; + BOOLEAN *pbIsCurRDLState=NULL; + BOOLEAN bLastIsCurRDLState=FALSE; + BOOLEAN bBiasOnRx=FALSE; + BOOLEAN bEdcaTurboOn=FALSE; + u1Byte TxRate = 0xFF; + u8Byte value64; + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("odm_EdcaTurboCheckMP========================>")); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Orginial BE PARAM: 0x%x\n",ODM_Read4Byte(pDM_Odm,ODM_EDCA_BE_PARAM))); + +////=============================== +////list paramter for different platform +////=============================== + bLastIsCurRDLState=pDM_Odm->DM_EDCA_Table.bIsCurRDLState; + pbIsCurRDLState=&(pDM_Odm->DM_EDCA_Table.bIsCurRDLState); + + //2012/09/14 MH Add + if (pMgntInfo->NumNonBePkt > pMgntInfo->RegEdcaThresh && !Adapter->MgntInfo.bWiFiConfg) + pHalData->bIsAnyNonBEPkts = TRUE; + + pMgntInfo->NumNonBePkt = 0; + + // Caculate TX/RX TP: + //curTxOkCnt = Adapter->TxStats.NumTxBytesUnicast - pMgntInfo->lastTxOkCnt; + //curRxOkCnt = Adapter->RxStats.NumRxBytesUnicast - pMgntInfo->lastRxOkCnt; + curTxOkCnt = Adapter->TxStats.NumTxBytesUnicast - pDM_Odm->lastTxOkCnt; + curRxOkCnt = Adapter->RxStats.NumRxBytesUnicast - pDM_Odm->lastRxOkCnt; + pDM_Odm->lastTxOkCnt = Adapter->TxStats.NumTxBytesUnicast; + pDM_Odm->lastRxOkCnt = Adapter->RxStats.NumRxBytesUnicast; + + if(pExtAdapter == NULL) + pExtAdapter = pDefaultAdapter; + + Ext_curTxOkCnt = pExtAdapter->TxStats.NumTxBytesUnicast - pMgntInfo->Ext_lastTxOkCnt; + Ext_curRxOkCnt = pExtAdapter->RxStats.NumRxBytesUnicast - pMgntInfo->Ext_lastRxOkCnt; + GetTwoPortSharedResource(Adapter,TWO_PORT_SHARED_OBJECT__STATUS,NULL,&TwoPortStatus); + //For future Win7 Enable Default Port to modify AMPDU size dynamically, 2009.08.20, Bohn. + if(TwoPortStatus == TWO_PORT_STATUS__EXTENSION_ONLY) + { + curTxOkCnt = Ext_curTxOkCnt ; + curRxOkCnt = Ext_curRxOkCnt ; + } + // + IOTPeer=pMgntInfo->IOTPeer; + bBiasOnRx=(pMgntInfo->IOTAction & HT_IOT_ACT_EDCA_BIAS_ON_RX)?TRUE:FALSE; + bEdcaTurboOn=((!pHalData->bIsAnyNonBEPkts))?TRUE:FALSE; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("bIsAnyNonBEPkts : 0x%lx \n",pHalData->bIsAnyNonBEPkts)); + + +////=============================== +////check if edca turbo is disabled +////=============================== + if(odm_IsEdcaTurboDisable(pDM_Odm)) + { + pHalData->bIsAnyNonBEPkts = FALSE; + pMgntInfo->lastTxOkCnt = Adapter->TxStats.NumTxBytesUnicast; + pMgntInfo->lastRxOkCnt = Adapter->RxStats.NumRxBytesUnicast; + pMgntInfo->Ext_lastTxOkCnt = pExtAdapter->TxStats.NumTxBytesUnicast; + pMgntInfo->Ext_lastRxOkCnt = pExtAdapter->RxStats.NumRxBytesUnicast; + + } + +////=============================== +////remove iot case out +////=============================== + ODM_EdcaParaSelByIot(pDM_Odm, &EDCA_BE_UL, &EDCA_BE_DL); + + +////=============================== +////Check if the status needs to be changed. +////=============================== + if(bEdcaTurboOn) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("bEdcaTurboOn : 0x%x bBiasOnRx : 0x%x\n",bEdcaTurboOn,bBiasOnRx)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("curTxOkCnt : 0x%lx \n",curTxOkCnt)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("curRxOkCnt : 0x%lx \n",curRxOkCnt)); + if(bBiasOnRx) + odm_EdcaChooseTrafficIdx(pDM_Odm,curTxOkCnt, curRxOkCnt, TRUE, pbIsCurRDLState); + else + odm_EdcaChooseTrafficIdx(pDM_Odm,curTxOkCnt, curRxOkCnt, FALSE, pbIsCurRDLState); + +//modify by Guo.Mingzhi 2011-12-29 + EDCA_BE=((*pbIsCurRDLState)==TRUE)?EDCA_BE_DL:EDCA_BE_UL; + if(IS_HARDWARE_TYPE_8821U(Adapter)) + { + if(pMgntInfo->RegTxDutyEnable) + { + //2013.01.23 LukeLee: debug for 8811AU thermal issue (reduce Tx duty cycle) + if(!pMgntInfo->ForcedDataRate) //auto rate + { + if(pDM_Odm->TxRate != 0xFF) + TxRate = Adapter->HalFunc.GetHwRateFromMRateHandler(pDM_Odm->TxRate); + } + else //force rate + { + TxRate = (u1Byte) pMgntInfo->ForcedDataRate; + } + + value64 = (curRxOkCnt<<2); + if(curTxOkCnt < value64) //Downlink + ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,EDCA_BE); + else //Uplink + { + //DbgPrint("pDM_Odm->RFCalibrateInfo.ThermalValue = 0x%X\n", pDM_Odm->RFCalibrateInfo.ThermalValue); + //if(pDM_Odm->RFCalibrateInfo.ThermalValue < pHalData->EEPROMThermalMeter) + if((pDM_Odm->RFCalibrateInfo.ThermalValue < 0x2c) || (*pDM_Odm->pBandType == BAND_ON_2_4G)) + ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,EDCA_BE); + else + { + switch (TxRate) + { + case MGN_VHT1SS_MCS6: + case MGN_VHT1SS_MCS5: + case MGN_MCS6: + case MGN_MCS5: + case MGN_48M: + case MGN_54M: + ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0x1ea42b); + break; + case MGN_VHT1SS_MCS4: + case MGN_MCS4: + case MGN_36M: + ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0xa42b); + break; + case MGN_VHT1SS_MCS3: + case MGN_MCS3: + case MGN_24M: + ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0xa47f); + break; + case MGN_VHT1SS_MCS2: + case MGN_MCS2: + case MGN_18M: + ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0xa57f); + break; + case MGN_VHT1SS_MCS1: + case MGN_MCS1: + case MGN_9M: + case MGN_12M: + ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0xa77f); + break; + case MGN_VHT1SS_MCS0: + case MGN_MCS0: + case MGN_6M: + ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0xa87f); + break; + default: + ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,EDCA_BE); + break; + } + } + } + } + else + { + ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,EDCA_BE); + } + + } + else if (IS_HARDWARE_TYPE_8812AU(Adapter)){ + if(pMgntInfo->RegTxDutyEnable) + { + //2013.07.26 Wilson: debug for 8812AU thermal issue (reduce Tx duty cycle) + // it;s the same issue as 8811AU + if(!pMgntInfo->ForcedDataRate) //auto rate + { + if(pDM_Odm->TxRate != 0xFF) + TxRate = Adapter->HalFunc.GetHwRateFromMRateHandler(pDM_Odm->TxRate); + } + else //force rate + { + TxRate = (u1Byte) pMgntInfo->ForcedDataRate; + } + + value64 = (curRxOkCnt<<2); + if(curTxOkCnt < value64) //Downlink + ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,EDCA_BE); + else //Uplink + { + //DbgPrint("pDM_Odm->RFCalibrateInfo.ThermalValue = 0x%X\n", pDM_Odm->RFCalibrateInfo.ThermalValue); + //if(pDM_Odm->RFCalibrateInfo.ThermalValue < pHalData->EEPROMThermalMeter) + if((pDM_Odm->RFCalibrateInfo.ThermalValue < 0x2c) || (*pDM_Odm->pBandType == BAND_ON_2_4G)) + ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,EDCA_BE); + else + { + switch (TxRate) + { + case MGN_VHT2SS_MCS9: + case MGN_VHT1SS_MCS9: + case MGN_VHT1SS_MCS8: + case MGN_MCS15: + case MGN_MCS7: + ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0x1ea44f); + case MGN_VHT2SS_MCS8: + case MGN_VHT1SS_MCS7: + case MGN_MCS14: + case MGN_MCS6: + case MGN_54M: + ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0xa44f); + case MGN_VHT2SS_MCS7: + case MGN_VHT2SS_MCS6: + case MGN_VHT1SS_MCS6: + case MGN_VHT1SS_MCS5: + case MGN_MCS13: + case MGN_MCS5: + case MGN_48M: + ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0xa630); + break; + case MGN_VHT2SS_MCS5: + case MGN_VHT2SS_MCS4: + case MGN_VHT1SS_MCS4: + case MGN_VHT1SS_MCS3: + case MGN_MCS12: + case MGN_MCS4: + case MGN_MCS3: + case MGN_36M: + case MGN_24M: + ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0xa730); + break; + case MGN_VHT2SS_MCS3: + case MGN_VHT2SS_MCS2: + case MGN_VHT2SS_MCS1: + case MGN_VHT1SS_MCS2: + case MGN_VHT1SS_MCS1: + case MGN_MCS11: + case MGN_MCS10: + case MGN_MCS9: + case MGN_MCS2: + case MGN_MCS1: + case MGN_18M: + case MGN_12M: + ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0xa830); + break; + case MGN_VHT2SS_MCS0: + case MGN_VHT1SS_MCS0: + case MGN_MCS0: + case MGN_MCS8: + case MGN_9M: + case MGN_6M: + ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,0xa87f); + break; + default: + ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,EDCA_BE); + break; + } + } + } + } + else + { + ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,EDCA_BE); + } + } + else + ODM_Write4Byte(pDM_Odm,ODM_EDCA_BE_PARAM,EDCA_BE); + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("EDCA Turbo on: EDCA_BE:0x%lx\n",EDCA_BE)); + + pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA = TRUE; + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("EDCA_BE_DL : 0x%lx EDCA_BE_UL : 0x%lx EDCA_BE : 0x%lx \n",EDCA_BE_DL,EDCA_BE_UL,EDCA_BE)); + + } + else + { + // Turn Off EDCA turbo here. + // Restore original EDCA according to the declaration of AP. + if(pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA) + { + Adapter->HalFunc.SetHwRegHandler(Adapter, HW_VAR_AC_PARAM, GET_WMM_PARAM_ELE_SINGLE_AC_PARAM(pStaQos->WMMParamEle, AC0_BE) ); + + pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA = FALSE; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Restore EDCA BE: 0x%lx \n",pDM_Odm->WMMEDCA_BE)); + + } + } + +} + + +//check if edca turbo is disabled +BOOLEAN +odm_IsEdcaTurboDisable( + IN PVOID pDM_VOID +) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + PADAPTER Adapter = pDM_Odm->Adapter; + PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; + u4Byte IOTPeer=pMgntInfo->IOTPeer; + + if(pDM_Odm->bBtDisableEdcaTurbo) + { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD, ("EdcaTurboDisable for BT!!\n")); + return TRUE; + } + + if((!(pDM_Odm->SupportAbility& ODM_MAC_EDCA_TURBO ))|| + (pDM_Odm->bWIFITest)|| + (IOTPeer>= HT_IOT_PEER_MAX)) + { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD, ("EdcaTurboDisable\n")); + return TRUE; + } + + + // 1. We do not turn on EDCA turbo mode for some AP that has IOT issue + // 2. User may disable EDCA Turbo mode with OID settings. + if(pMgntInfo->IOTAction & HT_IOT_ACT_DISABLE_EDCA_TURBO){ + ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD, ("IOTAction:EdcaTurboDisable\n")); + return TRUE; + } + + return FALSE; + + +} + +//add iot case here: for MP/CE +VOID +ODM_EdcaParaSelByIot( + IN PVOID pDM_VOID, + OUT u4Byte *EDCA_BE_UL, + OUT u4Byte *EDCA_BE_DL + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + PADAPTER Adapter = pDM_Odm->Adapter; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + u4Byte IOTPeer=0; + u4Byte ICType=pDM_Odm->SupportICType; + u1Byte WirelessMode=0xFF; //invalid value + u4Byte RFType=pDM_Odm->RFType; + u4Byte IOTPeerSubType=0; + + PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; + u1Byte TwoPortStatus = (u1Byte)TWO_PORT_STATUS__WITHOUT_ANY_ASSOCIATE; + + if(pDM_Odm->pWirelessMode!=NULL) + WirelessMode=*(pDM_Odm->pWirelessMode); + +/////////////////////////////////////////////////////////// +////list paramter for different platform + + IOTPeer=pMgntInfo->IOTPeer; + IOTPeerSubType=pMgntInfo->IOTPeerSubtype; + GetTwoPortSharedResource(Adapter,TWO_PORT_SHARED_OBJECT__STATUS,NULL,&TwoPortStatus); + + + if(ICType==ODM_RTL8192D) + { + // Single PHY + if(pDM_Odm->RFType==ODM_2T2R) + { + (*EDCA_BE_UL) = 0x60a42b; //0x5ea42b; + (*EDCA_BE_DL) = 0x60a42b; //0x5ea42b; + + } + else + { + (*EDCA_BE_UL) = 0x6ea42b; + (*EDCA_BE_DL) = 0x6ea42b; + } + + } +////============================ +/// IOT case for MP +////============================ + + else + { + + if(pDM_Odm->SupportInterface==ODM_ITRF_PCIE){ + if((ICType==ODM_RTL8192C)&&(pDM_Odm->RFType==ODM_2T2R)) { + (*EDCA_BE_UL) = 0x60a42b; + (*EDCA_BE_DL) = 0x60a42b; + } + else + { + (*EDCA_BE_UL) = 0x6ea42b; + (*EDCA_BE_DL) = 0x6ea42b; + } + } + } + + if(TwoPortStatus == TWO_PORT_STATUS__EXTENSION_ONLY) + { + (*EDCA_BE_UL) = 0x5ea42b;//Parameter suggested by Scott //edca_setting_UL[ExtAdapter->MgntInfo.IOTPeer]; + (*EDCA_BE_DL) = 0x5ea42b;//Parameter suggested by Scott //edca_setting_DL[ExtAdapter->MgntInfo.IOTPeer]; + } + + #if (INTEL_PROXIMITY_SUPPORT == 1) + if(pMgntInfo->IntelClassModeInfo.bEnableCA == TRUE) + { + (*EDCA_BE_UL) = (*EDCA_BE_DL) = 0xa44f; + } + else + #endif + { + if((pMgntInfo->IOTAction & (HT_IOT_ACT_FORCED_ENABLE_BE_TXOP|HT_IOT_ACT_AMSDU_ENABLE))) + {// To check whether we shall force turn on TXOP configuration. + if(!((*EDCA_BE_UL) & 0xffff0000)) + (*EDCA_BE_UL) |= 0x005e0000; // Force TxOP limit to 0x005e for UL. + if(!((*EDCA_BE_DL) & 0xffff0000)) + (*EDCA_BE_DL) |= 0x005e0000; // Force TxOP limit to 0x005e for DL. + } + + //92D txop can't be set to 0x3e for cisco1250 + if((ICType!=ODM_RTL8192D) && (IOTPeer== HT_IOT_PEER_CISCO) &&(WirelessMode==ODM_WM_N24G)) + { + (*EDCA_BE_DL) = edca_setting_DL[IOTPeer]; + (*EDCA_BE_UL) = edca_setting_UL[IOTPeer]; + } + //merge from 92s_92c_merge temp brunch v2445 20120215 + else if((IOTPeer == HT_IOT_PEER_CISCO) &&((WirelessMode==ODM_WM_G)||(WirelessMode==(ODM_WM_B|ODM_WM_G))||(WirelessMode==ODM_WM_A)||(WirelessMode==ODM_WM_B))) + { + (*EDCA_BE_DL) = edca_setting_DL_GMode[IOTPeer]; + } + else if((IOTPeer== HT_IOT_PEER_AIRGO )&& ((WirelessMode==ODM_WM_G)||(WirelessMode==ODM_WM_A))) + { + (*EDCA_BE_DL) = 0xa630; + } + + else if(IOTPeer == HT_IOT_PEER_MARVELL) + { + (*EDCA_BE_DL) = edca_setting_DL[IOTPeer]; + (*EDCA_BE_UL) = edca_setting_UL[IOTPeer]; + } + else if(IOTPeer == HT_IOT_PEER_ATHEROS) + { + // Set DL EDCA for Atheros peer to 0x3ea42b. Suggested by SD3 Wilson for ASUS TP issue. + if(WirelessMode==ODM_WM_G) + (*EDCA_BE_DL) = edca_setting_DL_GMode[IOTPeer]; + else + (*EDCA_BE_DL) = edca_setting_DL[IOTPeer]; + + if(ICType == ODM_RTL8821) + (*EDCA_BE_DL) = 0x5ea630; + + } + } + + if((ICType == ODM_RTL8192D)&&(IOTPeerSubType == HT_IOT_PEER_LINKSYS_E4200_V1)&&((WirelessMode==ODM_WM_N5G))) + { + (*EDCA_BE_DL) = 0x432b; + (*EDCA_BE_UL) = 0x432b; + } + + + + if((ICType==ODM_RTL8812)||(ICType==ODM_RTL8192E)) //add 8812AU/8812AE + { + (*EDCA_BE_UL) = 0x5ea42b; + (*EDCA_BE_DL) = 0x5ea42b; + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("8812A: EDCA_BE_UL=0x%lx EDCA_BE_DL =0x%lx",(*EDCA_BE_UL),(*EDCA_BE_DL))); + } + + // Revised for Atheros DIR-655 IOT issue to improve down link TP, added by Roger, 2013.03.22. + if((ICType == ODM_RTL8723A) && (IOTPeerSubType== HT_IOT_PEER_ATHEROS_DIR655) && + (pMgntInfo->dot11CurrentChannelNumber == 6)) + { + (*EDCA_BE_DL) = 0xa92b; + } + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Special: EDCA_BE_UL=0x%lx EDCA_BE_DL =0x%lx",(*EDCA_BE_UL),(*EDCA_BE_DL))); + +} + + +VOID +odm_EdcaChooseTrafficIdx( + IN PVOID pDM_VOID, + IN u8Byte cur_tx_bytes, + IN u8Byte cur_rx_bytes, + IN BOOLEAN bBiasOnRx, + OUT BOOLEAN *pbIsCurRDLState + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + + if(bBiasOnRx) + { + + if(cur_tx_bytes>(cur_rx_bytes*4)) + { + *pbIsCurRDLState=FALSE; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Uplink Traffic\n ")); + + } + else + { + *pbIsCurRDLState=TRUE; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Balance Traffic\n")); + + } + } + else + { + if(cur_rx_bytes>(cur_tx_bytes*4)) + { + *pbIsCurRDLState=TRUE; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Downlink Traffic\n")); + + } + else + { + *pbIsCurRDLState=FALSE; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("Balance Traffic\n")); + } + } + + return ; +} + +#endif + +#if((DM_ODM_SUPPORT_TYPE==ODM_AP)||(DM_ODM_SUPPORT_TYPE==ODM_ADSL)) + +void odm_EdcaParaInit( + IN PVOID pDM_VOID + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + prtl8192cd_priv priv = pDM_Odm->priv; + int mode=priv->pmib->dot11BssType.net_work_type; + + static unsigned int slot_time, sifs_time; + struct ParaRecord EDCA[4]; + + memset(EDCA, 0, 4*sizeof(struct ParaRecord)); + + sifs_time = 10; + slot_time = 20; + + if (mode & (ODM_WM_N24G|ODM_WM_N5G)) + sifs_time = 16; + + if (mode & (ODM_WM_N24G|ODM_WM_N5G| ODM_WM_G|ODM_WM_A)) + slot_time = 9; + + +#ifdef RTK_AC_SUPPORT //for 11ac logo, edit aifs time for cca test cases + if(AC_SIGMA_MODE != AC_SIGMA_NONE) + sifs_time = 10; +#endif + + +#if((defined(RTL_MANUAL_EDCA))&&(DM_ODM_SUPPORT_TYPE==ODM_AP)) + if( priv->pmib->dot11QosEntry.ManualEDCA ) { + if( OPMODE & WIFI_AP_STATE ) + memcpy(EDCA, priv->pmib->dot11QosEntry.AP_manualEDCA, 4*sizeof(struct ParaRecord)); + else + memcpy(EDCA, priv->pmib->dot11QosEntry.STA_manualEDCA, 4*sizeof(struct ParaRecord)); + + #ifdef WIFI_WMM + if (QOS_ENABLE) + ODM_Write4Byte(pDM_Odm, ODM_EDCA_VI_PARAM, (EDCA[VI].TXOPlimit<< 16) | (EDCA[VI].ECWmax<< 12) | (EDCA[VI].ECWmin<< 8) | (sifs_time + EDCA[VI].AIFSN* slot_time)); + else + #endif + ODM_Write4Byte(pDM_Odm, ODM_EDCA_VI_PARAM, (EDCA[BE].TXOPlimit<< 16) | (EDCA[BE].ECWmax<< 12) | (EDCA[BE].ECWmin<< 8) | (sifs_time + EDCA[VI].AIFSN* slot_time)); + + }else + #endif //RTL_MANUAL_EDCA + { + + if(OPMODE & WIFI_AP_STATE) + { + memcpy(EDCA, rtl_ap_EDCA, 2*sizeof(struct ParaRecord)); + + if(mode & (ODM_WM_A|ODM_WM_G|ODM_WM_N24G|ODM_WM_N5G)) + memcpy(&EDCA[VI], &rtl_ap_EDCA[VI_AG], 2*sizeof(struct ParaRecord)); + else + memcpy(&EDCA[VI], &rtl_ap_EDCA[VI], 2*sizeof(struct ParaRecord)); + } + else + { + memcpy(EDCA, rtl_sta_EDCA, 2*sizeof(struct ParaRecord)); + + if(mode & (ODM_WM_A|ODM_WM_G|ODM_WM_N24G|ODM_WM_N5G)) + memcpy(&EDCA[VI], &rtl_sta_EDCA[VI_AG], 2*sizeof(struct ParaRecord)); + else + memcpy(&EDCA[VI], &rtl_sta_EDCA[VI], 2*sizeof(struct ParaRecord)); + } + + #ifdef WIFI_WMM + if (QOS_ENABLE) + ODM_Write4Byte(pDM_Odm, ODM_EDCA_VI_PARAM, (EDCA[VI].TXOPlimit<< 16) | (EDCA[VI].ECWmax<< 12) | (EDCA[VI].ECWmin<< 8) | (sifs_time + EDCA[VI].AIFSN* slot_time)); + else + #endif + +#if (DM_ODM_SUPPORT_TYPE==ODM_AP) + ODM_Write4Byte(pDM_Odm, ODM_EDCA_VI_PARAM, (EDCA[BK].ECWmax<< 12) | (EDCA[BK].ECWmin<< 8) | (sifs_time + EDCA[VI].AIFSN* slot_time)); +#elif(DM_ODM_SUPPORT_TYPE==ODM_ADSL) + ODM_Write4Byte(pDM_Odm, ODM_EDCA_VI_PARAM, (EDCA[BK].ECWmax<< 12) | (EDCA[BK].ECWmin<< 8) | (sifs_time + 2* slot_time)); +#endif + + + } + + ODM_Write4Byte(pDM_Odm, ODM_EDCA_VO_PARAM, (EDCA[VO].TXOPlimit<< 16) | (EDCA[VO].ECWmax<< 12) | (EDCA[VO].ECWmin<< 8) | (sifs_time + EDCA[VO].AIFSN* slot_time)); + ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (EDCA[BE].TXOPlimit<< 16) | (EDCA[BE].ECWmax<< 12) | (EDCA[BE].ECWmin<< 8) | (sifs_time + EDCA[BE].AIFSN* slot_time)); + ODM_Write4Byte(pDM_Odm, ODM_EDCA_BK_PARAM, (EDCA[BK].TXOPlimit<< 16) | (EDCA[BK].ECWmax<< 12) | (EDCA[BK].ECWmin<< 8) | (sifs_time + EDCA[BK].AIFSN* slot_time)); + +#if defined(RTK_AC_SUPPORT) && defined(RTL_MANUAL_EDCA) //for 11ac logo, make BK worse to seperate with BE. + if((AC_SIGMA_MODE != AC_SIGMA_NONE) && (priv->pmib->dot11QosEntry.ManualEDCA)) + { + ODM_Write4Byte(pDM_Odm, ODM_EDCA_BK_PARAM, (EDCA[BK].TXOPlimit<< 16) | (EDCA[BK].ECWmax<< 12) | (EDCA[BK].ECWmin<< 8) | 0xa4 ); + } +#endif + +// ODM_Write1Byte(pDM_Odm,ACMHWCTRL, 0x00); + + priv->pshare->iot_mode_enable = 0; +#if(DM_ODM_SUPPORT_TYPE==ODM_AP) + if (priv->pshare->rf_ft_var.wifi_beq_iot) + priv->pshare->iot_mode_VI_exist = 0; + + #ifdef WMM_VIBE_PRI + priv->pshare->iot_mode_BE_exist = 0; + #endif + +#ifdef WMM_BEBK_PRI + priv->pshare->iot_mode_BK_exist = 0; +#endif + + #ifdef LOW_TP_TXOP + priv->pshare->BE_cwmax_enhance = 0; + #endif + +#elif (DM_ODM_SUPPORT_TYPE==ODM_ADSL) + priv->pshare->iot_mode_BE_exist = 0; +#endif + priv->pshare->iot_mode_VO_exist = 0; +} + +BOOLEAN +ODM_ChooseIotMainSTA( + IN PVOID pDM_VOID, + IN PSTA_INFO_T pstat + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + prtl8192cd_priv priv = pDM_Odm->priv; + BOOLEAN bhighTP_found_pstat=FALSE; + + if ((GET_ROOT(priv)->up_time % 2) == 0) { + unsigned int tx_2s_avg = 0; + unsigned int rx_2s_avg = 0; + int i=0, aggReady=0; + unsigned long total_sum = (priv->pshare->current_tx_bytes+priv->pshare->current_rx_bytes); + int assoc_num = GET_ROOT(priv)->assoc_num; +#ifdef MBSSID + if (GET_ROOT(priv)->pmib->miscEntry.vap_enable){ + for (i=0; ipvap_priv[i]-> assoc_num; + } +#endif +#ifdef UNIVERSAL_REPEATER + if (IS_DRV_OPEN(GET_VXD_PRIV(GET_ROOT(priv)))) + assoc_num += GET_VXD_PRIV(GET_ROOT(priv))-> assoc_num; +#endif +#ifdef WDS + if(GET_ROOT(priv)->pmib->dot11WdsInfo.wdsEnabled) + assoc_num ++; +#endif + + + pstat->current_tx_bytes += pstat->tx_byte_cnt; + pstat->current_rx_bytes += pstat->rx_byte_cnt; + + if (total_sum != 0) { + if (total_sum <= 1000000) { + tx_2s_avg = (unsigned int)((pstat->current_tx_bytes*100) / total_sum); + rx_2s_avg = (unsigned int)((pstat->current_rx_bytes*100) / total_sum); + } else { + tx_2s_avg = (unsigned int)(pstat->current_tx_bytes / (total_sum / 100)); + rx_2s_avg = (unsigned int)(pstat->current_rx_bytes / (total_sum / 100)); + } + + } + +#if(DM_ODM_SUPPORT_TYPE==ODM_ADSL) + if (pstat->ht_cap_len) { + if ((tx_2s_avg + rx_2s_avg) >=25 ) {//50// + + priv->pshare->highTP_found_pstat = pstat; + bhighTP_found_pstat=TRUE; + } + } +#elif(DM_ODM_SUPPORT_TYPE==ODM_AP) + for(i=0; i<8; i++) + aggReady += (pstat->ADDBA_ready[i]); + + if ((pstat->ht_cap_len && ( +#ifdef SUPPORT_TX_AMSDU + AMSDU_ENABLE || +#endif + aggReady)) || (pstat->IOTPeer==HT_IOT_PEER_INTEL)) + { + if ((assoc_num==1) || (tx_2s_avg + rx_2s_avg >= 25)) { + priv->pshare->highTP_found_pstat = pstat; + } + + #ifdef CLIENT_MODE + if (OPMODE & WIFI_STATION_STATE) { + if ((tx_2s_avg + rx_2s_avg) >= 20) + priv->pshare->highTP_found_pstat = pstat; + } + #endif + } +#endif + } + else { + pstat->current_tx_bytes = pstat->tx_byte_cnt; + pstat->current_rx_bytes = pstat->rx_byte_cnt; + } + + return bhighTP_found_pstat; +} + + +#ifdef WIFI_WMM +VOID +ODM_IotEdcaSwitch( + IN PVOID pDM_VOID, + IN unsigned char enable + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + prtl8192cd_priv priv = pDM_Odm->priv; + int mode=priv->pmib->dot11BssType.net_work_type; + unsigned int slot_time = 20, sifs_time = 10, BE_TXOP = 47, VI_TXOP = 94; + unsigned int vi_cw_max = 4, vi_cw_min = 3, vi_aifs; +#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) + u32 be_edca, vi_edca; + u16 disable_cfe; +#endif + +#if (DM_ODM_SUPPORT_TYPE==ODM_AP) + if (!(!priv->pmib->dot11OperationEntry.wifi_specific || + ((OPMODE & WIFI_AP_STATE) && (priv->pmib->dot11OperationEntry.wifi_specific)) + #ifdef CLIENT_MODE + || ((OPMODE & WIFI_STATION_STATE) && (priv->pmib->dot11OperationEntry.wifi_specific)) + #endif + )) + return; +#endif + +#ifdef RTK_AC_SUPPORT //for 11ac logo, do not dynamic switch edca + if(AC_SIGMA_MODE != AC_SIGMA_NONE) + return; +#endif + + if ((mode & (ODM_WM_N24G|ODM_WM_N5G)) && (priv->pshare->ht_sta_num + #ifdef WDS + || ((OPMODE & WIFI_AP_STATE) && priv->pmib->dot11WdsInfo.wdsEnabled && priv->pmib->dot11WdsInfo.wdsNum) + #endif + )) + sifs_time = 16; + + if (mode & (ODM_WM_N24G|ODM_WM_N5G|ODM_WM_G|ODM_WM_A)) { + slot_time = 9; + } + else + { + BE_TXOP = 94; + VI_TXOP = 188; + } + +#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) + vi_edca = -1; + disable_cfe = -1; +#endif + +#if (DM_ODM_SUPPORT_TYPE==ODM_ADSL) + if (priv->pshare->iot_mode_VO_exist) { + // to separate AC_VI and AC_BE to avoid using the same EDCA settings + if (priv->pshare->iot_mode_BE_exist) { + vi_cw_max = 5; + vi_cw_min = 3; + } else { + vi_cw_max = 6; + vi_cw_min = 4; + } + } + vi_aifs = (sifs_time + ((OPMODE & WIFI_AP_STATE)?1:2) * slot_time); + +#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) + vi_edca = ((VI_TXOP*(1-priv->pshare->iot_mode_VO_exist)) << 16)| (vi_cw_max << 12) | (vi_cw_min << 8) | vi_aifs; +#else + ODM_Write4Byte(pDM_Odm, ODM_EDCA_VI_PARAM, ((VI_TXOP*(1-priv->pshare->iot_mode_VO_exist)) << 16)| (vi_cw_max << 12) | (vi_cw_min << 8) | vi_aifs); +#endif + +#elif (DM_ODM_SUPPORT_TYPE==ODM_AP) + if ((OPMODE & WIFI_AP_STATE) && priv->pmib->dot11OperationEntry.wifi_specific) { + if (priv->pshare->iot_mode_VO_exist) { + #ifdef WMM_VIBE_PRI + if (priv->pshare->iot_mode_BE_exist) + { + vi_cw_max = 5; + vi_cw_min = 3; + vi_aifs = (sifs_time + ((OPMODE & WIFI_AP_STATE)?1:2) * slot_time); + } + else + #endif + { + vi_cw_max = 6; + vi_cw_min = 4; + vi_aifs = 0x2b; + } + } + else { + vi_aifs = (sifs_time + ((OPMODE & WIFI_AP_STATE)?1:2) * slot_time); + } + +#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) + vi_edca = ((VI_TXOP*(1-priv->pshare->iot_mode_VO_exist)) << 16) + | (vi_cw_max << 12) | (vi_cw_min << 8) | vi_aifs; +#else + ODM_Write4Byte(pDM_Odm, ODM_EDCA_VI_PARAM, ((VI_TXOP*(1-priv->pshare->iot_mode_VO_exist)) << 16) + | (vi_cw_max << 12) | (vi_cw_min << 8) | vi_aifs); +#endif + + #ifdef WMM_BEBK_PRI + #ifdef CONFIG_RTL_88E_SUPPORT + if ((GET_CHIP_VER(priv) == VERSION_8188E) && priv->pshare->iot_mode_BK_exist) { +#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) + be_edca = (10 << 12) | (6 << 8) | 0x4f; +#else + ODM_Write4Byte(pDM_Odm, ODM_EDCA_BK_PARAM, (10 << 12) | (6 << 8) | 0x4f); +#endif + } + #endif + #endif +#if defined(CONFIG_WLAN_HAL_8881A) + if (GET_CHIP_VER(priv) == VERSION_8881A) + ODM_Write4Byte(pDM_Odm, ODM_EDCA_BK_PARAM, 0xa64f); +#endif + } +#endif + + + +#if (DM_ODM_SUPPORT_TYPE==ODM_AP) + if (priv->pshare->rf_ft_var.wifi_beq_iot && priv->pshare->iot_mode_VI_exist) { +#if defined(CONFIG_RTL_88E_SUPPORT) || defined(CONFIG_RTL_8812_SUPPORT) + if (GET_CHIP_VER(priv) == VERSION_8188E || GET_CHIP_VER(priv) == VERSION_8812E) { +#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) + be_edca = (10 << 12) | (6 << 8) | 0x4f; +#else + ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (10 << 12) | (6 << 8) | 0x4f); +#endif + } + else +#endif + { +#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) + be_edca = (10 << 12) | (4 << 8) | 0x4f; +#else + ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (10 << 12) | (4 << 8) | 0x4f); +#endif + } + } else if(!enable) +#elif(DM_ODM_SUPPORT_TYPE==ODM_ADSL) + if(!enable) //if iot is disable ,maintain original BEQ PARAM +#endif + { +#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) + be_edca = (((OPMODE & WIFI_AP_STATE)?6:10) << 12) | (4 << 8) + | (sifs_time + 3 * slot_time); + disable_cfe = 1; +#else + ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (((OPMODE & WIFI_AP_STATE)?6:10) << 12) | (4 << 8) + | (sifs_time + 3 * slot_time)); +#endif +#ifdef CONFIG_PCI_HCI +// ODM_Write2Byte(pDM_Odm, RD_CTRL, ODM_Read2Byte(pDM_Odm, RD_CTRL) | (DIS_TXOP_CFE)); +#endif + } + else + { + int txop; + unsigned int cw_max; +#ifdef LOW_TP_TXOP + unsigned int txop_close; +#endif + + #if((DM_ODM_SUPPORT_TYPE==ODM_AP)&&(defined LOW_TP_TXOP)) + cw_max = ((priv->pshare->BE_cwmax_enhance) ? 10 : 6); + txop_close = ((priv->pshare->rf_ft_var.low_tp_txop && priv->pshare->rf_ft_var.low_tp_txop_close) ? 1 : 0); + + if(priv->pshare->txop_enlarge == 0xe) //if intel case + txop = (txop_close ? 0 : (BE_TXOP*2)); + else //if other case + txop = (txop_close ? 0: (BE_TXOP*priv->pshare->txop_enlarge)); + #else + cw_max=6; + if((priv->pshare->txop_enlarge==0xe)||(priv->pshare->txop_enlarge==0xd)) + txop=BE_TXOP*2; + else + txop=BE_TXOP*priv->pshare->txop_enlarge; + + #endif + + if (priv->pshare->ht_sta_num + #ifdef WDS + || ((OPMODE & WIFI_AP_STATE) && (mode & (ODM_WM_N24G|ODM_WM_N5G)) && + priv->pmib->dot11WdsInfo.wdsEnabled && priv->pmib->dot11WdsInfo.wdsNum) + #endif + ) + { + + if (priv->pshare->txop_enlarge == 0xe) { + // is intel client, use a different edca value + //ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (txop<< 16) | (cw_max<< 12) | (4 << 8) | 0x1f); + if (pDM_Odm->RFType==ODM_1T1R) { +#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) + be_edca = (txop << 16) | (5 << 12) | (3 << 8) | 0x1f; +#else + ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (txop << 16) | (5 << 12) | (3 << 8) | 0x1f); +#endif + } + else { +#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) + be_edca = (txop << 16) | (8 << 12) | (5 << 8) | 0x1f; +#else + ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (txop << 16) | (8 << 12) | (5 << 8) | 0x1f); +#endif + } + +#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) + disable_cfe = 0; +#endif +#ifdef CONFIG_PCI_HCI +// ODM_Write2Byte(pDM_Odm, RD_CTRL, ODM_Read2Byte(pDM_Odm, RD_CTRL) & ~(DIS_TXOP_CFE)); +#endif + priv->pshare->txop_enlarge = 2; + } +#if(DM_ODM_SUPPORT_TYPE==ODM_AP) + #ifndef LOW_TP_TXOP + else if (priv->pshare->txop_enlarge == 0xd) { + // is intel ralink, use a different edca value +#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) + be_edca = (txop << 16) | (6 << 12) | (5 << 8) | 0x2b; +#else + ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (txop << 16) | (6 << 12) | (5 << 8) | 0x2b); +#endif + priv->pshare->txop_enlarge = 2; + } + #endif +#endif + else + { +// if (txop == 0) { +//#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) +// disable_cfe = 1; +//#endif +//#ifdef CONFIG_PCI_HCI +// ODM_Write2Byte(pDM_Odm, RD_CTRL, ODM_Read2Byte(pDM_Odm, RD_CTRL) | (DIS_TXOP_CFE)); +//#endif +// } + + if (pDM_Odm->RFType==ODM_2T2R) { +#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) + be_edca = (txop << 16) | (cw_max << 12) | (4 << 8) | (sifs_time + 3 * slot_time); +#else + ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (txop << 16) | + (cw_max << 12) | (4 << 8) | (sifs_time + 3 * slot_time)); +#endif + } + else + #if(DM_ODM_SUPPORT_TYPE==ODM_AP)&&(defined LOW_TP_TXOP) + { +#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) + be_edca = (txop << 16) | + (((priv->pshare->BE_cwmax_enhance) ? 10 : 5) << 12) | (3 << 8) | (sifs_time + 2 * slot_time); +#else + ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (txop << 16) | + (((priv->pshare->BE_cwmax_enhance) ? 10 : 5) << 12) | (3 << 8) | (sifs_time + 2 * slot_time)); +#endif + } + #else + { + PSTA_INFO_T pstat = priv->pshare->highTP_found_pstat; + if ((GET_CHIP_VER(priv)==VERSION_8881A) && pstat && (pstat->IOTPeer == HT_IOT_PEER_HTC)) + ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, 0x642b); + else { +#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) + be_edca = (txop << 16) | (5 << 12) | (3 << 8) | (sifs_time + 2 * slot_time); + #else + ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (txop << 16) | + (5 << 12) | (3 << 8) | (sifs_time + 2 * slot_time)); +#endif + } + } + #endif + } + } + else + { + #if((DM_ODM_SUPPORT_TYPE==ODM_AP)&&(defined LOW_TP_TXOP)) +#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) + be_edca = (BE_TXOP << 16) | (cw_max << 12) | (4 << 8) | (sifs_time + 3 * slot_time); +#else + ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (BE_TXOP << 16) | (cw_max << 12) | (4 << 8) | (sifs_time + 3 * slot_time)); +#endif + #else + #if defined(CONFIG_RTL_8196D) || defined(CONFIG_RTL_8197DL) || defined(CONFIG_RTL_8196E) || (defined(CONFIG_RTL_8197D) && !defined(CONFIG_PORT0_EXT_GIGA)) +#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) + be_edca = (BE_TXOP*2 << 16) | (cw_max << 12) | (5 << 8) | (sifs_time + 3 * slot_time); + #else + ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (BE_TXOP*2 << 16) | (cw_max << 12) | (5 << 8) | (sifs_time + 3 * slot_time)); +#endif + #else +#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) + be_edca = (BE_TXOP*2 << 16) | (cw_max << 12) | (4 << 8) | (sifs_time + 3 * slot_time); + #else + ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (BE_TXOP*2 << 16) | (cw_max << 12) | (4 << 8) | (sifs_time + 3 * slot_time)); + #endif + #endif +/* + if (priv->pshare->txop_enlarge == 0xe) { +#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) + disable_cfe = 0; +#endif + #ifdef CONFIG_PCI_HCI + ODM_Write2Byte(pDM_Odm, RD_CTRL, ODM_Read2Byte(pDM_Odm, RD_CTRL) & ~(DIS_TXOP_CFE)); + #endif + } else { +#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) + disable_cfe = 1; +#endif + #ifdef CONFIG_PCI_HCI + ODM_Write2Byte(pDM_Odm, RD_CTRL, ODM_Read2Byte(pDM_Odm, RD_CTRL) | (DIS_TXOP_CFE)); + #endif + } +*/ + #endif + } + + } + +#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) + notify_IOT_EDCA_switch(priv, be_edca, vi_edca, disable_cfe); +#endif +} +#endif + +VOID +odm_IotEngine( + IN PVOID pDM_VOID + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct rtl8192cd_priv *priv=pDM_Odm->priv; + PSTA_INFO_T pstat = NULL; + u4Byte i; + +#ifdef WIFI_WMM + unsigned int switch_turbo = 0, avg_tp; +#endif +//////////////////////////////////////////////////////// +// if EDCA Turbo function is not supported or Manual EDCA Setting +// then return +//////////////////////////////////////////////////////// + if(!(pDM_Odm->SupportAbility&ODM_MAC_EDCA_TURBO)){ + ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("ODM_MAC_EDCA_TURBO NOT SUPPORTED\n")); + return; + } + +#if((DM_ODM_SUPPORT_TYPE==ODM_AP)&& defined(RTL_MANUAL_EDCA) && defined(WIFI_WMM)) + if(priv->pmib->dot11QosEntry.ManualEDCA){ + ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("ODM_MAC_EDCA_TURBO OFF: MANUAL SETTING\n")); + return ; + } +#endif + +#if !(DM_ODM_SUPPORT_TYPE &ODM_AP) + ////////////////////////////////////////////////////// + //find high TP STA every 2s +////////////////////////////////////////////////////// + if ((GET_ROOT(priv)->up_time % 2) == 0) + priv->pshare->highTP_found_pstat==NULL; + +#if 0 + phead = &priv->asoc_list; + plist = phead->next; + while(plist != phead) { + pstat = list_entry(plist, struct stat_info, asoc_list); + + if(ODM_ChooseIotMainSTA(pDM_Odm, pstat)); //find the correct station + break; + if (plist == plist->next) //the last plist + break; + plist = plist->next; + }; +#endif + + //find highTP STA + for(i=0; ipODM_StaInfo[i]; + if(IS_STA_VALID(pstat) && (ODM_ChooseIotMainSTA(pDM_Odm, pstat))) //find the correct station + break; + } + + ////////////////////////////////////////////////////// + //if highTP STA is not found, then return + ////////////////////////////////////////////////////// + if(priv->pshare->highTP_found_pstat==NULL) { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("ODM_MAC_EDCA_TURBO OFF: NO HT STA FOUND\n")); + return; + } +#endif + + pstat=priv->pshare->highTP_found_pstat; + if(pstat) { + if((pstat->tx_avarage + pstat->rx_avarage) < (1<<17)) // 1M bps + pstat = NULL; + } + +#ifdef WIFI_WMM + if (QOS_ENABLE) { + if (!priv->pmib->dot11OperationEntry.wifi_specific + #if(DM_ODM_SUPPORT_TYPE==ODM_AP) + ||((OPMODE & WIFI_AP_STATE) && (priv->pmib->dot11OperationEntry.wifi_specific)) + #elif(DM_ODM_SUPPORT_TYPE==ODM_ADSL) + || (priv->pmib->dot11OperationEntry.wifi_specific == 2) + #endif + ) { + if (priv->pshare->iot_mode_enable && + ((priv->pshare->phw->VO_pkt_count > 50) || + (priv->pshare->phw->VI_pkt_count > 50) || + (priv->pshare->phw->BK_pkt_count > 50))) { + priv->pshare->iot_mode_enable = 0; + switch_turbo++; +#ifdef CONFIG_WLAN_HAL_8881A + if (GET_CHIP_VER(priv) == VERSION_8881A) { + RTL_W32(0x460, 0x03086666); + } +#endif //CONFIG_WLAN_HAL_8881A + } else if ((!priv->pshare->iot_mode_enable) && + ((priv->pshare->phw->VO_pkt_count < 50) && + (priv->pshare->phw->VI_pkt_count < 50) && + (priv->pshare->phw->BK_pkt_count < 50))) { + priv->pshare->iot_mode_enable++; + switch_turbo++; +//#ifdef CONFIG_WLAN_HAL_8881A +#if 0 + if (GET_CHIP_VER(priv) == VERSION_8881A) { + if (get_bonding_type_8881A()==BOND_8881AB) { + RTL_W32(0x460, 0x03086666); + } + else { + RTL_W32(0x460, 0x0320ffff); + } + } +#endif //CONFIG_WLAN_HAL_8881A + } + } + + + #if(DM_ODM_SUPPORT_TYPE==ODM_AP) + if ((OPMODE & WIFI_AP_STATE) && priv->pmib->dot11OperationEntry.wifi_specific) + #elif (DM_ODM_SUPPORT_TYPE==ODM_ADSL) + if (priv->pmib->dot11OperationEntry.wifi_specific) + #endif + { + if (!priv->pshare->iot_mode_VO_exist && (priv->pshare->phw->VO_pkt_count > 50)) { + priv->pshare->iot_mode_VO_exist++; + switch_turbo++; + } else if (priv->pshare->iot_mode_VO_exist && (priv->pshare->phw->VO_pkt_count < 50)) { + priv->pshare->iot_mode_VO_exist = 0; + switch_turbo++; + } +#if((DM_ODM_SUPPORT_TYPE==ODM_ADSL)||((DM_ODM_SUPPORT_TYPE==ODM_AP)&&(defined WMM_VIBE_PRI))) + if (priv->pshare->iot_mode_VO_exist) { + //printk("[%s %d] BE_pkt_count=%d\n", __FUNCTION__, __LINE__, priv->pshare->phw->BE_pkt_count); + if (!priv->pshare->iot_mode_BE_exist && (priv->pshare->phw->BE_pkt_count > 250)) { + priv->pshare->iot_mode_BE_exist++; + switch_turbo++; + } else if (priv->pshare->iot_mode_BE_exist && (priv->pshare->phw->BE_pkt_count < 250)) { + priv->pshare->iot_mode_BE_exist = 0; + switch_turbo++; + } + } +#endif + +#if((DM_ODM_SUPPORT_TYPE==ODM_ADSL)||((DM_ODM_SUPPORT_TYPE==ODM_AP)&&(defined WMM_BEBK_PRI))) + if (priv->pshare->phw->BE_pkt_count) { + //printk("[%s %d] BK_pkt_count=%d\n", __FUNCTION__, __LINE__, priv->pshare->phw->BK_pkt_count); + if (!priv->pshare->iot_mode_BK_exist && (priv->pshare->phw->BK_pkt_count > 250)) { + priv->pshare->iot_mode_BK_exist++; + switch_turbo++; + } else if (priv->pshare->iot_mode_BK_exist && (priv->pshare->phw->BK_pkt_count < 250)) { + priv->pshare->iot_mode_BK_exist = 0; + switch_turbo++; + } + } +#endif + +#if (DM_ODM_SUPPORT_TYPE==ODM_AP) + if (priv->pshare->rf_ft_var.wifi_beq_iot) + { + if (!priv->pshare->iot_mode_VI_exist && (priv->pshare->phw->VI_rx_pkt_count > 50)) { + priv->pshare->iot_mode_VI_exist++; + switch_turbo++; + } else if (priv->pshare->iot_mode_VI_exist && (priv->pshare->phw->VI_rx_pkt_count < 50)) { + priv->pshare->iot_mode_VI_exist = 0; + switch_turbo++; + } + } +#endif + + } + else if (!pstat || pstat->rssi < priv->pshare->rf_ft_var.txop_enlarge_lower) { + if (priv->pshare->txop_enlarge) { + priv->pshare->txop_enlarge = 0; + if (priv->pshare->iot_mode_enable) + switch_turbo++; + } + } + +#if(defined(CLIENT_MODE) && (DM_ODM_SUPPORT_TYPE==ODM_AP)) + if ((OPMODE & WIFI_STATION_STATE) && (priv->pmib->dot11OperationEntry.wifi_specific)) + { + if (priv->pshare->iot_mode_enable && + (((priv->pshare->phw->VO_pkt_count > 50) || + (priv->pshare->phw->VI_pkt_count > 50) || + (priv->pshare->phw->BK_pkt_count > 50)) || + (pstat && (!pstat->ADDBA_ready[0]) & (!pstat->ADDBA_ready[3])))) + { + priv->pshare->iot_mode_enable = 0; + switch_turbo++; + } + else if ((!priv->pshare->iot_mode_enable) && + (((priv->pshare->phw->VO_pkt_count < 50) && + (priv->pshare->phw->VI_pkt_count < 50) && + (priv->pshare->phw->BK_pkt_count < 50)) && + (pstat && (pstat->ADDBA_ready[0] | pstat->ADDBA_ready[3])))) + { + priv->pshare->iot_mode_enable++; + switch_turbo++; + } + } +#endif + + priv->pshare->phw->VO_pkt_count = 0; + priv->pshare->phw->VI_pkt_count = 0; + priv->pshare->phw->BK_pkt_count = 0; + + #if((DM_ODM_SUPPORT_TYPE==ODM_ADSL)||((DM_ODM_SUPPORT_TYPE==ODM_AP)&&(defined WMM_VIBE_PRI))) + priv->pshare->phw->BE_pkt_count = 0; + #endif + + #if(DM_ODM_SUPPORT_TYPE==ODM_AP) + if (priv->pshare->rf_ft_var.wifi_beq_iot) + priv->pshare->phw->VI_rx_pkt_count = 0; + #endif + + } +#endif + + if ((priv->up_time % 2) == 0) { + /* + * decide EDCA content for different chip vendor + */ +#ifdef WIFI_WMM + #if(DM_ODM_SUPPORT_TYPE==ODM_ADSL) + if (QOS_ENABLE && (!priv->pmib->dot11OperationEntry.wifi_specific || (priv->pmib->dot11OperationEntry.wifi_specific == 2) + + #elif(DM_ODM_SUPPORT_TYPE==ODM_AP) + if (QOS_ENABLE && (!priv->pmib->dot11OperationEntry.wifi_specific || + ((OPMODE & WIFI_AP_STATE) && (priv->pmib->dot11OperationEntry.wifi_specific == 2)) + #ifdef CLIENT_MODE + || ((OPMODE & WIFI_STATION_STATE) && (priv->pmib->dot11OperationEntry.wifi_specific == 2)) + #endif + #endif + )) + + { + + if (pstat && pstat->rssi >= priv->pshare->rf_ft_var.txop_enlarge_upper) { +#ifdef LOW_TP_TXOP + if (pstat->IOTPeer==HT_IOT_PEER_INTEL) + { + if (priv->pshare->txop_enlarge != 0xe) + { + priv->pshare->txop_enlarge = 0xe; + + if (priv->pshare->iot_mode_enable) + switch_turbo++; + } + } + else if (priv->pshare->txop_enlarge != 2) + { + priv->pshare->txop_enlarge = 2; + if (priv->pshare->iot_mode_enable) + switch_turbo++; + } +#else + if (priv->pshare->txop_enlarge != 2) + { + if (pstat->IOTPeer==HT_IOT_PEER_INTEL) + priv->pshare->txop_enlarge = 0xe; + else if (pstat->IOTPeer==HT_IOT_PEER_RALINK) + priv->pshare->txop_enlarge = 0xd; + else if (pstat->IOTPeer==HT_IOT_PEER_HTC) + priv->pshare->txop_enlarge = 0; + else + priv->pshare->txop_enlarge = 2; + + if (priv->pshare->iot_mode_enable) + switch_turbo++; + } +#endif + } + else if (!pstat || pstat->rssi < priv->pshare->rf_ft_var.txop_enlarge_lower) + { + if (priv->pshare->txop_enlarge) { + priv->pshare->txop_enlarge = 0; + if (priv->pshare->iot_mode_enable) + switch_turbo++; + } + } + +#if((DM_ODM_SUPPORT_TYPE==ODM_AP)&&( defined LOW_TP_TXOP)) + // for Intel IOT, need to enlarge CW MAX from 6 to 10 + if (pstat && pstat->IOTPeer==HT_IOT_PEER_INTEL && (((pstat->tx_avarage+pstat->rx_avarage)>>10) < + priv->pshare->rf_ft_var.cwmax_enhance_thd)) + { + if (!priv->pshare->BE_cwmax_enhance && priv->pshare->iot_mode_enable) + { + priv->pshare->BE_cwmax_enhance = 1; + switch_turbo++; + } + } else { + if (priv->pshare->BE_cwmax_enhance) { + priv->pshare->BE_cwmax_enhance = 0; + switch_turbo++; + } + } +#endif + } +#endif + priv->pshare->current_tx_bytes = 0; + priv->pshare->current_rx_bytes = 0; + }else { + if ((GET_CHIP_VER(priv) == VERSION_8881A)||(GET_CHIP_VER(priv) == VERSION_8192E)|| (GET_CHIP_VER(priv) == VERSION_8188E) ){ + unsigned int uldl_tp = (priv->pshare->current_tx_bytes+priv->pshare->current_rx_bytes)>>17; + if((uldl_tp > 40) && (priv->pshare->agg_to!= 1)) { + RTL_W8(0x462, 0x08); + priv->pshare->agg_to = 1; + } else if((uldl_tp < 35) && (priv->pshare->agg_to !=0)) { + RTL_W8(0x462, 0x02); + priv->pshare->agg_to = 0; + } + } + } + +#if((DM_ODM_SUPPORT_TYPE==ODM_AP)&& defined( SW_TX_QUEUE)) + if(AMPDU_ENABLE) { +#ifdef TX_EARLY_MODE + if (GET_TX_EARLY_MODE) { + if (!GET_EM_SWQ_ENABLE && + ((priv->assoc_num > 1) || + (pstat && pstat->IOTPeer != HT_IOT_PEER_UNKNOWN))) { + if ((priv->pshare->em_tx_byte_cnt >> 17) > EM_TP_UP_BOUND) + priv->pshare->reach_tx_limit_cnt++; + else + priv->pshare->reach_tx_limit_cnt = 0; + + if (priv->pshare->txop_enlarge && priv->pshare->reach_tx_limit_cnt) { //>= WAIT_TP_TIME// + GET_EM_SWQ_ENABLE = 1; + priv->pshare->reach_tx_limit_cnt = 0; + + if (pstat->IOTPeer == HT_IOT_PEER_INTEL) + MAX_EM_QUE_NUM = 12; + else if (pstat->IOTPeer == HT_IOT_PEER_RALINK) + MAX_EM_QUE_NUM = 10; + + enable_em(priv); + } + } + else if (GET_EM_SWQ_ENABLE) { + if ((priv->pshare->em_tx_byte_cnt >> 17) < EM_TP_LOW_BOUND) + priv->pshare->reach_tx_limit_cnt++; + else + priv->pshare->reach_tx_limit_cnt = 0; + + if (!priv->pshare->txop_enlarge || priv->pshare->reach_tx_limit_cnt >= WAIT_TP_TIME) { + GET_EM_SWQ_ENABLE = 0; + priv->pshare->reach_tx_limit_cnt = 0; + disable_em(priv); + } + } + } +#endif + +#if defined(CONFIG_WLAN_HAL_8881A) || defined(CONFIG_WLAN_HAL_8192EE) || defined(CONFIG_RTL_8812_SUPPORT) || defined(CONFIG_WLAN_HAL_8814AE) + if (pDM_Odm->SupportICType == ODM_RTL8881A || pDM_Odm->SupportICType == ODM_RTL8192E || pDM_Odm->SupportICType == ODM_RTL8812 || pDM_Odm->SupportICType == ODM_RTL8814A) { + if (priv->assoc_num > 9) + { + if (priv->swq_txmac_chg >= priv->pshare->rf_ft_var.swq_en_highthd){ + if ((priv->swq_decision == 0)){ + switch_turbo++; + if (priv->pshare->txop_enlarge == 0) + priv->pshare->txop_enlarge = 2; + priv->swq_decision = 1; + } + else + { + if ((switch_turbo > 0) && (priv->pshare->txop_enlarge == 0) && (priv->pshare->iot_mode_enable != 0)) + { + priv->pshare->txop_enlarge = 2; + switch_turbo--; + } + } + } + else if(priv->swq_txmac_chg <= priv->pshare->rf_ft_var.swq_dis_lowthd){ + priv->swq_decision = 0; + } + else if ((priv->swq_decision == 1) && (switch_turbo > 0) && (priv->pshare->txop_enlarge == 0) && (priv->pshare->iot_mode_enable != 0)) { + priv->pshare->txop_enlarge = 2; + switch_turbo--; + } + } else { + priv->swq_decision = 0; + } + } else if(CONFIG_WLAN_NOT_HAL_EXIST) +#endif + { + if (priv->assoc_num > 1) + { + if (priv->swq_txmac_chg >= priv->pshare->rf_ft_var.swq_en_highthd){ + if ((priv->swq_decision == 0)){ + switch_turbo++; + if (priv->pshare->txop_enlarge == 0) + priv->pshare->txop_enlarge = 2; + priv->swq_decision = 1; + } + else + { + if ((switch_turbo > 0) && (priv->pshare->txop_enlarge == 0) && (priv->pshare->iot_mode_enable != 0)) + { + priv->pshare->txop_enlarge = 2; + switch_turbo--; + } + } + } + else if(priv->swq_txmac_chg <= priv->pshare->rf_ft_var.swq_dis_lowthd){ + priv->swq_decision = 0; + } + else if ((priv->swq_decision == 1) && (switch_turbo > 0) && (priv->pshare->txop_enlarge == 0) && (priv->pshare->iot_mode_enable != 0)) { + priv->pshare->txop_enlarge = 2; + switch_turbo--; + } + } + //#if (defined CONFIG_RTL_819XD)) + else if (priv->assoc_num == 1 && (priv->up_time % 2 == 0) +#if (DM_ODM_SUPPORT_TYPE==ODM_AP) && defined(TX_EARLY_MODE) + && (!GET_TX_EARLY_MODE || !GET_EM_SWQ_ENABLE) +#endif + ) { + if ((pstat) && (pstat->ADDBA_ready[0] | pstat->ADDBA_ready[3])) { + //int en_thd = 14417920>>(priv->up_time % 2); + avg_tp = (pstat->current_tx_bytes >> 17); + + //if ((priv->swq_decision == 0) && (pstat->current_tx_bytes > en_thd) && (pstat->current_rx_bytes > en_thd) ) { //50Mbps + if ((priv->swq_decision == 0) && (avg_tp > TP_HIGH_WATER_MARK)) { //55Mbps + //printk("[%s:%d] swq_decision=1 current_tp: %d Mbps\n", __FUNCTION__, __LINE__, avg_tp); + priv->swq_decision = 1; + } + //else if ((priv->swq_decision == 1) && ((pstat->tx_avarage < 4587520) || (pstat->rx_avarage < 4587520))) { //35Mbps + else if ((priv->swq_decision == 1) && (avg_tp < TP_LOW_WATER_MARK)) { //35Mbps + //printk("[%s:%d] swq_decision=0 current_tp: %d Mbps\n", __FUNCTION__, __LINE__, avg_tp); + priv->swq_decision = 0; + } + } else { + priv->swq_decision = 0; + } + } + } + if( (priv->swq_decision == 1) +#if (DM_ODM_SUPPORT_TYPE==ODM_AP) && defined(TX_EARLY_MODE) + || (GET_EM_SWQ_ENABLE == 1) +#endif + ) { + priv->swq_en = 1; + priv->swqen_keeptime = priv->up_time; + } else { + priv->swq_en = 0; + priv->swqen_keeptime = 0; + } + } +#endif + +#ifdef WIFI_WMM +#ifdef LOW_TP_TXOP + if ((!priv->pmib->dot11OperationEntry.wifi_specific || (priv->pmib->dot11OperationEntry.wifi_specific == 2)) + && QOS_ENABLE) { + if (switch_turbo || priv->pshare->rf_ft_var.low_tp_txop) { + unsigned int thd_tp; + unsigned char under_thd; + unsigned int curr_tp; + + if (priv->pmib->dot11BssType.net_work_type & (ODM_WM_N24G|ODM_WM_N5G| ODM_WM_G)) + { + // Determine the upper bound throughput threshold. + if (priv->pmib->dot11BssType.net_work_type & (ODM_WM_N24G|ODM_WM_N5G)) { + if (priv->assoc_num && priv->assoc_num != priv->pshare->ht_sta_num) + thd_tp = priv->pshare->rf_ft_var.low_tp_txop_thd_g; + else + thd_tp = priv->pshare->rf_ft_var.low_tp_txop_thd_n; + } + else + thd_tp = priv->pshare->rf_ft_var.low_tp_txop_thd_g; + + // Determine to close txop. +#if defined(UNIVERSAL_REPEATER) || defined(MBSSID) + if(IS_STA_VALID(pstat)) + { + struct rtl8192cd_priv *tmppriv; + struct aid_obj *aidarray; + aidarray = container_of(pstat, struct aid_obj, station); + tmppriv = aidarray->priv; + + curr_tp = (unsigned int)(tmppriv->ext_stats.tx_avarage>>17) + (unsigned int)(tmppriv->ext_stats.rx_avarage>>17); + } + else +#endif + curr_tp = (unsigned int)(priv->ext_stats.tx_avarage>>17) + (unsigned int)(priv->ext_stats.rx_avarage>>17); + if (curr_tp <= thd_tp && curr_tp >= priv->pshare->rf_ft_var.low_tp_txop_thd_low) + under_thd = 1; + else + under_thd = 0; + } + else + { + under_thd = 0; + } + + if (switch_turbo) + { + priv->pshare->rf_ft_var.low_tp_txop_close = under_thd; + priv->pshare->rf_ft_var.low_tp_txop_count = 0; + } + else if (priv->pshare->iot_mode_enable && (priv->pshare->rf_ft_var.low_tp_txop_close != under_thd)) { + priv->pshare->rf_ft_var.low_tp_txop_count++; + if (priv->pshare->rf_ft_var.low_tp_txop_close) { + priv->pshare->rf_ft_var.low_tp_txop_count = priv->pshare->rf_ft_var.low_tp_txop_delay; + } + if (priv->pshare->rf_ft_var.low_tp_txop_count ==priv->pshare->rf_ft_var.low_tp_txop_delay) + + { + priv->pshare->rf_ft_var.low_tp_txop_count = 0; + priv->pshare->rf_ft_var.low_tp_txop_close = under_thd; + switch_turbo++; + } + } + else + { + priv->pshare->rf_ft_var.low_tp_txop_count = 0; + } + } + } +#endif + +#ifdef WMM_DSCP_C42 + if (switch_turbo) { + if (!priv->pshare->iot_mode_enable && !priv->pshare->aggrmax_change) { + RTL_W16(0x4ca, 0x0404); + priv->pshare->aggrmax_change = 1; + } + else if (priv->pshare->iot_mode_enable && priv->pshare->aggrmax_change) { + RTL_W16(0x4ca, priv->pshare->aggrmax_bak); + priv->pshare->aggrmax_change = 0; + } + } +#endif +#ifdef TX_EARLY_MODE + unsigned int em_tp = ((priv->ext_stats.tx_avarage>>17) + (priv->ext_stats.rx_avarage>>17)); + if (em_tp > 80) + ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (0x5e << 16) | (4 << 12) | (3 << 8) | 0x19); + else //if (em_tp < 75) + ODM_Write4Byte(pDM_Odm, ODM_EDCA_BE_PARAM, (0x5e << 16) | (6 << 12) | (5 << 8) | 0x2b); +#endif + if (switch_turbo) + ODM_IotEdcaSwitch( pDM_Odm, priv->pshare->iot_mode_enable ); +#endif +} +#endif + diff --git a/hal/OUTSRC/odm_EdcaTurboCheck.h b/hal/OUTSRC/odm_EdcaTurboCheck.h new file mode 100644 index 0000000..8fba8a2 --- /dev/null +++ b/hal/OUTSRC/odm_EdcaTurboCheck.h @@ -0,0 +1,150 @@ +/****************************************************************************** + * + * 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 __ODMEDCATURBOCHECK_H__ +#define __ODMEDCATURBOCHECK_H__ + +typedef struct _EDCA_TURBO_ +{ + BOOLEAN bCurrentTurboEDCA; + BOOLEAN bIsCurRDLState; + + #if(DM_ODM_SUPPORT_TYPE == ODM_CE ) + u4Byte prv_traffic_idx; // edca turbo + #endif + +}EDCA_T,*pEDCA_T; + +#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) +static u4Byte edca_setting_UL[HT_IOT_PEER_MAX] = +// UNKNOWN REALTEK_90 REALTEK_92SE BROADCOM RALINK ATHEROS CISCO MERU MARVELL 92U_AP SELF_AP(DownLink/Tx) +{ 0x5e4322, 0xa44f, 0x5e4322, 0x5ea32b, 0x5ea422, 0x5ea322, 0x3ea430, 0x5ea42b, 0x5ea44f, 0x5e4322, 0x5e4322}; + + +static u4Byte edca_setting_DL[HT_IOT_PEER_MAX] = +// UNKNOWN REALTEK_90 REALTEK_92SE BROADCOM RALINK ATHEROS CISCO MERU, MARVELL 92U_AP SELF_AP(UpLink/Rx) +{ 0xa44f, 0x5ea44f, 0x5e4322, 0x5ea42b, 0xa44f, 0xa630, 0x5ea630, 0x5ea42b, 0xa44f, 0xa42b, 0xa42b}; + +static u4Byte edca_setting_DL_GMode[HT_IOT_PEER_MAX] = +// UNKNOWN REALTEK_90 REALTEK_92SE BROADCOM RALINK ATHEROS CISCO MERU, MARVELL 92U_AP SELF_AP +{ 0x4322, 0xa44f, 0x5e4322, 0xa42b, 0x5e4322, 0x4322, 0xa42b, 0x5ea42b, 0xa44f, 0x5e4322, 0x5ea42b}; + + +//============================================================ +// EDCA Paramter for AP/ADSL by Mingzhi 2011-11-22 +//============================================================ +#elif (DM_ODM_SUPPORT_TYPE &ODM_ADSL) +enum qos_prio { BK, BE, VI, VO, VI_AG, VO_AG }; + +static const struct ParaRecord rtl_ap_EDCA[] = +{ +//ACM,AIFSN, ECWmin, ECWmax, TXOplimit + {0, 7, 4, 10, 0}, //BK + {0, 3, 4, 6, 0}, //BE + {0, 1, 3, 4, 188}, //VI + {0, 1, 2, 3, 102}, //VO + {0, 1, 3, 4, 94}, //VI_AG + {0, 1, 2, 3, 47}, //VO_AG +}; + +static const struct ParaRecord rtl_sta_EDCA[] = +{ +//ACM,AIFSN, ECWmin, ECWmax, TXOplimit + {0, 7, 4, 10, 0}, + {0, 3, 4, 10, 0}, + {0, 2, 3, 4, 188}, + {0, 2, 2, 3, 102}, + {0, 2, 3, 4, 94}, + {0, 2, 2, 3, 47}, +}; +#endif + + +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) +#ifdef WIFI_WMM +VOID +ODM_IotEdcaSwitch( + IN PVOID pDM_VOID, + IN unsigned char enable + ); +#endif + +BOOLEAN +ODM_ChooseIotMainSTA( + IN PVOID pDM_VOID, + IN PSTA_INFO_T pstat + ); +#endif + +VOID +odm_EdcaTurboCheck( + IN PVOID pDM_VOID + ); +VOID +ODM_EdcaTurboInit( + IN PVOID pDM_VOID +); + +#if(DM_ODM_SUPPORT_TYPE==ODM_WIN) +VOID +odm_EdcaTurboCheckMP( + IN PVOID pDM_VOID + ); + +//check if edca turbo is disabled +BOOLEAN +odm_IsEdcaTurboDisable( + IN PVOID pDM_VOID +); +//choose edca paramter for special IOT case +VOID +ODM_EdcaParaSelByIot( + IN PVOID pDM_VOID, + OUT u4Byte *EDCA_BE_UL, + OUT u4Byte *EDCA_BE_DL + ); +//check if it is UL or DL +VOID +odm_EdcaChooseTrafficIdx( + IN PVOID pDM_VOID, + IN u8Byte cur_tx_bytes, + IN u8Byte cur_rx_bytes, + IN BOOLEAN bBiasOnRx, + OUT BOOLEAN *pbIsCurRDLState + ); + +#elif (DM_ODM_SUPPORT_TYPE==ODM_CE) +VOID +odm_EdcaTurboCheckCE( + IN PVOID pDM_VOID + ); +#else +VOID +odm_IotEngine( + IN PVOID pDM_VOID + ); + +VOID +odm_EdcaParaInit( + IN PVOID pDM_VOID + ); +#endif + +#endif diff --git a/hal/OUTSRC/odm_HWConfig.c b/hal/OUTSRC/odm_HWConfig.c index 0e4396c..f280db7 100644 --- a/hal/OUTSRC/odm_HWConfig.c +++ b/hal/OUTSRC/odm_HWConfig.c @@ -22,7 +22,7 @@ // include files //============================================================ - +#include "Mp_Precomp.h" #include "odm_precomp.h" #define READ_AND_CONFIG_MP(ic, txt) (ODM_ReadAndConfig_MP_##ic##txt(pDM_Odm)) @@ -57,13 +57,7 @@ #define GET_VERSION_MP(ic, txt) (ODM_GetVersion_MP_##ic##txt()) #define GET_VERSION_TC(ic, txt) (ODM_GetVersion_TC_##ic##txt()) - -#define GET_VERSION(ic, txt) do {\ - if (pDM_Odm->bIsMPChip)\ - GET_VERSION_MP(ic,txt);\ - else\ - GET_VERSION_TC(ic,txt);\ - } while(0) +#define GET_VERSION(ic, txt) (pDM_Odm->bIsMPChip?GET_VERSION_MP(ic,txt):GET_VERSION_TC(ic,txt)) u1Byte @@ -987,29 +981,7 @@ odm_RxPhyStatus92CSeries_Parsing( } } - //2 For dynamic ATC switch - if(pDM_Odm->SupportAbility & ODM_BB_DYNAMIC_ATC) - { - if(pPktinfo->bPacketMatchBSSID && ( *(pDM_Odm->mp_mode) == 0)) - { - // TODO: - - //3 Update CFO report for path-A & path-B - for(i = ODM_RF_PATH_A; i < ODM_RF_PATH_MAX; i++) - { - pDM_Odm->CFO_tail[i] = (int)pPhyStaRpt->path_cfotail[i]; - } - - //3 Update packet counter - if(pDM_Odm->packetCount == 0xffffffff) - pDM_Odm->packetCount = 0; - else - pDM_Odm->packetCount++; - - //ODM_RT_TRACE(pDM_Odm, ODM_COMP_DYNAMIC_ATC, ODM_DBG_LOUD, - //("pPhyStaRpt->path_cfotail[i] = 0x%x, pDM_Odm->CFO_tail[i] = 0x%x\n", pPhyStaRpt->path_cfotail[0], pDM_Odm->CFO_tail[1])); - } - } + ODM_ParsingCFO(pDM_Odm, pPktinfo, pPhyStaRpt->path_cfotail); } #if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) @@ -1020,8 +992,12 @@ odm_RxPhyStatus92CSeries_Parsing( #if (DM_ODM_SUPPORT_TYPE == ODM_WIN) // 2012/01/12 MH Use customeris signal strength from HalComRxdDesc.c/ pPhyInfo->SignalStrength = (u1Byte)(SignalScaleMapping(pDM_Odm->Adapter, PWDB_ALL));//PWDB_ALL; +#else +#ifdef CONFIG_SKIP_SIGNAL_SCALE_MAPPING + pPhyInfo->SignalStrength = (u1Byte)PWDB_ALL; #else pPhyInfo->SignalStrength = (u1Byte)(odm_SignalScaleMapping(pDM_Odm, PWDB_ALL));//PWDB_ALL; +#endif #endif } else @@ -1031,8 +1007,13 @@ odm_RxPhyStatus92CSeries_Parsing( #if (DM_ODM_SUPPORT_TYPE == ODM_WIN) // 2012/01/12 MH Use customeris signal strength from HalComRxdDesc.c/ pPhyInfo->SignalStrength = (u1Byte)(SignalScaleMapping(pDM_Odm->Adapter, total_rssi/=rf_rx_num));//PWDB_ALL; +#else +#ifdef CONFIG_SKIP_SIGNAL_SCALE_MAPPING + total_rssi/=rf_rx_num; + pPhyInfo->SignalStrength = (u1Byte)total_rssi; #else pPhyInfo->SignalStrength = (u1Byte)(odm_SignalScaleMapping(pDM_Odm, total_rssi/=rf_rx_num)); +#endif #endif } } @@ -1122,9 +1103,9 @@ odm_RxPhyStatusJaguarSeries_Parsing( // cck_highpwr = FALSE; cck_agc_rpt = pPhyStaRpt->cfosho[0] ; - LNA_idx = ((cck_agc_rpt & 0xE0) >>5); VGA_idx = (cck_agc_rpt & 0x1F); + if(pDM_Odm->SupportICType == ODM_RTL8812) { switch(LNA_idx) @@ -1166,6 +1147,7 @@ odm_RxPhyStatusJaguarSeries_Parsing( } rx_pwr_all += 6; PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all); + if(cck_highpwr == FALSE) { if(PWDB_ALL >= 80) @@ -1219,13 +1201,16 @@ odm_RxPhyStatusJaguarSeries_Parsing( u1Byte SQ,SQ_rpt; if((pDM_Odm->SupportPlatform == ODM_WIN) && - (pDM_Odm->PatchID==RT_CID_819x_Lenovo)){ + (pDM_Odm->PatchID==RT_CID_819x_Lenovo)) + { SQ = odm_SQ_process_patch_RT_CID_819x_Lenovo(pDM_Odm,isCCKrate,PWDB_ALL,0,0); } - else if(pPhyInfo->RxPWDBAll > 40 && !pDM_Odm->bInHctTest){ + else if(pPhyInfo->RxPWDBAll > 40 && !pDM_Odm->bInHctTest) + { SQ = 100; } - else{ + else + { SQ_rpt = pPhyStaRpt->pwdb_all; if(SQ_rpt > 64) @@ -1315,10 +1300,8 @@ odm_RxPhyStatusJaguarSeries_Parsing( else rx_pwr_all = (((pPhyStaRpt->pwdb_all) >> 1 )& 0x7f) -110; //OLD FORMULA - PWDB_ALL_BT = PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all); - pPhyInfo->RxPWDBAll = PWDB_ALL; //ODM_RT_TRACE(pDM_Odm,ODM_COMP_RSSI_MONITOR, ODM_DBG_LOUD, ("ODM OFDM RSSI=%d\n",pPhyInfo->RxPWDBAll)); #if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) @@ -1331,10 +1314,12 @@ odm_RxPhyStatusJaguarSeries_Parsing( // pPhyInfo->RxPWDBAll, pPhyInfo->RxMIMOSignalStrength[0], pPhyInfo->RxMIMOSignalStrength[1]); - if((pDM_Odm->SupportPlatform == ODM_WIN) &&(pDM_Odm->PatchID==19)){ + if((pDM_Odm->SupportPlatform == ODM_WIN) &&(pDM_Odm->PatchID==19)) + { //do nothing } - else{//pMgntInfo->CustomerID != RT_CID_819x_Lenovo + else + { //pMgntInfo->CustomerID != RT_CID_819x_Lenovo // // (4)EVM of OFDM rate // @@ -1386,7 +1371,6 @@ odm_RxPhyStatusJaguarSeries_Parsing( //RT_DISP(FRX, RX_PHY_SQ, ("RXRATE=%x RXEVM=%x EVM=%s%d\n", //pPktinfo->DataRate, pPhyStaRpt->rxevm[i], "%", EVM)); - { if(i==ODM_RF_PATH_A) // Fill value in RFD, Get the first spatial stream only { @@ -1398,27 +1382,9 @@ odm_RxPhyStatusJaguarSeries_Parsing( } } } - //2 For dynamic ATC switch - if(pDM_Odm->SupportAbility & ODM_BB_DYNAMIC_ATC) - { - if(pPktinfo->bPacketMatchBSSID && ( *(pDM_Odm->mp_mode) == 0) ) - { - //3 Update CFO report for path-A & path-B - for(i = ODM_RF_PATH_A; i < ODM_RF_PATH_MAX; i++) - { - pDM_Odm->CFO_tail[i] = (int)pPhyStaRpt->cfotail[i]; - } - //3 Update packet counter - if(pDM_Odm->packetCount == 0xffffffff) - pDM_Odm->packetCount = 0; - else - pDM_Odm->packetCount++; - - //ODM_RT_TRACE(pDM_Odm, ODM_COMP_DYNAMIC_ATC, ODM_DBG_LOUD, - //("pPhyStaRpt->path_cfotail[i] = 0x%x, pDM_Odm->CFO_tail[i] = 0x%x\n", pPhyStaRpt->path_cfotail[0], pDM_Odm->CFO_tail[1])); - } - } + ODM_ParsingCFO(pDM_Odm, pPktinfo, pPhyStaRpt->cfotail); + } //DbgPrint("isCCKrate= %d, pPhyInfo->SignalStrength=%d % PWDB_AL=%d rf_rx_num=%d\n", isCCKrate, pPhyInfo->SignalStrength, PWDB_ALL, rf_rx_num); @@ -1483,16 +1449,21 @@ odm_Process_RSSIForDM( { s4Byte UndecoratedSmoothedPWDB, UndecoratedSmoothedCCK, UndecoratedSmoothedOFDM, RSSI_Ave; - u1Byte isCCKrate=0; - u1Byte RSSI_max, RSSI_min, i; + u1Byte i, isCCKrate=0; + u1Byte RSSI_max, RSSI_min; u4Byte OFDM_pkt=0; u4Byte Weighting=0; PSTA_INFO_T pEntry; - if(pPktinfo->StationID == 0xFF) return; +#if (RTL8723B_SUPPORT == 1)||(RTL8821A_SUPPORT == 1) +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + odm_S0S1_SwAntDivByCtrlFrame_ProcessRSSI(pDM_Odm, pPhyInfo, pPktinfo); +#endif +#endif + // // 2012/05/30 MH/Luke.Lee Add some description // In windows driver: AP/IBSS mode STA @@ -1504,9 +1475,11 @@ odm_Process_RSSIForDM( //else pEntry = pDM_Odm->pODM_StaInfo[pPktinfo->StationID]; - if(!IS_STA_VALID(pEntry) ){ + if(!IS_STA_VALID(pEntry) ) + { return; } + if((!pPktinfo->bPacketMatchBSSID) ) { return; @@ -1559,7 +1532,8 @@ odm_Process_RSSIForDM( if(!isCCKrate)//ofdm rate { - if(pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_B] == 0){ + if(pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_B] == 0) + { RSSI_Ave = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A]; pDM_Odm->RSSI_A = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A]; pDM_Odm->RSSI_B = 0; @@ -1720,7 +1694,9 @@ ODM_PhyStatusQuery_92CSeries( //odm_SwAntDivRSSICheck8192C(padapter, precvframe->u.hdr.attrib.RxPWDBAll); #endif */ +#if (RTL8192C_SUPPORT == 1) ODM_SwAntDivChkPerPktRssi(pDM_Odm,pPktinfo->StationID,pPhyInfo); +#endif } } else @@ -1812,7 +1788,7 @@ ODM_ConfigRFWithHeaderFile( { if(ConfigType == CONFIG_RF_RADIO) { if(eRFPath == ODM_RF_PATH_A) - READ_AND_CONFIG_MP(8723A,_RadioA_1T); + READ_AND_CONFIG_MP(8723A,_RadioA); } } #endif @@ -1821,15 +1797,11 @@ ODM_ConfigRFWithHeaderFile( if (pDM_Odm->SupportICType == ODM_RTL8188E) { if(ConfigType == CONFIG_RF_RADIO) { - if(eRFPath == ODM_RF_PATH_A){ - if(IS_VENDOR_8188E_I_CUT_SERIES(Adapter)) - READ_AND_CONFIG(8188E,_RadioA_1T_ICUT); - else - READ_AND_CONFIG(8188E,_RadioA_1T); - } + if(eRFPath == ODM_RF_PATH_A) + READ_AND_CONFIG_MP(8188E,_RadioA); } else if(ConfigType == CONFIG_RF_TXPWR_LMT) { - READ_AND_CONFIG(8188E,_TXPWR_LMT); + READ_AND_CONFIG_MP(8188E,_TXPWR_LMT); } } #endif @@ -1840,15 +1812,15 @@ ODM_ConfigRFWithHeaderFile( if(ConfigType == CONFIG_RF_RADIO) { if(eRFPath == ODM_RF_PATH_A) { - READ_AND_CONFIG(8812A,_RadioA); + READ_AND_CONFIG_MP(8812A,_RadioA); } else if(eRFPath == ODM_RF_PATH_B) { - READ_AND_CONFIG(8812A,_RadioB); + READ_AND_CONFIG_MP(8812A,_RadioB); } } else if(ConfigType == CONFIG_RF_TXPWR_LMT) { - READ_AND_CONFIG(8812A,_TXPWR_LMT); + READ_AND_CONFIG_MP(8812A,_TXPWR_LMT); } } #endif @@ -1859,18 +1831,18 @@ ODM_ConfigRFWithHeaderFile( if(ConfigType == CONFIG_RF_RADIO) { if(eRFPath == ODM_RF_PATH_A) { - READ_AND_CONFIG(8821A,_RadioA); + READ_AND_CONFIG_MP(8821A,_RadioA); } } else if(ConfigType == CONFIG_RF_TXPWR_LMT) { if (pDM_Odm->SupportInterface == ODM_ITRF_USB) { if (pDM_Odm->ExtPA5G || pDM_Odm->ExtLNA5G) - READ_AND_CONFIG(8821A,_TXPWR_LMT_8811AU_FEM); + READ_AND_CONFIG_MP(8821A,_TXPWR_LMT_8811AU_FEM); else - READ_AND_CONFIG(8821A,_TXPWR_LMT_8811AU_IPA); + READ_AND_CONFIG_MP(8821A,_TXPWR_LMT_8811AU_IPA); } else { - READ_AND_CONFIG(8821A,_TXPWR_LMT_8821A); + READ_AND_CONFIG_MP(8821A,_TXPWR_LMT_8821A); } } ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("<===8821_ODM_ConfigRFWithHeaderFile\n")); @@ -1881,10 +1853,10 @@ ODM_ConfigRFWithHeaderFile( if (pDM_Odm->SupportICType == ODM_RTL8723B) { if(ConfigType == CONFIG_RF_RADIO) { - READ_AND_CONFIG(8723B,_RadioA); + READ_AND_CONFIG_MP(8723B,_RadioA); } else if(ConfigType == CONFIG_RF_TXPWR_LMT) { - READ_AND_CONFIG(8723B,_TXPWR_LMT); + READ_AND_CONFIG_MP(8723B,_TXPWR_LMT); } } #endif @@ -1894,18 +1866,18 @@ ODM_ConfigRFWithHeaderFile( { if(ConfigType == CONFIG_RF_RADIO) { if(eRFPath == ODM_RF_PATH_A) - READ_AND_CONFIG(8192E,_RadioA); + READ_AND_CONFIG_MP(8192E,_RadioA); else if(eRFPath == ODM_RF_PATH_B) - READ_AND_CONFIG(8192E,_RadioB); + READ_AND_CONFIG_MP(8192E,_RadioB); } else if(ConfigType == CONFIG_RF_TXPWR_LMT) { - READ_AND_CONFIG(8192E,_TXPWR_LMT); + READ_AND_CONFIG_MP(8192E,_TXPWR_LMT); } } #endif -#if (RTL8813A_SUPPORT == 1) - if (pDM_Odm->SupportICType == ODM_RTL8813A) +#if (RTL8814A_SUPPORT == 1) + if (pDM_Odm->SupportICType == ODM_RTL8814A) { /* if(ConfigType == CONFIG_RF_TXPWR_LMT) { @@ -1928,7 +1900,6 @@ ODM_ConfigRFWithTxPwrTrackHeaderFile( ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("pDM_Odm->SupportPlatform: 0x%X, pDM_Odm->SupportInterface: 0x%X, pDM_Odm->BoardType: 0x%X\n", pDM_Odm->SupportPlatform, pDM_Odm->SupportInterface, pDM_Odm->BoardType)); - if(0) { } @@ -1936,23 +1907,23 @@ ODM_ConfigRFWithTxPwrTrackHeaderFile( else if(pDM_Odm->SupportICType == ODM_RTL8821) { if (pDM_Odm->SupportInterface == ODM_ITRF_PCIE) - READ_AND_CONFIG(8821A,_TxPowerTrack_PCIE); + READ_AND_CONFIG_MP(8821A,_TxPowerTrack_PCIE); else if (pDM_Odm->SupportInterface == ODM_ITRF_USB) - READ_AND_CONFIG(8821A,_TxPowerTrack_USB); + READ_AND_CONFIG_MP(8821A,_TxPowerTrack_USB); else - READ_AND_CONFIG(8821A,_TxPowerTrack_PCIE); + READ_AND_CONFIG_MP(8821A,_TxPowerTrack_PCIE); } #endif #if (RTL8812A_SUPPORT == 1) else if(pDM_Odm->SupportICType == ODM_RTL8812) { if (pDM_Odm->SupportInterface == ODM_ITRF_PCIE) - READ_AND_CONFIG(8812A,_TxPowerTrack_PCIE); + READ_AND_CONFIG_MP(8812A,_TxPowerTrack_PCIE); else if (pDM_Odm->SupportInterface == ODM_ITRF_USB) { if (pDM_Odm->RFEType == 3 && pDM_Odm->bIsMPChip) READ_AND_CONFIG_MP(8812A,_TxPowerTrack_RFE3); else - READ_AND_CONFIG(8812A,_TxPowerTrack_USB); + READ_AND_CONFIG_MP(8812A,_TxPowerTrack_USB); } } @@ -1961,31 +1932,31 @@ ODM_ConfigRFWithTxPwrTrackHeaderFile( else if(pDM_Odm->SupportICType == ODM_RTL8192E) { if (pDM_Odm->SupportInterface == ODM_ITRF_PCIE) - READ_AND_CONFIG(8192E,_TxPowerTrack_PCIE); + READ_AND_CONFIG_MP(8192E,_TxPowerTrack_PCIE); else if (pDM_Odm->SupportInterface == ODM_ITRF_USB) - READ_AND_CONFIG(8192E,_TxPowerTrack_USB); + READ_AND_CONFIG_MP(8192E,_TxPowerTrack_USB); } #endif #if RTL8723B_SUPPORT else if(pDM_Odm->SupportICType == ODM_RTL8723B) { if (pDM_Odm->SupportInterface == ODM_ITRF_PCIE) - READ_AND_CONFIG(8723B,_TxPowerTrack_PCIE); + READ_AND_CONFIG_MP(8723B,_TxPowerTrack_PCIE); else if (pDM_Odm->SupportInterface == ODM_ITRF_USB) - READ_AND_CONFIG(8723B,_TxPowerTrack_USB); + READ_AND_CONFIG_MP(8723B,_TxPowerTrack_USB); else if (pDM_Odm->SupportInterface == ODM_ITRF_SDIO) - READ_AND_CONFIG(8723B,_TxPowerTrack_SDIO); + READ_AND_CONFIG_MP(8723B,_TxPowerTrack_SDIO); } #endif #if RTL8188E_SUPPORT else if(pDM_Odm->SupportICType == ODM_RTL8188E) { if (pDM_Odm->SupportInterface == ODM_ITRF_PCIE) - READ_AND_CONFIG(8188E,_TxPowerTrack_PCIE); + READ_AND_CONFIG_MP(8188E,_TxPowerTrack_PCIE); else if (pDM_Odm->SupportInterface == ODM_ITRF_USB) - READ_AND_CONFIG(8188E,_TxPowerTrack_USB); + READ_AND_CONFIG_MP(8188E,_TxPowerTrack_USB); else - READ_AND_CONFIG(8188E,_TxPowerTrack_PCIE); + READ_AND_CONFIG_MP(8188E,_TxPowerTrack_PCIE); } #endif @@ -2016,11 +1987,11 @@ ODM_ConfigBBWithHeaderFile( { if(ConfigType == CONFIG_BB_PHY_REG) { - READ_AND_CONFIG_MP(8723A,_PHY_REG_1T); + READ_AND_CONFIG_MP(8723A,_PHY_REG); } else if(ConfigType == CONFIG_BB_AGC_TAB) { - READ_AND_CONFIG_MP(8723A,_AGC_TAB_1T); + READ_AND_CONFIG_MP(8723A,_AGC_TAB); } } #endif @@ -2030,21 +2001,15 @@ ODM_ConfigBBWithHeaderFile( { if(ConfigType == CONFIG_BB_PHY_REG) { - if(IS_VENDOR_8188E_I_CUT_SERIES(Adapter)) - READ_AND_CONFIG(8188E,_PHY_REG_1T_ICUT); - else - READ_AND_CONFIG(8188E,_PHY_REG_1T); + READ_AND_CONFIG_MP(8188E,_PHY_REG); } else if(ConfigType == CONFIG_BB_AGC_TAB) { - if(IS_VENDOR_8188E_I_CUT_SERIES(Adapter)) - READ_AND_CONFIG(8188E,_AGC_TAB_1T_ICUT); - else - READ_AND_CONFIG(8188E,_AGC_TAB_1T); + READ_AND_CONFIG_MP(8188E,_AGC_TAB); } else if(ConfigType == CONFIG_BB_PHY_REG_PG) { - READ_AND_CONFIG(8188E,_PHY_REG_PG); + READ_AND_CONFIG_MP(8188E,_PHY_REG_PG); } } #endif @@ -2054,11 +2019,11 @@ ODM_ConfigBBWithHeaderFile( { if(ConfigType == CONFIG_BB_PHY_REG) { - READ_AND_CONFIG(8812A,_PHY_REG); + READ_AND_CONFIG_MP(8812A,_PHY_REG); } else if(ConfigType == CONFIG_BB_AGC_TAB) { - READ_AND_CONFIG(8812A,_AGC_TAB); + READ_AND_CONFIG_MP(8812A,_AGC_TAB); } else if(ConfigType == CONFIG_BB_PHY_REG_PG) { @@ -2069,7 +2034,7 @@ ODM_ConfigBBWithHeaderFile( READ_AND_CONFIG_MP(8812A,_PHY_REG_PG_NEC); #endif else - READ_AND_CONFIG(8812A,_PHY_REG_PG); + READ_AND_CONFIG_MP(8812A,_PHY_REG_PG); } else if(ConfigType == CONFIG_BB_PHY_REG_MP) { @@ -2090,15 +2055,15 @@ ODM_ConfigBBWithHeaderFile( { if(ConfigType == CONFIG_BB_PHY_REG) { - READ_AND_CONFIG(8821A,_PHY_REG); + READ_AND_CONFIG_MP(8821A,_PHY_REG); } else if(ConfigType == CONFIG_BB_AGC_TAB) { - READ_AND_CONFIG(8821A,_AGC_TAB); + READ_AND_CONFIG_MP(8821A,_AGC_TAB); } else if(ConfigType == CONFIG_BB_PHY_REG_PG) { - READ_AND_CONFIG(8821A,_PHY_REG_PG); + READ_AND_CONFIG_MP(8821A,_PHY_REG_PG); } } #endif @@ -2108,15 +2073,15 @@ ODM_ConfigBBWithHeaderFile( if(ConfigType == CONFIG_BB_PHY_REG) { - READ_AND_CONFIG(8723B,_PHY_REG); + READ_AND_CONFIG_MP(8723B,_PHY_REG); } else if(ConfigType == CONFIG_BB_AGC_TAB) { - READ_AND_CONFIG(8723B,_AGC_TAB); + READ_AND_CONFIG_MP(8723B,_AGC_TAB); } else if(ConfigType == CONFIG_BB_PHY_REG_PG) { - READ_AND_CONFIG(8723B,_PHY_REG_PG); + READ_AND_CONFIG_MP(8723B,_PHY_REG_PG); } } #endif @@ -2126,20 +2091,20 @@ ODM_ConfigBBWithHeaderFile( if(ConfigType == CONFIG_BB_PHY_REG) { - READ_AND_CONFIG(8192E,_PHY_REG); + READ_AND_CONFIG_MP(8192E,_PHY_REG); } else if(ConfigType == CONFIG_BB_AGC_TAB) { - READ_AND_CONFIG(8192E,_AGC_TAB); + READ_AND_CONFIG_MP(8192E,_AGC_TAB); } else if(ConfigType == CONFIG_BB_PHY_REG_PG) { - READ_AND_CONFIG(8192E,_PHY_REG_PG); + READ_AND_CONFIG_MP(8192E,_PHY_REG_PG); } } #endif -#if (RTL8813A_SUPPORT == 1) - if(pDM_Odm->SupportICType == ODM_RTL8813A) +#if (RTL8814A_SUPPORT == 1) + if(pDM_Odm->SupportICType == ODM_RTL8814A) { if(ConfigType == CONFIG_BB_PHY_REG) @@ -2184,22 +2149,19 @@ ODM_ConfigMACWithHeaderFile( #if (RTL8188E_SUPPORT == 1) if (pDM_Odm->SupportICType == ODM_RTL8188E) { - if(IS_VENDOR_8188E_I_CUT_SERIES(Adapter)) - result = READ_AND_CONFIG(8188E,_MAC_REG_ICUT); - else - result = READ_AND_CONFIG(8188E,_MAC_REG); + READ_AND_CONFIG_MP(8188E,_MAC_REG); } #endif #if (RTL8812A_SUPPORT == 1) if (pDM_Odm->SupportICType == ODM_RTL8812) { - READ_AND_CONFIG(8812A,_MAC_REG); + READ_AND_CONFIG_MP(8812A,_MAC_REG); } #endif #if (RTL8821A_SUPPORT == 1) if (pDM_Odm->SupportICType == ODM_RTL8821) { - READ_AND_CONFIG(8821A,_MAC_REG); + READ_AND_CONFIG_MP(8821A,_MAC_REG); ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("<===8821_ODM_ConfigMACwithHeaderFile\n")); } @@ -2207,13 +2169,13 @@ ODM_ConfigMACWithHeaderFile( #if (RTL8723B_SUPPORT == 1) if (pDM_Odm->SupportICType == ODM_RTL8723B) { - READ_AND_CONFIG(8723B,_MAC_REG); + READ_AND_CONFIG_MP(8723B,_MAC_REG); } #endif #if (RTL8192E_SUPPORT == 1) if (pDM_Odm->SupportICType == ODM_RTL8192E) { - READ_AND_CONFIG(8192E,_MAC_REG); + READ_AND_CONFIG_MP(8192E,_MAC_REG); } #endif @@ -2232,22 +2194,33 @@ ODM_ConfigFWWithHeaderFile( #if (RTL8188E_SUPPORT == 1) if (pDM_Odm->SupportICType == ODM_RTL8188E) { + #ifdef CONFIG_SFW_SUPPORTED if (ConfigType == CONFIG_FW_NIC) { - READ_FIRMWARE(8188E,_FW_NIC_T); + READ_FIRMWARE_MP(8188E,_FW_NIC_T); } else if (ConfigType == CONFIG_FW_WoWLAN) { - READ_FIRMWARE(8188E,_FW_WoWLAN_T); + READ_FIRMWARE_MP(8188E,_FW_WoWLAN_T); } else if(ConfigType == CONFIG_FW_NIC_2) { - READ_FIRMWARE(8188E,_FW_NIC_S); + READ_FIRMWARE_MP(8188E,_FW_NIC_S); } else if (ConfigType == CONFIG_FW_WoWLAN_2) { - READ_FIRMWARE(8188E,_FW_WoWLAN_S); + READ_FIRMWARE_MP(8188E,_FW_WoWLAN_S); } + #else + if (ConfigType == CONFIG_FW_NIC) + { + READ_FIRMWARE_MP(8188E,_FW_NIC); + } + else if (ConfigType == CONFIG_FW_WoWLAN) + { + READ_FIRMWARE_MP(8188E,_FW_WoWLAN); + } + #endif } #endif #if (RTL8723B_SUPPORT == 1) @@ -2255,11 +2228,11 @@ ODM_ConfigFWWithHeaderFile( { if (ConfigType == CONFIG_FW_NIC) { - READ_FIRMWARE(8723B,_FW_NIC); + READ_FIRMWARE_MP(8723B,_FW_NIC); } else if (ConfigType == CONFIG_FW_WoWLAN) { - READ_FIRMWARE(8723B,_FW_WoWLAN); + READ_FIRMWARE_MP(8723B,_FW_WoWLAN); } #ifdef CONFIG_AP_WOWLAN else if (ConfigType == CONFIG_FW_AP_WoWLAN) @@ -2282,15 +2255,15 @@ ODM_ConfigFWWithHeaderFile( { if (ConfigType == CONFIG_FW_NIC) { - READ_FIRMWARE(8812A,_FW_NIC); + READ_FIRMWARE_MP(8812A,_FW_NIC); } else if (ConfigType == CONFIG_FW_WoWLAN) { - READ_FIRMWARE(8812A,_FW_WoWLAN); + READ_FIRMWARE_MP(8812A,_FW_WoWLAN); } else if (ConfigType == CONFIG_FW_BT) { - READ_FIRMWARE(8812A,_FW_NIC_BT); + READ_FIRMWARE_MP(8812A,_FW_NIC_BT); } } @@ -2304,7 +2277,7 @@ ODM_ConfigFWWithHeaderFile( } else if (ConfigType == CONFIG_FW_WoWLAN) { - READ_FIRMWARE(8821A,_FW_WoWLAN); + READ_FIRMWARE_MP(8821A,_FW_WoWLAN); } else if (ConfigType == CONFIG_FW_BT) { @@ -2317,16 +2290,16 @@ ODM_ConfigFWWithHeaderFile( { if (ConfigType == CONFIG_FW_NIC) { - READ_FIRMWARE(8192E,_FW_NIC); + READ_FIRMWARE_MP(8192E,_FW_NIC); } else if (ConfigType == CONFIG_FW_WoWLAN) { - READ_FIRMWARE(8192E,_FW_WoWLAN); + READ_FIRMWARE_MP(8192E,_FW_WoWLAN); } #ifdef CONFIG_AP_WOWLAN else if (ConfigType == CONFIG_FW_AP_WoWLAN) { - READ_FIRMWARE(8192E,_FW_AP_WoWLAN); + READ_FIRMWARE_MP(8192E,_FW_AP_WoWLAN); } #endif @@ -2341,13 +2314,39 @@ ODM_GetHWImgVersion( IN PDM_ODM_T pDM_Odm ) { + u4Byte Version=0; + +#if (RTL8723A_SUPPORT == 1) + if (pDM_Odm->SupportICType == ODM_RTL8723A) + Version = GET_VERSION_MP(8723A,_MAC_REG); +#endif + +#if (RTL8723B_SUPPORT == 1) + if (pDM_Odm->SupportICType == ODM_RTL8723B) + Version = GET_VERSION_MP(8723B,_MAC_REG); +#endif + +#if (RTL8188E_SUPPORT == 1) + if (pDM_Odm->SupportICType == ODM_RTL8188E) + Version = GET_VERSION_MP(8188E,_MAC_REG); +#endif + +#if (RTL8821A_SUPPORT == 1) + if (pDM_Odm->SupportICType == ODM_RTL8821) + Version = GET_VERSION_MP(8821A,_MAC_REG); +#endif + +#if (RTL8192E_SUPPORT == 1) + if (pDM_Odm->SupportICType == ODM_RTL8192E) + Version = GET_VERSION_MP(8192E,_MAC_REG); +#endif #if (RTL8812A_SUPPORT == 1) if (pDM_Odm->SupportICType == ODM_RTL8812) - return GET_VERSION_MP(8812A,_MAC_REG); + Version = GET_VERSION_MP(8812A,_MAC_REG); #endif - return 0; + return Version; } diff --git a/hal/OUTSRC/odm_HWConfig.h b/hal/OUTSRC/odm_HWConfig.h index 16a26f6..da0e5fc 100644 --- a/hal/OUTSRC/odm_HWConfig.h +++ b/hal/OUTSRC/odm_HWConfig.h @@ -24,7 +24,7 @@ /*--------------------------Define -------------------------------------------*/ -#define READ_NEXT_PAIR(v1, v2, i) do { i += 2; v1 = Array[i]; v2 = Array[i+1]; } while(0) +//#define READ_NEXT_PAIR(v1, v2, i) do { i += 2; v1 = Array[i]; v2 = Array[i+1]; } while(0) #define AGC_DIFF_CONFIG_MP(ic, band) (ODM_ReadAndConfig_MP_##ic##_AGC_TAB_DIFF(pDM_Odm, Array_MP_##ic##_AGC_TAB_DIFF_##band, \ sizeof(Array_MP_##ic##_AGC_TAB_DIFF_##band)/sizeof(u4Byte))) #define AGC_DIFF_CONFIG_TC(ic, band) (ODM_ReadAndConfig_TC_##ic##_AGC_TAB_DIFF(pDM_Odm, Array_TC_##ic##_AGC_TAB_DIFF_##band, \ @@ -225,6 +225,12 @@ ODM_GetHWImgVersion( IN PDM_ODM_T pDM_Odm ); +s4Byte +odm_SignalScaleMapping( + IN OUT PDM_ODM_T pDM_Odm, + IN s4Byte CurrSig + ); + #endif #endif diff --git a/hal/OUTSRC/odm_NoiseMonitor.c b/hal/OUTSRC/odm_NoiseMonitor.c new file mode 100644 index 0000000..cda06bd --- /dev/null +++ b/hal/OUTSRC/odm_NoiseMonitor.c @@ -0,0 +1,197 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA + * + * + ******************************************************************************/ + +//============================================================ +// include files +//============================================================ +//#include "Mp_Precomp.h" +#include "odm_precomp.h" + +//================================================= +// This function is for inband noise test utility only +// To obtain the inband noise level(dbm), do the following. +// 1. disable DIG and Power Saving +// 2. Set initial gain = 0x1a +// 3. Stop updating idle time pwer report (for driver read) +// - 0x80c[25] +// +//================================================= + +#define Valid_Min -35 +#define Valid_Max 10 +#define ValidCnt 5 + +s2Byte odm_InbandNoise_Monitor_NSeries(PDM_ODM_T pDM_Odm,u8 bPauseDIG,u8 IGIValue,u32 max_time) +{ + u4Byte tmp4b; + u1Byte max_rf_path=0,rf_path; + u1Byte reg_c50, reg_c58,valid_done=0; + struct noise_level noise_data; + u32 start = 0, func_start=0, func_end = 0; + + func_start = ODM_GetCurrentTime(pDM_Odm); + pDM_Odm->noise_level.noise_all = 0; + + if((pDM_Odm->RFType == ODM_1T2R) ||(pDM_Odm->RFType == ODM_2T2R)) + max_rf_path = 2; + else + max_rf_path = 1; + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD,("odm_DebugControlInbandNoise_Nseries() ==> \n")); + + ODM_Memory_Set(pDM_Odm,&noise_data,0,sizeof(struct noise_level)); + + // + // Step 1. Disable DIG && Set initial gain. + // + + if(bPauseDIG) + { + odm_PauseDIG(pDM_Odm,ODM_PAUSE_DIG,IGIValue); + } + // + // Step 2. Disable all power save for read registers + // + //dcmd_DebugControlPowerSave(pAdapter, PSDisable); + + // + // Step 3. Get noise power level + // + start = ODM_GetCurrentTime(pDM_Odm); + while(1) + { + + //Stop updating idle time pwer report (for driver read) + ODM_SetBBReg(pDM_Odm, rFPGA0_TxGainStage, BIT25, 1); + + //Read Noise Floor Report + tmp4b = ODM_GetBBReg(pDM_Odm, 0x8f8,bMaskDWord ); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD,("Noise Floor Report (0x8f8) = 0x%08x\n", tmp4b)); + + //ODM_SetBBReg(pDM_Odm, rOFDM0_XAAGCCore1, bMaskByte0, TestInitialGain); + //if(max_rf_path == 2) + // ODM_SetBBReg(pDM_Odm, rOFDM0_XBAGCCore1, bMaskByte0, TestInitialGain); + + //update idle time pwer report per 5us + ODM_SetBBReg(pDM_Odm, rFPGA0_TxGainStage, BIT25, 0); + + noise_data.value[ODM_RF_PATH_A] = (u1Byte)(tmp4b&0xff); + noise_data.value[ODM_RF_PATH_B] = (u1Byte)((tmp4b&0xff00)>>8); + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("value_a = 0x%x(%d), value_b = 0x%x(%d)\n", + noise_data.value[ODM_RF_PATH_A], noise_data.value[ODM_RF_PATH_A], noise_data.value[ODM_RF_PATH_B], noise_data.value[ODM_RF_PATH_B])); + + for(rf_path = ODM_RF_PATH_A; rf_path < max_rf_path; rf_path++) + { + noise_data.sval[rf_path] = (s1Byte)noise_data.value[rf_path]; + noise_data.sval[rf_path] /= 2; + } + + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD,("sval_a = %d, sval_b = %d\n", + noise_data.sval[ODM_RF_PATH_A], noise_data.sval[ODM_RF_PATH_B])); + //ODM_delay_ms(10); + //ODM_sleep_ms(10); + + for(rf_path = ODM_RF_PATH_A; rf_path < max_rf_path; rf_path++) + { + if( (noise_data.valid_cnt[rf_path] < ValidCnt) && (noise_data.sval[rf_path] < Valid_Max && noise_data.sval[rf_path] >= Valid_Min)) + { + noise_data.valid_cnt[rf_path]++; + noise_data.sum[rf_path] += noise_data.sval[rf_path]; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD,("RF_Path:%d Valid sval = %d\n", rf_path,noise_data.sval[rf_path])); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD,("Sum of sval = %d, \n", noise_data.sum[rf_path])); + if(noise_data.valid_cnt[rf_path] == ValidCnt) + { + valid_done++; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD,("After divided, RF_Path:%d ,sum = %d \n", rf_path,noise_data.sum[rf_path])); + } + + } + + } + + //printk("####### valid_done:%d #############\n",valid_done); + if ((valid_done==max_rf_path) || (ODM_GetProgressingTime(pDM_Odm,start) > max_time)) + { + for(rf_path = ODM_RF_PATH_A; rf_path < max_rf_path; rf_path++) + { + //printk("%s PATH_%d - sum = %d, valid_cnt = %d \n",__FUNCTION__,rf_path,noise_data.sum[rf_path], noise_data.valid_cnt[rf_path]); + if(noise_data.valid_cnt[rf_path]) + noise_data.sum[rf_path] /= noise_data.valid_cnt[rf_path]; + else + noise_data.sum[rf_path] = 0; + } + break; + } + } + reg_c50 = (s4Byte)ODM_GetBBReg(pDM_Odm,rOFDM0_XAAGCCore1,bMaskByte0); + reg_c50 &= ~BIT7; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD,("0x%x = 0x%02x(%d)\n", rOFDM0_XAAGCCore1, reg_c50, reg_c50)); + pDM_Odm->noise_level.noise[ODM_RF_PATH_A] = -110 + reg_c50 + noise_data.sum[ODM_RF_PATH_A]; + pDM_Odm->noise_level.noise_all += pDM_Odm->noise_level.noise[ODM_RF_PATH_A]; + + if(max_rf_path == 2){ + reg_c58 = (s4Byte)ODM_GetBBReg(pDM_Odm,rOFDM0_XBAGCCore1,bMaskByte0); + reg_c58 &= ~BIT7; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD,("0x%x = 0x%02x(%d)\n", rOFDM0_XBAGCCore1, reg_c58, reg_c58)); + pDM_Odm->noise_level.noise[ODM_RF_PATH_B] = -110 + reg_c58 + noise_data.sum[ODM_RF_PATH_B]; + pDM_Odm->noise_level.noise_all += pDM_Odm->noise_level.noise[ODM_RF_PATH_B]; + } + pDM_Odm->noise_level.noise_all /= max_rf_path; + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD,("noise_a = %d, noise_b = %d\n", + pDM_Odm->noise_level.noise[ODM_RF_PATH_A], + pDM_Odm->noise_level.noise[ODM_RF_PATH_B])); + + // + // Step 4. Recover the Dig + // + if(bPauseDIG) + { + odm_PauseDIG(pDM_Odm,ODM_RESUME_DIG,IGIValue); + } + func_end = ODM_GetProgressingTime(pDM_Odm,func_start) ; + //printk("%s noise_a = %d, noise_b = %d noise_all:%d (%d ms)\n",__FUNCTION__, + // pDM_Odm->noise_level.noise[ODM_RF_PATH_A], + // pDM_Odm->noise_level.noise[ODM_RF_PATH_B], + // pDM_Odm->noise_level.noise_all,func_end); + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD,("odm_DebugControlInbandNoise_Nseries() <== \n")); + return pDM_Odm->noise_level.noise_all; + +} +s2Byte ODM_InbandNoise_Monitor(PVOID pDM_VOID,u8 bPauseDIG,u8 IGIValue,u32 max_time) +{ + + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + if(pDM_Odm->SupportICType & ODM_IC_11AC_SERIES ) + { + //odm_InbandNoise_Monitor_JaguarSeries(pDM_Odm,bPauseDIG,IGIValue,max_time); + return 0; + } + else + { + return odm_InbandNoise_Monitor_NSeries(pDM_VOID,bPauseDIG,IGIValue,max_time); + } +} + + + diff --git a/hal/OUTSRC/odm_NoiseMonitor.h b/hal/OUTSRC/odm_NoiseMonitor.h new file mode 100644 index 0000000..6625be6 --- /dev/null +++ b/hal/OUTSRC/odm_NoiseMonitor.h @@ -0,0 +1,49 @@ +/****************************************************************************** + * + * 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 __ODMNOISEMONITOR_H__ +#define __ODMNOISEMONITOR_H__ + +#define ODM_MAX_CHANNEL_NUM 38//14+24 +struct noise_level +{ + //u1Byte value_a, value_b; + u1Byte value[MAX_RF_PATH]; + //s1Byte sval_a, sval_b; + s1Byte sval[MAX_RF_PATH]; + + //s4Byte noise_a=0, noise_b=0,sum_a=0, sum_b=0; + //s4Byte noise[ODM_RF_PATH_MAX]; + s4Byte sum[MAX_RF_PATH]; + //u1Byte valid_cnt_a=0, valid_cnt_b=0, + u1Byte valid[MAX_RF_PATH]; + u1Byte valid_cnt[MAX_RF_PATH]; + +}; + + +typedef struct _ODM_NOISE_MONITOR_ +{ + s1Byte noise[MAX_RF_PATH]; + s2Byte noise_all; +}ODM_NOISE_MONITOR; + +s2Byte ODM_InbandNoise_Monitor(PVOID pDM_VOID,u8 bPauseDIG,u8 IGIValue,u32 max_time); + +#endif diff --git a/hal/OUTSRC/odm_PathDiv.c b/hal/OUTSRC/odm_PathDiv.c new file mode 100644 index 0000000..27a3ec1 --- /dev/null +++ b/hal/OUTSRC/odm_PathDiv.c @@ -0,0 +1,1585 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA + * + * + ******************************************************************************/ + +//============================================================ +// include files +//============================================================ +#include "Mp_Precomp.h" +#include "odm_precomp.h" + + + +VOID +odm_PathDiversityInit( + IN PVOID pDM_VOID +) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + + if(pDM_Odm->mp_mode == TRUE) + return; + + if(!(pDM_Odm->SupportAbility & ODM_BB_PATH_DIV)) + { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_PATH_DIV,ODM_DBG_LOUD,("Return: Not Support PathDiv\n")); + return; + } + + #if RTL8812A_SUPPORT + if(pDM_Odm->SupportICType & ODM_RTL8812) + ODM_PathDiversityInit_8812A(pDM_Odm); + #endif +#endif +} + +VOID +odm_PathDiversity( + IN PVOID pDM_VOID +) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + if(!(pDM_Odm->SupportAbility & ODM_BB_PATH_DIV)) + { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_PATH_DIV,ODM_DBG_LOUD,("Return: Not Support PathDiv\n")); + return; + } + +#if RTL8812A_SUPPORT + + if(pDM_Odm->SupportICType & ODM_RTL8812) + ODM_PathDiversity_8812A(pDM_Odm); +#endif +#endif //(DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) +} + + + +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) +// +// 2011/12/02 MH Copy from MP oursrc for temporarily test. +// + +BOOLEAN +odm_IsConnected_92C( + IN PADAPTER Adapter +) +{ + PRT_WLAN_STA pEntry; + PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo); + u4Byte i; + BOOLEAN bConnected=FALSE; + + if(pMgntInfo->mAssoc) + { + bConnected = TRUE; + } + else + { + for(i = 0; i < ODM_ASSOCIATE_ENTRY_NUM; i++) + { + if(IsAPModeExist(Adapter) && GetFirstExtAdapter(Adapter) != NULL) + pEntry = AsocEntry_EnumStation(GetFirstExtAdapter(Adapter), i); + else + pEntry = AsocEntry_EnumStation(GetDefaultAdapter(Adapter), i); + + if(pEntry!=NULL) + { + if(pEntry->bAssociated) + { + bConnected = TRUE; + break; + } + } + else + { + break; + } + } + } + return bConnected; +} + +BOOLEAN +ODM_PathDiversityBeforeLink92C( + //IN PADAPTER Adapter + IN PDM_ODM_T pDM_Odm + ) +{ +#if (RT_MEM_SIZE_LEVEL != RT_MEM_SIZE_MINIMUM) + PADAPTER Adapter = pDM_Odm->Adapter; + HAL_DATA_TYPE* pHalData = NULL; + PMGNT_INFO pMgntInfo = NULL; + //pSWAT_T pDM_SWAT_Table = &Adapter->DM_SWAT_Table; + pPD_T pDM_PDTable = NULL; + + s1Byte Score = 0; + PRT_WLAN_BSS pTmpBssDesc; + PRT_WLAN_BSS pTestBssDesc; + + u1Byte target_chnl = 0; + u2Byte index; + + if (pDM_Odm->Adapter == NULL) //For BSOD when plug/unplug fast. //By YJ,120413 + { // The ODM structure is not initialized. + return FALSE; + } + pHalData = GET_HAL_DATA(Adapter); + pMgntInfo = &Adapter->MgntInfo; + pDM_PDTable = &Adapter->DM_PDTable; + + // Condition that does not need to use path diversity. + if((!(pHalData->CVID_Version==VERSION_1_BEFORE_8703B && IS_92C_SERIAL(pHalData->VersionID))) || (pHalData->PathDivCfg!=1) || pMgntInfo->AntennaTest ) + { + RT_TRACE(COMP_INIT, DBG_LOUD, + ("ODM_PathDiversityBeforeLink92C(): No PathDiv Mechanism before link.\n")); + return FALSE; + } + + // Since driver is going to set BB register, it shall check if there is another thread controlling BB/RF. + PlatformAcquireSpinLock(Adapter, RT_RF_STATE_SPINLOCK); + if(pHalData->eRFPowerState!=eRfOn || pMgntInfo->RFChangeInProgress || pMgntInfo->bMediaConnect) + { + PlatformReleaseSpinLock(Adapter, RT_RF_STATE_SPINLOCK); + + RT_TRACE(COMP_INIT, DBG_LOUD, + ("ODM_PathDiversityBeforeLink92C(): RFChangeInProgress(%x), eRFPowerState(%x)\n", + pMgntInfo->RFChangeInProgress, + pHalData->eRFPowerState)); + + //pDM_SWAT_Table->SWAS_NoLink_State = 0; + pDM_PDTable->PathDiv_NoLink_State = 0; + + return FALSE; + } + else + { + PlatformReleaseSpinLock(Adapter, RT_RF_STATE_SPINLOCK); + } + + //1 Run AntDiv mechanism "Before Link" part. + //if(pDM_SWAT_Table->SWAS_NoLink_State == 0) + if(pDM_PDTable->PathDiv_NoLink_State == 0) + { + //1 Prepare to do Scan again to check current antenna state. + + // Set check state to next step. + //pDM_SWAT_Table->SWAS_NoLink_State = 1; + pDM_PDTable->PathDiv_NoLink_State = 1; + + // Copy Current Scan list. + Adapter->MgntInfo.tmpNumBssDesc = pMgntInfo->NumBssDesc; + PlatformMoveMemory((PVOID)Adapter->MgntInfo.tmpbssDesc, (PVOID)pMgntInfo->bssDesc, sizeof(RT_WLAN_BSS)*MAX_BSS_DESC); + + // Switch Antenna to another one. + if(pDM_PDTable->DefaultRespPath == 0) + { + PHY_SetBBReg(Adapter, rCCK0_AFESetting , 0x0F000000, 0x05); // TRX path = PathB + odm_SetRespPath_92C(Adapter, 1); + pDM_PDTable->OFDMTXPath = 0xFFFFFFFF; + pDM_PDTable->CCKTXPath = 0xFFFFFFFF; + } + else + { + PHY_SetBBReg(Adapter, rCCK0_AFESetting , 0x0F000000, 0x00); // TRX path = PathA + odm_SetRespPath_92C(Adapter, 0); + pDM_PDTable->OFDMTXPath = 0x0; + pDM_PDTable->CCKTXPath = 0x0; + } +#if 0 + + pDM_SWAT_Table->PreAntenna = pDM_SWAT_Table->CurAntenna; + pDM_SWAT_Table->CurAntenna = (pDM_SWAT_Table->CurAntenna==Antenna_A)?Antenna_B:Antenna_A; + + RT_TRACE(COMP_INIT, DBG_LOUD, + ("ODM_SwAntDivCheckBeforeLink: Change to Ant(%s) for testing.\n", (pDM_SWAT_Table->CurAntenna==Antenna_A)?"A":"B")); + //PHY_SetBBReg(Adapter, rFPGA0_XA_RFInterfaceOE, 0x300, DM_SWAT_Table.CurAntenna); + pDM_SWAT_Table->SWAS_NoLink_BK_Reg860 = ((pDM_SWAT_Table->SWAS_NoLink_BK_Reg860 & 0xfffffcff) | (pDM_SWAT_Table->CurAntenna<<8)); + PHY_SetBBReg(Adapter, rFPGA0_XA_RFInterfaceOE, bMaskDWord, pDM_SWAT_Table->SWAS_NoLink_BK_Reg860); +#endif + + // Go back to scan function again. + RT_TRACE(COMP_INIT, DBG_LOUD, ("ODM_PathDiversityBeforeLink92C: Scan one more time\n")); + pMgntInfo->ScanStep=0; + target_chnl = odm_SwAntDivSelectScanChnl(Adapter); + odm_SwAntDivConstructScanChnl(Adapter, target_chnl); + PlatformSetTimer(Adapter, &pMgntInfo->ScanTimer, 5); + + return TRUE; + } + else + { + //1 ScanComple() is called after antenna swiched. + //1 Check scan result and determine which antenna is going + //1 to be used. + + for(index=0; indexMgntInfo.tmpNumBssDesc; index++) + { + pTmpBssDesc = &(Adapter->MgntInfo.tmpbssDesc[index]); + pTestBssDesc = &(pMgntInfo->bssDesc[index]); + + if(PlatformCompareMemory(pTestBssDesc->bdBssIdBuf, pTmpBssDesc->bdBssIdBuf, 6)!=0) + { + RT_TRACE(COMP_INIT, DBG_LOUD, ("ODM_PathDiversityBeforeLink92C(): ERROR!! This shall not happen.\n")); + continue; + } + + if(pTmpBssDesc->RecvSignalPower > pTestBssDesc->RecvSignalPower) + { + RT_TRACE(COMP_INIT, DBG_LOUD, ("ODM_PathDiversityBeforeLink92C: Compare scan entry: Score++\n")); + RT_PRINT_STR(COMP_INIT, DBG_LOUD, "SSID: ", pTestBssDesc->bdSsIdBuf, pTestBssDesc->bdSsIdLen); + RT_TRACE(COMP_INIT, DBG_LOUD, ("Original: %d, Test: %d\n", pTmpBssDesc->RecvSignalPower, pTestBssDesc->RecvSignalPower)); + + Score++; + PlatformMoveMemory(pTestBssDesc, pTmpBssDesc, sizeof(RT_WLAN_BSS)); + } + else if(pTmpBssDesc->RecvSignalPower < pTestBssDesc->RecvSignalPower) + { + RT_TRACE(COMP_INIT, DBG_LOUD, ("ODM_PathDiversityBeforeLink92C: Compare scan entry: Score--\n")); + RT_PRINT_STR(COMP_INIT, DBG_LOUD, "SSID: ", pTestBssDesc->bdSsIdBuf, pTestBssDesc->bdSsIdLen); + RT_TRACE(COMP_INIT, DBG_LOUD, ("Original: %d, Test: %d\n", pTmpBssDesc->RecvSignalPower, pTestBssDesc->RecvSignalPower)); + Score--; + } + + } + + if(pMgntInfo->NumBssDesc!=0 && Score<=0) + { + RT_TRACE(COMP_INIT, DBG_LOUD, + ("ODM_PathDiversityBeforeLink92C(): DefaultRespPath=%d\n", pDM_PDTable->DefaultRespPath)); + + //pDM_SWAT_Table->PreAntenna = pDM_SWAT_Table->CurAntenna; + } + else + { + RT_TRACE(COMP_INIT, DBG_LOUD, + ("ODM_PathDiversityBeforeLink92C(): DefaultRespPath=%d\n", pDM_PDTable->DefaultRespPath)); + + if(pDM_PDTable->DefaultRespPath == 0) + { + pDM_PDTable->OFDMTXPath = 0xFFFFFFFF; + pDM_PDTable->CCKTXPath = 0xFFFFFFFF; + odm_SetRespPath_92C(Adapter, 1); + } + else + { + pDM_PDTable->OFDMTXPath = 0x0; + pDM_PDTable->CCKTXPath = 0x0; + odm_SetRespPath_92C(Adapter, 0); + } + PHY_SetBBReg(Adapter, rCCK0_AFESetting , 0x0F000000, 0x01); // RX path = PathAB + + //pDM_SWAT_Table->CurAntenna = pDM_SWAT_Table->PreAntenna; + + //PHY_SetBBReg(Adapter, rFPGA0_XA_RFInterfaceOE, 0x300, DM_SWAT_Table.CurAntenna); + //pDM_SWAT_Table->SWAS_NoLink_BK_Reg860 = ((pDM_SWAT_Table->SWAS_NoLink_BK_Reg860 & 0xfffffcff) | (pDM_SWAT_Table->CurAntenna<<8)); + //PHY_SetBBReg(Adapter, rFPGA0_XA_RFInterfaceOE, bMaskDWord, pDM_SWAT_Table->SWAS_NoLink_BK_Reg860); + } + + // Check state reset to default and wait for next time. + //pDM_SWAT_Table->SWAS_NoLink_State = 0; + pDM_PDTable->PathDiv_NoLink_State = 0; + + return FALSE; + } +#else + return FALSE; +#endif + +} + + + +VOID +odm_PathDiversityAfterLink_92C( + IN PADAPTER Adapter +) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + pPD_T pDM_PDTable = &Adapter->DM_PDTable; + u1Byte DefaultRespPath=0; + + if((!(pHalData->CVID_Version==VERSION_1_BEFORE_8703B && IS_92C_SERIAL(pHalData->VersionID))) || (pHalData->PathDivCfg != 1) || (pHalData->eRFPowerState == eRfOff)) + { + if(pHalData->PathDivCfg == 0) + { + RT_TRACE( COMP_INIT, DBG_LOUD, ("No ODM_TXPathDiversity()\n")); + } + else + { + RT_TRACE( COMP_INIT, DBG_LOUD, ("2T ODM_TXPathDiversity()\n")); + } + return; + } + if(!odm_IsConnected_92C(Adapter)) + { + RT_TRACE( COMP_INIT, DBG_LOUD, ("ODM_TXPathDiversity(): No Connections\n")); + return; + } + + + if(pDM_PDTable->TrainingState == 0) + { + RT_TRACE( COMP_INIT, DBG_LOUD, ("ODM_TXPathDiversity() ==>\n")); + odm_OFDMTXPathDiversity_92C(Adapter); + + if((pDM_PDTable->CCKPathDivEnable == TRUE) && (pDM_PDTable->OFDM_Pkt_Cnt < 100)) + { + //RT_TRACE( COMP_INIT, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: TrainingState=0\n")); + + if(pDM_PDTable->CCK_Pkt_Cnt > 300) + pDM_PDTable->Timer = 20; + else if(pDM_PDTable->CCK_Pkt_Cnt > 100) + pDM_PDTable->Timer = 60; + else + pDM_PDTable->Timer = 250; + RT_TRACE( COMP_INIT, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: timer=%d\n",pDM_PDTable->Timer)); + + PHY_SetBBReg(Adapter, rCCK0_AFESetting , 0x0F000000, 0x00); // RX path = PathA + pDM_PDTable->TrainingState = 1; + pHalData->RSSI_test = TRUE; + ODM_SetTimer( pDM_Odm, &pDM_Odm->CCKPathDiversityTimer, pDM_PDTable->Timer); //ms + } + else + { + pDM_PDTable->CCKTXPath = pDM_PDTable->OFDMTXPath; + DefaultRespPath = pDM_PDTable->OFDMDefaultRespPath; + RT_TRACE( COMP_INIT, DBG_LOUD, ("odm_SetRespPath_92C: Skip odm_CCKTXPathDiversity_92C, DefaultRespPath is OFDM\n")); + odm_SetRespPath_92C(Adapter, DefaultRespPath); + odm_ResetPathDiversity_92C(Adapter); + RT_TRACE( COMP_INIT, DBG_LOUD, ("ODM_TXPathDiversity() <==\n")); + } + } + else if(pDM_PDTable->TrainingState == 1) + { + //RT_TRACE( COMP_INIT, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: TrainingState=1\n")); + PHY_SetBBReg(Adapter, rCCK0_AFESetting , 0x0F000000, 0x05); // RX path = PathB + pDM_PDTable->TrainingState = 2; + ODM_SetTimer( pDM_Odm, &pDM_Odm->CCKPathDiversityTimer, pDM_PDTable->Timer); //ms + } + else + { + //RT_TRACE( COMP_INIT, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: TrainingState=2\n")); + pDM_PDTable->TrainingState = 0; + odm_CCKTXPathDiversity_92C(Adapter); + if(pDM_PDTable->OFDM_Pkt_Cnt != 0) + { + DefaultRespPath = pDM_PDTable->OFDMDefaultRespPath; + RT_TRACE( COMP_INIT, DBG_LOUD, ("odm_SetRespPath_92C: DefaultRespPath is OFDM\n")); + } + else + { + DefaultRespPath = pDM_PDTable->CCKDefaultRespPath; + RT_TRACE( COMP_INIT, DBG_LOUD, ("odm_SetRespPath_92C: DefaultRespPath is CCK\n")); + } + odm_SetRespPath_92C(Adapter, DefaultRespPath); + odm_ResetPathDiversity_92C(Adapter); + RT_TRACE( COMP_INIT, DBG_LOUD, ("ODM_TXPathDiversity() <==\n")); + } + +} + +VOID +odm_SetRespPath_92C( + IN PADAPTER Adapter, + IN u1Byte DefaultRespPath + ) +{ + pPD_T pDM_PDTable = &Adapter->DM_PDTable; + + RT_TRACE( COMP_INIT, DBG_LOUD, ("odm_SetRespPath_92C: Select Response Path=%d\n",DefaultRespPath)); + if(DefaultRespPath != pDM_PDTable->DefaultRespPath) + { + if(DefaultRespPath == 0) + { + PlatformEFIOWrite1Byte(Adapter, 0x6D8, (PlatformEFIORead1Byte(Adapter, 0x6D8)&0xc0)|0x15); + } + else + { + PlatformEFIOWrite1Byte(Adapter, 0x6D8, (PlatformEFIORead1Byte(Adapter, 0x6D8)&0xc0)|0x2A); + } + } + pDM_PDTable->DefaultRespPath = DefaultRespPath; +} + +VOID +odm_OFDMTXPathDiversity_92C( + IN PADAPTER Adapter) +{ +// HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo); + PRT_WLAN_STA pEntry; + u1Byte i, DefaultRespPath = 0; + s4Byte MinRSSI = 0xFF; + pPD_T pDM_PDTable = &Adapter->DM_PDTable; + pDM_PDTable->OFDMTXPath = 0; + + //1 Default Port + if(pMgntInfo->mAssoc) + { + RT_TRACE( COMP_INIT, DBG_LOUD, ("odm_OFDMTXPathDiversity_92C: Default port RSSI[0]=%d, RSSI[1]=%d\n", + Adapter->RxStats.RxRSSIPercentage[0], Adapter->RxStats.RxRSSIPercentage[1])); + if(Adapter->RxStats.RxRSSIPercentage[0] > Adapter->RxStats.RxRSSIPercentage[1]) + { + pDM_PDTable->OFDMTXPath = pDM_PDTable->OFDMTXPath & (~BIT0); + MinRSSI = Adapter->RxStats.RxRSSIPercentage[1]; + DefaultRespPath = 0; + RT_TRACE( COMP_INIT, DBG_LOUD, ("odm_OFDMTXPathDiversity_92C: Default port Select Path-0\n")); + } + else + { + pDM_PDTable->OFDMTXPath = pDM_PDTable->OFDMTXPath | BIT0; + MinRSSI = Adapter->RxStats.RxRSSIPercentage[0]; + DefaultRespPath = 1; + RT_TRACE( COMP_INIT, DBG_LOUD, ("odm_OFDMTXPathDiversity_92C: Default port Select Path-1\n")); + } + //RT_TRACE( COMP_INIT, DBG_LOUD, ("pDM_PDTable->OFDMTXPath =0x%x\n",pDM_PDTable->OFDMTXPath)); + } + //1 Extension Port + for(i = 0; i < ODM_ASSOCIATE_ENTRY_NUM; i++) + { + if(IsAPModeExist(Adapter) && GetFirstExtAdapter(Adapter) != NULL) + pEntry = AsocEntry_EnumStation(GetFirstExtAdapter(Adapter), i); + else + pEntry = AsocEntry_EnumStation(GetDefaultAdapter(Adapter), i); + + if(pEntry!=NULL) + { + if(pEntry->bAssociated) + { + RT_TRACE( COMP_INIT, DBG_LOUD, ("odm_OFDMTXPathDiversity_92C: MACID=%d, RSSI_0=%d, RSSI_1=%d\n", + pEntry->AssociatedMacId, pEntry->rssi_stat.RxRSSIPercentage[0], pEntry->rssi_stat.RxRSSIPercentage[1])); + + if(pEntry->rssi_stat.RxRSSIPercentage[0] > pEntry->rssi_stat.RxRSSIPercentage[1]) + { + pDM_PDTable->OFDMTXPath = pDM_PDTable->OFDMTXPath & ~(BIT(pEntry->AssociatedMacId)); + //pHalData->TXPath = pHalData->TXPath & ~(1<<(pEntry->AssociatedMacId)); + RT_TRACE( COMP_INIT, DBG_LOUD, ("odm_OFDMTXPathDiversity_92C: MACID=%d Select Path-0\n", pEntry->AssociatedMacId)); + if(pEntry->rssi_stat.RxRSSIPercentage[1] < MinRSSI) + { + MinRSSI = pEntry->rssi_stat.RxRSSIPercentage[1]; + DefaultRespPath = 0; + } + } + else + { + pDM_PDTable->OFDMTXPath = pDM_PDTable->OFDMTXPath | BIT(pEntry->AssociatedMacId); + //pHalData->TXPath = pHalData->TXPath | (1 << (pEntry->AssociatedMacId)); + RT_TRACE( COMP_INIT, DBG_LOUD, ("odm_OFDMTXPathDiversity_92C: MACID=%d Select Path-1\n", pEntry->AssociatedMacId)); + if(pEntry->rssi_stat.RxRSSIPercentage[0] < MinRSSI) + { + MinRSSI = pEntry->rssi_stat.RxRSSIPercentage[0]; + DefaultRespPath = 1; + } + } + } + } + else + { + break; + } + } + + pDM_PDTable->OFDMDefaultRespPath = DefaultRespPath; +} + + +VOID +odm_CCKTXPathDiversity_92C( + IN PADAPTER Adapter +) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo); + PRT_WLAN_STA pEntry; + s4Byte MinRSSI = 0xFF; + u1Byte i, DefaultRespPath = 0; +// BOOLEAN bBModePathDiv = FALSE; + pPD_T pDM_PDTable = &Adapter->DM_PDTable; + + //1 Default Port + if(pMgntInfo->mAssoc) + { + if(pHalData->OFDM_Pkt_Cnt == 0) + { + for(i=0; i<2; i++) + { + if(pDM_PDTable->RSSI_CCK_Path_cnt[i] > 1) //Because the first packet is discarded + pDM_PDTable->RSSI_CCK_Path[i] = pDM_PDTable->RSSI_CCK_Path[i] / (pDM_PDTable->RSSI_CCK_Path_cnt[i]-1); + else + pDM_PDTable->RSSI_CCK_Path[i] = 0; + } + RT_TRACE( COMP_INIT, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: pDM_PDTable->RSSI_CCK_Path[0]=%d, pDM_PDTable->RSSI_CCK_Path[1]=%d\n", + pDM_PDTable->RSSI_CCK_Path[0], pDM_PDTable->RSSI_CCK_Path[1])); + RT_TRACE( COMP_INIT, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: pDM_PDTable->RSSI_CCK_Path_cnt[0]=%d, pDM_PDTable->RSSI_CCK_Path_cnt[1]=%d\n", + pDM_PDTable->RSSI_CCK_Path_cnt[0], pDM_PDTable->RSSI_CCK_Path_cnt[1])); + + if(pDM_PDTable->RSSI_CCK_Path[0] > pDM_PDTable->RSSI_CCK_Path[1]) + { + pDM_PDTable->CCKTXPath = pDM_PDTable->CCKTXPath & (~BIT0); + MinRSSI = pDM_PDTable->RSSI_CCK_Path[1]; + DefaultRespPath = 0; + RT_TRACE( COMP_INIT, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: Default port Select CCK Path-0\n")); + } + else if(pDM_PDTable->RSSI_CCK_Path[0] < pDM_PDTable->RSSI_CCK_Path[1]) + { + pDM_PDTable->CCKTXPath = pDM_PDTable->CCKTXPath | BIT0; + MinRSSI = pDM_PDTable->RSSI_CCK_Path[0]; + DefaultRespPath = 1; + RT_TRACE( COMP_INIT, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: Default port Select CCK Path-1\n")); + } + else + { + if((pDM_PDTable->RSSI_CCK_Path[0] != 0) && (pDM_PDTable->RSSI_CCK_Path[0] < MinRSSI)) + { + pDM_PDTable->CCKTXPath = pDM_PDTable->CCKTXPath & (~BIT0); + RT_TRACE( COMP_INIT, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: Default port Select CCK Path-0\n")); + MinRSSI = pDM_PDTable->RSSI_CCK_Path[1]; + DefaultRespPath = 0; + } + else + { + RT_TRACE( COMP_INIT, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: Default port unchange CCK Path\n")); + } + } + } + else //Follow OFDM decision + { + pDM_PDTable->CCKTXPath = (pDM_PDTable->CCKTXPath & (~BIT0)) | (pDM_PDTable->OFDMTXPath &BIT0); + RT_TRACE( COMP_INIT, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: Follow OFDM decision, Default port Select CCK Path-%d\n", + pDM_PDTable->CCKTXPath &BIT0)); + } + } + //1 Extension Port + for(i = 0; i < ODM_ASSOCIATE_ENTRY_NUM; i++) + { + if(IsAPModeExist(Adapter) && GetFirstExtAdapter(Adapter) != NULL) + pEntry = AsocEntry_EnumStation(GetFirstExtAdapter(Adapter), i); + else + pEntry = AsocEntry_EnumStation(GetDefaultAdapter(Adapter), i); + + if(pEntry!=NULL) + { + if(pEntry->bAssociated) + { + if(pEntry->rssi_stat.OFDM_Pkt_Cnt == 0) + { + u1Byte j=0; + for(j=0; j<2; j++) + { + if(pEntry->rssi_stat.RSSI_CCK_Path_cnt[j] > 1) + pEntry->rssi_stat.RSSI_CCK_Path[j] = pEntry->rssi_stat.RSSI_CCK_Path[j] / (pEntry->rssi_stat.RSSI_CCK_Path_cnt[j]-1); + else + pEntry->rssi_stat.RSSI_CCK_Path[j] = 0; + } + RT_TRACE( COMP_INIT, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: MACID=%d, RSSI_CCK0=%d, RSSI_CCK1=%d\n", + pEntry->AssociatedMacId, pEntry->rssi_stat.RSSI_CCK_Path[0], pEntry->rssi_stat.RSSI_CCK_Path[1])); + + if(pEntry->rssi_stat.RSSI_CCK_Path[0] >pEntry->rssi_stat.RSSI_CCK_Path[1]) + { + pDM_PDTable->CCKTXPath = pDM_PDTable->CCKTXPath & ~(BIT(pEntry->AssociatedMacId)); + RT_TRACE( COMP_INIT, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: MACID=%d Select CCK Path-0\n", pEntry->AssociatedMacId)); + if(pEntry->rssi_stat.RSSI_CCK_Path[1] < MinRSSI) + { + MinRSSI = pEntry->rssi_stat.RSSI_CCK_Path[1]; + DefaultRespPath = 0; + } + } + else if(pEntry->rssi_stat.RSSI_CCK_Path[0] rssi_stat.RSSI_CCK_Path[1]) + { + pDM_PDTable->CCKTXPath = pDM_PDTable->CCKTXPath | BIT(pEntry->AssociatedMacId); + RT_TRACE( COMP_INIT, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: MACID=%d Select CCK Path-1\n", pEntry->AssociatedMacId)); + if(pEntry->rssi_stat.RSSI_CCK_Path[0] < MinRSSI) + { + MinRSSI = pEntry->rssi_stat.RSSI_CCK_Path[0]; + DefaultRespPath = 1; + } + } + else + { + if((pEntry->rssi_stat.RSSI_CCK_Path[0] != 0) && (pEntry->rssi_stat.RSSI_CCK_Path[0] < MinRSSI)) + { + pDM_PDTable->CCKTXPath = pDM_PDTable->CCKTXPath & ~(BIT(pEntry->AssociatedMacId)); + MinRSSI = pEntry->rssi_stat.RSSI_CCK_Path[1]; + DefaultRespPath = 0; + RT_TRACE( COMP_INIT, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: MACID=%d Select CCK Path-0\n", pEntry->AssociatedMacId)); + } + else + { + RT_TRACE( COMP_INIT, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: MACID=%d unchange CCK Path\n", pEntry->AssociatedMacId)); + } + } + } + else //Follow OFDM decision + { + pDM_PDTable->CCKTXPath = (pDM_PDTable->CCKTXPath & (~(BIT(pEntry->AssociatedMacId)))) | (pDM_PDTable->OFDMTXPath & BIT(pEntry->AssociatedMacId)); + RT_TRACE( COMP_INIT, DBG_LOUD, ("odm_CCKTXPathDiversity_92C: Follow OFDM decision, MACID=%d Select CCK Path-%d\n", + pEntry->AssociatedMacId, (pDM_PDTable->CCKTXPath & BIT(pEntry->AssociatedMacId))>>(pEntry->AssociatedMacId))); + } + } + } + else + { + break; + } + } + + RT_TRACE( COMP_INIT, DBG_LOUD, ("odm_CCKTXPathDiversity_92C:MinRSSI=%d\n",MinRSSI)); + + if(MinRSSI == 0xFF) + DefaultRespPath = pDM_PDTable->CCKDefaultRespPath; + + pDM_PDTable->CCKDefaultRespPath = DefaultRespPath; +} + + +VOID +odm_ResetPathDiversity_92C( + IN PADAPTER Adapter +) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + pPD_T pDM_PDTable = &Adapter->DM_PDTable; + PRT_WLAN_STA pEntry; + u4Byte i,j; + + pHalData->RSSI_test = FALSE; + pDM_PDTable->CCK_Pkt_Cnt = 0; + pDM_PDTable->OFDM_Pkt_Cnt = 0; + pHalData->CCK_Pkt_Cnt =0; + pHalData->OFDM_Pkt_Cnt =0; + + if(pDM_PDTable->CCKPathDivEnable == TRUE) + PHY_SetBBReg(Adapter, rCCK0_AFESetting , 0x0F000000, 0x01); //RX path = PathAB + + for(i=0; i<2; i++) + { + pDM_PDTable->RSSI_CCK_Path_cnt[i]=0; + pDM_PDTable->RSSI_CCK_Path[i] = 0; + } + for(i = 0; i < ODM_ASSOCIATE_ENTRY_NUM; i++) + { + if(IsAPModeExist(Adapter) && GetFirstExtAdapter(Adapter) != NULL) + pEntry = AsocEntry_EnumStation(GetFirstExtAdapter(Adapter), i); + else + pEntry = AsocEntry_EnumStation(GetDefaultAdapter(Adapter), i); + + if(pEntry!=NULL) + { + pEntry->rssi_stat.CCK_Pkt_Cnt = 0; + pEntry->rssi_stat.OFDM_Pkt_Cnt = 0; + for(j=0; j<2; j++) + { + pEntry->rssi_stat.RSSI_CCK_Path_cnt[j] = 0; + pEntry->rssi_stat.RSSI_CCK_Path[j] = 0; + } + } + else + break; + } +} + + + + + +VOID +odm_CCKTXPathDiversityCallback( + PRT_TIMER pTimer +) +{ +#if USE_WORKITEM + PADAPTER Adapter = (PADAPTER)pTimer->Adapter; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; +#else + PADAPTER Adapter = (PADAPTER)pTimer->Adapter; +#endif + +#if DEV_BUS_TYPE==RT_PCI_INTERFACE +#if USE_WORKITEM + PlatformScheduleWorkItem(&pDM_Odm->CCKPathDiversityWorkitem); +#else + odm_PathDiversityAfterLink_92C(Adapter); +#endif +#else + PlatformScheduleWorkItem(&pDM_Odm->CCKPathDiversityWorkitem); +#endif + +} + + +VOID +odm_CCKTXPathDiversityWorkItemCallback( + IN PVOID pContext + ) +{ + PADAPTER Adapter = (PADAPTER)pContext; + + odm_CCKTXPathDiversity_92C(Adapter); +} + +// +// 20100514 Luke/Joseph: +// Callback function for 500ms antenna test trying. +// +VOID +odm_PathDivChkAntSwitchCallback( + PRT_TIMER pTimer +) +{ + PADAPTER Adapter = (PADAPTER)pTimer->Adapter; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + +#if DEV_BUS_TYPE==RT_PCI_INTERFACE + +#if USE_WORKITEM + PlatformScheduleWorkItem(&pDM_Odm->PathDivSwitchWorkitem); +#else + odm_PathDivChkAntSwitch(pDM_Odm); +#endif +#else + PlatformScheduleWorkItem(&pDM_Odm->PathDivSwitchWorkitem); +#endif + +//odm_SwAntDivChkAntSwitch(Adapter, SWAW_STEP_DETERMINE); + +} + + +VOID +odm_PathDivChkAntSwitchWorkitemCallback( + IN PVOID pContext + ) +{ + PADAPTER pAdapter = (PADAPTER)pContext; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + + odm_PathDivChkAntSwitch(pDM_Odm); +} + + + //MAC0_ACCESS_PHY1 + +// 2011-06-22 Neil Chen & Gary Hsin +// Refer to Jr.Luke's SW ANT DIV +// 92D Path Diversity Main function +// refer to 88C software antenna diversity +// +VOID +odm_PathDivChkAntSwitch( + PDM_ODM_T pDM_Odm + //PADAPTER Adapter, + //u1Byte Step +) +{ + PADAPTER Adapter = pDM_Odm->Adapter; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; + + + pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; + s4Byte curRSSI=100, RSSI_A, RSSI_B; + u1Byte nextAntenna=AUX_ANT; + static u8Byte lastTxOkCnt=0, lastRxOkCnt=0; + u8Byte curTxOkCnt, curRxOkCnt; + static u8Byte TXByteCnt_A=0, TXByteCnt_B=0, RXByteCnt_A=0, RXByteCnt_B=0; + u8Byte CurByteCnt=0, PreByteCnt=0; + static u1Byte TrafficLoad = TRAFFIC_LOW; + u1Byte Score_A=0, Score_B=0; + u1Byte i=0x0; + // Neil Chen + static u1Byte pathdiv_para=0x0; + static u1Byte switchfirsttime=0x00; + // u1Byte regB33 = (u1Byte) PHY_QueryBBReg(Adapter, 0xB30,BIT27); + u1Byte regB33 = (u1Byte)ODM_GetBBReg(pDM_Odm, PATHDIV_REG, BIT27); + + + //u1Byte reg637 =0x0; + static u1Byte fw_value=0x0; + //u8Byte curTxOkCnt_tmp, curRxOkCnt_tmp; + PADAPTER BuddyAdapter = Adapter->BuddyAdapter; // another adapter MAC + // Path Diversity //Neil Chen--2011--06--22 + + //u1Byte PathDiv_Trigger = (u1Byte) PHY_QueryBBReg(Adapter, 0xBA0,BIT31); + u1Byte PathDiv_Trigger = (u1Byte) ODM_GetBBReg(pDM_Odm, PATHDIV_TRI,BIT31); + u1Byte PathDiv_Enable = pHalData->bPathDiv_Enable; + + + //DbgPrint("Path Div PG Value:%x \n",PathDiv_Enable); + if((BuddyAdapter==NULL)||(!PathDiv_Enable)||(PathDiv_Trigger)||(pHalData->CurrentBandType == BAND_ON_2_4G)) + { + return; + } + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD,("===================>odm_PathDivChkAntSwitch()\n")); + + // The first time to switch path excluding 2nd, 3rd, ....etc.... + if(switchfirsttime==0) + { + if(regB33==0) + { + pDM_SWAT_Table->CurAntenna = MAIN_ANT; // Default MAC0_5G-->Path A (current antenna) + } + } + + // Condition that does not need to use antenna diversity. + if(pDM_Odm->SupportICType != ODM_RTL8192D) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("odm_PathDiversityMechanims(): No PathDiv Mechanism.\n")); + return; + } + + // Radio off: Status reset to default and return. + if(pHalData->eRFPowerState==eRfOff) + { + //ODM_SwAntDivRestAfterLink(Adapter); + return; + } + + /* + // Handling step mismatch condition. + // Peak step is not finished at last time. Recover the variable and check again. + if( Step != pDM_SWAT_Table->try_flag ) + { + ODM_SwAntDivRestAfterLink(Adapter); + } */ + + if(pDM_SWAT_Table->try_flag == 0xff) + { + // Select RSSI checking target + if(pMgntInfo->mAssoc && !ACTING_AS_AP(Adapter)) + { + // Target: Infrastructure mode AP. + pHalData->RSSI_target = NULL; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("odm_PathDivMechanism(): RSSI_target is DEF AP!\n")); + } + else + { + u1Byte index = 0; + PRT_WLAN_STA pEntry = NULL; + PADAPTER pTargetAdapter = NULL; + + if( pMgntInfo->mIbss || ACTING_AS_AP(Adapter) ) + { + // Target: AP/IBSS peer. + pTargetAdapter = Adapter; + } + else if(IsAPModeExist(Adapter) && GetFirstExtAdapter(Adapter) != NULL) + { + // Target: VWIFI peer. + pTargetAdapter = GetFirstExtAdapter(Adapter); + } + + if(pTargetAdapter != NULL) + { + for(index=0; indexbAssociated) + break; + } + } + } + + if(pEntry == NULL) + { + ODM_PathDivRestAfterLink(pDM_Odm); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("odm_SwAntDivChkAntSwitch(): No Link.\n")); + return; + } + else + { + pHalData->RSSI_target = pEntry; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("odm_SwAntDivChkAntSwitch(): RSSI_target is PEER STA\n")); + } + } + + pHalData->RSSI_cnt_A = 0; + pHalData->RSSI_cnt_B = 0; + pDM_SWAT_Table->try_flag = 0; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("odm_SwAntDivChkAntSwitch(): Set try_flag to 0 prepare for peak!\n")); + return; + } + else + { + // 1st step + curTxOkCnt = Adapter->TxStats.NumTxBytesUnicast - lastTxOkCnt; + curRxOkCnt = Adapter->RxStats.NumRxBytesUnicast - lastRxOkCnt; + lastTxOkCnt = Adapter->TxStats.NumTxBytesUnicast; + lastRxOkCnt = Adapter->RxStats.NumRxBytesUnicast; + + if(pDM_SWAT_Table->try_flag == 1) // Training State + { + if(pDM_SWAT_Table->CurAntenna == MAIN_ANT) + { + TXByteCnt_A += curTxOkCnt; + RXByteCnt_A += curRxOkCnt; + } + else + { + TXByteCnt_B += curTxOkCnt; + RXByteCnt_B += curRxOkCnt; + } + + nextAntenna = (pDM_SWAT_Table->CurAntenna == MAIN_ANT)? AUX_ANT : MAIN_ANT; + pDM_SWAT_Table->RSSI_Trying--; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH DIV=: RSSI_Trying = %d\n",pDM_SWAT_Table->RSSI_Trying)); + if(pDM_SWAT_Table->RSSI_Trying == 0) + { + CurByteCnt = (pDM_SWAT_Table->CurAntenna == MAIN_ANT)? (TXByteCnt_A+RXByteCnt_A) : (TXByteCnt_B+RXByteCnt_B); + PreByteCnt = (pDM_SWAT_Table->CurAntenna == MAIN_ANT)? (TXByteCnt_B+RXByteCnt_B) : (TXByteCnt_A+RXByteCnt_A); + + if(TrafficLoad == TRAFFIC_HIGH) + { + //CurByteCnt = PlatformDivision64(CurByteCnt, 9); + PreByteCnt =PreByteCnt*9; + } + else if(TrafficLoad == TRAFFIC_LOW) + { + //CurByteCnt = PlatformDivision64(CurByteCnt, 2); + PreByteCnt =PreByteCnt*2; + } + if(pHalData->RSSI_cnt_A > 0) + RSSI_A = pHalData->RSSI_sum_A/pHalData->RSSI_cnt_A; + else + RSSI_A = 0; + if(pHalData->RSSI_cnt_B > 0) + RSSI_B = pHalData->RSSI_sum_B/pHalData->RSSI_cnt_B; + else + RSSI_B = 0; + curRSSI = (pDM_SWAT_Table->CurAntenna == MAIN_ANT)? RSSI_A : RSSI_B; + pDM_SWAT_Table->PreRSSI = (pDM_SWAT_Table->CurAntenna == MAIN_ANT)? RSSI_B : RSSI_A; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH DIV=: PreRSSI = %d, CurRSSI = %d\n",pDM_SWAT_Table->PreRSSI, curRSSI)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH DIV=: preAntenna= %s, curAntenna= %s \n", + (pDM_SWAT_Table->PreAntenna == MAIN_ANT?"MAIN":"AUX"), (pDM_SWAT_Table->CurAntenna == MAIN_ANT?"MAIN":"AUX"))); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH DIV=: RSSI_A= %d, RSSI_cnt_A = %d, RSSI_B= %d, RSSI_cnt_B = %d\n", + RSSI_A, pHalData->RSSI_cnt_A, RSSI_B, pHalData->RSSI_cnt_B)); + } + + } + else // try_flag=0 + { + + if(pHalData->RSSI_cnt_A > 0) + RSSI_A = pHalData->RSSI_sum_A/pHalData->RSSI_cnt_A; + else + RSSI_A = 0; + if(pHalData->RSSI_cnt_B > 0) + RSSI_B = pHalData->RSSI_sum_B/pHalData->RSSI_cnt_B; + else + RSSI_B = 0; + curRSSI = (pDM_SWAT_Table->CurAntenna == MAIN_ANT)? RSSI_A : RSSI_B; + pDM_SWAT_Table->PreRSSI = (pDM_SWAT_Table->PreAntenna == MAIN_ANT)? RSSI_A : RSSI_B; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH DIV=: PreRSSI = %d, CurRSSI = %d\n", pDM_SWAT_Table->PreRSSI, curRSSI)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH DIV=: preAntenna= %s, curAntenna= %s \n", + (pDM_SWAT_Table->PreAntenna == MAIN_ANT?"MAIN":"AUX"), (pDM_SWAT_Table->CurAntenna == MAIN_ANT?"MAIN":"AUX"))); + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH DIV=: RSSI_A= %d, RSSI_cnt_A = %d, RSSI_B= %d, RSSI_cnt_B = %d\n", + RSSI_A, pHalData->RSSI_cnt_A, RSSI_B, pHalData->RSSI_cnt_B)); + //RT_TRACE(COMP_INIT, DBG_LOUD, ("Ekul:curTxOkCnt = %d\n", curTxOkCnt)); + //RT_TRACE(COMP_INIT, DBG_LOUD, ("Ekul:curRxOkCnt = %d\n", curRxOkCnt)); + } + + //1 Trying State + if((pDM_SWAT_Table->try_flag == 1)&&(pDM_SWAT_Table->RSSI_Trying == 0)) + { + + if(pDM_SWAT_Table->TestMode == TP_MODE) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: TestMode = TP_MODE")); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH= TRY:CurByteCnt = %"i64fmt"d,", CurByteCnt)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH= TRY:PreByteCnt = %"i64fmt"d\n",PreByteCnt)); + if(CurByteCnt < PreByteCnt) + { + if(pDM_SWAT_Table->CurAntenna == MAIN_ANT) + pDM_SWAT_Table->SelectAntennaMap=pDM_SWAT_Table->SelectAntennaMap<<1; + else + pDM_SWAT_Table->SelectAntennaMap=(pDM_SWAT_Table->SelectAntennaMap<<1)+1; + } + else + { + if(pDM_SWAT_Table->CurAntenna == MAIN_ANT) + pDM_SWAT_Table->SelectAntennaMap=(pDM_SWAT_Table->SelectAntennaMap<<1)+1; + else + pDM_SWAT_Table->SelectAntennaMap=pDM_SWAT_Table->SelectAntennaMap<<1; + } + for (i= 0; i<8; i++) + { + if(((pDM_SWAT_Table->SelectAntennaMap>>i)&BIT0) == 1) + Score_A++; + else + Score_B++; + } + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("SelectAntennaMap=%x\n ",pDM_SWAT_Table->SelectAntennaMap)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: Score_A=%d, Score_B=%d\n", Score_A, Score_B)); + + if(pDM_SWAT_Table->CurAntenna == MAIN_ANT) + { + nextAntenna = (Score_A >= Score_B)?MAIN_ANT:AUX_ANT; + } + else + { + nextAntenna = (Score_B >= Score_A)?AUX_ANT:MAIN_ANT; + } + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: nextAntenna=%s\n",(nextAntenna==MAIN_ANT)?"MAIN":"AUX")); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: preAntenna= %s, curAntenna= %s \n", + (pDM_SWAT_Table->PreAntenna == MAIN_ANT?"MAIN":"AUX"), (pDM_SWAT_Table->CurAntenna == MAIN_ANT?"MAIN":"AUX"))); + + if(nextAntenna != pDM_SWAT_Table->CurAntenna) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: Switch back to another antenna")); + } + else + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: current anntena is good\n")); + } + } + + + if(pDM_SWAT_Table->TestMode == RSSI_MODE) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: TestMode = RSSI_MODE")); + pDM_SWAT_Table->SelectAntennaMap=0xAA; + if(curRSSI < pDM_SWAT_Table->PreRSSI) //Current antenna is worse than previous antenna + { + //RT_TRACE(COMP_INIT, DBG_LOUD, ("SWAS: Switch back to another antenna")); + nextAntenna = (pDM_SWAT_Table->CurAntenna == MAIN_ANT)?AUX_ANT : MAIN_ANT; + } + else // current anntena is good + { + nextAntenna =pDM_SWAT_Table->CurAntenna; + //RT_TRACE(COMP_INIT, DBG_LOUD, ("SWAS: current anntena is good\n")); + } + } + + pDM_SWAT_Table->try_flag = 0; + pHalData->RSSI_test = FALSE; + pHalData->RSSI_sum_A = 0; + pHalData->RSSI_cnt_A = 0; + pHalData->RSSI_sum_B = 0; + pHalData->RSSI_cnt_B = 0; + TXByteCnt_A = 0; + TXByteCnt_B = 0; + RXByteCnt_A = 0; + RXByteCnt_B = 0; + + } + + //1 Normal State + else if(pDM_SWAT_Table->try_flag == 0) + { + if(TrafficLoad == TRAFFIC_HIGH) + { + if ((curTxOkCnt+curRxOkCnt) > 3750000)//if(PlatformDivision64(curTxOkCnt+curRxOkCnt, 2) > 1875000) + TrafficLoad = TRAFFIC_HIGH; + else + TrafficLoad = TRAFFIC_LOW; + } + else if(TrafficLoad == TRAFFIC_LOW) + { + if ((curTxOkCnt+curRxOkCnt) > 3750000)//if(PlatformDivision64(curTxOkCnt+curRxOkCnt, 2) > 1875000) + TrafficLoad = TRAFFIC_HIGH; + else + TrafficLoad = TRAFFIC_LOW; + } + if(TrafficLoad == TRAFFIC_HIGH) + pDM_SWAT_Table->bTriggerAntennaSwitch = 0; + //RT_TRACE(COMP_INIT, DBG_LOUD, ("Normal:TrafficLoad = %llu\n", curTxOkCnt+curRxOkCnt)); + + //Prepare To Try Antenna + nextAntenna = (pDM_SWAT_Table->CurAntenna == MAIN_ANT)? AUX_ANT : MAIN_ANT; + pDM_SWAT_Table->try_flag = 1; + pHalData->RSSI_test = TRUE; + if((curRxOkCnt+curTxOkCnt) > 1000) + { +#if DEV_BUS_TYPE==RT_PCI_INTERFACE + pDM_SWAT_Table->RSSI_Trying = 4; +#else + pDM_SWAT_Table->RSSI_Trying = 2; +#endif + pDM_SWAT_Table->TestMode = TP_MODE; + } + else + { + pDM_SWAT_Table->RSSI_Trying = 2; + pDM_SWAT_Table->TestMode = RSSI_MODE; + + } + + //RT_TRACE(COMP_INIT, DBG_LOUD, ("SWAS: Normal State -> Begin Trying!\n")); + pHalData->RSSI_sum_A = 0; + pHalData->RSSI_cnt_A = 0; + pHalData->RSSI_sum_B = 0; + pHalData->RSSI_cnt_B = 0; + } // end of try_flag=0 + } + + //1 4.Change TRX antenna + if(nextAntenna != pDM_SWAT_Table->CurAntenna) + { + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: Change TX Antenna!\n ")); + //PHY_SetBBReg(Adapter, rFPGA0_XA_RFInterfaceOE, 0x300, nextAntenna); for 88C + if(nextAntenna==MAIN_ANT) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: Next Antenna is RF PATH A\n ")); + pathdiv_para = 0x02; //02 to switchback to RF path A + fw_value = 0x03; +#if DEV_BUS_TYPE==RT_PCI_INTERFACE + odm_PathDiversity_8192D(pDM_Odm, pathdiv_para); +#else + ODM_FillH2CCmd(pDM_Odm, ODM_H2C_PathDiv,1,(pu1Byte)(&fw_value)); +#endif + } + else if(nextAntenna==AUX_ANT) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: Next Antenna is RF PATH B\n ")); + if(switchfirsttime==0) // First Time To Enter Path Diversity + { + switchfirsttime=0x01; + pathdiv_para = 0x00; + fw_value=0x00; // to backup RF Path A Releated Registers + +#if DEV_BUS_TYPE==RT_PCI_INTERFACE + odm_PathDiversity_8192D(pDM_Odm, pathdiv_para); +#else + ODM_FillH2CCmd(pDM_Odm, ODM_H2C_PathDiv,1,(pu1Byte)(&fw_value)); + //for(u1Byte n=0; n<80,n++) + //{ + //delay_us(500); + ODM_delay_ms(500); + odm_PathDiversity_8192D(pDM_Odm, pathdiv_para); + + fw_value=0x01; // to backup RF Path A Releated Registers + ODM_FillH2CCmd(pDM_Odm, ODM_H2C_PathDiv,1,(pu1Byte)(&fw_value)); +#endif + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: FIRST TIME To DO PATH SWITCH!\n ")); + } + else + { + pathdiv_para = 0x01; + fw_value = 0x02; +#if DEV_BUS_TYPE==RT_PCI_INTERFACE + odm_PathDiversity_8192D(pDM_Odm, pathdiv_para); +#else + ODM_FillH2CCmd(pDM_Odm, ODM_H2C_PathDiv,1,(pu1Byte)(&fw_value)); +#endif + } + } + // odm_PathDiversity_8192D(Adapter, pathdiv_para); + } + + //1 5.Reset Statistics + pDM_SWAT_Table->PreAntenna = pDM_SWAT_Table->CurAntenna; + pDM_SWAT_Table->CurAntenna = nextAntenna; + pDM_SWAT_Table->PreRSSI = curRSSI; + + //1 6.Set next timer + + if(pDM_SWAT_Table->RSSI_Trying == 0) + return; + + if(pDM_SWAT_Table->RSSI_Trying%2 == 0) + { + if(pDM_SWAT_Table->TestMode == TP_MODE) + { + if(TrafficLoad == TRAFFIC_HIGH) + { +#if DEV_BUS_TYPE==RT_PCI_INTERFACE + ODM_SetTimer( pDM_Odm, &pDM_Odm->PathDivSwitchTimer, 10 ); //ms + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: Test another antenna for 10 ms\n")); +#else + ODM_SetTimer( pDM_Odm, &pDM_Odm->PathDivSwitchTimer, 20 ); //ms + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: Test another antenna for 20 ms\n")); +#endif + } + else if(TrafficLoad == TRAFFIC_LOW) + { + ODM_SetTimer( pDM_Odm, &pDM_Odm->PathDivSwitchTimer, 50 ); //ms + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: Test another antenna for 50 ms\n")); + } + } + else // TestMode == RSSI_MODE + { + ODM_SetTimer( pDM_Odm, &pDM_Odm->PathDivSwitchTimer, 500 ); //ms + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: Test another antenna for 500 ms\n")); + } + } + else + { + if(pDM_SWAT_Table->TestMode == TP_MODE) + { + if(TrafficLoad == TRAFFIC_HIGH) + +#if DEV_BUS_TYPE==RT_PCI_INTERFACE + ODM_SetTimer( pDM_Odm, &pDM_Odm->PathDivSwitchTimer, 90 ); //ms + //ODM_RT_TRACE(pDM_Odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("=PATH=: Test another antenna for 90 ms\n")); +#else + ODM_SetTimer( pDM_Odm, &pDM_Odm->PathDivSwitchTimer, 180); //ms +#endif + else if(TrafficLoad == TRAFFIC_LOW) + ODM_SetTimer( pDM_Odm, &pDM_Odm->PathDivSwitchTimer, 100 ); //ms + } + else + ODM_SetTimer( pDM_Odm, &pDM_Odm->PathDivSwitchTimer, 500 ); //ms + } +} + + + +VOID +ODM_CCKPathDiversityChkPerPktRssi( + PADAPTER Adapter, + BOOLEAN bIsDefPort, + BOOLEAN bMatchBSSID, + PRT_WLAN_STA pEntry, + PRT_RFD pRfd, + pu1Byte pDesc + ) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + BOOLEAN bCount = FALSE; + pPD_T pDM_PDTable = &Adapter->DM_PDTable; + //BOOLEAN isCCKrate = RX_HAL_IS_CCK_RATE_92C(pDesc); +#if DEV_BUS_TYPE != RT_SDIO_INTERFACE + BOOLEAN isCCKrate = RX_HAL_IS_CCK_RATE(Adapter, pDesc); +#else //below code would be removed if we have verified SDIO + BOOLEAN isCCKrate = IS_HARDWARE_TYPE_8188E(Adapter) ? RX_HAL_IS_CCK_RATE_88E(pDesc) : RX_HAL_IS_CCK_RATE_92C(pDesc); +#endif + + if((pHalData->PathDivCfg != 1) || (pHalData->RSSI_test == FALSE)) + return; + + if(pHalData->RSSI_target==NULL && bIsDefPort && bMatchBSSID) + bCount = TRUE; + else if(pHalData->RSSI_target!=NULL && pEntry!=NULL && pHalData->RSSI_target==pEntry) + bCount = TRUE; + + if(bCount && isCCKrate) + { + if(pDM_PDTable->TrainingState == 1 ) + { + if(pEntry) + { + if(pEntry->rssi_stat.RSSI_CCK_Path_cnt[0] != 0) + pEntry->rssi_stat.RSSI_CCK_Path[0] += pRfd->Status.RxPWDBAll; + pEntry->rssi_stat.RSSI_CCK_Path_cnt[0]++; + } + else + { + if(pDM_PDTable->RSSI_CCK_Path_cnt[0] != 0) + pDM_PDTable->RSSI_CCK_Path[0] += pRfd->Status.RxPWDBAll; + pDM_PDTable->RSSI_CCK_Path_cnt[0]++; + } + } + else if(pDM_PDTable->TrainingState == 2 ) + { + if(pEntry) + { + if(pEntry->rssi_stat.RSSI_CCK_Path_cnt[1] != 0) + pEntry->rssi_stat.RSSI_CCK_Path[1] += pRfd->Status.RxPWDBAll; + pEntry->rssi_stat.RSSI_CCK_Path_cnt[1]++; + } + else + { + if(pDM_PDTable->RSSI_CCK_Path_cnt[1] != 0) + pDM_PDTable->RSSI_CCK_Path[1] += pRfd->Status.RxPWDBAll; + pDM_PDTable->RSSI_CCK_Path_cnt[1]++; + } + } + } +} + + + + +//Neil Chen---2011--06--22 +//----92D Path Diversity----// +//#ifdef PathDiv92D +//================================== +//3 Path Diversity +//================================== +// +// 20100514 Luke/Joseph: +// Add new function for antenna diversity after link. +// This is the main function of antenna diversity after link. +// This function is called in HalDmWatchDog() and ODM_SwAntDivChkAntSwitchCallback(). +// HalDmWatchDog() calls this function with SWAW_STEP_PEAK to initialize the antenna test. +// In SWAW_STEP_PEAK, another antenna and a 500ms timer will be set for testing. +// After 500ms, ODM_SwAntDivChkAntSwitchCallback() calls this function to compare the signal just +// listened on the air with the RSSI of original antenna. +// It chooses the antenna with better RSSI. +// There is also a aged policy for error trying. Each error trying will cost more 5 seconds waiting +// penalty to get next try. +// +// +// 20100503 Joseph: +// Add new function SwAntDivCheck8192C(). +// This is the main function of Antenna diversity function before link. +// Mainly, it just retains last scan result and scan again. +// After that, it compares the scan result to see which one gets better RSSI. +// It selects antenna with better receiving power and returns better scan result. +// + + +// +// 20100514 Luke/Joseph: +// This function is used to gather the RSSI information for antenna testing. +// It selects the RSSI of the peer STA that we want to know. +// +VOID +ODM_PathDivChkPerPktRssi( + PADAPTER Adapter, + BOOLEAN bIsDefPort, + BOOLEAN bMatchBSSID, + PRT_WLAN_STA pEntry, + PRT_RFD pRfd + ) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + BOOLEAN bCount = FALSE; + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; + + if(pHalData->RSSI_target==NULL && bIsDefPort && bMatchBSSID) + bCount = TRUE; + else if(pHalData->RSSI_target!=NULL && pEntry!=NULL && pHalData->RSSI_target==pEntry) + bCount = TRUE; + + if(bCount) + { + //1 RSSI for SW Antenna Switch + if(pDM_SWAT_Table->CurAntenna == MAIN_ANT) + { + pHalData->RSSI_sum_A += pRfd->Status.RxPWDBAll; + pHalData->RSSI_cnt_A++; + } + else + { + pHalData->RSSI_sum_B += pRfd->Status.RxPWDBAll; + pHalData->RSSI_cnt_B++; + + } + } +} + + +// +// 20100514 Luke/Joseph: +// Add new function to reset antenna diversity state after link. +// +VOID +ODM_PathDivRestAfterLink( + IN PDM_ODM_T pDM_Odm + ) +{ + PADAPTER Adapter=pDM_Odm->Adapter; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; + + pHalData->RSSI_cnt_A = 0; + pHalData->RSSI_cnt_B = 0; + pHalData->RSSI_test = FALSE; + pDM_SWAT_Table->try_flag = 0x0; // NOT 0xff + pDM_SWAT_Table->RSSI_Trying = 0; + pDM_SWAT_Table->SelectAntennaMap=0xAA; + pDM_SWAT_Table->CurAntenna = MAIN_ANT; +} + + +//================================================== +//3 PathDiv End +//================================================== + + +VOID +ODM_FillTXPathInTXDESC( + IN PADAPTER Adapter, + IN PRT_TCB pTcb, + IN pu1Byte pDesc +) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + u4Byte TXPath; + pPD_T pDM_PDTable = &Adapter->DM_PDTable; + + //2011.09.05 Add by Luke Lee for path diversity + if(pHalData->PathDivCfg == 1) + { + TXPath = (pDM_PDTable->OFDMTXPath >> pTcb->macId) & BIT0; + //RT_TRACE( COMP_INIT, DBG_LOUD, ("Fill TXDESC: macID=%d, TXPath=%d\n", pTcb->macId, TXPath)); + //SET_TX_DESC_TX_ANT_CCK(pDesc,TXPath); + if(TXPath == 0) + { + SET_TX_DESC_TX_ANTL_92C(pDesc,1); + SET_TX_DESC_TX_ANT_HT_92C(pDesc,1); + } + else + { + SET_TX_DESC_TX_ANTL_92C(pDesc,2); + SET_TX_DESC_TX_ANT_HT_92C(pDesc,2); + } + TXPath = (pDM_PDTable->CCKTXPath >> pTcb->macId) & BIT0; + if(TXPath == 0) + { + SET_TX_DESC_TX_ANT_CCK_92C(pDesc,1); + } + else + { + SET_TX_DESC_TX_ANT_CCK_92C(pDesc,2); + } + } +} + +//Only for MP //Neil Chen--2012--0502-- +VOID +odm_PathDivInit_92D( +IN PDM_ODM_T pDM_Odm) +{ + pPATHDIV_PARA pathIQK = &pDM_Odm->pathIQK; + + pathIQK->org_2g_RegC14=0x0; + pathIQK->org_2g_RegC4C=0x0; + pathIQK->org_2g_RegC80=0x0; + pathIQK->org_2g_RegC94=0x0; + pathIQK->org_2g_RegCA0=0x0; + pathIQK->org_5g_RegC14=0x0; + pathIQK->org_5g_RegCA0=0x0; + pathIQK->org_5g_RegE30=0x0; + pathIQK->swt_2g_RegC14=0x0; + pathIQK->swt_2g_RegC4C=0x0; + pathIQK->swt_2g_RegC80=0x0; + pathIQK->swt_2g_RegC94=0x0; + pathIQK->swt_2g_RegCA0=0x0; + pathIQK->swt_5g_RegC14=0x0; + pathIQK->swt_5g_RegCA0=0x0; + pathIQK->swt_5g_RegE30=0x0; + +} + + +u1Byte +odm_SwAntDivSelectScanChnl( + IN PADAPTER Adapter + ) +{ +#if (RT_MEM_SIZE_LEVEL != RT_MEM_SIZE_MINIMUM) + PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter); + PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo); + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + u2Byte i; + u1Byte j, ScanChannel = 0, ChannelNum = 0; + PRT_CHANNEL_LIST pChannelList = GET_RT_CHANNEL_LIST(pMgntInfo); + u1Byte EachChannelSTAs[MAX_SCAN_CHANNEL_NUM] = {0}; + + if(pMgntInfo->tmpNumBssDesc == 0) + return 0; + + for(i = 0; i < pMgntInfo->tmpNumBssDesc; i++) + { + ChannelNum = pMgntInfo->tmpbssDesc[i].ChannelNumber; + for(j = 0; j < pChannelList->ChannelLen; j++) + { + if(pChannelList->ChnlListEntry[j].ChannelNum == ChannelNum) + { + EachChannelSTAs[j]++; + break; + } + } + } + + for(i = 0; i < MAX_SCAN_CHANNEL_NUM; i++) + { + if(EachChannelSTAs[i] > EachChannelSTAs[ScanChannel]) + ScanChannel = (u1Byte)i; + } + + if(EachChannelSTAs[ScanChannel] == 0) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, DBG_LOUD, ("odm_SwAntDivSelectScanChnl(): Scan List is empty.\n")); + return 0; + } + + ScanChannel = pChannelList->ChnlListEntry[ScanChannel].ChannelNum; + + + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, DBG_LOUD, + ("odm_SwAntDivSelectScanChnl(): Channel (( %d )) is select as scan channel.\n", ScanChannel)); + + return ScanChannel; +#else + return 0; +#endif +} + + +VOID +odm_SwAntDivConstructScanChnl( + IN PADAPTER Adapter, + IN u1Byte ScanChnl + ) +{ + + PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; + + if(ScanChnl == 0) + { + u1Byte i; + PRT_CHANNEL_LIST pChannelList = GET_RT_CHANNEL_LIST(pMgntInfo); + + // 20100519 Joseph: Original antenna scanned nothing. + // Test antenna shall scan all channel with half period in this condition. + + RT_TRACE_F(COMP_SCAN, DBG_TRACE, (" RT_CHNL_LIST_ACTION_CONSTRUCT chnl %d \n", ScanChnl)); + + RtActChannelList(Adapter, RT_CHNL_LIST_ACTION_CONSTRUCT_SCAN_LIST, NULL, NULL); + for(i = 0; i < pChannelList->ChannelLen; i++) + pChannelList->ChnlListEntry[i].ScanPeriod /= 2; + } + else + { + // The using of this CustomizedScanRequest is a trick to rescan the two channels + // under the NORMAL scanning process. It will not affect MGNT_INFO.CustomizedScanRequest. + CUSTOMIZED_SCAN_REQUEST CustomScanReq; + + CustomScanReq.bEnabled = TRUE; + CustomScanReq.Channels[0] = ScanChnl; + CustomScanReq.Channels[1] = pMgntInfo->dot11CurrentChannelNumber; + CustomScanReq.nChannels = 2; + CustomScanReq.ScanType = SCAN_ACTIVE; + CustomScanReq.Duration = DEFAULT_PASSIVE_SCAN_PERIOD; + + RT_TRACE_F(COMP_SCAN, DBG_TRACE, (" RT_CHNL_LIST_ACTION_CONSTRUCT chnl %d \n", ScanChnl)); + + RtActChannelList(Adapter, RT_CHNL_LIST_ACTION_CONSTRUCT_SCAN_LIST, &CustomScanReq, NULL); + } + +} + + +#endif // #if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + diff --git a/hal/OUTSRC/odm_PathDiv.h b/hal/OUTSRC/odm_PathDiv.h new file mode 100644 index 0000000..54c8d08 --- /dev/null +++ b/hal/OUTSRC/odm_PathDiv.h @@ -0,0 +1,192 @@ +/****************************************************************************** + * + * 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 __ODMPATHDIV_H__ +#define __ODMPATHDIV_H__ + + +VOID +odm_PathDiversityInit( + IN PVOID pDM_VOID + ); + +VOID +odm_PathDiversity( + IN PVOID pDM_VOID + ); + +#if(DM_ODM_SUPPORT_TYPE & (ODM_WIN)) + +//#define PATHDIV_ENABLE 1 +#define dm_PathDiv_RSSI_Check ODM_PathDivChkPerPktRssi +#define PathDivCheckBeforeLink8192C ODM_PathDiversityBeforeLink92C + +typedef struct _PathDiv_Parameter_define_ +{ + u4Byte org_5g_RegE30; + u4Byte org_5g_RegC14; + u4Byte org_5g_RegCA0; + u4Byte swt_5g_RegE30; + u4Byte swt_5g_RegC14; + u4Byte swt_5g_RegCA0; + //for 2G IQK information + u4Byte org_2g_RegC80; + u4Byte org_2g_RegC4C; + u4Byte org_2g_RegC94; + u4Byte org_2g_RegC14; + u4Byte org_2g_RegCA0; + + u4Byte swt_2g_RegC80; + u4Byte swt_2g_RegC4C; + u4Byte swt_2g_RegC94; + u4Byte swt_2g_RegC14; + u4Byte swt_2g_RegCA0; +}PATHDIV_PARA,*pPATHDIV_PARA; + +VOID +odm_PathDiversityInit_92C( + IN PADAPTER Adapter + ); + +VOID +odm_2TPathDiversityInit_92C( + IN PADAPTER Adapter + ); + +VOID +odm_1TPathDiversityInit_92C( + IN PADAPTER Adapter + ); + +BOOLEAN +odm_IsConnected_92C( + IN PADAPTER Adapter + ); + +BOOLEAN +ODM_PathDiversityBeforeLink92C( + //IN PADAPTER Adapter + IN PDM_ODM_T pDM_Odm + ); + +VOID +odm_PathDiversityAfterLink_92C( + IN PADAPTER Adapter + ); + +VOID +odm_SetRespPath_92C( + IN PADAPTER Adapter, + IN u1Byte DefaultRespPath + ); + +VOID +odm_OFDMTXPathDiversity_92C( + IN PADAPTER Adapter + ); + +VOID +odm_CCKTXPathDiversity_92C( + IN PADAPTER Adapter + ); + +VOID +odm_ResetPathDiversity_92C( + IN PADAPTER Adapter + ); + +VOID +odm_CCKTXPathDiversityCallback( + PRT_TIMER pTimer + ); + +VOID +odm_CCKTXPathDiversityWorkItemCallback( + IN PVOID pContext + ); + +VOID +odm_PathDivChkAntSwitchCallback( + PRT_TIMER pTimer + ); + +VOID +odm_PathDivChkAntSwitchWorkitemCallback( + IN PVOID pContext + ); + + +VOID +odm_PathDivChkAntSwitch( + PDM_ODM_T pDM_Odm + ); + +VOID +ODM_CCKPathDiversityChkPerPktRssi( + PADAPTER Adapter, + BOOLEAN bIsDefPort, + BOOLEAN bMatchBSSID, + PRT_WLAN_STA pEntry, + PRT_RFD pRfd, + pu1Byte pDesc + ); + +VOID +ODM_PathDivChkPerPktRssi( + PADAPTER Adapter, + BOOLEAN bIsDefPort, + BOOLEAN bMatchBSSID, + PRT_WLAN_STA pEntry, + PRT_RFD pRfd + ); + +VOID +ODM_PathDivRestAfterLink( + IN PDM_ODM_T pDM_Odm + ); + +VOID +ODM_FillTXPathInTXDESC( + IN PADAPTER Adapter, + IN PRT_TCB pTcb, + IN pu1Byte pDesc + ); + +VOID +odm_PathDivInit_92D( + IN PDM_ODM_T pDM_Odm + ); + +u1Byte +odm_SwAntDivSelectScanChnl( + IN PADAPTER Adapter + ); + +VOID +odm_SwAntDivConstructScanChnl( + IN PADAPTER Adapter, + IN u1Byte ScanChnl + ); + + #endif //#if(DM_ODM_SUPPORT_TYPE & (ODM_WIN)) + + + #endif //#ifndef __ODMPATHDIV_H__ + diff --git a/hal/OUTSRC/odm_PowerTracking.c b/hal/OUTSRC/odm_PowerTracking.c new file mode 100644 index 0000000..6064321 --- /dev/null +++ b/hal/OUTSRC/odm_PowerTracking.c @@ -0,0 +1,687 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA + * + * + ******************************************************************************/ + +//============================================================ +// include files +//============================================================ +#include "Mp_Precomp.h" +#include "odm_precomp.h" + +//============================================================ +// Global var +//============================================================ + +u4Byte OFDMSwingTable[OFDM_TABLE_SIZE] = { + 0x7f8001fe, // 0, +6.0dB + 0x788001e2, // 1, +5.5dB + 0x71c001c7, // 2, +5.0dB + 0x6b8001ae, // 3, +4.5dB + 0x65400195, // 4, +4.0dB + 0x5fc0017f, // 5, +3.5dB + 0x5a400169, // 6, +3.0dB + 0x55400155, // 7, +2.5dB + 0x50800142, // 8, +2.0dB + 0x4c000130, // 9, +1.5dB + 0x47c0011f, // 10, +1.0dB + 0x43c0010f, // 11, +0.5dB + 0x40000100, // 12, +0dB + 0x3c8000f2, // 13, -0.5dB + 0x390000e4, // 14, -1.0dB + 0x35c000d7, // 15, -1.5dB + 0x32c000cb, // 16, -2.0dB + 0x300000c0, // 17, -2.5dB + 0x2d4000b5, // 18, -3.0dB + 0x2ac000ab, // 19, -3.5dB + 0x288000a2, // 20, -4.0dB + 0x26000098, // 21, -4.5dB + 0x24000090, // 22, -5.0dB + 0x22000088, // 23, -5.5dB + 0x20000080, // 24, -6.0dB + 0x1e400079, // 25, -6.5dB + 0x1c800072, // 26, -7.0dB + 0x1b00006c, // 27. -7.5dB + 0x19800066, // 28, -8.0dB + 0x18000060, // 29, -8.5dB + 0x16c0005b, // 30, -9.0dB + 0x15800056, // 31, -9.5dB + 0x14400051, // 32, -10.0dB + 0x1300004c, // 33, -10.5dB + 0x12000048, // 34, -11.0dB + 0x11000044, // 35, -11.5dB + 0x10000040, // 36, -12.0dB +}; + +u1Byte CCKSwingTable_Ch1_Ch13[CCK_TABLE_SIZE][8] = { + {0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04}, // 0, +0dB + {0x33, 0x32, 0x2b, 0x23, 0x1a, 0x11, 0x08, 0x04}, // 1, -0.5dB + {0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x03}, // 2, -1.0dB + {0x2d, 0x2d, 0x27, 0x1f, 0x18, 0x0f, 0x08, 0x03}, // 3, -1.5dB + {0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03}, // 4, -2.0dB + {0x28, 0x28, 0x22, 0x1c, 0x15, 0x0d, 0x07, 0x03}, // 5, -2.5dB + {0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03}, // 6, -3.0dB + {0x24, 0x23, 0x1f, 0x19, 0x13, 0x0c, 0x06, 0x03}, // 7, -3.5dB + {0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02}, // 8, -4.0dB + {0x20, 0x20, 0x1b, 0x16, 0x11, 0x08, 0x05, 0x02}, // 9, -4.5dB + {0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02}, // 10, -5.0dB + {0x1d, 0x1c, 0x18, 0x14, 0x0f, 0x0a, 0x05, 0x02}, // 11, -5.5dB + {0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02}, // 12, -6.0dB <== default + {0x1a, 0x19, 0x16, 0x12, 0x0d, 0x09, 0x04, 0x02}, // 13, -6.5dB + {0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02}, // 14, -7.0dB + {0x17, 0x16, 0x13, 0x10, 0x0c, 0x08, 0x04, 0x02}, // 15, -7.5dB + {0x16, 0x15, 0x12, 0x0f, 0x0b, 0x07, 0x04, 0x01}, // 16, -8.0dB + {0x14, 0x14, 0x11, 0x0e, 0x0b, 0x07, 0x03, 0x02}, // 17, -8.5dB + {0x13, 0x13, 0x10, 0x0d, 0x0a, 0x06, 0x03, 0x01}, // 18, -9.0dB + {0x12, 0x12, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, // 19, -9.5dB + {0x11, 0x11, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, // 20, -10.0dB + {0x10, 0x10, 0x0e, 0x0b, 0x08, 0x05, 0x03, 0x01}, // 21, -10.5dB + {0x0f, 0x0f, 0x0d, 0x0b, 0x08, 0x05, 0x03, 0x01}, // 22, -11.0dB + {0x0e, 0x0e, 0x0c, 0x0a, 0x08, 0x05, 0x02, 0x01}, // 23, -11.5dB + {0x0d, 0x0d, 0x0c, 0x0a, 0x07, 0x05, 0x02, 0x01}, // 24, -12.0dB + {0x0d, 0x0c, 0x0b, 0x09, 0x07, 0x04, 0x02, 0x01}, // 25, -12.5dB + {0x0c, 0x0c, 0x0a, 0x09, 0x06, 0x04, 0x02, 0x01}, // 26, -13.0dB + {0x0b, 0x0b, 0x0a, 0x08, 0x06, 0x04, 0x02, 0x01}, // 27, -13.5dB + {0x0b, 0x0a, 0x09, 0x08, 0x06, 0x04, 0x02, 0x01}, // 28, -14.0dB + {0x0a, 0x0a, 0x09, 0x07, 0x05, 0x03, 0x02, 0x01}, // 29, -14.5dB + {0x0a, 0x09, 0x08, 0x07, 0x05, 0x03, 0x02, 0x01}, // 30, -15.0dB + {0x09, 0x09, 0x08, 0x06, 0x05, 0x03, 0x01, 0x01}, // 31, -15.5dB + {0x09, 0x08, 0x07, 0x06, 0x04, 0x03, 0x01, 0x01} // 32, -16.0dB +}; + + +u1Byte CCKSwingTable_Ch14[CCK_TABLE_SIZE][8] = { + {0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00}, // 0, +0dB + {0x33, 0x32, 0x2b, 0x19, 0x00, 0x00, 0x00, 0x00}, // 1, -0.5dB + {0x30, 0x2f, 0x29, 0x18, 0x00, 0x00, 0x00, 0x00}, // 2, -1.0dB + {0x2d, 0x2d, 0x17, 0x17, 0x00, 0x00, 0x00, 0x00}, // 3, -1.5dB + {0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00}, // 4, -2.0dB + {0x28, 0x28, 0x24, 0x14, 0x00, 0x00, 0x00, 0x00}, // 5, -2.5dB + {0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00}, // 6, -3.0dB + {0x24, 0x23, 0x1f, 0x12, 0x00, 0x00, 0x00, 0x00}, // 7, -3.5dB + {0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00}, // 8, -4.0dB + {0x20, 0x20, 0x1b, 0x10, 0x00, 0x00, 0x00, 0x00}, // 9, -4.5dB + {0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00}, // 10, -5.0dB + {0x1d, 0x1c, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00}, // 11, -5.5dB + {0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00}, // 12, -6.0dB <== default + {0x1a, 0x19, 0x16, 0x0d, 0x00, 0x00, 0x00, 0x00}, // 13, -6.5dB + {0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00}, // 14, -7.0dB + {0x17, 0x16, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x00}, // 15, -7.5dB + {0x16, 0x15, 0x12, 0x0b, 0x00, 0x00, 0x00, 0x00}, // 16, -8.0dB + {0x14, 0x14, 0x11, 0x0a, 0x00, 0x00, 0x00, 0x00}, // 17, -8.5dB + {0x13, 0x13, 0x10, 0x0a, 0x00, 0x00, 0x00, 0x00}, // 18, -9.0dB + {0x12, 0x12, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, // 19, -9.5dB + {0x11, 0x11, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, // 20, -10.0dB + {0x10, 0x10, 0x0e, 0x08, 0x00, 0x00, 0x00, 0x00}, // 21, -10.5dB + {0x0f, 0x0f, 0x0d, 0x08, 0x00, 0x00, 0x00, 0x00}, // 22, -11.0dB + {0x0e, 0x0e, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, // 23, -11.5dB + {0x0d, 0x0d, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, // 24, -12.0dB + {0x0d, 0x0c, 0x0b, 0x06, 0x00, 0x00, 0x00, 0x00}, // 25, -12.5dB + {0x0c, 0x0c, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, // 26, -13.0dB + {0x0b, 0x0b, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, // 27, -13.5dB + {0x0b, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, // 28, -14.0dB + {0x0a, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, // 29, -14.5dB + {0x0a, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, // 30, -15.0dB + {0x09, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, // 31, -15.5dB + {0x09, 0x08, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00} // 32, -16.0dB +}; + + +u4Byte OFDMSwingTable_New[OFDM_TABLE_SIZE] = { + 0x0b40002d, // 0, -15.0dB + 0x0c000030, // 1, -14.5dB + 0x0cc00033, // 2, -14.0dB + 0x0d800036, // 3, -13.5dB + 0x0e400039, // 4, -13.0dB + 0x0f00003c, // 5, -12.5dB + 0x10000040, // 6, -12.0dB + 0x11000044, // 7, -11.5dB + 0x12000048, // 8, -11.0dB + 0x1300004c, // 9, -10.5dB + 0x14400051, // 10, -10.0dB + 0x15800056, // 11, -9.5dB + 0x16c0005b, // 12, -9.0dB + 0x18000060, // 13, -8.5dB + 0x19800066, // 14, -8.0dB + 0x1b00006c, // 15, -7.5dB + 0x1c800072, // 16, -7.0dB + 0x1e400079, // 17, -6.5dB + 0x20000080, // 18, -6.0dB + 0x22000088, // 19, -5.5dB + 0x24000090, // 20, -5.0dB + 0x26000098, // 21, -4.5dB + 0x288000a2, // 22, -4.0dB + 0x2ac000ab, // 23, -3.5dB + 0x2d4000b5, // 24, -3.0dB + 0x300000c0, // 25, -2.5dB + 0x32c000cb, // 26, -2.0dB + 0x35c000d7, // 27, -1.5dB + 0x390000e4, // 28, -1.0dB + 0x3c8000f2, // 29, -0.5dB + 0x40000100, // 30, +0dB + 0x43c0010f, // 31, +0.5dB + 0x47c0011f, // 32, +1.0dB + 0x4c000130, // 33, +1.5dB + 0x50800142, // 34, +2.0dB + 0x55400155, // 35, +2.5dB + 0x5a400169, // 36, +3.0dB + 0x5fc0017f, // 37, +3.5dB + 0x65400195, // 38, +4.0dB + 0x6b8001ae, // 39, +4.5dB + 0x71c001c7, // 40, +5.0dB + 0x788001e2, // 41, +5.5dB + 0x7f8001fe // 42, +6.0dB +}; + + +u1Byte CCKSwingTable_Ch1_Ch13_New[CCK_TABLE_SIZE][8] = { + {0x09, 0x08, 0x07, 0x06, 0x04, 0x03, 0x01, 0x01}, // 0, -16.0dB + {0x09, 0x09, 0x08, 0x06, 0x05, 0x03, 0x01, 0x01}, // 1, -15.5dB + {0x0a, 0x09, 0x08, 0x07, 0x05, 0x03, 0x02, 0x01}, // 2, -15.0dB + {0x0a, 0x0a, 0x09, 0x07, 0x05, 0x03, 0x02, 0x01}, // 3, -14.5dB + {0x0b, 0x0a, 0x09, 0x08, 0x06, 0x04, 0x02, 0x01}, // 4, -14.0dB + {0x0b, 0x0b, 0x0a, 0x08, 0x06, 0x04, 0x02, 0x01}, // 5, -13.5dB + {0x0c, 0x0c, 0x0a, 0x09, 0x06, 0x04, 0x02, 0x01}, // 6, -13.0dB + {0x0d, 0x0c, 0x0b, 0x09, 0x07, 0x04, 0x02, 0x01}, // 7, -12.5dB + {0x0d, 0x0d, 0x0c, 0x0a, 0x07, 0x05, 0x02, 0x01}, // 8, -12.0dB + {0x0e, 0x0e, 0x0c, 0x0a, 0x08, 0x05, 0x02, 0x01}, // 9, -11.5dB + {0x0f, 0x0f, 0x0d, 0x0b, 0x08, 0x05, 0x03, 0x01}, // 10, -11.0dB + {0x10, 0x10, 0x0e, 0x0b, 0x08, 0x05, 0x03, 0x01}, // 11, -10.5dB + {0x11, 0x11, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, // 12, -10.0dB + {0x12, 0x12, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, // 13, -9.5dB + {0x13, 0x13, 0x10, 0x0d, 0x0a, 0x06, 0x03, 0x01}, // 14, -9.0dB + {0x14, 0x14, 0x11, 0x0e, 0x0b, 0x07, 0x03, 0x02}, // 15, -8.5dB + {0x16, 0x15, 0x12, 0x0f, 0x0b, 0x07, 0x04, 0x01}, // 16, -8.0dB + {0x17, 0x16, 0x13, 0x10, 0x0c, 0x08, 0x04, 0x02}, // 17, -7.5dB + {0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02}, // 18, -7.0dB + {0x1a, 0x19, 0x16, 0x12, 0x0d, 0x09, 0x04, 0x02}, // 19, -6.5dB + {0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02}, // 20, -6.0dB + {0x1d, 0x1c, 0x18, 0x14, 0x0f, 0x0a, 0x05, 0x02}, // 21, -5.5dB + {0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02}, // 22, -5.0dB + {0x20, 0x20, 0x1b, 0x16, 0x11, 0x08, 0x05, 0x02}, // 23, -4.5dB + {0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02}, // 24, -4.0dB + {0x24, 0x23, 0x1f, 0x19, 0x13, 0x0c, 0x06, 0x03}, // 25, -3.5dB + {0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03}, // 26, -3.0dB + {0x28, 0x28, 0x22, 0x1c, 0x15, 0x0d, 0x07, 0x03}, // 27, -2.5dB + {0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03}, // 28, -2.0dB + {0x2d, 0x2d, 0x27, 0x1f, 0x18, 0x0f, 0x08, 0x03}, // 29, -1.5dB + {0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x03}, // 30, -1.0dB + {0x33, 0x32, 0x2b, 0x23, 0x1a, 0x11, 0x08, 0x04}, // 31, -0.5dB + {0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04} // 32, +0dB +}; + + +u1Byte CCKSwingTable_Ch14_New[CCK_TABLE_SIZE][8]= { + {0x09, 0x08, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00}, // 0, -16.0dB + {0x09, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, // 1, -15.5dB + {0x0a, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, // 2, -15.0dB + {0x0a, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, // 3, -14.5dB + {0x0b, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, // 4, -14.0dB + {0x0b, 0x0b, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, // 5, -13.5dB + {0x0c, 0x0c, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, // 6, -13.0dB + {0x0d, 0x0c, 0x0b, 0x06, 0x00, 0x00, 0x00, 0x00}, // 7, -12.5dB + {0x0d, 0x0d, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, // 8, -12.0dB + {0x0e, 0x0e, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, // 9, -11.5dB + {0x0f, 0x0f, 0x0d, 0x08, 0x00, 0x00, 0x00, 0x00}, // 10, -11.0dB + {0x10, 0x10, 0x0e, 0x08, 0x00, 0x00, 0x00, 0x00}, // 11, -10.5dB + {0x11, 0x11, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, // 12, -10.0dB + {0x12, 0x12, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, // 13, -9.5dB + {0x13, 0x13, 0x10, 0x0a, 0x00, 0x00, 0x00, 0x00}, // 14, -9.0dB + {0x14, 0x14, 0x11, 0x0a, 0x00, 0x00, 0x00, 0x00}, // 15, -8.5dB + {0x16, 0x15, 0x12, 0x0b, 0x00, 0x00, 0x00, 0x00}, // 16, -8.0dB + {0x17, 0x16, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x00}, // 17, -7.5dB + {0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00}, // 18, -7.0dB + {0x1a, 0x19, 0x16, 0x0d, 0x00, 0x00, 0x00, 0x00}, // 19, -6.5dB + {0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00}, // 20, -6.0dB + {0x1d, 0x1c, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00}, // 21, -5.5dB + {0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00}, // 22, -5.0dB + {0x20, 0x20, 0x1b, 0x10, 0x00, 0x00, 0x00, 0x00}, // 23, -4.5dB + {0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00}, // 24, -4.0dB + {0x24, 0x23, 0x1f, 0x12, 0x00, 0x00, 0x00, 0x00}, // 25, -3.5dB + {0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00}, // 26, -3.0dB + {0x28, 0x28, 0x24, 0x14, 0x00, 0x00, 0x00, 0x00}, // 27, -2.5dB + {0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00}, // 28, -2.0dB + {0x2d, 0x2d, 0x17, 0x17, 0x00, 0x00, 0x00, 0x00}, // 29, -1.5dB + {0x30, 0x2f, 0x29, 0x18, 0x00, 0x00, 0x00, 0x00}, // 30, -1.0dB + {0x33, 0x32, 0x2b, 0x19, 0x00, 0x00, 0x00, 0x00}, // 31, -0.5dB + {0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00} // 32, +0dB +}; + +u4Byte TxScalingTable_Jaguar[TXSCALE_TABLE_SIZE] = +{ + 0x081, // 0, -12.0dB + 0x088, // 1, -11.5dB + 0x090, // 2, -11.0dB + 0x099, // 3, -10.5dB + 0x0A2, // 4, -10.0dB + 0x0AC, // 5, -9.5dB + 0x0B6, // 6, -9.0dB + 0x0C0, // 7, -8.5dB + 0x0CC, // 8, -8.0dB + 0x0D8, // 9, -7.5dB + 0x0E5, // 10, -7.0dB + 0x0F2, // 11, -6.5dB + 0x101, // 12, -6.0dB + 0x110, // 13, -5.5dB + 0x120, // 14, -5.0dB + 0x131, // 15, -4.5dB + 0x143, // 16, -4.0dB + 0x156, // 17, -3.5dB + 0x16A, // 18, -3.0dB + 0x180, // 19, -2.5dB + 0x197, // 20, -2.0dB + 0x1AF, // 21, -1.5dB + 0x1C8, // 22, -1.0dB + 0x1E3, // 23, -0.5dB + 0x200, // 24, +0 dB + 0x21E, // 25, +0.5dB + 0x23E, // 26, +1.0dB + 0x261, // 27, +1.5dB + 0x285, // 28, +2.0dB + 0x2AB, // 29, +2.5dB + 0x2D3, // 30, +3.0dB + 0x2FE, // 31, +3.5dB + 0x32B, // 32, +4.0dB + 0x35C, // 33, +4.5dB + 0x38E, // 34, +5.0dB + 0x3C4, // 35, +5.5dB + 0x3FE // 36, +6.0dB +}; + +#ifdef AP_BUILD_WORKAROUND + +unsigned int TxPwrTrk_OFDM_SwingTbl[TxPwrTrk_OFDM_SwingTbl_Len] = { + /* +6.0dB */ 0x7f8001fe, + /* +5.5dB */ 0x788001e2, + /* +5.0dB */ 0x71c001c7, + /* +4.5dB */ 0x6b8001ae, + /* +4.0dB */ 0x65400195, + /* +3.5dB */ 0x5fc0017f, + /* +3.0dB */ 0x5a400169, + /* +2.5dB */ 0x55400155, + /* +2.0dB */ 0x50800142, + /* +1.5dB */ 0x4c000130, + /* +1.0dB */ 0x47c0011f, + /* +0.5dB */ 0x43c0010f, + /* 0.0dB */ 0x40000100, + /* -0.5dB */ 0x3c8000f2, + /* -1.0dB */ 0x390000e4, + /* -1.5dB */ 0x35c000d7, + /* -2.0dB */ 0x32c000cb, + /* -2.5dB */ 0x300000c0, + /* -3.0dB */ 0x2d4000b5, + /* -3.5dB */ 0x2ac000ab, + /* -4.0dB */ 0x288000a2, + /* -4.5dB */ 0x26000098, + /* -5.0dB */ 0x24000090, + /* -5.5dB */ 0x22000088, + /* -6.0dB */ 0x20000080, + /* -6.5dB */ 0x1a00006c, + /* -7.0dB */ 0x1c800072, + /* -7.5dB */ 0x18000060, + /* -8.0dB */ 0x19800066, + /* -8.5dB */ 0x15800056, + /* -9.0dB */ 0x26c0005b, + /* -9.5dB */ 0x14400051, + /* -10.0dB */ 0x24400051, + /* -10.5dB */ 0x1300004c, + /* -11.0dB */ 0x12000048, + /* -11.5dB */ 0x11000044, + /* -12.0dB */ 0x10000040 +}; +#endif + + + +VOID +odm_TXPowerTrackingInit( + IN PVOID pDM_VOID + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; +#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + if(!(pDM_Odm->SupportICType & (ODM_RTL8814A|ODM_IC_11N_SERIES))) + return; +#endif + + odm_TXPowerTrackingThermalMeterInit(pDM_Odm); +} + +u1Byte +getSwingIndex( + IN PVOID pDM_VOID + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + PADAPTER Adapter = pDM_Odm->Adapter; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + u1Byte i = 0; + u4Byte bbSwing; + u4Byte swingTableSize; + pu4Byte pSwingTable; + + if (pDM_Odm->SupportICType == ODM_RTL8188E || pDM_Odm->SupportICType == ODM_RTL8723B || + pDM_Odm->SupportICType == ODM_RTL8192E) + { + bbSwing = PHY_QueryBBReg(Adapter, rOFDM0_XATxIQImbalance, 0xFFC00000); + + pSwingTable = OFDMSwingTable_New; + swingTableSize = OFDM_TABLE_SIZE; + } else { +#if ((RTL8812A_SUPPORT==1)||(RTL8821A_SUPPORT==1)) + if (pDM_Odm->SupportICType == ODM_RTL8812 || pDM_Odm->SupportICType == ODM_RTL8821) + { + bbSwing = PHY_GetTxBBSwing_8812A(Adapter, pHalData->CurrentBandType, ODM_RF_PATH_A); + pSwingTable = TxScalingTable_Jaguar; + swingTableSize = TXSCALE_TABLE_SIZE; + } + else +#endif + { + bbSwing = 0; + pSwingTable = OFDMSwingTable; + swingTableSize = OFDM_TABLE_SIZE; + } + } + + for (i = 0; i < swingTableSize; ++i) { + u4Byte tableValue = pSwingTable[i]; + + if (tableValue >= 0x100000 ) + tableValue >>= 22; + if (bbSwing == tableValue) + break; + } + return i; +} + +VOID +odm_TXPowerTrackingThermalMeterInit( + IN PVOID pDM_VOID + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + u1Byte defaultSwingIndex = getSwingIndex(pDM_Odm); + u1Byte p = 0; +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + PADAPTER Adapter = pDM_Odm->Adapter; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + + if(pDM_Odm->mp_mode == FALSE) + pHalData->TxPowerTrackControl = TRUE; +#elif (DM_ODM_SUPPORT_TYPE == ODM_CE) + PADAPTER Adapter = pDM_Odm->Adapter; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + + + if (pDM_Odm->SupportICType >= ODM_RTL8188E) + { + pDM_Odm->RFCalibrateInfo.bTXPowerTracking = _TRUE; + pDM_Odm->RFCalibrateInfo.TXPowercount = 0; + pDM_Odm->RFCalibrateInfo.bTXPowerTrackingInit = _FALSE; + + if(pDM_Odm->mp_mode == FALSE) + pDM_Odm->RFCalibrateInfo.TxPowerTrackControl = _TRUE; + else + pDM_Odm->RFCalibrateInfo.TxPowerTrackControl = _FALSE; + + MSG_8192C("pDM_Odm TxPowerTrackControl = %d\n", pDM_Odm->RFCalibrateInfo.TxPowerTrackControl); + } + else + { + struct dm_priv *pdmpriv = &pHalData->dmpriv; + + pdmpriv->bTXPowerTracking = _TRUE; + pdmpriv->TXPowercount = 0; + pdmpriv->bTXPowerTrackingInit = _FALSE; + //#if (MP_DRIVER != 1) //for mp driver, turn off txpwrtracking as default + + if(pDM_Odm->mp_mode == FALSE) + pdmpriv->TxPowerTrackControl = _TRUE; + else + pdmpriv->TxPowerTrackControl = _FALSE; + + + //MSG_8192C("pdmpriv->TxPowerTrackControl = %d\n", pdmpriv->TxPowerTrackControl); + } + +#elif (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + #ifdef RTL8188E_SUPPORT + { + pDM_Odm->RFCalibrateInfo.bTXPowerTracking = _TRUE; + pDM_Odm->RFCalibrateInfo.TXPowercount = 0; + pDM_Odm->RFCalibrateInfo.bTXPowerTrackingInit = _FALSE; + pDM_Odm->RFCalibrateInfo.TxPowerTrackControl = _TRUE; + } + #endif +#endif + + //pDM_Odm->RFCalibrateInfo.TxPowerTrackControl = TRUE; + pDM_Odm->RFCalibrateInfo.ThermalValue = pHalData->EEPROMThermalMeter; + pDM_Odm->RFCalibrateInfo.ThermalValue_IQK = pHalData->EEPROMThermalMeter; + pDM_Odm->RFCalibrateInfo.ThermalValue_LCK = pHalData->EEPROMThermalMeter; + + // The index of "0 dB" in SwingTable. + if (pDM_Odm->SupportICType == ODM_RTL8188E || pDM_Odm->SupportICType == ODM_RTL8723B || + pDM_Odm->SupportICType == ODM_RTL8192E) + { + pDM_Odm->DefaultOfdmIndex = (defaultSwingIndex >= OFDM_TABLE_SIZE) ? 30 : defaultSwingIndex; + pDM_Odm->DefaultCckIndex = 20; + } + else + { + pDM_Odm->DefaultOfdmIndex = (defaultSwingIndex >= TXSCALE_TABLE_SIZE) ? 24 : defaultSwingIndex; + pDM_Odm->DefaultCckIndex = 24; + } + + pDM_Odm->BbSwingIdxCckBase = pDM_Odm->DefaultCckIndex; + pDM_Odm->RFCalibrateInfo.CCK_index = pDM_Odm->DefaultCckIndex; + + for (p = ODM_RF_PATH_A; p < MAX_RF_PATH; ++p) + { + pDM_Odm->BbSwingIdxOfdmBase[p] = pDM_Odm->DefaultOfdmIndex; + pDM_Odm->RFCalibrateInfo.OFDM_index[p] = pDM_Odm->DefaultOfdmIndex; + pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[p] = 0; + pDM_Odm->RFCalibrateInfo.DeltaPowerIndexLast[p] = 0; + pDM_Odm->RFCalibrateInfo.PowerIndexOffset[p] = 0; + } + +} + + +VOID +ODM_TXPowerTrackingCheck( + IN PVOID pDM_VOID + ) +{ + // + // 2011/09/29 MH In HW integration first stage, we provide 4 different handle to operate + // at the same time. In the stage2/3, we need to prive universal interface and merge all + // HW dynamic mechanism. + // + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + switch (pDM_Odm->SupportPlatform) + { + case ODM_WIN: + odm_TXPowerTrackingCheckMP(pDM_Odm); + break; + + case ODM_CE: + odm_TXPowerTrackingCheckCE(pDM_Odm); + break; + + case ODM_AP: + odm_TXPowerTrackingCheckAP(pDM_Odm); + break; + + case ODM_ADSL: + //odm_DIGAP(pDM_Odm); + break; + } + +} + +VOID +odm_TXPowerTrackingCheckCE( + IN PVOID pDM_VOID + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; +#if (DM_ODM_SUPPORT_TYPE == ODM_CE) + PADAPTER Adapter = pDM_Odm->Adapter; + #if( (RTL8192C_SUPPORT==1) || (RTL8723A_SUPPORT==1) ) + if(IS_HARDWARE_TYPE_8192C(Adapter)){ + rtl8192c_odm_CheckTXPowerTracking(Adapter); + return; + } + #endif + + #if (RTL8192D_SUPPORT==1) + if(IS_HARDWARE_TYPE_8192D(Adapter)){ + #if (RTL8192D_EASY_SMART_CONCURRENT == 1) + if(!Adapter->bSlaveOfDMSP) + #endif + rtl8192d_odm_CheckTXPowerTracking(Adapter); + return; + } + #endif + + #if(((RTL8188E_SUPPORT==1) || (RTL8812A_SUPPORT==1) || (RTL8821A_SUPPORT==1) || (RTL8192E_SUPPORT==1) || (RTL8723B_SUPPORT==1) )) + if(!(pDM_Odm->SupportAbility & ODM_RF_TX_PWR_TRACK)) + { + return; + } + + if(!pDM_Odm->RFCalibrateInfo.TM_Trigger) //at least delay 1 sec + { + //pHalData->TxPowerCheckCnt++; //cosa add for debug + if(IS_HARDWARE_TYPE_8188E(Adapter) || IS_HARDWARE_TYPE_JAGUAR(Adapter) || IS_HARDWARE_TYPE_8192E(Adapter)||IS_HARDWARE_TYPE_8723B(Adapter)) + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_T_METER_NEW, (BIT17 | BIT16), 0x03); + else + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_T_METER_OLD, bRFRegOffsetMask, 0x60); + + //DBG_871X("Trigger Thermal Meter!!\n"); + + pDM_Odm->RFCalibrateInfo.TM_Trigger = 1; + return; + } + else + { + //DBG_871X("Schedule TxPowerTracking direct call!!\n"); + ODM_TXPowerTrackingCallback_ThermalMeter(Adapter); + pDM_Odm->RFCalibrateInfo.TM_Trigger = 0; + } + #endif +#endif +} + +VOID +odm_TXPowerTrackingCheckMP( + IN PVOID pDM_VOID + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + PADAPTER Adapter = pDM_Odm->Adapter; + + if (ODM_CheckPowerStatus(Adapter) == FALSE) + { + RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, ("===>ODM_CheckPowerStatus() return FALSE\n")); + return; + } + + if(IS_HARDWARE_TYPE_8723A(Adapter)) + return; + + if(!Adapter->bSlaveOfDMSP || Adapter->DualMacSmartConcurrent == FALSE) + odm_TXPowerTrackingThermalMeterCheck(Adapter); + else { + RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, ("!Adapter->bSlaveOfDMSP || Adapter->DualMacSmartConcurrent == FALSE\n")); + } +#endif + +} + + +VOID +odm_TXPowerTrackingCheckAP( + IN PVOID pDM_VOID + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; +#if (DM_ODM_SUPPORT_TYPE == ODM_AP) + prtl8192cd_priv priv = pDM_Odm->priv; + + if ( (priv->pmib->dot11RFEntry.ther) && ((priv->up_time % priv->pshare->rf_ft_var.tpt_period) == 0)){ +#ifdef CONFIG_RTL_92D_SUPPORT + if (GET_CHIP_VER(priv)==VERSION_8192D){ + tx_power_tracking_92D(priv); + } else +#endif + { +#ifdef CONFIG_RTL_92C_SUPPORT + tx_power_tracking(priv); +#endif + } + } +#endif + +} + +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) +VOID +odm_TXPowerTrackingThermalMeterCheck( + IN PADAPTER Adapter + ) +{ +#ifndef AP_BUILD_WORKAROUND + static u1Byte TM_Trigger = 0; + + if(!(GET_HAL_DATA(Adapter)->DM_OutSrc.SupportAbility & ODM_RF_TX_PWR_TRACK)) + { + RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, + ("===>odm_TXPowerTrackingThermalMeterCheck(),pMgntInfo->bTXPowerTracking is FALSE, return!!\n")); + return; + } + + if(!TM_Trigger) //at least delay 1 sec + { + if(IS_HARDWARE_TYPE_8192D(Adapter)) + PHY_SetRFReg(Adapter, ODM_RF_PATH_A, RF_T_METER_92D, BIT17 | BIT16, 0x03); + else if(IS_HARDWARE_TYPE_8188E(Adapter) || IS_HARDWARE_TYPE_JAGUAR(Adapter) || IS_HARDWARE_TYPE_8192E(Adapter) || + IS_HARDWARE_TYPE_8723B(Adapter)) + PHY_SetRFReg(Adapter, ODM_RF_PATH_A, RF_T_METER_88E, BIT17 | BIT16, 0x03); + else + PHY_SetRFReg(Adapter, ODM_RF_PATH_A, RF_T_METER, bRFRegOffsetMask, 0x60); + + RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD,("Trigger Thermal Meter!!\n")); + + TM_Trigger = 1; + return; + } + else + { + RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD,("Schedule TxPowerTracking direct call!!\n")); + odm_TXPowerTrackingDirectCall(Adapter); //Using direct call is instead, added by Roger, 2009.06.18. + TM_Trigger = 0; + } +#endif +} +#endif + + diff --git a/hal/OUTSRC/odm_PowerTracking.h b/hal/OUTSRC/odm_PowerTracking.h new file mode 100644 index 0000000..de8685a --- /dev/null +++ b/hal/OUTSRC/odm_PowerTracking.h @@ -0,0 +1,246 @@ +/****************************************************************************** + * + * 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 __ODMPOWERTRACKING_H__ +#define __ODMPOWERTRACKING_H__ + +#define DPK_DELTA_MAPPING_NUM 13 +#define index_mapping_HP_NUM 15 +#define OFDM_TABLE_SIZE 43 +#define CCK_TABLE_SIZE 33 +#define TXSCALE_TABLE_SIZE 37 +#define TXPWR_TRACK_TABLE_SIZE 30 +#define DELTA_SWINGIDX_SIZE 30 +#define BAND_NUM 4 + +#define AVG_THERMAL_NUM 8 +#define HP_THERMAL_NUM 8 +#define IQK_MAC_REG_NUM 4 +#define IQK_ADDA_REG_NUM 16 +#define IQK_BB_REG_NUM_MAX 10 +#if (RTL8192D_SUPPORT==1) +#define IQK_BB_REG_NUM 10 +#else +#define IQK_BB_REG_NUM 9 +#endif + + +#define IQK_Matrix_REG_NUM 8 +#define IQK_Matrix_Settings_NUM 14+24+21 // Channels_2_4G_NUM + Channels_5G_20M_NUM + Channels_5G + +extern u4Byte OFDMSwingTable[OFDM_TABLE_SIZE]; +extern u1Byte CCKSwingTable_Ch1_Ch13[CCK_TABLE_SIZE][8]; +extern u1Byte CCKSwingTable_Ch14 [CCK_TABLE_SIZE][8]; + +extern u4Byte OFDMSwingTable_New[OFDM_TABLE_SIZE]; +extern u1Byte CCKSwingTable_Ch1_Ch13_New[CCK_TABLE_SIZE][8]; +extern u1Byte CCKSwingTable_Ch14_New [CCK_TABLE_SIZE][8]; + +extern u4Byte TxScalingTable_Jaguar[TXSCALE_TABLE_SIZE]; + +// <20121018, Kordan> In case fail to read TxPowerTrack.txt, we use the table of 88E as the default table. +static u1Byte DeltaSwingTableIdx_2GA_P_8188E[] = {0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9}; +static u1Byte DeltaSwingTableIdx_2GA_N_8188E[] = {0, 0, 0, 2, 2, 3, 3, 4, 4, 4, 4, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 11}; + +#define dm_CheckTXPowerTracking ODM_TXPowerTrackingCheck + +typedef struct _IQK_MATRIX_REGS_SETTING{ + BOOLEAN bIQKDone; + s4Byte Value[3][IQK_Matrix_REG_NUM]; + BOOLEAN bBWIqkResultSaved[3]; +}IQK_MATRIX_REGS_SETTING,*PIQK_MATRIX_REGS_SETTING; + +typedef struct ODM_RF_Calibration_Structure +{ + //for tx power tracking + + u4Byte RegA24; // for TempCCK + s4Byte RegE94; + s4Byte RegE9C; + s4Byte RegEB4; + s4Byte RegEBC; + + u1Byte TXPowercount; + BOOLEAN bTXPowerTrackingInit; + BOOLEAN bTXPowerTracking; + u1Byte TxPowerTrackControl; //for mp mode, turn off txpwrtracking as default + u1Byte TM_Trigger; + u1Byte InternalPA5G[2]; //pathA / pathB + + u1Byte ThermalMeter[2]; // ThermalMeter, index 0 for RFIC0, and 1 for RFIC1 + u1Byte ThermalValue; + u1Byte ThermalValue_LCK; + u1Byte ThermalValue_IQK; + u1Byte ThermalValue_DPK; + u1Byte ThermalValue_AVG[AVG_THERMAL_NUM]; + u1Byte ThermalValue_AVG_index; + u1Byte ThermalValue_RxGain; + u1Byte ThermalValue_Crystal; + u1Byte ThermalValue_DPKstore; + u1Byte ThermalValue_DPKtrack; + BOOLEAN TxPowerTrackingInProgress; + + BOOLEAN bReloadtxpowerindex; + u1Byte bRfPiEnable; + u4Byte TXPowerTrackingCallbackCnt; //cosa add for debug + + + //------------------------- Tx power Tracking -------------------------// + u1Byte bCCKinCH14; + u1Byte CCK_index; + u1Byte OFDM_index[MAX_RF_PATH]; + s1Byte PowerIndexOffset[MAX_RF_PATH]; + s1Byte DeltaPowerIndex[MAX_RF_PATH]; + s1Byte DeltaPowerIndexLast[MAX_RF_PATH]; + BOOLEAN bTxPowerChanged; + + u1Byte ThermalValue_HP[HP_THERMAL_NUM]; + u1Byte ThermalValue_HP_index; + IQK_MATRIX_REGS_SETTING IQKMatrixRegSetting[IQK_Matrix_Settings_NUM]; + u1Byte Delta_LCK; + s1Byte BBSwingDiff2G, BBSwingDiff5G; // Unit: dB + u1Byte DeltaSwingTableIdx_2GCCKA_P[DELTA_SWINGIDX_SIZE]; + u1Byte DeltaSwingTableIdx_2GCCKA_N[DELTA_SWINGIDX_SIZE]; + u1Byte DeltaSwingTableIdx_2GCCKB_P[DELTA_SWINGIDX_SIZE]; + u1Byte DeltaSwingTableIdx_2GCCKB_N[DELTA_SWINGIDX_SIZE]; + u1Byte DeltaSwingTableIdx_2GA_P[DELTA_SWINGIDX_SIZE]; + u1Byte DeltaSwingTableIdx_2GA_N[DELTA_SWINGIDX_SIZE]; + u1Byte DeltaSwingTableIdx_2GB_P[DELTA_SWINGIDX_SIZE]; + u1Byte DeltaSwingTableIdx_2GB_N[DELTA_SWINGIDX_SIZE]; + u1Byte DeltaSwingTableIdx_5GA_P[BAND_NUM][DELTA_SWINGIDX_SIZE]; + u1Byte DeltaSwingTableIdx_5GA_N[BAND_NUM][DELTA_SWINGIDX_SIZE]; + u1Byte DeltaSwingTableIdx_5GB_P[BAND_NUM][DELTA_SWINGIDX_SIZE]; + u1Byte DeltaSwingTableIdx_5GB_N[BAND_NUM][DELTA_SWINGIDX_SIZE]; + u1Byte DeltaSwingTableIdx_2GA_P_8188E[DELTA_SWINGIDX_SIZE]; + u1Byte DeltaSwingTableIdx_2GA_N_8188E[DELTA_SWINGIDX_SIZE]; + + + //--------------------------------------------------------------------// + + //for IQK + u4Byte RegC04; + u4Byte Reg874; + u4Byte RegC08; + u4Byte RegB68; + u4Byte RegB6C; + u4Byte Reg870; + u4Byte Reg860; + u4Byte Reg864; + + BOOLEAN bIQKInitialized; + BOOLEAN bLCKInProgress; + BOOLEAN bAntennaDetected; + BOOLEAN bNeedIQK; + BOOLEAN bIQKInProgress; + u1Byte Delta_IQK; + u4Byte ADDA_backup[IQK_ADDA_REG_NUM]; + u4Byte IQK_MAC_backup[IQK_MAC_REG_NUM]; + u4Byte IQK_BB_backup_recover[9]; + u4Byte IQK_BB_backup[IQK_BB_REG_NUM]; + u4Byte TxIQC_8723B[2][3][2]; // { {S1: 0xc94, 0xc80, 0xc4c} , {S0: 0xc9c, 0xc88, 0xc4c}} + u4Byte RxIQC_8723B[2][2][2]; // { {S1: 0xc14, 0xca0} , {S0: 0xc14, 0xca0}} + + // IQK time measurement + u8Byte IQK_StartTime; + u8Byte IQK_ProgressingTime; + + //for APK + u4Byte APKoutput[2][2]; //path A/B; output1_1a/output1_2a + u1Byte bAPKdone; + u1Byte bAPKThermalMeterIgnore; + + // DPK + BOOLEAN bDPKFail; + u1Byte bDPdone; + u1Byte bDPPathAOK; + u1Byte bDPPathBOK; + + u4Byte TxLOK[2]; + +}ODM_RF_CAL_T,*PODM_RF_CAL_T; + + +VOID +ODM_TXPowerTrackingCheck( + IN PVOID pDM_VOID + ); + + +VOID +odm_TXPowerTrackingInit( + IN PVOID pDM_VOID + ); + +VOID +odm_TXPowerTrackingCheckAP( + IN PVOID pDM_VOID + ); + +VOID +odm_TXPowerTrackingThermalMeterInit( + IN PVOID pDM_VOID + ); + +VOID +odm_TXPowerTrackingInit( + IN PVOID pDM_VOID + ); + +VOID +odm_TXPowerTrackingCheckMP( + IN PVOID pDM_VOID + ); + + +VOID +odm_TXPowerTrackingCheckCE( + IN PVOID pDM_VOID + ); + +#if(DM_ODM_SUPPORT_TYPE & (ODM_WIN)) + +VOID +odm_TXPowerTrackingCallbackThermalMeter92C( + IN PADAPTER Adapter + ); + +VOID +odm_TXPowerTrackingCallbackRXGainThermalMeter92D( + IN PADAPTER Adapter + ); + +VOID +odm_TXPowerTrackingCallbackThermalMeter92D( + IN PADAPTER Adapter + ); + +VOID +odm_TXPowerTrackingDirectCall92C( + IN PADAPTER Adapter + ); + +VOID +odm_TXPowerTrackingThermalMeterCheck( + IN PADAPTER Adapter + ); + +#endif + +#endif diff --git a/hal/OUTSRC/odm_RXHP.c b/hal/OUTSRC/odm_RXHP.c new file mode 100644 index 0000000..3b2118a --- /dev/null +++ b/hal/OUTSRC/odm_RXHP.c @@ -0,0 +1,1685 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA + * + * + ******************************************************************************/ +//============================================================ +// include files +//============================================================ +#include "Mp_Precomp.h" +#include "odm_precomp.h" + +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + +#define AFH_PSD 1 //0:normal PSD scan, 1: only do 20 pts PSD +#define MODE_40M 0 //0:20M, 1:40M +#define PSD_TH2 3 +#define PSD_CHMIN 20 // Minimum channel number for BT AFH +#define SIR_STEP_SIZE 3 +#define Smooth_Size_1 5 +#define Smooth_TH_1 3 +#define Smooth_Size_2 10 +#define Smooth_TH_2 4 +#define Smooth_Size_3 20 +#define Smooth_TH_3 4 +#define Smooth_Step_Size 5 +#define Adaptive_SIR 1 +#define SCAN_INTERVAL 1500 //ms +#define SYN_Length 5 // for 92D + +#define LNA_Low_Gain_1 0x64 +#define LNA_Low_Gain_2 0x5A +#define LNA_Low_Gain_3 0x58 + +#define pw_th_10dB 0x0 +#define pw_th_16dB 0x3 + +#define FA_RXHP_TH1 5000 +#define FA_RXHP_TH2 1500 +#define FA_RXHP_TH3 800 +#define FA_RXHP_TH4 600 +#define FA_RXHP_TH5 500 + +#define Idle_Mode 0 +#define High_TP_Mode 1 +#define Low_TP_Mode 2 + + +VOID +odm_PSDMonitorInit( + IN PVOID pDM_VOID + ) +{ +#if (DEV_BUS_TYPE == RT_PCI_INTERFACE)|(DEV_BUS_TYPE == RT_USB_INTERFACE) + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + + //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + //PSD Monitor Setting + //Which path in ADC/DAC is turnned on for PSD: both I/Q + ODM_SetBBReg(pDM_Odm, ODM_PSDREG, BIT10|BIT11, 0x3); + //Ageraged number: 8 + ODM_SetBBReg(pDM_Odm, ODM_PSDREG, BIT12|BIT13, 0x1); + pDM_Odm->bPSDinProcess = FALSE; + pDM_Odm->bUserAssignLevel = FALSE; + pDM_Odm->bPSDactive = FALSE; + //pDM_Odm->bDMInitialGainEnable=TRUE; //change the initialization to DIGinit + //Set Debug Port + //PHY_SetBBReg(Adapter, 0x908, bMaskDWord, 0x803); + //PHY_SetBBReg(Adapter, 0xB34, bMaskByte0, 0x00); // pause PSD + //PHY_SetBBReg(Adapter, 0xB38, bMaskByte0, 10); //rescan + //PHY_SetBBReg(Adapter, 0xB38, bMaskByte2|bMaskByte3, 100); //interval + + //PlatformSetTimer( Adapter, &pHalData->PSDTriggerTimer, 0); //ms +#endif +} + +VOID +PatchDCTone( + IN PVOID pDM_VOID, + pu4Byte PSD_report, + u1Byte initial_gain_psd +) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + //PADAPTER pAdapter; + + u4Byte psd_report; + + //2 Switch to CH11 to patch CH9 and CH13 DC tone + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_CHNLBW, 0x3FF, 11); + + if(pDM_Odm->SupportICType== ODM_RTL8192D) + { + if((*(pDM_Odm->pMacPhyMode) == ODM_SMSP)||(*(pDM_Odm->pMacPhyMode) == ODM_DMSP)) + { + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_CHNLBW, 0x3FF, 11); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x25, 0xfffff, 0x643BC); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x26, 0xfffff, 0xFC038); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x27, 0xfffff, 0x77C1A); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x2B, 0xfffff, 0x41289); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x2C, 0xfffff, 0x01840); + } + else + { + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x25, 0xfffff, 0x643BC); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x26, 0xfffff, 0xFC038); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x27, 0xfffff, 0x77C1A); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x2B, 0xfffff, 0x41289); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x2C, 0xfffff, 0x01840); + } + } + + //Ch9 DC tone patch + psd_report = GetPSDData(pDM_Odm, 96, initial_gain_psd); + PSD_report[50] = psd_report; + //Ch13 DC tone patch + psd_report = GetPSDData(pDM_Odm, 32, initial_gain_psd); + PSD_report[70] = psd_report; + + //2 Switch to CH3 to patch CH1 and CH5 DC tone + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_CHNLBW, 0x3FF, 3); + + + if(pDM_Odm->SupportICType==ODM_RTL8192D) + { + if((*(pDM_Odm->pMacPhyMode) == ODM_SMSP)||(*(pDM_Odm->pMacPhyMode) == ODM_DMSP)) + { + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_CHNLBW, 0x3FF, 3); + //PHY_SetRFReg(Adapter, ODM_RF_PATH_B, 0x25, 0xfffff, 0x643BC); + //PHY_SetRFReg(Adapter, ODM_RF_PATH_B, 0x26, 0xfffff, 0xFC038); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x27, 0xfffff, 0x07C1A); + //PHY_SetRFReg(Adapter, ODM_RF_PATH_B, 0x2B, 0xfffff, 0x61289); + //PHY_SetRFReg(Adapter, ODM_RF_PATH_B, 0x2C, 0xfffff, 0x01C41); + } + else + { + //PHY_SetRFReg(Adapter, ODM_RF_PATH_A, 0x25, 0xfffff, 0x643BC); + //PHY_SetRFReg(Adapter, ODM_RF_PATH_A, 0x26, 0xfffff, 0xFC038); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x27, 0xfffff, 0x07C1A); + //PHY_SetRFReg(Adapter, ODM_RF_PATH_A, 0x2B, 0xfffff, 0x61289); + //PHY_SetRFReg(Adapter, ODM_RF_PATH_A, 0x2C, 0xfffff, 0x01C41); + } + } + + //Ch1 DC tone patch + psd_report = GetPSDData(pDM_Odm, 96, initial_gain_psd); + PSD_report[10] = psd_report; + //Ch5 DC tone patch + psd_report = GetPSDData(pDM_Odm, 32, initial_gain_psd); + PSD_report[30] = psd_report; + +} + + +VOID +GoodChannelDecision( + IN PVOID pDM_VOID, + pu4Byte PSD_report, + pu1Byte PSD_bitmap, + u1Byte RSSI_BT, + pu1Byte PSD_bitmap_memory) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + pRXHP_T pRX_HP_Table = &pDM_Odm->DM_RXHP_Table; + //s4Byte TH1 = SSBT-0x15; // modify TH by Neil Chen + s4Byte TH1= RSSI_BT+0x14; + s4Byte TH2 = RSSI_BT+85; + //u2Byte TH3; +// s4Byte RegB34; + u1Byte bitmap, Smooth_size[3], Smooth_TH[3]; + //u1Byte psd_bit; + u4Byte i,n,j, byte_idx, bit_idx, good_cnt, good_cnt_smoothing, Smooth_Interval[3]; + int start_byte_idx,start_bit_idx,cur_byte_idx, cur_bit_idx,NOW_byte_idx ; + +// RegB34 = PHY_QueryBBReg(Adapter,0xB34, bMaskDWord)&0xFF; + + if((pDM_Odm->SupportICType == ODM_RTL8192C)||(pDM_Odm->SupportICType == ODM_RTL8192D)) + { + TH1 = RSSI_BT + 0x14; + } + + Smooth_size[0]=Smooth_Size_1; + Smooth_size[1]=Smooth_Size_2; + Smooth_size[2]=Smooth_Size_3; + Smooth_TH[0]=Smooth_TH_1; + Smooth_TH[1]=Smooth_TH_2; + Smooth_TH[2]=Smooth_TH_3; + Smooth_Interval[0]=16; + Smooth_Interval[1]=15; + Smooth_Interval[2]=13; + good_cnt = 0; + if(pDM_Odm->SupportICType==ODM_RTL8723A) + { + //2 Threshold + + if(RSSI_BT >=41) + TH1 = 113; + else if(RSSI_BT >=38) // >= -15dBm + TH1 = 105; //0x69 + else if((RSSI_BT >=33)&(RSSI_BT <38)) + TH1 = 99+(RSSI_BT-33); //0x63 + else if((RSSI_BT >=26)&(RSSI_BT<33)) + TH1 = 99-(33-RSSI_BT)+2; //0x5e + else if((RSSI_BT >=24)&(RSSI_BT<26)) + TH1 = 88-((RSSI_BT-24)*3); //0x58 + else if((RSSI_BT >=18)&(RSSI_BT<24)) + TH1 = 77+((RSSI_BT-18)*2); + else if((RSSI_BT >=14)&(RSSI_BT<18)) + TH1 = 63+((RSSI_BT-14)*2); + else if((RSSI_BT >=8)&(RSSI_BT<14)) + TH1 = 58+((RSSI_BT-8)*2); + else if((RSSI_BT >=3)&(RSSI_BT<8)) + TH1 = 52+(RSSI_BT-3); + else + TH1 = 51; + } + + for (i = 0; i< 10; i++) + PSD_bitmap[i] = 0; + + + // Add By Gary + for (i=0; i<80; i++) + pRX_HP_Table->PSD_bitmap_RXHP[i] = 0; + // End + + + + if(pDM_Odm->SupportICType==ODM_RTL8723A) + { + TH1 =TH1-SIR_STEP_SIZE; + } + while (good_cnt < PSD_CHMIN) + { + good_cnt = 0; + if(pDM_Odm->SupportICType==ODM_RTL8723A) + { + if(TH1 ==TH2) + break; + if((TH1+SIR_STEP_SIZE) < TH2) + TH1 += SIR_STEP_SIZE; + else + TH1 = TH2; + } + else + { + if(TH1==(RSSI_BT+0x1E)) + break; + if((TH1+2) < (RSSI_BT+0x1E)) + TH1+=3; + else + TH1 = RSSI_BT+0x1E; + + } + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PSD,DBG_LOUD,("PSD: decision threshold is: %d", TH1)); + + for (i = 0; i< 80; i++) + { + if((s4Byte)(PSD_report[i]) < TH1) + { + byte_idx = i / 8; + bit_idx = i -8*byte_idx; + bitmap = PSD_bitmap[byte_idx]; + PSD_bitmap[byte_idx] = bitmap | (u1Byte) (1 << bit_idx); + } + } + +#if DBG + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PSD, DBG_LOUD,("PSD: before smoothing\n")); + for(n=0;n<10;n++) + { + //DbgPrint("PSD_bitmap[%u]=%x\n", n, PSD_bitmap[n]); + for (i = 0; i<8; i++) + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PSD, DBG_LOUD,("PSD_bitmap[%u] = %d\n", 2402+n*8+i, (PSD_bitmap[n]&BIT(i))>>i)); + } +#endif + + //1 Start of smoothing function + + for (j=0;j<3;j++) + { + start_byte_idx=0; + start_bit_idx=0; + for(n=0; n 7 ) + { + start_byte_idx= start_byte_idx+start_bit_idx/8; + start_bit_idx = start_bit_idx%8; + } + } + + ODM_RT_TRACE( pDM_Odm,ODM_COMP_PSD, DBG_LOUD,("PSD: after %u smoothing", j+1)); + for(n=0;n<10;n++) + { + for (i = 0; i<8; i++) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PSD, DBG_LOUD,("PSD_bitmap[%u] = %d\n", 2402+n*8+i, (PSD_bitmap[n]&BIT(i))>>i)); + + if ( ((PSD_bitmap[n]&BIT(i))>>i) ==1) //----- Add By Gary + { + pRX_HP_Table->PSD_bitmap_RXHP[8*n+i] = 1; + } // ------end by Gary + } + } + + } + + + good_cnt = 0; + for ( i = 0; i < 10; i++) + { + for (n = 0; n < 8; n++) + if((PSD_bitmap[i]& BIT(n)) != 0) + good_cnt++; + } + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PSD, ODM_COMP_PSD,("PSD: good channel cnt = %u",good_cnt)); + } + + //RT_TRACE(ODM_COMP_PSD, DBG_LOUD,("PSD: SSBT=%d, TH2=%d, TH1=%d",SSBT,TH2,TH1)); + for (i = 0; i <10; i++) + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PSD, DBG_LOUD,("PSD: PSD_bitmap[%u]=%x",i,PSD_bitmap[i])); +/* + //Update bitmap memory + for(i = 0; i < 80; i++) + { + byte_idx = i / 8; + bit_idx = i -8*byte_idx; + psd_bit = (PSD_bitmap[byte_idx] & BIT(bit_idx)) >> bit_idx; + bitmap = PSD_bitmap_memory[i]; + PSD_bitmap_memory[i] = (bitmap << 1) |psd_bit; + } +*/ +} + + + +VOID +odm_PSD_Monitor( + IN PVOID pDM_VOID +) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + //PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + + unsigned int pts, start_point, stop_point; + u1Byte initial_gain ; + static u1Byte PSD_bitmap_memory[80], init_memory = 0; + static u1Byte psd_cnt=0; + static u4Byte PSD_report[80], PSD_report_tmp; + static u8Byte lastTxOkCnt=0, lastRxOkCnt=0; + u1Byte H2C_PSD_DATA[5]={0,0,0,0,0}; + static u1Byte H2C_PSD_DATA_last[5] ={0,0,0,0,0}; + u1Byte idx[20]={96,99,102,106,109,112,115,118,122,125, + 0,3,6,10,13,16,19,22,26,29}; + u1Byte n, i, channel, BBReset,tone_idx; + u1Byte PSD_bitmap[10], SSBT=0,initial_gain_psd=0, RSSI_BT=0, initialGainUpper; + s4Byte PSD_skip_start, PSD_skip_stop; + u4Byte CurrentChannel, RXIQI, RxIdleLowPwr, wlan_channel; + u4Byte ReScan, Interval, Is40MHz; + u8Byte curTxOkCnt, curRxOkCnt; + int cur_byte_idx, cur_bit_idx; + PADAPTER Adapter = pDM_Odm->Adapter; + PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; + + + if(*pDM_Odm->pbDriverIsGoingToPnpSetPowerSleep) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PSD, DBG_LOUD,("pbDriverIsGoingToPnpSetPowerSleep!!!!!!!!!!!!!!!\n")); + return; + } + + + if( (*(pDM_Odm->pbScanInProcess)) || + pDM_Odm->bLinkInProcess) + { + if((pDM_Odm->SupportICType==ODM_RTL8723A)&(pDM_Odm->SupportInterface==ODM_ITRF_PCIE)) + { + ODM_SetTimer( pDM_Odm, &pDM_Odm->PSDTimer, 1500); //ms + //psd_cnt=0; + } + return; + } + + if(pDM_Odm->bBtHsOperation) + { + ReScan = 1; + Interval = SCAN_INTERVAL; + } + else + { + ReScan = PSD_RESCAN; + Interval = SCAN_INTERVAL; + } + + //1 Initialization + if(init_memory == 0) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PSD, DBG_LOUD,("Init memory\n")); + for(i = 0; i < 80; i++) + PSD_bitmap_memory[i] = 0xFF; // channel is always good + init_memory = 1; + } + if(psd_cnt == 0) + { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PSD, DBG_LOUD,("Enter dm_PSD_Monitor\n")); + for(i = 0; i < 80; i++) + PSD_report[i] = 0; + } + + //1 Backup Current Settings + CurrentChannel = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask); +/* + if(pDM_Odm->SupportICType==ODM_RTL8192D) + { + //2 Record Current synthesizer parameters based on current channel + if((*pDM_Odm->MacPhyMode92D == SINGLEMAC_SINGLEPHY)||(*pDM_Odm->MacPhyMode92D == DUALMAC_SINGLEPHY)) + { + SYN_RF25 = ODM_GetRFReg(Adapter, ODM_RF_PATH_B, 0x25, bMaskDWord); + SYN_RF26 = ODM_GetRFReg(Adapter, ODM_RF_PATH_B, 0x26, bMaskDWord); + SYN_RF27 = ODM_GetRFReg(Adapter, ODM_RF_PATH_B, 0x27, bMaskDWord); + SYN_RF2B = ODM_GetRFReg(Adapter, ODM_RF_PATH_B, 0x2B, bMaskDWord); + SYN_RF2C = ODM_GetRFReg(Adapter, ODM_RF_PATH_B, 0x2C, bMaskDWord); + } + else // DualMAC_DualPHY 2G + { + SYN_RF25 = ODM_GetRFReg(Adapter, ODM_RF_PATH_A, 0x25, bMaskDWord); + SYN_RF26 = ODM_GetRFReg(Adapter, ODM_RF_PATH_A, 0x26, bMaskDWord); + SYN_RF27 = ODM_GetRFReg(Adapter, ODM_RF_PATH_A, 0x27, bMaskDWord); + SYN_RF2B = ODM_GetRFReg(Adapter, ODM_RF_PATH_A, 0x2B, bMaskDWord); + SYN_RF2C = ODM_GetRFReg(Adapter, ODM_RF_PATH_A, 0x2C, bMaskDWord); + } + } +*/ + //RXIQI = PHY_QueryBBReg(Adapter, 0xC14, bMaskDWord); + RXIQI = ODM_GetBBReg(pDM_Odm, 0xC14, bMaskDWord); + + //RxIdleLowPwr = (PHY_QueryBBReg(Adapter, 0x818, bMaskDWord)&BIT28)>>28; + RxIdleLowPwr = (ODM_GetBBReg(pDM_Odm, 0x818, bMaskDWord)&BIT28)>>28; + + //2??? + if(CHNL_RUN_ABOVE_40MHZ(pMgntInfo)) + Is40MHz = TRUE; + else + Is40MHz = FALSE; + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_PSD, DBG_LOUD,("PSD Scan Start\n")); + //1 Turn off CCK + //PHY_SetBBReg(Adapter, rFPGA0_RFMOD, BIT24, 0); + ODM_SetBBReg(pDM_Odm, rFPGA0_RFMOD, BIT24, 0); + //1 Turn off TX + //Pause TX Queue + //PlatformEFIOWrite1Byte(Adapter, REG_TXPAUSE, 0xFF); + ODM_Write1Byte(pDM_Odm,REG_TXPAUSE, 0xFF); + + //Force RX to stop TX immediately + //PHY_SetRFReg(Adapter, ODM_RF_PATH_A, RF_AC, bRFRegOffsetMask, 0x32E13); + + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_AC, bRFRegOffsetMask, 0x32E13); + //1 Turn off RX + //Rx AGC off RegC70[0]=0, RegC7C[20]=0 + //PHY_SetBBReg(Adapter, 0xC70, BIT0, 0); + //PHY_SetBBReg(Adapter, 0xC7C, BIT20, 0); + + ODM_SetBBReg(pDM_Odm, 0xC70, BIT0, 0); + ODM_SetBBReg(pDM_Odm, 0xC7C, BIT20, 0); + + + //Turn off CCA + //PHY_SetBBReg(Adapter, 0xC14, bMaskDWord, 0x0); + ODM_SetBBReg(pDM_Odm, 0xC14, bMaskDWord, 0x0); + + //BB Reset + //BBReset = PlatformEFIORead1Byte(Adapter, 0x02); + BBReset = ODM_Read1Byte(pDM_Odm, 0x02); + + //PlatformEFIOWrite1Byte(Adapter, 0x02, BBReset&(~BIT0)); + //PlatformEFIOWrite1Byte(Adapter, 0x02, BBReset|BIT0); + ODM_SetBBReg(pDM_Odm, 0x87C, BIT31, 1); //clock gated to prevent from AGC table mess + ODM_Write1Byte(pDM_Odm, 0x02, BBReset&(~BIT0)); + ODM_Write1Byte(pDM_Odm, 0x02, BBReset|BIT0); + ODM_SetBBReg(pDM_Odm, 0x87C, BIT31, 0); + + //1 Leave RX idle low power + //PHY_SetBBReg(Adapter, 0x818, BIT28, 0x0); + + ODM_SetBBReg(pDM_Odm, 0x818, BIT28, 0x0); + //1 Fix initial gain + //if (IS_HARDWARE_TYPE_8723AE(Adapter)) + //RSSI_BT = pHalData->RSSI_BT; + //else if((IS_HARDWARE_TYPE_8192C(Adapter))||(IS_HARDWARE_TYPE_8192D(Adapter))) // Add by Gary + // RSSI_BT = RSSI_BT_new; + + if((pDM_Odm->SupportICType==ODM_RTL8723A)&(pDM_Odm->SupportInterface==ODM_ITRF_PCIE)) + RSSI_BT=pDM_Odm->RSSI_BT; //need to check C2H to pDM_Odm RSSI BT + + if(RSSI_BT>=47) + RSSI_BT=47; + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PSD, DBG_LOUD,("PSD: RSSI_BT= %d\n", RSSI_BT)); + + if(pDM_Odm->SupportICType==ODM_RTL8723A) + { + //Neil add--2011--10--12 + //2 Initial Gain index + if(RSSI_BT >=35) // >= -15dBm + initial_gain_psd = RSSI_BT*2; + else if((RSSI_BT >=33)&(RSSI_BT<35)) + initial_gain_psd = RSSI_BT*2+6; + else if((RSSI_BT >=24)&(RSSI_BT<33)) + initial_gain_psd = 70-(33-RSSI_BT); + else if((RSSI_BT >=19)&(RSSI_BT<24)) + initial_gain_psd = 64-((24-RSSI_BT)*4); + else if((RSSI_BT >=14)&(RSSI_BT<19)) + initial_gain_psd = 44-((18-RSSI_BT)*2); + else if((RSSI_BT >=8)&(RSSI_BT<14)) + initial_gain_psd = 35-(14-RSSI_BT); + else + initial_gain_psd = 0x1B; + } + else + { + + //need to do + initial_gain_psd = pDM_Odm->RSSI_Min; // PSD report based on RSSI + //} + } + //if(RSSI_BT<0x17) + // RSSI_BT +=3; + //DbgPrint("PSD: RSSI_BT= %d\n", RSSI_BT); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PSD, DBG_LOUD,("PSD: RSSI_BT= %d\n", RSSI_BT)); + + //initialGainUpper = 0x5E; //Modify by neil chen + + if(pDM_Odm->bUserAssignLevel) + { + pDM_Odm->bUserAssignLevel = FALSE; + initialGainUpper = 0x7f; + } + else + { + initialGainUpper = 0x5E; + } + + /* + if (initial_gain_psd < 0x1a) + initial_gain_psd = 0x1a; + if (initial_gain_psd > initialGainUpper) + initial_gain_psd = initialGainUpper; + */ + + //if(pDM_Odm->SupportICType==ODM_RTL8723A) + SSBT = RSSI_BT * 2 +0x3E; + + + //if(IS_HARDWARE_TYPE_8723AE(Adapter)) + // SSBT = RSSI_BT * 2 +0x3E; + //else if((IS_HARDWARE_TYPE_8192C(Adapter))||(IS_HARDWARE_TYPE_8192D(Adapter))) // Add by Gary + //{ + // RSSI_BT = initial_gain_psd; + // SSBT = RSSI_BT; + //} + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PSD, DBG_LOUD,("PSD: SSBT= %d\n", SSBT)); + ODM_RT_TRACE( pDM_Odm,ODM_COMP_PSD, DBG_LOUD,("PSD: initial gain= 0x%x\n", initial_gain_psd)); + //DbgPrint("PSD: SSBT= %d", SSBT); + //need to do + pDM_Odm->bDMInitialGainEnable = FALSE; + initial_gain =(u1Byte) (ODM_GetBBReg(pDM_Odm, 0xc50, bMaskDWord) & 0x7F); + + // make sure the initial gain is under the correct range. + //initial_gain_psd &= 0x7f; + ODM_Write_DIG(pDM_Odm, initial_gain_psd); + //1 Turn off 3-wire + ODM_SetBBReg(pDM_Odm, 0x88c, BIT20|BIT21|BIT22|BIT23, 0xF); + + //pts value = 128, 256, 512, 1024 + pts = 128; + + if(pts == 128) + { + ODM_SetBBReg(pDM_Odm, 0x808, BIT14|BIT15, 0x0); + start_point = 64; + stop_point = 192; + } + else if(pts == 256) + { + ODM_SetBBReg(pDM_Odm, 0x808, BIT14|BIT15, 0x1); + start_point = 128; + stop_point = 384; + } + else if(pts == 512) + { + ODM_SetBBReg(pDM_Odm, 0x808, BIT14|BIT15, 0x2); + start_point = 256; + stop_point = 768; + } + else + { + ODM_SetBBReg(pDM_Odm, 0x808, BIT14|BIT15, 0x3); + start_point = 512; + stop_point = 1536; + } + + +//3 Skip WLAN channels if WLAN busy + + curTxOkCnt = *(pDM_Odm->pNumTxBytesUnicast) - lastTxOkCnt; + curRxOkCnt = *(pDM_Odm->pNumRxBytesUnicast) - lastRxOkCnt; + lastTxOkCnt = *(pDM_Odm->pNumTxBytesUnicast); + lastRxOkCnt = *(pDM_Odm->pNumRxBytesUnicast); + + PSD_skip_start=80; + PSD_skip_stop = 0; + wlan_channel = CurrentChannel & 0x0f; + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PSD,DBG_LOUD,("PSD: current channel: %x, BW:%d \n", wlan_channel, Is40MHz)); + if(pDM_Odm->SupportICType==ODM_RTL8723A) + { + if(pDM_Odm->bBtHsOperation) + { + if(pDM_Odm->bLinked) + { + if(Is40MHz) + { + PSD_skip_start = ((wlan_channel-1)*5 -Is40MHz*10)-2; // Modify by Neil to add 10 chs to mask + PSD_skip_stop = (PSD_skip_start + (1+Is40MHz)*20)+4; + } + else + { + PSD_skip_start = ((wlan_channel-1)*5 -Is40MHz*10)-10; // Modify by Neil to add 10 chs to mask + PSD_skip_stop = (PSD_skip_start + (1+Is40MHz)*20)+18; + } + } + else + { + // mask for 40MHz + PSD_skip_start = ((wlan_channel-1)*5 -Is40MHz*10)-2; // Modify by Neil to add 10 chs to mask + PSD_skip_stop = (PSD_skip_start + (1+Is40MHz)*20)+4; + } + if(PSD_skip_start < 0) + PSD_skip_start = 0; + if(PSD_skip_stop >80) + PSD_skip_stop = 80; + } + else + { + if((curRxOkCnt+curTxOkCnt) > 5) + { + if(Is40MHz) + { + PSD_skip_start = ((wlan_channel-1)*5 -Is40MHz*10)-2; // Modify by Neil to add 10 chs to mask + PSD_skip_stop = (PSD_skip_start + (1+Is40MHz)*20)+4; + } + else + { + PSD_skip_start = ((wlan_channel-1)*5 -Is40MHz*10)-10; // Modify by Neil to add 10 chs to mask + PSD_skip_stop = (PSD_skip_start + (1+Is40MHz)*20)+18; + } + + if(PSD_skip_start < 0) + PSD_skip_start = 0; + if(PSD_skip_stop >80) + PSD_skip_stop = 80; + } + } + } +#if 0 + else + { + if((curRxOkCnt+curTxOkCnt) > 1000) + { + PSD_skip_start = (wlan_channel-1)*5 -Is40MHz*10; + PSD_skip_stop = PSD_skip_start + (1+Is40MHz)*20; + } + } +#endif //Reove RXHP Issue + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PSD,DBG_LOUD,("PSD: Skip tone from %d to %d \n", PSD_skip_start, PSD_skip_stop)); + + for (n=0;n<80;n++) + { + if((n%20)==0) + { + channel = (n/20)*4 + 1; + + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_CHNLBW, 0x3FF, channel); + } + tone_idx = n%20; + if ((n>=PSD_skip_start) && (n PSD_report[n]) + PSD_report[n] = PSD_report_tmp; + + } + } + + PatchDCTone(pDM_Odm, PSD_report, initial_gain_psd); + + //----end + //1 Turn on RX + //Rx AGC on + ODM_SetBBReg(pDM_Odm, 0xC70, BIT0, 1); + ODM_SetBBReg(pDM_Odm, 0xC7C, BIT20, 1); + //CCK on + ODM_SetBBReg(pDM_Odm, rFPGA0_RFMOD, BIT24, 1); + //1 Turn on TX + //Resume TX Queue + + ODM_Write1Byte(pDM_Odm,REG_TXPAUSE, 0x00); + //Turn on 3-wire + ODM_SetBBReg(pDM_Odm, 0x88c, BIT20|BIT21|BIT22|BIT23, 0x0); + //1 Restore Current Settings + //Resume DIG + pDM_Odm->bDMInitialGainEnable = TRUE; + + ODM_Write_DIG(pDM_Odm, initial_gain); + + // restore originl center frequency + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask, CurrentChannel); + + //Turn on CCA + ODM_SetBBReg(pDM_Odm, 0xC14, bMaskDWord, RXIQI); + //Restore RX idle low power + if(RxIdleLowPwr == TRUE) + ODM_SetBBReg(pDM_Odm, 0x818, BIT28, 1); + + psd_cnt++; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PSD, DBG_LOUD,("PSD:psd_cnt = %d \n",psd_cnt)); + if (psd_cnt < ReScan) + ODM_SetTimer(pDM_Odm, &pDM_Odm->PSDTimer, Interval); + else + { + psd_cnt = 0; + for(i=0;i<80;i++) + //DbgPrint("psd_report[%d]= %d \n", 2402+i, PSD_report[i]); + RT_TRACE( ODM_COMP_PSD, DBG_LOUD,("psd_report[%d]= %d \n", 2402+i, PSD_report[i])); + + + GoodChannelDecision(pDM_Odm, PSD_report, PSD_bitmap,RSSI_BT, PSD_bitmap_memory); + + if(pDM_Odm->SupportICType==ODM_RTL8723A) + { + cur_byte_idx=0; + cur_bit_idx=0; + + //2 Restore H2C PSD Data to Last Data + H2C_PSD_DATA_last[0] = H2C_PSD_DATA[0]; + H2C_PSD_DATA_last[1] = H2C_PSD_DATA[1]; + H2C_PSD_DATA_last[2] = H2C_PSD_DATA[2]; + H2C_PSD_DATA_last[3] = H2C_PSD_DATA[3]; + H2C_PSD_DATA_last[4] = H2C_PSD_DATA[4]; + + + //2 Translate 80bit channel map to 40bit channel + for ( i=0;i<5;i++) + { + for(n=0;n<8;n++) + { + cur_byte_idx = i*2 + n/4; + cur_bit_idx = (n%4)*2; + if ( ((PSD_bitmap[cur_byte_idx]& BIT(cur_bit_idx)) != 0) && ((PSD_bitmap[cur_byte_idx]& BIT(cur_bit_idx+1)) != 0)) + H2C_PSD_DATA[i] = H2C_PSD_DATA[i] | (u1Byte) (1 << n); + } + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PSD, DBG_LOUD,("H2C_PSD_DATA[%d]=0x%x\n" ,i, H2C_PSD_DATA[i])); + } + + //3 To Compare the difference + for ( i=0;i<5;i++) + { + if(H2C_PSD_DATA[i] !=H2C_PSD_DATA_last[i]) + { + FW_FillH2CCmd(Adapter, H2C_92C_PSD_RESULT, 5, H2C_PSD_DATA); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_PSD, DBG_LOUD,("Need to Update the AFH Map \n")); + break; + } + else + { + if(i==5) + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PSD, DBG_LOUD,("Not need to Update\n")); + } + } + if(pDM_Odm->bBtHsOperation) + { + ODM_SetTimer(pDM_Odm, &pDM_Odm->PSDTimer, 10000); + ODM_RT_TRACE( pDM_Odm,ODM_COMP_PSD, DBG_LOUD,("Leave dm_PSD_Monitor\n")); + } + else + { + ODM_SetTimer(pDM_Odm, &pDM_Odm->PSDTimer, 1500); + ODM_RT_TRACE( pDM_Odm,ODM_COMP_PSD, DBG_LOUD,("Leave dm_PSD_Monitor\n")); + } + } + } +} +/* +//Neil for Get BT RSSI +// Be Triggered by BT C2H CMD +VOID +ODM_PSDGetRSSI( + IN u1Byte RSSI_BT) +{ + + +} + +*/ + +VOID +ODM_PSDMonitor( + IN PVOID pDM_VOID + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + + //if(IS_HARDWARE_TYPE_8723AE(Adapter)) + + if(pDM_Odm->SupportICType == ODM_RTL8723A) //may need to add other IC type + { + if(pDM_Odm->SupportInterface==ODM_ITRF_PCIE) + { + if(!pDM_Odm->bBtEnabled) //need to check upper layer connection + { + pDM_Odm->bPSDactive=FALSE; + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PSD, DBG_LOUD, ("odm_PSDMonitor, return for BT is disabled!!!\n")); + return; + } + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PSD, DBG_LOUD, ("odm_PSDMonitor\n")); + //{ + pDM_Odm->bPSDinProcess = TRUE; + pDM_Odm->bPSDactive=TRUE; + odm_PSD_Monitor(pDM_Odm); + pDM_Odm->bPSDinProcess = FALSE; + } + } + +} +VOID +odm_PSDMonitorCallback( + PRT_TIMER pTimer +) +{ + PADAPTER Adapter = (PADAPTER)pTimer->Adapter; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + + PlatformScheduleWorkItem(&pHalData->PSDMonitorWorkitem); +} + +VOID +odm_PSDMonitorWorkItemCallback( + IN PVOID pContext + ) +{ + PADAPTER Adapter = (PADAPTER)pContext; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + + ODM_PSDMonitor(pDM_Odm); +} + + + //cosa debug tool need to modify + +VOID +ODM_PSDDbgControl( + IN PADAPTER Adapter, + IN u4Byte mode, + IN u4Byte btRssi + ) +{ +#if (DEV_BUS_TYPE == RT_PCI_INTERFACE) + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PSD, DBG_LOUD, (" Monitor mode=%d, btRssi=%d\n", mode, btRssi)); + if(mode) + { + pDM_Odm->RSSI_BT = (u1Byte)btRssi; + pDM_Odm->bUserAssignLevel = TRUE; + ODM_SetTimer( pDM_Odm, &pDM_Odm->PSDTimer, 0); //ms + } + else + { + ODM_CancelTimer(pDM_Odm, &pDM_Odm->PSDTimer); + } +#endif +} + + +//#if(DEV_BUS_TYPE == RT_PCI_INTERFACE)|(DEV_BUS_TYPE == RT_USB_INTERFACE) + +void odm_RXHPInit( + IN PVOID pDM_VOID) +{ +#if (DEV_BUS_TYPE == RT_PCI_INTERFACE)|(DEV_BUS_TYPE == RT_USB_INTERFACE) + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + pRXHP_T pRX_HP_Table = &pDM_Odm->DM_RXHP_Table; + u1Byte index; + + pRX_HP_Table->RXHP_enable = TRUE; + pRX_HP_Table->RXHP_flag = 0; + pRX_HP_Table->PSD_func_trigger = 0; + pRX_HP_Table->Pre_IGI = 0x20; + pRX_HP_Table->Cur_IGI = 0x20; + pRX_HP_Table->Cur_pw_th = pw_th_10dB; + pRX_HP_Table->Pre_pw_th = pw_th_10dB; + for(index=0; index<80; index++) + pRX_HP_Table->PSD_bitmap_RXHP[index] = 1; + +#if(DEV_BUS_TYPE == RT_USB_INTERFACE) + pRX_HP_Table->TP_Mode = Idle_Mode; +#endif +#endif +} + +VOID +odm_PSD_RXHP( + IN PVOID pDM_VOID +) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + pRXHP_T pRX_HP_Table = &pDM_Odm->DM_RXHP_Table; + PADAPTER Adapter = pDM_Odm->Adapter; + PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo); + unsigned int pts, start_point, stop_point, initial_gain ; + static u1Byte PSD_bitmap_memory[80], init_memory = 0; + static u1Byte psd_cnt=0; + static u4Byte PSD_report[80], PSD_report_tmp; + static u8Byte lastTxOkCnt=0, lastRxOkCnt=0; + u1Byte idx[20]={96,99,102,106,109,112,115,118,122,125, + 0,3,6,10,13,16,19,22,26,29}; + u1Byte n, i, channel, BBReset,tone_idx; + u1Byte PSD_bitmap[10]/*, SSBT=0*/,initial_gain_psd=0, RSSI_BT=0, initialGainUpper; + s4Byte PSD_skip_start, PSD_skip_stop; + u4Byte CurrentChannel, RXIQI, RxIdleLowPwr, wlan_channel; + u4Byte ReScan, Interval, Is40MHz; + u8Byte curTxOkCnt, curRxOkCnt; + //--------------2G band synthesizer for 92D switch RF channel using----------------- + u1Byte group_idx=0; + u4Byte SYN_RF25=0, SYN_RF26=0, SYN_RF27=0, SYN_RF2B=0, SYN_RF2C=0; + u4Byte SYN[5] = {0x25, 0x26, 0x27, 0x2B, 0x2C}; // synthesizer RF register for 2G channel + u4Byte SYN_group[3][5] = {{0x643BC, 0xFC038, 0x77C1A, 0x41289, 0x01840}, // For CH1,2,4,9,10.11.12 {0x643BC, 0xFC038, 0x77C1A, 0x41289, 0x01840} + {0x643BC, 0xFC038, 0x07C1A, 0x41289, 0x01840}, // For CH3,13,14 + {0x243BC, 0xFC438, 0x07C1A, 0x4128B, 0x0FC41}}; // For Ch5,6,7,8 + //--------------------- Add by Gary for Debug setting ---------------------- + u1Byte RSSI_BT_new = (u1Byte) ODM_GetBBReg(pDM_Odm, 0xB9C, 0xFF); + u1Byte rssi_ctrl = (u1Byte) ODM_GetBBReg(pDM_Odm, 0xB38, 0xFF); + //--------------------------------------------------------------------- + + if(pMgntInfo->bScanInProgress) + { + return; + } + + ReScan = PSD_RESCAN; + Interval = SCAN_INTERVAL; + + + //1 Initialization + if(init_memory == 0) + { + RT_TRACE( ODM_COMP_PSD, DBG_LOUD,("Init memory\n")); + for(i = 0; i < 80; i++) + PSD_bitmap_memory[i] = 0xFF; // channel is always good + init_memory = 1; + } + if(psd_cnt == 0) + { + RT_TRACE(ODM_COMP_PSD, DBG_LOUD,("Enter dm_PSD_Monitor\n")); + for(i = 0; i < 80; i++) + PSD_report[i] = 0; + } + + //1 Backup Current Settings + CurrentChannel = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask); + if(pDM_Odm->SupportICType == ODM_RTL8192D) + { + //2 Record Current synthesizer parameters based on current channel + if((*(pDM_Odm->pMacPhyMode)==ODM_SMSP)||(*(pDM_Odm->pMacPhyMode)==ODM_DMSP)) + { + SYN_RF25 = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x25, bMaskDWord); + SYN_RF26 = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x26, bMaskDWord); + SYN_RF27 = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x27, bMaskDWord); + SYN_RF2B = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x2B, bMaskDWord); + SYN_RF2C = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x2C, bMaskDWord); + } + else // DualMAC_DualPHY 2G + { + SYN_RF25 = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x25, bMaskDWord); + SYN_RF26 = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x26, bMaskDWord); + SYN_RF27 = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x27, bMaskDWord); + SYN_RF2B = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x2B, bMaskDWord); + SYN_RF2C = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x2C, bMaskDWord); + } + } + RXIQI = ODM_GetBBReg(pDM_Odm, 0xC14, bMaskDWord); + RxIdleLowPwr = (ODM_GetBBReg(pDM_Odm, 0x818, bMaskDWord)&BIT28)>>28; + Is40MHz = *(pDM_Odm->pBandWidth); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_PSD, DBG_LOUD,("PSD Scan Start\n")); + //1 Turn off CCK + ODM_SetBBReg(pDM_Odm, rFPGA0_RFMOD, BIT24, 0); + //1 Turn off TX + //Pause TX Queue + ODM_Write1Byte(pDM_Odm, REG_TXPAUSE, 0xFF); + //Force RX to stop TX immediately + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_AC, bRFRegOffsetMask, 0x32E13); + //1 Turn off RX + //Rx AGC off RegC70[0]=0, RegC7C[20]=0 + ODM_SetBBReg(pDM_Odm, 0xC70, BIT0, 0); + ODM_SetBBReg(pDM_Odm, 0xC7C, BIT20, 0); + //Turn off CCA + ODM_SetBBReg(pDM_Odm, 0xC14, bMaskDWord, 0x0); + //BB Reset + ODM_SetBBReg(pDM_Odm, 0x87C, BIT31, 1); //clock gated to prevent from AGC table mess + BBReset = ODM_Read1Byte(pDM_Odm, 0x02); + ODM_Write1Byte(pDM_Odm, 0x02, BBReset&(~BIT0)); + ODM_Write1Byte(pDM_Odm, 0x02, BBReset|BIT0); + ODM_SetBBReg(pDM_Odm, 0x87C, BIT31, 0); + //1 Leave RX idle low power + ODM_SetBBReg(pDM_Odm, 0x818, BIT28, 0x0); + //1 Fix initial gain + RSSI_BT = RSSI_BT_new; + RT_TRACE(ODM_COMP_PSD, DBG_LOUD,("PSD: RSSI_BT= %d\n", RSSI_BT)); + + if(rssi_ctrl == 1) // just for debug!! + initial_gain_psd = RSSI_BT_new; + else + initial_gain_psd = pDM_Odm->RSSI_Min; // PSD report based on RSSI + + RT_TRACE(ODM_COMP_PSD, DBG_LOUD,("PSD: RSSI_BT= %d\n", RSSI_BT)); + + initialGainUpper = 0x54; + + RSSI_BT = initial_gain_psd; + //SSBT = RSSI_BT; + + //RT_TRACE( ODM_COMP_PSD, DBG_LOUD,("PSD: SSBT= %d\n", SSBT)); + RT_TRACE( ODM_COMP_PSD, DBG_LOUD,("PSD: initial gain= 0x%x\n", initial_gain_psd)); + + pDM_Odm->bDMInitialGainEnable = FALSE; + initial_gain = ODM_GetBBReg(pDM_Odm, 0xc50, bMaskDWord) & 0x7F; + //ODM_SetBBReg(pDM_Odm, 0xc50, 0x7F, initial_gain_psd); + ODM_Write_DIG(pDM_Odm, initial_gain_psd); + //1 Turn off 3-wire + ODM_SetBBReg(pDM_Odm, 0x88c, BIT20|BIT21|BIT22|BIT23, 0xF); + + //pts value = 128, 256, 512, 1024 + pts = 128; + + if(pts == 128) + { + ODM_SetBBReg(pDM_Odm, 0x808, BIT14|BIT15, 0x0); + start_point = 64; + stop_point = 192; + } + else if(pts == 256) + { + ODM_SetBBReg(pDM_Odm, 0x808, BIT14|BIT15, 0x1); + start_point = 128; + stop_point = 384; + } + else if(pts == 512) + { + ODM_SetBBReg(pDM_Odm, 0x808, BIT14|BIT15, 0x2); + start_point = 256; + stop_point = 768; + } + else + { + ODM_SetBBReg(pDM_Odm, 0x808, BIT14|BIT15, 0x3); + start_point = 512; + stop_point = 1536; + } + + +//3 Skip WLAN channels if WLAN busy + curTxOkCnt = *(pDM_Odm->pNumTxBytesUnicast) - lastTxOkCnt; + curRxOkCnt = *(pDM_Odm->pNumRxBytesUnicast) - lastRxOkCnt; + lastTxOkCnt = *(pDM_Odm->pNumTxBytesUnicast); + lastRxOkCnt = *(pDM_Odm->pNumRxBytesUnicast); + + PSD_skip_start=80; + PSD_skip_stop = 0; + wlan_channel = CurrentChannel & 0x0f; + + RT_TRACE(ODM_COMP_PSD,DBG_LOUD,("PSD: current channel: %x, BW:%d \n", wlan_channel, Is40MHz)); + + if((curRxOkCnt+curTxOkCnt) > 1000) + { + PSD_skip_start = (wlan_channel-1)*5 -Is40MHz*10; + PSD_skip_stop = PSD_skip_start + (1+Is40MHz)*20; + } + + RT_TRACE(ODM_COMP_PSD,DBG_LOUD,("PSD: Skip tone from %d to %d \n", PSD_skip_start, PSD_skip_stop)); + + for (n=0;n<80;n++) + { + if((n%20)==0) + { + channel = (n/20)*4 + 1; + if(pDM_Odm->SupportICType == ODM_RTL8192D) + { + switch(channel) + { + case 1: + case 9: + group_idx = 0; + break; + case 5: + group_idx = 2; + break; + case 13: + group_idx = 1; + break; + } + if((*(pDM_Odm->pMacPhyMode)==ODM_SMSP)||(*(pDM_Odm->pMacPhyMode)==ODM_DMSP)) + { + for(i = 0; i < SYN_Length; i++) + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, SYN[i], bMaskDWord, SYN_group[group_idx][i]); + + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_CHNLBW, 0x3FF, channel); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_CHNLBW, 0x3FF, channel); + } + else // DualMAC_DualPHY 2G + { + for(i = 0; i < SYN_Length; i++) + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, SYN[i], bMaskDWord, SYN_group[group_idx][i]); + + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_CHNLBW, 0x3FF, channel); + } + } + else + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_CHNLBW, 0x3FF, channel); + } + tone_idx = n%20; + if ((n>=PSD_skip_start) && (n PSD_report[n]) + PSD_report[n] = PSD_report_tmp; + + } + } + + PatchDCTone(pDM_Odm, PSD_report, initial_gain_psd); + + //----end + //1 Turn on RX + //Rx AGC on + ODM_SetBBReg(pDM_Odm, 0xC70, BIT0, 1); + ODM_SetBBReg(pDM_Odm, 0xC7C, BIT20, 1); + //CCK on + ODM_SetBBReg(pDM_Odm, rFPGA0_RFMOD, BIT24, 1); + //1 Turn on TX + //Resume TX Queue + ODM_Write1Byte(pDM_Odm, REG_TXPAUSE, 0x00); + //Turn on 3-wire + ODM_SetBBReg(pDM_Odm, 0x88c, BIT20|BIT21|BIT22|BIT23, 0x0); + //1 Restore Current Settings + //Resume DIG + pDM_Odm->bDMInitialGainEnable= TRUE; + //ODM_SetBBReg(pDM_Odm, 0xc50, 0x7F, initial_gain); + ODM_Write_DIG(pDM_Odm,(u1Byte) initial_gain); + // restore originl center frequency + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask, CurrentChannel); + if(pDM_Odm->SupportICType == ODM_RTL8192D) + { + if((*(pDM_Odm->pMacPhyMode)==ODM_SMSP)||(*(pDM_Odm->pMacPhyMode)==ODM_DMSP)) + { + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_CHNLBW, bMaskDWord, CurrentChannel); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x25, bMaskDWord, SYN_RF25); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x26, bMaskDWord, SYN_RF26); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x27, bMaskDWord, SYN_RF27); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x2B, bMaskDWord, SYN_RF2B); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x2C, bMaskDWord, SYN_RF2C); + } + else // DualMAC_DualPHY + { + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x25, bMaskDWord, SYN_RF25); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x26, bMaskDWord, SYN_RF26); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x27, bMaskDWord, SYN_RF27); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x2B, bMaskDWord, SYN_RF2B); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x2C, bMaskDWord, SYN_RF2C); + } + } + //Turn on CCA + ODM_SetBBReg(pDM_Odm, 0xC14, bMaskDWord, RXIQI); + //Restore RX idle low power + if(RxIdleLowPwr == TRUE) + ODM_SetBBReg(pDM_Odm, 0x818, BIT28, 1); + + psd_cnt++; + //gPrint("psd cnt=%d\n", psd_cnt); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_PSD, DBG_LOUD,("PSD:psd_cnt = %d \n",psd_cnt)); + if (psd_cnt < ReScan) + { + ODM_SetTimer(pDM_Odm, &pRX_HP_Table->PSDTimer, Interval); //ms + } + else + { + psd_cnt = 0; + for(i=0;i<80;i++) + RT_TRACE( ODM_COMP_PSD, DBG_LOUD,("psd_report[%d]= %d \n", 2402+i, PSD_report[i])); + //DbgPrint("psd_report[%d]= %d \n", 2402+i, PSD_report[i]); + + GoodChannelDecision(pDM_Odm, PSD_report, PSD_bitmap,RSSI_BT, PSD_bitmap_memory); + + } +} + +void odm_Write_RXHP( + IN PVOID pDM_VOID) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + pRXHP_T pRX_HP_Table = &pDM_Odm->DM_RXHP_Table; + u4Byte currentIGI; + + if(pRX_HP_Table->Cur_IGI != pRX_HP_Table->Pre_IGI) + { + ODM_SetBBReg(pDM_Odm, rOFDM0_XAAGCCore1, bMaskByte0, pRX_HP_Table->Cur_IGI); + ODM_SetBBReg(pDM_Odm, rOFDM0_XBAGCCore1, bMaskByte0, pRX_HP_Table->Cur_IGI); + } + + if(pRX_HP_Table->Cur_pw_th != pRX_HP_Table->Pre_pw_th) +{ + ODM_SetBBReg(pDM_Odm, rOFDM0_XAAGCCore2, BIT8|BIT9, pRX_HP_Table->Cur_pw_th); // RegC54[9:8]=2'b11: AGC Flow 3 + } + + if(pRX_HP_Table->RXHP_flag == 0) + { + pRX_HP_Table->Cur_IGI = 0x20; + } + else + { + currentIGI = ODM_GetBBReg(pDM_Odm, rOFDM0_XAAGCCore1, bMaskByte0); + if(currentIGI<0x50) + { + ODM_SetBBReg(pDM_Odm, rOFDM0_XAAGCCore1, bMaskByte0, pRX_HP_Table->Cur_IGI); + ODM_SetBBReg(pDM_Odm, rOFDM0_XBAGCCore1, bMaskByte0, pRX_HP_Table->Cur_IGI); + } + } + pRX_HP_Table->Pre_IGI = pRX_HP_Table->Cur_IGI; + pRX_HP_Table->Pre_pw_th = pRX_HP_Table->Cur_pw_th; + +} + + +void odm_RXHP( + IN PVOID pDM_VOID) +{ +#if( DM_ODM_SUPPORT_TYPE & (ODM_WIN)) +#if (DEV_BUS_TYPE == RT_PCI_INTERFACE) | (DEV_BUS_TYPE == RT_USB_INTERFACE) + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + PADAPTER Adapter = pDM_Odm->Adapter; + PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo); + pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; + pRXHP_T pRX_HP_Table = &pDM_Odm->DM_RXHP_Table; + PFALSE_ALARM_STATISTICS FalseAlmCnt = &(pDM_Odm->FalseAlmCnt); + + u1Byte i, j, sum; + u1Byte Is40MHz; + s1Byte Intf_diff_idx, MIN_Intf_diff_idx = 16; + s4Byte cur_channel; + u1Byte ch_map_intf_5M[17] = {0}; + static u4Byte FA_TH = 0; + static u1Byte psd_intf_flag = 0; + static s4Byte curRssi = 0; + static s4Byte preRssi = 0; + static u1Byte PSDTriggerCnt = 1; + + u1Byte RX_HP_enable = (u1Byte)(ODM_GetBBReg(pDM_Odm, rOFDM0_XAAGCCore2, bMaskDWord)>>31); // for debug!! + +#if(DEV_BUS_TYPE == RT_USB_INTERFACE) + static s8Byte lastTxOkCnt = 0, lastRxOkCnt = 0; + s8Byte curTxOkCnt, curRxOkCnt; + s8Byte curTPOkCnt; + s8Byte TP_Acc3, TP_Acc5; + static s8Byte TP_Buff[5] = {0}; + static u1Byte pre_state = 0, pre_state_flag = 0; + static u1Byte Intf_HighTP_flag = 0, De_counter = 16; + static u1Byte TP_Degrade_flag = 0; +#endif + static u1Byte LatchCnt = 0; + + if(pDM_Odm->SupportICType & (ODM_RTL8723A|ODM_RTL8188E)) + return; + //AGC RX High Power Mode is only applied on 2G band in 92D!!! + if(pDM_Odm->SupportICType == ODM_RTL8192D) + { + if(*(pDM_Odm->pBandType) != ODM_BAND_2_4G) + return; + } + + if(!(pDM_Odm->SupportAbility & ODM_BB_RXHP)) + return; + + + //RX HP ON/OFF + if(RX_HP_enable == 1) + pRX_HP_Table->RXHP_enable = FALSE; + else + pRX_HP_Table->RXHP_enable = TRUE; + + if(pRX_HP_Table->RXHP_enable == FALSE) + { + if(pRX_HP_Table->RXHP_flag == 1) + { + pRX_HP_Table->RXHP_flag = 0; + psd_intf_flag = 0; + } + return; + } + +#if(DEV_BUS_TYPE == RT_USB_INTERFACE) + //2 Record current TP for USB interface + curTxOkCnt = *(pDM_Odm->pNumTxBytesUnicast)-lastTxOkCnt; + curRxOkCnt = *(pDM_Odm->pNumRxBytesUnicast)-lastRxOkCnt; + lastTxOkCnt = *(pDM_Odm->pNumTxBytesUnicast); + lastRxOkCnt = *(pDM_Odm->pNumRxBytesUnicast); + + curTPOkCnt = curTxOkCnt+curRxOkCnt; + TP_Buff[0] = curTPOkCnt; // current TP + TP_Acc3 = PlatformDivision64((TP_Buff[1]+TP_Buff[2]+TP_Buff[3]), 3); + TP_Acc5 = PlatformDivision64((TP_Buff[0]+TP_Buff[1]+TP_Buff[2]+TP_Buff[3]+TP_Buff[4]), 5); + + if(TP_Acc5 < 1000) + pRX_HP_Table->TP_Mode = Idle_Mode; + else if((1000 < TP_Acc5)&&(TP_Acc5 < 3750000)) + pRX_HP_Table->TP_Mode = Low_TP_Mode; + else + pRX_HP_Table->TP_Mode = High_TP_Mode; + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_RXHP, ODM_DBG_LOUD, ("RX HP TP Mode = %d\n", pRX_HP_Table->TP_Mode)); + // Since TP result would be sampled every 2 sec, it needs to delay 4sec to wait PSD processing. + // When LatchCnt = 0, we would Get PSD result. + if(TP_Degrade_flag == 1) + { + LatchCnt--; + if(LatchCnt == 0) + { + TP_Degrade_flag = 0; + } + } + // When PSD function triggered by TP degrade 20%, and Interference Flag = 1 + // Set a De_counter to wait IGI = upper bound. If time is UP, the Interference flag will be pull down. + if(Intf_HighTP_flag == 1) + { + De_counter--; + if(De_counter == 0) + { + Intf_HighTP_flag = 0; + psd_intf_flag = 0; + } + } +#endif + + //2 AGC RX High Power Mode by PSD only applied to STA Mode + //3 NOT applied 1. Ad Hoc Mode. + //3 NOT applied 2. AP Mode + if ((pMgntInfo->mAssoc) && (!pMgntInfo->mIbss) && (!ACTING_AS_AP(Adapter))) + { + Is40MHz = *(pDM_Odm->pBandWidth); + curRssi = pDM_Odm->RSSI_Min; + cur_channel = ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_CHNLBW, 0x0fff) & 0x0f; + ODM_RT_TRACE(pDM_Odm, ODM_COMP_RXHP, ODM_DBG_LOUD, ("RXHP RX HP flag = %d\n", pRX_HP_Table->RXHP_flag)); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_RXHP, ODM_DBG_LOUD, ("RXHP FA = %d\n", FalseAlmCnt->Cnt_all)); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_RXHP, ODM_DBG_LOUD, ("RXHP cur RSSI = %d, pre RSSI=%d\n", curRssi, preRssi)); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_RXHP, ODM_DBG_LOUD, ("RXHP current CH = %d\n", cur_channel)); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_RXHP, ODM_DBG_LOUD, ("RXHP Is 40MHz = %d\n", Is40MHz)); + //2 PSD function would be triggered + //3 1. Every 4 sec for PCIE + //3 2. Before TP Mode (Idle TP<4kbps) for USB + //3 3. After TP Mode (High TP) for USB + if((curRssi > 68) && (pRX_HP_Table->RXHP_flag == 0)) // Only RSSI>TH and RX_HP_flag=0 will Do PSD process + { +#if (DEV_BUS_TYPE == RT_USB_INTERFACE) + //2 Before TP Mode ==> PSD would be trigger every 4 sec + if(pRX_HP_Table->TP_Mode == Idle_Mode) //2.1 less wlan traffic <4kbps + { +#endif + if(PSDTriggerCnt == 1) + { + odm_PSD_RXHP(pDM_Odm); + pRX_HP_Table->PSD_func_trigger = 1; + PSDTriggerCnt = 0; + } + else + { + PSDTriggerCnt++; + } +#if(DEV_BUS_TYPE == RT_USB_INTERFACE) + } + //2 After TP Mode ==> Check if TP degrade larger than 20% would trigger PSD function + if(pRX_HP_Table->TP_Mode == High_TP_Mode) + { + if((pre_state_flag == 0)&&(LatchCnt == 0)) + { + // TP var < 5% + if((((curTPOkCnt-TP_Acc3)*20)<(TP_Acc3))&&(((curTPOkCnt-TP_Acc3)*20)>(-TP_Acc3))) + { + pre_state++; + if(pre_state == 3) // hit pre_state condition => consecutive 3 times + { + pre_state_flag = 1; + pre_state = 0; + } + + } + else + { + pre_state = 0; + } + } + //3 If pre_state_flag=1 ==> start to monitor TP degrade 20% + if(pre_state_flag == 1) + { + if(((TP_Acc3-curTPOkCnt)*5)>(TP_Acc3)) // degrade 20% + { + odm_PSD_RXHP(pDM_Odm); + pRX_HP_Table->PSD_func_trigger = 1; + TP_Degrade_flag = 1; + LatchCnt = 2; + pre_state_flag = 0; + } + else if(((TP_Buff[2]-curTPOkCnt)*5)>TP_Buff[2]) + { + odm_PSD_RXHP(pDM_Odm); + pRX_HP_Table->PSD_func_trigger = 1; + TP_Degrade_flag = 1; + LatchCnt = 2; + pre_state_flag = 0; + } + else if(((TP_Buff[3]-curTPOkCnt)*5)>TP_Buff[3]) + { + odm_PSD_RXHP(pDM_Odm); + pRX_HP_Table->PSD_func_trigger = 1; + TP_Degrade_flag = 1; + LatchCnt = 2; + pre_state_flag = 0; + } + } + } +#endif +} + +#if (DEV_BUS_TYPE == RT_USB_INTERFACE) + for (i=0;i<4;i++) + { + TP_Buff[4-i] = TP_Buff[3-i]; + } +#endif + //2 Update PSD bitmap according to PSD report + if((pRX_HP_Table->PSD_func_trigger == 1)&&(LatchCnt == 0)) + { + //2 Separate 80M bandwidth into 16 group with smaller 5M BW. + for (i = 0 ; i < 16 ; i++) + { + sum = 0; + for(j = 0; j < 5 ; j++) + sum += pRX_HP_Table->PSD_bitmap_RXHP[5*i + j]; + + if(sum < 5) + { + ch_map_intf_5M[i] = 1; // interference flag + } + } + //=============just for debug========================= + //for(i=0;i<16;i++) + //DbgPrint("RX HP: ch_map_intf_5M[%d] = %d\n", i, ch_map_intf_5M[i]); + //=============================================== + //2 Mask target channel 5M index + for(i = 0; i < (4+4*Is40MHz) ; i++) + { + ch_map_intf_5M[cur_channel - (1+2*Is40MHz) + i] = 0; + } + + psd_intf_flag = 0; + for(i = 0; i < 16; i++) + { + if(ch_map_intf_5M[i] == 1) + { + psd_intf_flag = 1; // interference is detected!!! + break; + } + } + +#if (DEV_BUS_TYPE == RT_USB_INTERFACE) + if(pRX_HP_Table->TP_Mode!=Idle_Mode) + { + if(psd_intf_flag == 1) // to avoid psd_intf_flag always 1 + { + Intf_HighTP_flag = 1; + De_counter = 32; // 0x1E -> 0x3E needs 32 times by each IGI step =1 + } + } +#endif + ODM_RT_TRACE(pDM_Odm, ODM_COMP_RXHP, ODM_DBG_LOUD, ("RX HP psd_intf_flag = %d\n", psd_intf_flag)); + //2 Distance between target channel and interference + for(i = 0; i < 16; i++) + { + if(ch_map_intf_5M[i] == 1) + { + Intf_diff_idx = ((cur_channel+Is40MHz-(i+1))>0) ? (s1Byte)(cur_channel-2*Is40MHz-(i-2)) : (s1Byte)((i+1)-(cur_channel+2*Is40MHz)); + if(Intf_diff_idx < MIN_Intf_diff_idx) + MIN_Intf_diff_idx = Intf_diff_idx; // the min difference index between interference and target + } + } + ODM_RT_TRACE(pDM_Odm, ODM_COMP_RXHP, ODM_DBG_LOUD, ("RX HP MIN_Intf_diff_idx = %d\n", MIN_Intf_diff_idx)); + //2 Choose False Alarm Threshold + switch (MIN_Intf_diff_idx){ + case 0: + case 1: + case 2: + case 3: + FA_TH = FA_RXHP_TH1; + break; + case 4: // CH5 + case 5: // CH6 + FA_TH = FA_RXHP_TH2; + break; + case 6: // CH7 + case 7: // CH8 + FA_TH = FA_RXHP_TH3; + break; + case 8: // CH9 + case 9: //CH10 + FA_TH = FA_RXHP_TH4; + break; + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + FA_TH = FA_RXHP_TH5; + break; + } + ODM_RT_TRACE(pDM_Odm, ODM_COMP_RXHP, ODM_DBG_LOUD, ("RX HP FA_TH = %d\n", FA_TH)); + pRX_HP_Table->PSD_func_trigger = 0; + } + //1 Monitor RSSI variation to choose the suitable IGI or Exit AGC RX High Power Mode + if(pRX_HP_Table->RXHP_flag == 1) + { + if ((curRssi > 80)&&(preRssi < 80)) + { + pRX_HP_Table->Cur_IGI = LNA_Low_Gain_1; + } + else if ((curRssi < 80)&&(preRssi > 80)) + { + pRX_HP_Table->Cur_IGI = LNA_Low_Gain_2; + } + else if ((curRssi > 72)&&(preRssi < 72)) + { + pRX_HP_Table->Cur_IGI = LNA_Low_Gain_2; + } + else if ((curRssi < 72)&&( preRssi > 72)) + { + pRX_HP_Table->Cur_IGI = LNA_Low_Gain_3; + } + else if (curRssi < 68) //RSSI is NOT large enough!!==> Exit AGC RX High Power Mode + { + pRX_HP_Table->Cur_pw_th = pw_th_10dB; + pRX_HP_Table->RXHP_flag = 0; // Back to Normal DIG Mode + psd_intf_flag = 0; + } + } + else // pRX_HP_Table->RXHP_flag == 0 + { + //1 Decide whether to enter AGC RX High Power Mode + if ((curRssi > 70) && (psd_intf_flag == 1) && (FalseAlmCnt->Cnt_all > FA_TH) && + (pDM_DigTable->CurIGValue == pDM_DigTable->rx_gain_range_max)) + { + if (curRssi > 80) + { + pRX_HP_Table->Cur_IGI = LNA_Low_Gain_1; + } + else if (curRssi > 72) + { + pRX_HP_Table->Cur_IGI = LNA_Low_Gain_2; + } + else + { + pRX_HP_Table->Cur_IGI = LNA_Low_Gain_3; + } + pRX_HP_Table->Cur_pw_th = pw_th_16dB; //RegC54[9:8]=2'b11: to enter AGC Flow 3 + pRX_HP_Table->First_time_enter = TRUE; + pRX_HP_Table->RXHP_flag = 1; // RXHP_flag=1: AGC RX High Power Mode, RXHP_flag=0: Normal DIG Mode + } + } + preRssi = curRssi; + odm_Write_RXHP(pDM_Odm); + } +#endif //#if( DM_ODM_SUPPORT_TYPE & (ODM_WIN)) +#endif //#if (DEV_BUS_TYPE == RT_PCI_INTERFACE) | (DEV_BUS_TYPE == RT_USB_INTERFACE) +} + + +VOID +odm_PSD_RXHPCallback( + PRT_TIMER pTimer +) +{ + PADAPTER Adapter = (PADAPTER)pTimer->Adapter; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + pRXHP_T pRX_HP_Table = &pDM_Odm->DM_RXHP_Table; + +#if DEV_BUS_TYPE==RT_PCI_INTERFACE + #if USE_WORKITEM + ODM_ScheduleWorkItem(&pRX_HP_Table->PSDTimeWorkitem); + #else + odm_PSD_RXHP(pDM_Odm); + #endif +#else + ODM_ScheduleWorkItem(&pRX_HP_Table->PSDTimeWorkitem); +#endif + + } + +VOID +odm_PSD_RXHPWorkitemCallback( + IN PVOID pContext + ) +{ + PADAPTER pAdapter = (PADAPTER)pContext; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + + odm_PSD_RXHP(pDM_Odm); +} + +#endif //#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + + + diff --git a/hal/OUTSRC/odm_RXHP.h b/hal/OUTSRC/odm_RXHP.h new file mode 100644 index 0000000..0ed6170 --- /dev/null +++ b/hal/OUTSRC/odm_RXHP.h @@ -0,0 +1,104 @@ +/****************************************************************************** + * + * 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 __ODMRXHP_H__ +#define __ODMRXHP_H__ + + +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + +#define AFH_PSD 1 //0:normal PSD scan, 1: only do 20 pts PSD +#define MODE_40M 0 //0:20M, 1:40M +#define PSD_TH2 3 +#define PSD_CHMIN 20 // Minimum channel number for BT AFH +#define SIR_STEP_SIZE 3 +#define Smooth_Size_1 5 +#define Smooth_TH_1 3 +#define Smooth_Size_2 10 +#define Smooth_TH_2 4 +#define Smooth_Size_3 20 +#define Smooth_TH_3 4 +#define Smooth_Step_Size 5 +#define Adaptive_SIR 1 +#define PSD_RESCAN 4 +#define PSD_SCAN_INTERVAL 700 //ms + +typedef struct _RX_High_Power_ +{ + u1Byte RXHP_flag; + u1Byte PSD_func_trigger; + u1Byte PSD_bitmap_RXHP[80]; + u1Byte Pre_IGI; + u1Byte Cur_IGI; + u1Byte Pre_pw_th; + u1Byte Cur_pw_th; + BOOLEAN First_time_enter; + BOOLEAN RXHP_enable; + u1Byte TP_Mode; + RT_TIMER PSDTimer; + #if USE_WORKITEM + RT_WORK_ITEM PSDTimeWorkitem; + #endif +}RXHP_T, *pRXHP_T; + +#define dm_PSDMonitorCallback odm_PSDMonitorCallback +VOID odm_PSDMonitorCallback(PRT_TIMER pTimer); + +VOID +odm_PSDMonitorInit( + IN PVOID pDM_VOID + ); + +void odm_RXHPInit( + IN PVOID pDM_VOID); + +void odm_RXHP( + IN PVOID pDM_VOID); + +VOID +odm_PSD_RXHPCallback( + PRT_TIMER pTimer +); + + VOID +ODM_PSDDbgControl( + IN PADAPTER Adapter, + IN u4Byte mode, + IN u4Byte btRssi + ); + + VOID +odm_PSD_RXHPCallback( + PRT_TIMER pTimer +); + +VOID +odm_PSD_RXHPWorkitemCallback( + IN PVOID pContext + ); + +VOID +odm_PSDMonitorWorkItemCallback( + IN PVOID pContext + ); + + #endif + + #endif + \ No newline at end of file diff --git a/hal/OUTSRC/odm_RaInfo.c b/hal/OUTSRC/odm_RaInfo.c new file mode 100644 index 0000000..0be8ca0 --- /dev/null +++ b/hal/OUTSRC/odm_RaInfo.c @@ -0,0 +1,1595 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA + * + * + ******************************************************************************/ + +//============================================================ +// include files +//============================================================ +#include "Mp_Precomp.h" +#include "odm_precomp.h" + + +VOID +odm_RSSIMonitorInit( + IN PVOID pDM_VOID + ) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + pRA_T pRA_Table = &pDM_Odm->DM_RA_Table; + pRA_Table->firstconnect = FALSE; + +#if(DM_ODM_SUPPORT_TYPE & (ODM_WIN)) + pRA_Table->PT_collision_pre = TRUE; //used in ODM_DynamicARFBSelect(WIN only) +#endif +#endif +} + + +VOID +odm_RSSIMonitorCheck( + IN PVOID pDM_VOID + ) +{ + // + // For AP/ADSL use prtl8192cd_priv + // For CE/NIC use PADAPTER + // +PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + if (!(pDM_Odm->SupportAbility & ODM_BB_RSSI_MONITOR)) + return; + + // + // 2011/09/29 MH In HW integration first stage, we provide 4 different handle to operate + // at the same time. In the stage2/3, we need to prive universal interface and merge all + // HW dynamic mechanism. + // + switch (pDM_Odm->SupportPlatform) + { + case ODM_WIN: + odm_RSSIMonitorCheckMP(pDM_Odm); + break; + + case ODM_CE: + odm_RSSIMonitorCheckCE(pDM_Odm); + break; + + case ODM_AP: + odm_RSSIMonitorCheckAP(pDM_Odm); + break; + + case ODM_ADSL: + //odm_DIGAP(pDM_Odm); + break; + } + +} // odm_RSSIMonitorCheck + +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) +VOID +odm_RSSIDumpToRegister( + IN PVOID pDM_VOID + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + PADAPTER Adapter = pDM_Odm->Adapter; + + if(pDM_Odm->SupportICType == ODM_RTL8812) + { + PlatformEFIOWrite1Byte(Adapter, rA_RSSIDump_Jaguar, Adapter->RxStats.RxRSSIPercentage[0]); + PlatformEFIOWrite1Byte(Adapter, rB_RSSIDump_Jaguar, Adapter->RxStats.RxRSSIPercentage[1]); + + // Rx EVM + PlatformEFIOWrite1Byte(Adapter, rS1_RXevmDump_Jaguar, Adapter->RxStats.RxEVMdbm[0]); + PlatformEFIOWrite1Byte(Adapter, rS2_RXevmDump_Jaguar, Adapter->RxStats.RxEVMdbm[1]); + + // Rx SNR + PlatformEFIOWrite1Byte(Adapter, rA_RXsnrDump_Jaguar, (u1Byte)(Adapter->RxStats.RxSNRdB[0])); + PlatformEFIOWrite1Byte(Adapter, rB_RXsnrDump_Jaguar, (u1Byte)(Adapter->RxStats.RxSNRdB[1])); + + // Rx Cfo_Short + PlatformEFIOWrite2Byte(Adapter, rA_CfoShortDump_Jaguar, Adapter->RxStats.RxCfoShort[0]); + PlatformEFIOWrite2Byte(Adapter, rB_CfoShortDump_Jaguar, Adapter->RxStats.RxCfoShort[1]); + + // Rx Cfo_Tail + PlatformEFIOWrite2Byte(Adapter, rA_CfoLongDump_Jaguar, Adapter->RxStats.RxCfoTail[0]); + PlatformEFIOWrite2Byte(Adapter, rB_CfoLongDump_Jaguar, Adapter->RxStats.RxCfoTail[1]); + } + else if(pDM_Odm->SupportICType == ODM_RTL8192E) + { + PlatformEFIOWrite1Byte(Adapter, rA_RSSIDump_92E, Adapter->RxStats.RxRSSIPercentage[0]); + PlatformEFIOWrite1Byte(Adapter, rB_RSSIDump_92E, Adapter->RxStats.RxRSSIPercentage[1]); + // Rx EVM + PlatformEFIOWrite1Byte(Adapter, rS1_RXevmDump_92E, Adapter->RxStats.RxEVMdbm[0]); + PlatformEFIOWrite1Byte(Adapter, rS2_RXevmDump_92E, Adapter->RxStats.RxEVMdbm[1]); + // Rx SNR + PlatformEFIOWrite1Byte(Adapter, rA_RXsnrDump_92E, (u1Byte)(Adapter->RxStats.RxSNRdB[0])); + PlatformEFIOWrite1Byte(Adapter, rB_RXsnrDump_92E, (u1Byte)(Adapter->RxStats.RxSNRdB[1])); + // Rx Cfo_Short + PlatformEFIOWrite2Byte(Adapter, rA_CfoShortDump_92E, Adapter->RxStats.RxCfoShort[0]); + PlatformEFIOWrite2Byte(Adapter, rB_CfoShortDump_92E, Adapter->RxStats.RxCfoShort[1]); + // Rx Cfo_Tail + PlatformEFIOWrite2Byte(Adapter, rA_CfoLongDump_92E, Adapter->RxStats.RxCfoTail[0]); + PlatformEFIOWrite2Byte(Adapter, rB_CfoLongDump_92E, Adapter->RxStats.RxCfoTail[1]); + } +} +#endif + +VOID +odm_RSSIMonitorCheckMP( + IN PVOID pDM_VOID + ) +{ +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + PADAPTER Adapter = pDM_Odm->Adapter; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + PRT_WLAN_STA pEntry = NULL; + u1Byte i; + s4Byte tmpEntryMaxPWDB=0, tmpEntryMinPWDB=0xff; + u1Byte H2C_Parameter[4] ={0}; + PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; + PMGNT_INFO pDefaultMgntInfo = &Adapter->MgntInfo; + u8Byte curTxOkCnt = 0, curRxOkCnt = 0; + u1Byte STBC_TX = 0; + BOOLEAN FirstConnect; + pRA_T pRA_Table = &pDM_Odm->DM_RA_Table; + pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; + +#if (BEAMFORMING_SUPPORT == 1) + BEAMFORMING_CAP Beamform_cap = BEAMFORMING_CAP_NONE; + u1Byte TxBF_EN = 0; +#endif + + PADAPTER pLoopAdapter = GetDefaultAdapter(Adapter); + + BOOLEAN bExtRAInfo = FALSE; + + if(pDM_Odm->SupportICType == ODM_RTL8192E || pDM_Odm->SupportICType == ODM_RTL8812 || pDM_Odm->SupportICType == ODM_RTL8821 || pDM_Odm->SupportICType == ODM_RTL8723B) + bExtRAInfo = TRUE; + + FirstConnect = (pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_0 == FALSE); + pRA_Table->firstconnect = pHalData->bLinked; + H2C_Parameter[3] |= FirstConnect << 5; + + if(pDM_Odm->SupportICType == ODM_RTL8188E && (pDefaultMgntInfo->CustomerID==RT_CID_819x_HP)) + { + if(curRxOkCnt >(curTxOkCnt*6)) + PlatformEFIOWrite4Byte(Adapter, REG_ARFR0, 0x8f015); + else + PlatformEFIOWrite4Byte(Adapter, REG_ARFR0, 0xff015); + } + + if(pDM_Odm->SupportICType == ODM_RTL8812 || pDM_Odm->SupportICType == ODM_RTL8821) + { + if(curRxOkCnt >(curTxOkCnt*6)) + H2C_Parameter[3]=0x01; + else + H2C_Parameter[3]=0x00; + } + + while(pLoopAdapter) + { + + if(pLoopAdapter != NULL){ + pMgntInfo = &pLoopAdapter->MgntInfo; + curTxOkCnt = pLoopAdapter->TxStats.NumTxBytesUnicast - pMgntInfo->lastTxOkCnt; + curRxOkCnt = pLoopAdapter->RxStats.NumRxBytesUnicast - pMgntInfo->lastRxOkCnt; + pMgntInfo->lastTxOkCnt = curTxOkCnt; + pMgntInfo->lastRxOkCnt = curRxOkCnt; + } + + for(i = 0; i < ASSOCIATE_ENTRY_NUM; i++) + { + + if(IsAPModeExist(pLoopAdapter)) + { + if(GetFirstExtAdapter(pLoopAdapter) != NULL && + GetFirstExtAdapter(pLoopAdapter) == pLoopAdapter){ + pEntry = AsocEntry_EnumStation(pLoopAdapter, i); + } + else if(GetFirstGOPort(pLoopAdapter) != NULL && + IsFirstGoAdapter(pLoopAdapter)){ + pEntry = AsocEntry_EnumStation(pLoopAdapter, i); + } + } + else + { + if(GetDefaultAdapter(pLoopAdapter) == pLoopAdapter){ + pEntry = AsocEntry_EnumStation(pLoopAdapter, i); + } + } + + if(pEntry != NULL) + { + if(pEntry->bAssociated) + { + + RT_DISP_ADDR(FDM, DM_PWDB, ("pEntry->MacAddr ="), pEntry->MacAddr); + RT_DISP(FDM, DM_PWDB, ("pEntry->rssi = 0x%x(%d)\n", + pEntry->rssi_stat.UndecoratedSmoothedPWDB, pEntry->rssi_stat.UndecoratedSmoothedPWDB)); + + if(bExtRAInfo) + { + +#if (BEAMFORMING_SUPPORT == 1) + Beamform_cap = Beamforming_GetEntryBeamCapByMacId(Adapter, pEntry->AssociatedMacId); + if(Beamform_cap & (BEAMFORMER_CAP_HT_EXPLICIT |BEAMFORMER_CAP_VHT_SU)) + TxBF_EN = 1; + else + TxBF_EN = 0; + + H2C_Parameter[3] |= TxBF_EN << 6; + + if(TxBF_EN) + STBC_TX = 0; + else +#endif + { + if(IS_WIRELESS_MODE_AC(Adapter)) + STBC_TX = TEST_FLAG(pEntry->VHTInfo.STBC, STBC_VHT_ENABLE_TX); + else + STBC_TX = TEST_FLAG(pEntry->HTInfo.STBC, STBC_HT_ENABLE_TX); + } + + H2C_Parameter[3] |= STBC_TX << 1; + } + + if(pEntry->rssi_stat.UndecoratedSmoothedPWDB < tmpEntryMinPWDB) + tmpEntryMinPWDB = pEntry->rssi_stat.UndecoratedSmoothedPWDB; + if(pEntry->rssi_stat.UndecoratedSmoothedPWDB > tmpEntryMaxPWDB) + tmpEntryMaxPWDB = pEntry->rssi_stat.UndecoratedSmoothedPWDB; + + H2C_Parameter[2] = (u1Byte)(pEntry->rssi_stat.UndecoratedSmoothedPWDB & 0xFF); + H2C_Parameter[1] = 0x20; // fw v12 cmdid 5:use max macid ,for nic ,default macid is 0 ,max macid is 1 + H2C_Parameter[0] = (pEntry->AssociatedMacId); + if(bExtRAInfo) + ODM_FillH2CCmd(pDM_Odm, ODM_H2C_RSSI_REPORT, 4, H2C_Parameter); + else + ODM_FillH2CCmd(pDM_Odm, ODM_H2C_RSSI_REPORT, 3, H2C_Parameter); + } + } + else + { + break; + } + } + + pLoopAdapter = GetNextExtAdapter(pLoopAdapter); + } + + if(tmpEntryMaxPWDB != 0) // If associated entry is found + { + pHalData->EntryMaxUndecoratedSmoothedPWDB = tmpEntryMaxPWDB; + RT_DISP(FDM, DM_PWDB, ("EntryMaxPWDB = 0x%x(%d)\n", tmpEntryMaxPWDB, tmpEntryMaxPWDB)); + } + else + { + pHalData->EntryMaxUndecoratedSmoothedPWDB = 0; + } + + if(tmpEntryMinPWDB != 0xff) // If associated entry is found + { + pHalData->EntryMinUndecoratedSmoothedPWDB = tmpEntryMinPWDB; + RT_DISP(FDM, DM_PWDB, ("EntryMinPWDB = 0x%x(%d)\n", tmpEntryMinPWDB, tmpEntryMinPWDB)); + + } + else + { + pHalData->EntryMinUndecoratedSmoothedPWDB = 0; + } + + // Indicate Rx signal strength to FW. + if(pHalData->bUseRAMask) + { + if(bExtRAInfo) + { + PRT_HIGH_THROUGHPUT pHTInfo = GET_HT_INFO(pDefaultMgntInfo); + PRT_VERY_HIGH_THROUGHPUT pVHTInfo = GET_VHT_INFO(pDefaultMgntInfo); + +#if (BEAMFORMING_SUPPORT == 1) + + Beamform_cap = Beamforming_GetEntryBeamCapByMacId(Adapter, pDefaultMgntInfo->mMacId); + + if(Beamform_cap & (BEAMFORMER_CAP_HT_EXPLICIT |BEAMFORMER_CAP_VHT_SU)) + TxBF_EN = 1; + else + TxBF_EN = 0; + + H2C_Parameter[3] |= TxBF_EN << 6; + + if(TxBF_EN) + STBC_TX = 0; + else +#endif + { + if(IS_WIRELESS_MODE_AC(Adapter)) + STBC_TX = TEST_FLAG(pVHTInfo->VhtCurStbc, STBC_VHT_ENABLE_TX); + else + STBC_TX = TEST_FLAG(pHTInfo->HtCurStbc, STBC_HT_ENABLE_TX); + } + + H2C_Parameter[3] |= STBC_TX << 1; + } + + H2C_Parameter[2] = (u1Byte)(pHalData->UndecoratedSmoothedPWDB & 0xFF); + H2C_Parameter[1] = 0x20; // fw v12 cmdid 5:use max macid ,for nic ,default macid is 0 ,max macid is 1 + H2C_Parameter[0] = 0; // fw v12 cmdid 5:use max macid ,for nic ,default macid is 0 ,max macid is 1 + if(bExtRAInfo) + ODM_FillH2CCmd(pDM_Odm, ODM_H2C_RSSI_REPORT, 4, H2C_Parameter); + else + ODM_FillH2CCmd(pDM_Odm, ODM_H2C_RSSI_REPORT, 3, H2C_Parameter); + + // BT 3.0 HS mode Rssi + if(pDM_Odm->bBtHsOperation) + { + H2C_Parameter[2] = pDM_Odm->btHsRssi; + H2C_Parameter[1] = 0x0; + H2C_Parameter[0] = 2; + if(bExtRAInfo) + ODM_FillH2CCmd(pDM_Odm, ODM_H2C_RSSI_REPORT, 4, H2C_Parameter); + else + ODM_FillH2CCmd(pDM_Odm, ODM_H2C_RSSI_REPORT, 3, H2C_Parameter); + } + } + else + { + PlatformEFIOWrite1Byte(Adapter, 0x4fe, (u1Byte)pHalData->UndecoratedSmoothedPWDB); + } + + if((pDM_Odm->SupportICType == ODM_RTL8812)||(pDM_Odm->SupportICType == ODM_RTL8192E)) + odm_RSSIDumpToRegister(pDM_Odm); + + + { + PADAPTER pLoopAdapter = GetDefaultAdapter(Adapter); + s4Byte GlobalRSSI_min = 0xFF, LocalRSSI_Min; + BOOLEAN bLink= FALSE; + + while(pLoopAdapter) + { + LocalRSSI_Min = odm_FindMinimumRSSI(pLoopAdapter); + //DbgPrint("pHalData->bLinked=%d, LocalRSSI_Min=%d\n", pHalData->bLinked, LocalRSSI_Min); + if((LocalRSSI_Min < GlobalRSSI_min) && (LocalRSSI_Min != 0)) + GlobalRSSI_min = LocalRSSI_Min; + + if(pHalData->bLinked) + bLink = TRUE; + + pLoopAdapter = GetNextExtAdapter(pLoopAdapter); + } + + pHalData->bLinked = bLink; + ODM_CmnInfoUpdate(&pHalData->DM_OutSrc ,ODM_CMNINFO_LINK, (u8Byte)bLink); + ODM_CmnInfoUpdate(&pHalData->DM_OutSrc ,ODM_CMNINFO_RSSI_MIN, (u8Byte)GlobalRSSI_min); + + } + +#endif // #if (DM_ODM_SUPPORT_TYPE == ODM_WIN) +} + +#if(DM_ODM_SUPPORT_TYPE==ODM_CE) +// +//sherry move from DUSC to here 20110517 +// +static VOID +FindMinimumRSSI_Dmsp( + IN PADAPTER pAdapter +) +{ +#if 0 + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + struct dm_priv *pdmpriv = &pHalData->dmpriv; + s32 Rssi_val_min_back_for_mac0; + BOOLEAN bGetValueFromBuddyAdapter = dm_DualMacGetParameterFromBuddyAdapter(pAdapter); + BOOLEAN bRestoreRssi = _FALSE; + PADAPTER BuddyAdapter = pAdapter->BuddyAdapter; + + if(pHalData->MacPhyMode92D == DUALMAC_SINGLEPHY) + { + if(BuddyAdapter!= NULL) + { + if(pHalData->bSlaveOfDMSP) + { + //ODM_RT_TRACE(pDM_Odm,COMP_EASY_CONCURRENT,DBG_LOUD,("bSlavecase of dmsp\n")); + BuddyAdapter->DualMacDMSPControl.RssiValMinForAnotherMacOfDMSP = pdmpriv->MinUndecoratedPWDBForDM; + } + else + { + if(bGetValueFromBuddyAdapter) + { + //ODM_RT_TRACE(pDM_Odm,COMP_EASY_CONCURRENT,DBG_LOUD,("get new RSSI\n")); + bRestoreRssi = _TRUE; + Rssi_val_min_back_for_mac0 = pdmpriv->MinUndecoratedPWDBForDM; + pdmpriv->MinUndecoratedPWDBForDM = pAdapter->DualMacDMSPControl.RssiValMinForAnotherMacOfDMSP; + } + } + } + + } + + if(bRestoreRssi) + { + bRestoreRssi = _FALSE; + pdmpriv->MinUndecoratedPWDBForDM = Rssi_val_min_back_for_mac0; + } +#endif +} + +static void +FindMinimumRSSI( +IN PADAPTER pAdapter + ) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + struct dm_priv *pdmpriv = &pHalData->dmpriv; + PDM_ODM_T pDM_Odm = &(pHalData->odmpriv); + + //1 1.Determine the minimum RSSI + + if((pDM_Odm->bLinked != _TRUE) && + (pdmpriv->EntryMinUndecoratedSmoothedPWDB == 0)) + { + pdmpriv->MinUndecoratedPWDBForDM = 0; + //ODM_RT_TRACE(pDM_Odm,COMP_BB_POWERSAVING, DBG_LOUD, ("Not connected to any \n")); + } + else + { + pdmpriv->MinUndecoratedPWDBForDM = pdmpriv->EntryMinUndecoratedSmoothedPWDB; + } + + //DBG_8192C("%s=>MinUndecoratedPWDBForDM(%d)\n",__FUNCTION__,pdmpriv->MinUndecoratedPWDBForDM); + //ODM_RT_TRACE(pDM_Odm,COMP_DIG, DBG_LOUD, ("MinUndecoratedPWDBForDM =%d\n",pHalData->MinUndecoratedPWDBForDM)); +} +#endif + +VOID +odm_RSSIMonitorCheckCE( + IN PVOID pDM_VOID + ) +{ +#if (DM_ODM_SUPPORT_TYPE == ODM_CE) + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + PADAPTER Adapter = pDM_Odm->Adapter; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + struct dm_priv *pdmpriv = &pHalData->dmpriv; + struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(Adapter); + int i; + int tmpEntryMaxPWDB=0, tmpEntryMinPWDB=0xff; + u8 sta_cnt=0; + u32 UL_DL_STATE = 0, STBC_TX = 0, TxBF_EN = 0; + u32 PWDB_rssi[NUM_STA]={0};//[0~15]:MACID, [16~31]:PWDB_rssi + BOOLEAN FirstConnect = FALSE; + pRA_T pRA_Table = &pDM_Odm->DM_RA_Table; + + if(pDM_Odm->bLinked != _TRUE) + return; + + #if((RTL8812A_SUPPORT==1)||(RTL8821A_SUPPORT==1)) + if((pDM_Odm->SupportICType == ODM_RTL8812)||(pDM_Odm->SupportICType == ODM_RTL8821)) + { + u64 curTxOkCnt = pdvobjpriv->traffic_stat.cur_tx_bytes; + u64 curRxOkCnt = pdvobjpriv->traffic_stat.cur_rx_bytes; + + if(curRxOkCnt >(curTxOkCnt*6)) + UL_DL_STATE = 1; + else + UL_DL_STATE = 0; + } + #endif + + FirstConnect = (pDM_Odm->bLinked) && (pRA_Table->firstconnect == FALSE); + pRA_Table->firstconnect = pDM_Odm->bLinked; + + //if(check_fwstate(&Adapter->mlmepriv, WIFI_AP_STATE|WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE) == _TRUE) + { + #if 1 + struct sta_info *psta; + + for(i=0; ipODM_StaInfo[i])) + { + if(IS_MCAST( psta->hwaddr)) //if(psta->mac_id ==1) + continue; + + if(psta->rssi_stat.UndecoratedSmoothedPWDB == (-1)) + continue; + + if(psta->rssi_stat.UndecoratedSmoothedPWDB < tmpEntryMinPWDB) + tmpEntryMinPWDB = psta->rssi_stat.UndecoratedSmoothedPWDB; + + if(psta->rssi_stat.UndecoratedSmoothedPWDB > tmpEntryMaxPWDB) + tmpEntryMaxPWDB = psta->rssi_stat.UndecoratedSmoothedPWDB; + + #if 0 + DBG_871X("%s mac_id:%u, mac:"MAC_FMT", rssi:%d\n", __func__, + psta->mac_id, MAC_ARG(psta->hwaddr), psta->rssi_stat.UndecoratedSmoothedPWDB); + #endif + + if(psta->rssi_stat.UndecoratedSmoothedPWDB != (-1)) { + +#ifdef CONFIG_80211N_HT + if(pDM_Odm->SupportICType == ODM_RTL8192E || pDM_Odm->SupportICType == ODM_RTL8812) + { +#ifdef CONFIG_BEAMFORMING + BEAMFORMING_CAP Beamform_cap = beamforming_get_entry_beam_cap_by_mac_id(&Adapter->mlmepriv, psta->mac_id); + + if(Beamform_cap & (BEAMFORMER_CAP_HT_EXPLICIT |BEAMFORMER_CAP_VHT_SU)) + TxBF_EN = 1; + else + TxBF_EN = 0; + + if (TxBF_EN) { + STBC_TX = 0; + } + else +#endif + { +#ifdef CONFIG_80211AC_VHT + if(IsSupportedVHT(psta->wireless_mode)) + STBC_TX = TEST_FLAG(psta->vhtpriv.stbc_cap, STBC_VHT_ENABLE_TX); + else +#endif + STBC_TX = TEST_FLAG(psta->htpriv.stbc_cap, STBC_HT_ENABLE_TX); + } + } +#endif + + if(pDM_Odm->SupportICType == ODM_RTL8192D) + PWDB_rssi[sta_cnt++] = (psta->mac_id | (psta->rssi_stat.UndecoratedSmoothedPWDB<<16) | ((Adapter->stapriv.asoc_sta_count+1) << 8)); + else if ((pDM_Odm->SupportICType == ODM_RTL8192E)||(pDM_Odm->SupportICType == ODM_RTL8812)||(pDM_Odm->SupportICType == ODM_RTL8821)) + PWDB_rssi[sta_cnt++] = (((u8)(psta->mac_id&0xFF)) | ((psta->rssi_stat.UndecoratedSmoothedPWDB&0x7F)<<16) |(STBC_TX << 25) | (FirstConnect << 29) | (TxBF_EN << 30)); + else + PWDB_rssi[sta_cnt++] = (psta->mac_id | (psta->rssi_stat.UndecoratedSmoothedPWDB<<16) ); + } + } + } + #else + _irqL irqL; + _list *plist, *phead; + struct sta_info *psta; + struct sta_priv *pstapriv = &Adapter->stapriv; + u8 bcast_addr[ETH_ALEN]= {0xff,0xff,0xff,0xff,0xff,0xff}; + + _enter_critical_bh(&pstapriv->sta_hash_lock, &irqL); + + for(i=0; i< NUM_STA; i++) + { + phead = &(pstapriv->sta_hash[i]); + plist = get_next(phead); + + while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) + { + psta = LIST_CONTAINOR(plist, struct sta_info, hash_list); + + plist = get_next(plist); + + if(_rtw_memcmp(psta->hwaddr, bcast_addr, ETH_ALEN) || + _rtw_memcmp(psta->hwaddr, myid(&Adapter->eeprompriv), ETH_ALEN)) + continue; + + if(psta->state & WIFI_ASOC_STATE) + { + + if(psta->rssi_stat.UndecoratedSmoothedPWDB < tmpEntryMinPWDB) + tmpEntryMinPWDB = psta->rssi_stat.UndecoratedSmoothedPWDB; + + if(psta->rssi_stat.UndecoratedSmoothedPWDB > tmpEntryMaxPWDB) + tmpEntryMaxPWDB = psta->rssi_stat.UndecoratedSmoothedPWDB; + + if(psta->rssi_stat.UndecoratedSmoothedPWDB != (-1)){ + //printk("%s==> mac_id(%d),rssi(%d)\n",__FUNCTION__,psta->mac_id,psta->rssi_stat.UndecoratedSmoothedPWDB); + #if(RTL8192D_SUPPORT==1) + PWDB_rssi[sta_cnt++] = (psta->mac_id | (psta->rssi_stat.UndecoratedSmoothedPWDB<<16) | ((Adapter->stapriv.asoc_sta_count+1) << 8)); + #else + PWDB_rssi[sta_cnt++] = (psta->mac_id | (psta->rssi_stat.UndecoratedSmoothedPWDB<<16) ); + #endif + } + } + + } + + } + + _exit_critical_bh(&pstapriv->sta_hash_lock, &irqL); + #endif + + //printk("%s==> sta_cnt(%d)\n",__FUNCTION__,sta_cnt); + + for(i=0; i< sta_cnt; i++) + { + if(PWDB_rssi[i] != (0)){ + if(pHalData->fw_ractrl == _TRUE)// Report every sta's RSSI to FW + { + #if(RTL8192D_SUPPORT==1) + if(pDM_Odm->SupportICType == ODM_RTL8192D){ + FillH2CCmd92D(Adapter, H2C_RSSI_REPORT, 3, (u8 *)(&PWDB_rssi[i])); + } + #endif + + #if((RTL8192C_SUPPORT==1)||(RTL8723A_SUPPORT==1)) + if((pDM_Odm->SupportICType == ODM_RTL8192C)||(pDM_Odm->SupportICType == ODM_RTL8723A)){ + rtl8192c_set_rssi_cmd(Adapter, (u8*)&PWDB_rssi[i]); + } + #endif + + #if((RTL8812A_SUPPORT==1)||(RTL8821A_SUPPORT==1)) + if((pDM_Odm->SupportICType == ODM_RTL8812)||(pDM_Odm->SupportICType == ODM_RTL8821)){ + PWDB_rssi[i] |= (UL_DL_STATE << 24); + rtl8812_set_rssi_cmd(Adapter, (u8 *)(&PWDB_rssi[i])); + } + #endif + #if(RTL8192E_SUPPORT==1) + if(pDM_Odm->SupportICType == ODM_RTL8192E){ + rtl8192e_set_rssi_cmd(Adapter, (u8 *)(&PWDB_rssi[i])); + } + #endif + #if(RTL8723B_SUPPORT==1) + if(pDM_Odm->SupportICType == ODM_RTL8723B){ + rtl8723b_set_rssi_cmd(Adapter, (u8 *)(&PWDB_rssi[i])); + } + #endif + + #if(RTL8188E_SUPPORT==1) + if(pDM_Odm->SupportICType == ODM_RTL8188E){ + rtl8188e_set_rssi_cmd(Adapter, (u8 *)(&PWDB_rssi[i])); + } + #endif + + } + else{ + #if((RTL8188E_SUPPORT==1)&&(RATE_ADAPTIVE_SUPPORT == 1)) + if(pDM_Odm->SupportICType == ODM_RTL8188E){ + ODM_RA_SetRSSI_8188E( + &(pHalData->odmpriv), (PWDB_rssi[i]&0xFF), (u8)((PWDB_rssi[i]>>16) & 0xFF)); + } + #endif + } + } + } + } + + + + if(tmpEntryMaxPWDB != 0) // If associated entry is found + { + pdmpriv->EntryMaxUndecoratedSmoothedPWDB = tmpEntryMaxPWDB; + } + else + { + pdmpriv->EntryMaxUndecoratedSmoothedPWDB = 0; + } + + if(tmpEntryMinPWDB != 0xff) // If associated entry is found + { + pdmpriv->EntryMinUndecoratedSmoothedPWDB = tmpEntryMinPWDB; + } + else + { + pdmpriv->EntryMinUndecoratedSmoothedPWDB = 0; + } + + FindMinimumRSSI(Adapter);//get pdmpriv->MinUndecoratedPWDBForDM + + #if(RTL8192D_SUPPORT==1) + FindMinimumRSSI_Dmsp(Adapter); + #endif + pDM_Odm->RSSI_Min = pdmpriv->MinUndecoratedPWDBForDM; + //ODM_CmnInfoUpdate(&pHalData->odmpriv ,ODM_CMNINFO_RSSI_MIN, pdmpriv->MinUndecoratedPWDBForDM); +#endif//if (DM_ODM_SUPPORT_TYPE == ODM_CE) +} + + +VOID +odm_RSSIMonitorCheckAP( + IN PVOID pDM_VOID + ) +{ +#if (DM_ODM_SUPPORT_TYPE == ODM_AP) +#if defined(CONFIG_RTL_92C_SUPPORT) || defined(CONFIG_RTL_92D_SUPPORT) ||defined(CONFIG_RTL_8812_SUPPORT)||defined(CONFIG_WLAN_HAL_8881A)||defined(CONFIG_WLAN_HAL_8192EE) + { + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + prtl8192cd_priv priv = pDM_Odm->priv; + u4Byte i; + PSTA_INFO_T pstat; + static u1Byte H2C_Parameter[5]; + u1Byte TxBF_EN = 0; + pBDC_T pDM_BdcTable = &pDM_Odm->DM_BdcTable; + + if( priv->up_time % 2 ) + return; + + pDM_BdcTable->num_Txbfee_Client=0; + pDM_BdcTable->num_Txbfer_Client=0; + //pDM_BdcTable->num_Client=0; + + for(i=0; ipODM_StaInfo[i]; + if(IS_STA_VALID(pstat) ) + { +#ifdef BEAMFORMING_SUPPORT + BEAMFORMING_CAP Beamform_cap = Beamforming_GetEntryBeamCapByMacId(priv, pstat->aid); + if(Beamform_cap == BEAMFORMER_CAP_HT_EXPLICIT || Beamform_cap == BEAMFORMER_CAP_VHT_SU || + Beamform_cap == (BEAMFORMER_CAP_HT_EXPLICIT|BEAMFORMEE_CAP_HT_EXPLICIT) || + Beamform_cap == (BEAMFORMER_CAP_VHT_SU|BEAMFORMEE_CAP_VHT_SU)) + { + TxBF_EN = (1<< 6); + pDM_BdcTable->w_BFee_Client[i]=1; //AP act as BFer + pDM_BdcTable->num_Txbfee_Client++; + } + else + { + pDM_BdcTable->w_BFee_Client[i]=0; //AP act as BFer + } + + if((Beamform_cap & BEAMFORMEE_CAP_HT_EXPLICIT) || (Beamform_cap & BEAMFORMEE_CAP_VHT_SU) ) + { + pDM_BdcTable->w_BFer_Client[i]=1; //AP act as BFee + pDM_BdcTable->num_Txbfer_Client++; + } + else + { + pDM_BdcTable->w_BFer_Client[i]=0; //AP act as BFer + } + + + //pDM_BdcTable->num_Client++; + + + +#endif +//#ifdef STA_EXT +// if (GET_CHIP_VER(priv)==VERSION_8812E && REMAP_AID(pstat) < (RTL8812_NUM_STAT - 1)) +//#endif + { +#ifdef CONFIG_RTL_8812_SUPPORT +#ifdef STA_EXT + if(REMAP_AID(pstat) < (RTL8812_NUM_STAT - 1)) +#endif + + if(pDM_Odm->SupportICType == ODM_RTL8812) { + memset(H2C_Parameter,0,5); + H2C_Parameter[2] = (u1Byte)(pstat->rssi & 0x7F); + H2C_Parameter[0] = REMAP_AID(pstat); + if ((priv->pmib->dot11nConfigEntry.dot11nSTBC) && ( + (pstat->ht_cap_buf.ht_cap_info & cpu_to_le16(_HTCAP_RX_STBC_CAP_) +#ifdef RTK_AC_SUPPORT + || (pstat->vht_cap_buf.vht_cap_info & cpu_to_le32(_VHTCAP_RX_STBC_CAP_)) +#endif + ))) + H2C_Parameter[3] |= 2; + H2C_Parameter[3] |= TxBF_EN ; + FillH2CCmd8812(pDM_Odm->priv, H2C_8812_RSSI_REPORT, 4, H2C_Parameter); + } +#endif + } +//#ifdef STA_EXT +// else if (GET_CHIP_VER(priv)!=VERSION_8812E && REMAP_AID(pstat) < (FW_NUM_STAT - 1)) +//#endif + { +#if defined(CONFIG_WLAN_HAL_8881A) || defined(CONFIG_WLAN_HAL_8192EE) +#ifdef STA_EXT + if(REMAP_AID(pstat) < (RTL8812_NUM_STAT - 1)) +#endif + if(pDM_Odm->SupportICType == ODM_RTL8881A || pDM_Odm->SupportICType == ODM_RTL8192E) { +// u1Byte H2C_Parameter[5] ={0}; + u1Byte cmdlen = 3; + memset(H2C_Parameter, 0, 5); + H2C_Parameter[2] = (u1Byte)(pstat->rssi & 0xFF); + H2C_Parameter[0] = REMAP_AID(pstat); + if(pDM_Odm->SupportICType == ODM_RTL8192E) { + cmdlen = 4; + if ((priv->pmib->dot11nConfigEntry.dot11nSTBC) && (pstat->ht_cap_buf.ht_cap_info & cpu_to_le16(_HTCAP_RX_STBC_CAP_))) + H2C_Parameter[3] |= 2; + H2C_Parameter[3] |= TxBF_EN; + + } + GET_HAL_INTERFACE(pDM_Odm->priv)->FillH2CCmdHandler(pDM_Odm->priv, H2C_88XX_RSSI_REPORT, cmdlen, H2C_Parameter); + } +#endif + +#if defined(CONFIG_RTL_92C_SUPPORT) || defined(CONFIG_RTL_92D_SUPPORT) +#ifdef STA_EXT + if(REMAP_AID(pstat) < (FW_NUM_STAT - 1)) +#endif + if(pDM_Odm->SupportICType == ODM_RTL8192C || pDM_Odm->SupportICType == ODM_RTL8192D) + add_update_rssi(pDM_Odm->priv, pstat); +#endif + } + + } + } + } +#endif +#endif + +} + + +VOID +odm_RateAdaptiveMaskInit( + IN PVOID pDM_VOID + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + PODM_RATE_ADAPTIVE pOdmRA = &pDM_Odm->RateAdaptive; + +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + PMGNT_INFO pMgntInfo = &pDM_Odm->Adapter->MgntInfo; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pDM_Odm->Adapter); + + pMgntInfo->Ratr_State = DM_RATR_STA_INIT; + + if (pMgntInfo->DM_Type == DM_Type_ByDriver) + pHalData->bUseRAMask = TRUE; + else + pHalData->bUseRAMask = FALSE; + +#elif (DM_ODM_SUPPORT_TYPE == ODM_CE) + pOdmRA->Type = DM_Type_ByDriver; + if (pOdmRA->Type == DM_Type_ByDriver) + pDM_Odm->bUseRAMask = _TRUE; + else + pDM_Odm->bUseRAMask = _FALSE; +#endif + + pOdmRA->RATRState = DM_RATR_STA_INIT; + +#if(DM_ODM_SUPPORT_TYPE & ODM_WIN) + if(pDM_Odm->SupportICType == ODM_RTL8812) + pOdmRA->LdpcThres = 50; + else + pOdmRA->LdpcThres = 35; + + pOdmRA->RtsThres = 35; + +#elif(DM_ODM_SUPPORT_TYPE & ODM_CE) + pOdmRA->LdpcThres = 35; + pOdmRA->bUseLdpc = FALSE; + +#else + pOdmRA->UltraLowRSSIThresh = 9; + +#endif + + pOdmRA->HighRSSIThresh = 50; + pOdmRA->LowRSSIThresh = 20; +} +/*----------------------------------------------------------------------------- + * Function: odm_RefreshRateAdaptiveMask() + * + * Overview: Update rate table mask according to rssi + * + * Input: NONE + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 05/27/2009 hpfan Create Version 0. + * + *---------------------------------------------------------------------------*/ +VOID +odm_RefreshRateAdaptiveMask( + IN PVOID pDM_VOID + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_TRACE, ("odm_RefreshRateAdaptiveMask()---------->\n")); + if (!(pDM_Odm->SupportAbility & ODM_BB_RA_MASK)) + { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_TRACE, ("odm_RefreshRateAdaptiveMask(): Return cos not supported\n")); + return; + } + // + // 2011/09/29 MH In HW integration first stage, we provide 4 different handle to operate + // at the same time. In the stage2/3, we need to prive universal interface and merge all + // HW dynamic mechanism. + // + switch (pDM_Odm->SupportPlatform) + { + case ODM_WIN: + odm_RefreshRateAdaptiveMaskMP(pDM_Odm); + break; + + case ODM_CE: + odm_RefreshRateAdaptiveMaskCE(pDM_Odm); + break; + + case ODM_AP: + case ODM_ADSL: + odm_RefreshRateAdaptiveMaskAPADSL(pDM_Odm); + break; + } + +} + +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) +VOID +odm_RefreshLdpcRtsMP( + IN PADAPTER pAdapter, + IN PDM_ODM_T pDM_Odm, + IN u1Byte mMacId, + IN u1Byte IOTPeer, + IN s4Byte UndecoratedSmoothedPWDB + ) +{ + BOOLEAN bCtlLdpc = FALSE; + PMGNT_INFO pMgntInfo = GetDefaultMgntInfo(pAdapter); + PODM_RATE_ADAPTIVE pRA = &pDM_Odm->RateAdaptive; + + if(pDM_Odm->SupportICType != ODM_RTL8821 && pDM_Odm->SupportICType != ODM_RTL8812) + return; + + if((pDM_Odm->SupportICType == ODM_RTL8821) && (pDM_Odm->CutVersion == ODM_CUT_A)) + bCtlLdpc = TRUE; + else if( pDM_Odm->SupportICType == ODM_RTL8812 && + IOTPeer == HT_IOT_PEER_REALTEK_JAGUAR_CCUTAP) + bCtlLdpc = TRUE; + + if(bCtlLdpc) + { + if(UndecoratedSmoothedPWDB < (pRA->LdpcThres-5)) + MgntSet_TX_LDPC(pAdapter, mMacId, TRUE); + else if(UndecoratedSmoothedPWDB > pRA->LdpcThres) + MgntSet_TX_LDPC(pAdapter, mMacId, FALSE); + } + + if(UndecoratedSmoothedPWDB < (pRA->RtsThres-5)) + pRA->bLowerRtsRate = TRUE; + else if(UndecoratedSmoothedPWDB > pRA->RtsThres) + pRA->bLowerRtsRate = FALSE; +} +#endif + + +VOID +odm_RefreshRateAdaptiveMaskMP( + IN PVOID pDM_VOID + ) +{ +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + PADAPTER pAdapter = pDM_Odm->Adapter; + PADAPTER pTargetAdapter = NULL; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + PMGNT_INFO pMgntInfo = GetDefaultMgntInfo(pAdapter); + + if(pAdapter->bDriverStopped) + { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_TRACE, ("<---- odm_RefreshRateAdaptiveMask(): driver is going to unload\n")); + return; + } + + if(!pHalData->bUseRAMask) + { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, ("<---- odm_RefreshRateAdaptiveMask(): driver does not control rate adaptive mask\n")); + return; + } + + // if default port is connected, update RA table for default port (infrastructure mode only) + if(pMgntInfo->mAssoc && (!ACTING_AS_AP(pAdapter))) + { + odm_RefreshLdpcRtsMP(pAdapter, pDM_Odm, pMgntInfo->mMacId, pMgntInfo->IOTPeer, pHalData->UndecoratedSmoothedPWDB); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, ("odm_RefreshRateAdaptiveMask(): Infrasture Mode\n")); + if( ODM_RAStateCheck(pDM_Odm, pHalData->UndecoratedSmoothedPWDB, pMgntInfo->bSetTXPowerTrainingByOid, &pMgntInfo->Ratr_State) ) + { + ODM_PRINT_ADDR(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, ("Target AP addr : "), pMgntInfo->Bssid); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, ("RSSI:%d, RSSI_LEVEL:%d\n", pHalData->UndecoratedSmoothedPWDB, pMgntInfo->Ratr_State)); + pAdapter->HalFunc.UpdateHalRAMaskHandler(pAdapter, pMgntInfo->mMacId, NULL, pMgntInfo->Ratr_State); + } + else if(pDM_Odm->bChangeState) + { + ODM_PRINT_ADDR(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, ("Target AP addr : "), pMgntInfo->Bssid); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, ("Change Power Training State, bDisablePowerTraining = %d\n", pDM_Odm->bDisablePowerTraining)); + pAdapter->HalFunc.UpdateHalRAMaskHandler(pAdapter, pMgntInfo->mMacId, NULL, pMgntInfo->Ratr_State); + } + } + + // + // The following part configure AP/VWifi/IBSS rate adaptive mask. + // + + if(pMgntInfo->mIbss) // Target: AP/IBSS peer. + pTargetAdapter = GetDefaultAdapter(pAdapter); + else + pTargetAdapter = GetFirstAPAdapter(pAdapter); + + // if extension port (softap) is started, updaet RA table for more than one clients associate + if(pTargetAdapter != NULL) + { + int i; + PRT_WLAN_STA pEntry; + + for(i = 0; i < ODM_ASSOCIATE_ENTRY_NUM; i++) + { + pEntry = AsocEntry_EnumStation(pTargetAdapter, i); + if(NULL != pEntry) + { + if(pEntry->bAssociated) + { + odm_RefreshLdpcRtsMP(pAdapter, pDM_Odm, pEntry->AssociatedMacId, pEntry->IOTPeer, pEntry->rssi_stat.UndecoratedSmoothedPWDB); + + if(ODM_RAStateCheck(pDM_Odm, pEntry->rssi_stat.UndecoratedSmoothedPWDB, pMgntInfo->bSetTXPowerTrainingByOid, &pEntry->Ratr_State) ) + { + ODM_PRINT_ADDR(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, ("Target STA addr : "), pEntry->MacAddr); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, ("RSSI:%d, RSSI_LEVEL:%d\n", pEntry->rssi_stat.UndecoratedSmoothedPWDB, pEntry->Ratr_State)); + pAdapter->HalFunc.UpdateHalRAMaskHandler(pTargetAdapter, pEntry->AssociatedMacId, pEntry, pEntry->Ratr_State); + } + else if(pDM_Odm->bChangeState) + { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, ("Change Power Training State, bDisablePowerTraining = %d\n", pDM_Odm->bDisablePowerTraining)); + pAdapter->HalFunc.UpdateHalRAMaskHandler(pAdapter, pMgntInfo->mMacId, NULL, pMgntInfo->Ratr_State); + } + } + } + } + } + + if(pMgntInfo->bSetTXPowerTrainingByOid) + pMgntInfo->bSetTXPowerTrainingByOid = FALSE; +#endif // #if (DM_ODM_SUPPORT_TYPE == ODM_WIN) +} + + +VOID +odm_RefreshRateAdaptiveMaskCE( + IN PVOID pDM_VOID + ) +{ +#if (DM_ODM_SUPPORT_TYPE == ODM_CE) + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + u1Byte i; + PADAPTER pAdapter = pDM_Odm->Adapter; + PODM_RATE_ADAPTIVE pRA = &pDM_Odm->RateAdaptive; + + if(pAdapter->bDriverStopped) + { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_TRACE, ("<---- odm_RefreshRateAdaptiveMask(): driver is going to unload\n")); + return; + } + + if(!pDM_Odm->bUseRAMask) + { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, ("<---- odm_RefreshRateAdaptiveMask(): driver does not control rate adaptive mask\n")); + return; + } + + //printk("==> %s \n",__FUNCTION__); + + for(i=0; ipODM_StaInfo[i]; + if(IS_STA_VALID(pstat) ) { + if(IS_MCAST( pstat->hwaddr)) //if(psta->mac_id ==1) + continue; + if(IS_MCAST( pstat->hwaddr)) + continue; + + #if((RTL8812A_SUPPORT==1)||(RTL8821A_SUPPORT==1)) + if((pDM_Odm->SupportICType == ODM_RTL8812)||(pDM_Odm->SupportICType == ODM_RTL8821)) + { + if(pstat->rssi_stat.UndecoratedSmoothedPWDB < pRA->LdpcThres) + { + pRA->bUseLdpc = TRUE; + pRA->bLowerRtsRate = TRUE; + if((pDM_Odm->SupportICType == ODM_RTL8821) && (pDM_Odm->CutVersion == ODM_CUT_A)) + Set_RA_LDPC_8812(pstat, TRUE); + //DbgPrint("RSSI=%d, bUseLdpc = TRUE\n", pHalData->UndecoratedSmoothedPWDB); + } + else if(pstat->rssi_stat.UndecoratedSmoothedPWDB > (pRA->LdpcThres-5)) + { + pRA->bUseLdpc = FALSE; + pRA->bLowerRtsRate = FALSE; + if((pDM_Odm->SupportICType == ODM_RTL8821) && (pDM_Odm->CutVersion == ODM_CUT_A)) + Set_RA_LDPC_8812(pstat, FALSE); + //DbgPrint("RSSI=%d, bUseLdpc = FALSE\n", pHalData->UndecoratedSmoothedPWDB); + } + } + #endif + + if( TRUE == ODM_RAStateCheck(pDM_Odm, pstat->rssi_stat.UndecoratedSmoothedPWDB, FALSE , &pstat->rssi_level) ) + { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, ("RSSI:%d, RSSI_LEVEL:%d\n", pstat->rssi_stat.UndecoratedSmoothedPWDB, pstat->rssi_level)); + //printk("RSSI:%d, RSSI_LEVEL:%d\n", pstat->rssi_stat.UndecoratedSmoothedPWDB, pstat->rssi_level); + rtw_hal_update_ra_mask(pstat, pstat->rssi_level); + } + else if(pDM_Odm->bChangeState) + { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, ("Change Power Training State, bDisablePowerTraining = %d\n", pDM_Odm->bDisablePowerTraining)); + rtw_hal_update_ra_mask(pstat, pstat->rssi_level); + } + + } + } + +#endif +} + +VOID +odm_RefreshRateAdaptiveMaskAPADSL( + IN PVOID pDM_VOID + ) +{ +#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct rtl8192cd_priv *priv = pDM_Odm->priv; + struct aid_obj *aidarray; + u4Byte i; + PSTA_INFO_T pstat; + + if(priv->up_time % 2) + return; + + for(i=0; ipODM_StaInfo[i]; + + if(IS_STA_VALID(pstat) ) + { +#if defined(UNIVERSAL_REPEATER) || defined(MBSSID) + aidarray = container_of(pstat, struct aid_obj, station); + priv = aidarray->priv; +#endif + + if (!priv->pmib->dot11StationConfigEntry.autoRate) + continue; + + if(ODM_RAStateCheck(pDM_Odm, (s4Byte)pstat->rssi, FALSE, &pstat->rssi_level) ) { + ODM_PRINT_ADDR(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, ("Target STA addr : "), pstat->hwaddr); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, ("RSSI:%d, RSSI_LEVEL:%d\n", pstat->rssi, pstat->rssi_level)); + +#if defined(CONFIG_PCI_HCI) +#ifdef CONFIG_WLAN_HAL + if (IS_HAL_CHIP(priv)) { +#ifdef WDS + if(!(pstat->state & WIFI_WDS))//if WDS donot setting +#endif + GET_HAL_INTERFACE(priv)->UpdateHalRAMaskHandler(priv, pstat, pstat->rssi_level); + } else +#endif +#ifdef CONFIG_RTL_8812_SUPPORT + if(GET_CHIP_VER(priv)== VERSION_8812E) { + UpdateHalRAMask8812(priv, pstat, 3); + } else +#endif +#ifdef CONFIG_RTL_88E_SUPPORT + if (GET_CHIP_VER(priv)==VERSION_8188E) { +#ifdef TXREPORT + add_RATid(priv, pstat); +#endif + } else +#endif + { +#if defined(CONFIG_RTL_92D_SUPPORT) || defined(CONFIG_RTL_92C_SUPPORT) + add_update_RATid(priv, pstat); +#endif + } +#elif defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) + update_STA_RATid(priv, pstat); +#endif + } + } + } +#endif +} + + +// Return Value: BOOLEAN +// - TRUE: RATRState is changed. +BOOLEAN +ODM_RAStateCheck( + IN PVOID pDM_VOID, + IN s4Byte RSSI, + IN BOOLEAN bForceUpdate, + OUT pu1Byte pRATRState + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + PODM_RATE_ADAPTIVE pRA = &pDM_Odm->RateAdaptive; + const u1Byte GoUpGap = 5; + u1Byte HighRSSIThreshForRA = pRA->HighRSSIThresh; + u1Byte LowRSSIThreshForRA = pRA->LowRSSIThresh; + u1Byte RATRState; + + // Threshold Adjustment: + // when RSSI state trends to go up one or two levels, make sure RSSI is high enough. + // Here GoUpGap is added to solve the boundary's level alternation issue. +#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + u1Byte UltraLowRSSIThreshForRA = pRA->UltraLowRSSIThresh; + if(pDM_Odm->SupportICType == ODM_RTL8881A) + LowRSSIThreshForRA = 30; // for LDPC / BCC switch +#endif + + switch (*pRATRState) + { + case DM_RATR_STA_INIT: + case DM_RATR_STA_HIGH: + break; + + case DM_RATR_STA_MIDDLE: + HighRSSIThreshForRA += GoUpGap; + break; + + case DM_RATR_STA_LOW: + HighRSSIThreshForRA += GoUpGap; + LowRSSIThreshForRA += GoUpGap; + break; + +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + case DM_RATR_STA_ULTRA_LOW: + HighRSSIThreshForRA += GoUpGap; + LowRSSIThreshForRA += GoUpGap; + UltraLowRSSIThreshForRA += GoUpGap; + break; +#endif + + default: + ODM_RT_ASSERT(pDM_Odm, FALSE, ("wrong rssi level setting %d !", *pRATRState) ); + break; + } + + // Decide RATRState by RSSI. + if(RSSI > HighRSSIThreshForRA) + RATRState = DM_RATR_STA_HIGH; + else if(RSSI > LowRSSIThreshForRA) + RATRState = DM_RATR_STA_MIDDLE; + +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + else if(RSSI > UltraLowRSSIThreshForRA) + RATRState = DM_RATR_STA_LOW; + else + RATRState = DM_RATR_STA_ULTRA_LOW; +#else + else + RATRState = DM_RATR_STA_LOW; +#endif + //printk("==>%s,RATRState:0x%02x ,RSSI:%d \n",__FUNCTION__,RATRState,RSSI); + + if( *pRATRState!=RATRState || bForceUpdate) + { + ODM_RT_TRACE( pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, ("RSSI Level %d -> %d\n", *pRATRState, RATRState) ); + *pRATRState = RATRState; + return TRUE; + } + + return FALSE; +} + +VOID +odm_RefreshBasicRateMask( + IN PVOID pDM_VOID + ) +{ +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + PADAPTER Adapter = pDM_Odm->Adapter; + static u1Byte Stage = 0; + u1Byte CurStage = 0; + OCTET_STRING osRateSet; + PMGNT_INFO pMgntInfo = GetDefaultMgntInfo(Adapter); + u1Byte RateSet[5] = {MGN_1M, MGN_2M, MGN_5_5M, MGN_11M, MGN_6M}; + + if(pDM_Odm->SupportICType != ODM_RTL8812 && pDM_Odm->SupportICType != ODM_RTL8821 ) + return; + + if(pDM_Odm->bLinked == FALSE) // unlink Default port information + CurStage = 0; + else if(pDM_Odm->RSSI_Min < 40) // link RSSI < 40% + CurStage = 1; + else if(pDM_Odm->RSSI_Min > 45) // link RSSI > 45% + CurStage = 3; + else + CurStage = 2; // link 25% <= RSSI <= 30% + + if(CurStage != Stage) + { + if(CurStage == 1) + { + FillOctetString(osRateSet, RateSet, 5); + FilterSupportRate(pMgntInfo->mBrates, &osRateSet, FALSE); + Adapter->HalFunc.SetHwRegHandler(Adapter, HW_VAR_BASIC_RATE, (pu1Byte)&osRateSet); + } + else if(CurStage == 3 && (Stage == 1 || Stage == 2)) + { + Adapter->HalFunc.SetHwRegHandler( Adapter, HW_VAR_BASIC_RATE, (pu1Byte)(&pMgntInfo->mBrates) ); + } + } + + Stage = CurStage; +#endif +} + +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) +VOID +ODM_DynamicARFBSelect( + IN PVOID pDM_VOID, + IN u1Byte rate, + IN BOOLEAN Collision_State +) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + pRA_T pRA_Table = &pDM_Odm->DM_RA_Table; + + if(pDM_Odm->SupportICType != ODM_RTL8192E) + return; + + if(Collision_State == pRA_Table->PT_collision_pre) + return; + + if (rate >= DESC_RATEMCS8 && rate <= DESC_RATEMCS12){ + if (Collision_State == 1){ + if(rate == DESC_RATEMCS12){ + + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x0); + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x07060501); + } + else if(rate == DESC_RATEMCS11){ + + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x0); + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x07070605); + } + else if(rate == DESC_RATEMCS10){ + + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x0); + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x08080706); + } + else if(rate == DESC_RATEMCS9){ + + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x0); + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x08080707); + } + else{ + + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x0); + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x09090808); + } + } + else{ // Collision_State == 0 + if(rate == DESC_RATEMCS12){ + + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x05010000); + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x09080706); + } + else if(rate == DESC_RATEMCS11){ + + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x06050000); + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x09080807); + } + else if(rate == DESC_RATEMCS10){ + + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x07060000); + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x0a090908); + } + else if(rate == DESC_RATEMCS9){ + + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x07070000); + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x0a090808); + } + else{ + + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x08080000); + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x0b0a0909); + } + } + } + else{ // MCS13~MCS15, 1SS, G-mode + if (Collision_State == 1){ + if(rate == DESC_RATEMCS15){ + + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x00000000); + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x05040302); + } + else if(rate == DESC_RATEMCS14){ + + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x00000000); + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x06050302); + } + else if(rate == DESC_RATEMCS13){ + + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x00000000); + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x07060502); + } + else{ + + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x00000000); + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x06050402); + } + } + else{ // Collision_State == 0 + if(rate == DESC_RATEMCS15){ + + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x03020000); + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x07060504); + } + else if(rate == DESC_RATEMCS14){ + + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x03020000); + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x08070605); + } + else if(rate == DESC_RATEMCS13){ + + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x05020000); + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x09080706); + } + else{ + + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E, 0x04020000); + ODM_Write4Byte(pDM_Odm, REG_DARFRC_8192E+4, 0x08070605); + } + + + } + + } + pRA_Table->PT_collision_pre = Collision_State; +} + +VOID +ODM_RateAdaptiveStateApInit( + IN PVOID PADAPTER_VOID, + IN PRT_WLAN_STA pEntry + ) +{ + PADAPTER Adapter = (PADAPTER)PADAPTER_VOID; + pEntry->Ratr_State = DM_RATR_STA_INIT; +} +#endif //#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + + +#if (DM_ODM_SUPPORT_TYPE == ODM_CE) +u4Byte +ODM_Get_Rate_Bitmap( + IN PVOID pDM_VOID, + IN u4Byte macid, + IN u4Byte ra_mask, + IN u1Byte rssi_level + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + PSTA_INFO_T pEntry; + u4Byte rate_bitmap = 0; + u1Byte WirelessMode; + //u1Byte WirelessMode =*(pDM_Odm->pWirelessMode); + + + pEntry = pDM_Odm->pODM_StaInfo[macid]; + if(!IS_STA_VALID(pEntry)) + return ra_mask; + + WirelessMode = pEntry->wireless_mode; + + switch(WirelessMode) + { + case ODM_WM_B: + if(ra_mask & 0x0000000c) //11M or 5.5M enable + rate_bitmap = 0x0000000d; + else + rate_bitmap = 0x0000000f; + break; + + case (ODM_WM_G): + case (ODM_WM_A): + if(rssi_level == DM_RATR_STA_HIGH) + rate_bitmap = 0x00000f00; + else + rate_bitmap = 0x00000ff0; + break; + + case (ODM_WM_B|ODM_WM_G): + if(rssi_level == DM_RATR_STA_HIGH) + rate_bitmap = 0x00000f00; + else if(rssi_level == DM_RATR_STA_MIDDLE) + rate_bitmap = 0x00000ff0; + else + rate_bitmap = 0x00000ff5; + break; + + case (ODM_WM_B|ODM_WM_G|ODM_WM_N24G) : + case (ODM_WM_B|ODM_WM_N24G) : + case (ODM_WM_G|ODM_WM_N24G) : + case (ODM_WM_A|ODM_WM_N5G) : + { + if ( pDM_Odm->RFType == ODM_1T2R ||pDM_Odm->RFType == ODM_1T1R) + { + if(rssi_level == DM_RATR_STA_HIGH) + { + rate_bitmap = 0x000f0000; + } + else if(rssi_level == DM_RATR_STA_MIDDLE) + { + rate_bitmap = 0x000ff000; + } + else{ + if (*(pDM_Odm->pBandWidth) == ODM_BW40M) + rate_bitmap = 0x000ff015; + else + rate_bitmap = 0x000ff005; + } + } + else + { + if(rssi_level == DM_RATR_STA_HIGH) + { + rate_bitmap = 0x0f8f0000; + } + else if(rssi_level == DM_RATR_STA_MIDDLE) + { + rate_bitmap = 0x0f8ff000; + } + else + { + if (*(pDM_Odm->pBandWidth) == ODM_BW40M) + rate_bitmap = 0x0f8ff015; + else + rate_bitmap = 0x0f8ff005; + } + } + } + break; + + case (ODM_WM_AC|ODM_WM_G): + if(rssi_level == 1) + rate_bitmap = 0xfc3f0000; + else if(rssi_level == 2) + rate_bitmap = 0xfffff000; + else + rate_bitmap = 0xffffffff; + break; + + case (ODM_WM_AC|ODM_WM_A): + + if (pDM_Odm->RFType == RF_1T1R) + { + if(rssi_level == 1) // add by Gary for ac-series + rate_bitmap = 0x003f8000; + else if (rssi_level == 2) + rate_bitmap = 0x003ff000; + else + rate_bitmap = 0x003ff010; + } + else + { + if(rssi_level == 1) // add by Gary for ac-series + rate_bitmap = 0xfe3f8000; // VHT 2SS MCS3~9 + else if (rssi_level == 2) + rate_bitmap = 0xfffff000; // VHT 2SS MCS0~9 + else + rate_bitmap = 0xfffff010; // All + } + break; + + default: + if(pDM_Odm->RFType == RF_1T2R) + rate_bitmap = 0x000fffff; + else + rate_bitmap = 0x0fffffff; + break; + + } + + //printk("%s ==> rssi_level:0x%02x, WirelessMode:0x%02x, rate_bitmap:0x%08x \n",__FUNCTION__,rssi_level,WirelessMode,rate_bitmap); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, (" ==> rssi_level:0x%02x, WirelessMode:0x%02x, rate_bitmap:0x%08x \n",rssi_level,WirelessMode,rate_bitmap)); + + return (ra_mask&rate_bitmap); + +} + +#endif //#if (DM_ODM_SUPPORT_TYPE == ODM_CE) \ No newline at end of file diff --git a/hal/OUTSRC/odm_RaInfo.h b/hal/OUTSRC/odm_RaInfo.h new file mode 100644 index 0000000..5ee4cba --- /dev/null +++ b/hal/OUTSRC/odm_RaInfo.h @@ -0,0 +1,165 @@ +/****************************************************************************** + * + * 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 __ODMRAINFO_H__ +#define __ODMRAINFO_H__ + +#define AP_InitRateAdaptiveState ODM_RateAdaptiveStateApInit + +#define DM_RATR_STA_INIT 0 +#define DM_RATR_STA_HIGH 1 +#define DM_RATR_STA_MIDDLE 2 +#define DM_RATR_STA_LOW 3 +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) +#define DM_RATR_STA_ULTRA_LOW 4 +#endif + +#if(DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) +typedef struct _Rate_Adaptive_Table_{ + u1Byte firstconnect; + #if(DM_ODM_SUPPORT_TYPE==ODM_WIN) + BOOLEAN PT_collision_pre; + #endif +}RA_T, *pRA_T; +#endif + +typedef struct _ODM_RATE_ADAPTIVE +{ + u1Byte Type; // DM_Type_ByFW/DM_Type_ByDriver + u1Byte HighRSSIThresh; // if RSSI > HighRSSIThresh => RATRState is DM_RATR_STA_HIGH + u1Byte LowRSSIThresh; // if RSSI <= LowRSSIThresh => RATRState is DM_RATR_STA_LOW + u1Byte RATRState; // Current RSSI level, DM_RATR_STA_HIGH/DM_RATR_STA_MIDDLE/DM_RATR_STA_LOW + + #if(DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) + u1Byte LdpcThres; // if RSSI > LdpcThres => switch from LPDC to BCC + BOOLEAN bLowerRtsRate; + #endif + + #if(DM_ODM_SUPPORT_TYPE & ODM_WIN) + u1Byte RtsThres; + #elif(DM_ODM_SUPPORT_TYPE & ODM_CE) + BOOLEAN bUseLdpc; + #else + u1Byte UltraLowRSSIThresh; + u4Byte LastRATR; // RATR Register Content + #endif + +} ODM_RATE_ADAPTIVE, *PODM_RATE_ADAPTIVE; + +VOID +odm_RSSIMonitorInit( + IN PVOID pDM_VOID + ); + +VOID +odm_RSSIMonitorCheck( + IN PVOID pDM_VOID + ); + +#if(DM_ODM_SUPPORT_TYPE==ODM_WIN) +VOID +odm_RSSIDumpToRegister( + IN PVOID pDM_VOID + ); +#endif + +VOID +odm_RSSIMonitorCheckMP( + IN PVOID pDM_VOID + ); + +VOID +odm_RSSIMonitorCheckCE( + IN PVOID pDM_VOID + ); + +VOID +odm_RSSIMonitorCheckAP( + IN PVOID pDM_VOID + ); + + +VOID +odm_RateAdaptiveMaskInit( + IN PVOID pDM_VOID + ); + +VOID +odm_RefreshRateAdaptiveMask( + IN PVOID pDM_VOID + ); + +VOID +odm_RefreshRateAdaptiveMaskMP( + IN PVOID pDM_VOID + ); + +VOID +odm_RefreshRateAdaptiveMaskCE( + IN PVOID pDM_VOID + ); + +VOID +odm_RefreshRateAdaptiveMaskAPADSL( + IN PVOID pDM_VOID + ); + +BOOLEAN +ODM_RAStateCheck( + IN PVOID pDM_VOID, + IN s4Byte RSSI, + IN BOOLEAN bForceUpdate, + OUT pu1Byte pRATRState + ); + +VOID +odm_RefreshBasicRateMask( + IN PVOID pDM_VOID + ); + + +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) +VOID +ODM_DynamicARFBSelect( + IN PVOID pDM_VOID, + IN u1Byte rate, + IN BOOLEAN Collision_State + ); + +VOID +ODM_RateAdaptiveStateApInit( + IN PVOID PADAPTER_VOID, + IN PRT_WLAN_STA pEntry + ); +#endif + +#if (DM_ODM_SUPPORT_TYPE == ODM_CE) +u4Byte +ODM_Get_Rate_Bitmap( + IN PVOID pDM_VOID, + IN u4Byte macid, + IN u4Byte ra_mask, + IN u1Byte rssi_level + ); +#endif + +#endif //#ifndef __ODMRAINFO_H__ + + diff --git a/hal/OUTSRC/odm_RegDefine11AC.h b/hal/OUTSRC/odm_RegDefine11AC.h index 1193653..e7e5418 100644 --- a/hal/OUTSRC/odm_RegDefine11AC.h +++ b/hal/OUTSRC/odm_RegDefine11AC.h @@ -29,19 +29,37 @@ //PAGE 8 #define ODM_REG_CCK_RPT_FORMAT_11AC 0x804 #define ODM_REG_BB_RX_PATH_11AC 0x808 +#define ODM_REG_BB_ATC_11AC 0x860 +#define ODM_REG_DBG_RPT_11AC 0x8fc //PAGE 9 #define ODM_REG_OFDM_FA_RST_11AC 0x9A4 +#define ODM_REG_NHM_TIMER_11AC 0x990 +#define ODM_REG_NHM_TH9_TH10_11AC 0x994 +#define ODM_REG_NHM_TH3_TO_TH0_11AC 0x998 +#define ODM_REG_NHM_TH7_TO_TH4_11AC 0x99c +#define ODM_REG_NHM_TH8_11AC 0x9a0 +#define ODM_REG_NHM_9E8_11AC 0x9e8 //PAGE A #define ODM_REG_CCK_CCA_11AC 0xA0A #define ODM_REG_CCK_FA_RST_11AC 0xA2C #define ODM_REG_CCK_FA_11AC 0xA5C +//PAGE B +#define ODM_REG_RST_RPT_11AC 0xB58 //PAGE C +#define ODM_REG_TRMUX_11AC 0xC08 #define ODM_REG_IGI_A_11AC 0xC50 //PAGE E #define ODM_REG_IGI_B_11AC 0xE50 +#define ODM_REG_TRMUX_11AC_B 0xE08 //PAGE F +#define ODM_REG_CCK_CCA_CNT_11AC 0xF08 #define ODM_REG_OFDM_FA_11AC 0xF48 - +#define ODM_REG_RPT_11AC 0xfa0 +#define ODM_REG_NHM_CNT_11AC 0xfa8 +//PAGE 18 +#define ODM_REG_IGI_C_11AC 0x1850 +//PAGE 1A +#define ODM_REG_IGI_D_11AC 0x1A50 //2 MAC REG LIST #define ODM_REG_RESP_TX_11AC 0x6D8 @@ -52,6 +70,7 @@ #define ODM_BIT_IGI_11AC 0xFFFFFFFF #define ODM_BIT_CCK_RPT_FORMAT_11AC BIT16 #define ODM_BIT_BB_RX_PATH_11AC 0xF +#define ODM_BIT_BB_ATC_11AC BIT14 #endif diff --git a/hal/OUTSRC/odm_RegDefine11N.h b/hal/OUTSRC/odm_RegDefine11N.h index b623609..9d07509 100644 --- a/hal/OUTSRC/odm_RegDefine11N.h +++ b/hal/OUTSRC/odm_RegDefine11N.h @@ -44,20 +44,28 @@ #define ODM_REG_RF_PIN_11N 0x804 #define ODM_REG_PSD_CTRL_11N 0x808 #define ODM_REG_TX_ANT_CTRL_11N 0x80C -#define ODM_REG_BB_PWR_SAV5_11N 0x818 +#define ODM_REG_BB_PWR_SAV5_11N 0x818 #define ODM_REG_CCK_RPT_FORMAT_11N 0x824 +#define ODM_REG_CCK_RPT_FORMAT_11N_B 0x82C #define ODM_REG_RX_DEFUALT_A_11N 0x858 #define ODM_REG_RX_DEFUALT_B_11N 0x85A -#define ODM_REG_BB_PWR_SAV3_11N 0x85C +#define ODM_REG_BB_PWR_SAV3_11N 0x85C #define ODM_REG_ANTSEL_CTRL_11N 0x860 #define ODM_REG_RX_ANT_CTRL_11N 0x864 #define ODM_REG_PIN_CTRL_11N 0x870 -#define ODM_REG_BB_PWR_SAV1_11N 0x874 +#define ODM_REG_BB_PWR_SAV1_11N 0x874 #define ODM_REG_ANTSEL_PATH_11N 0x878 #define ODM_REG_BB_3WIRE_11N 0x88C #define ODM_REG_SC_CNT_11N 0x8C4 -#define ODM_REG_PSD_DATA_11N 0x8B4 +#define ODM_REG_PSD_DATA_11N 0x8B4 +#define ODM_REG_PSD_DATA_11N 0x8B4 +#define ODM_REG_NHM_TIMER_11N 0x894 +#define ODM_REG_NHM_TH9_TH10_11N 0x890 +#define ODM_REG_NHM_TH3_TO_TH0_11N 0x898 +#define ODM_REG_NHM_TH7_TO_TH4_11N 0x89c +#define ODM_REG_NHM_CNT_11N 0x8d8 //PAGE 9 +#define ODM_REG_DBG_RPT_11N 0x908 #define ODM_REG_ANT_MAPPING1_11N 0x914 #define ODM_REG_ANT_MAPPING2_11N 0x918 //PAGE A @@ -78,7 +86,7 @@ #define ODM_REG_CCK_FA_MSB_11N 0xA58 #define ODM_REG_CCK_FA_LSB_11N 0xA5C #define ODM_REG_CCK_CCA_CNT_11N 0xA60 -#define ODM_REG_BB_PWR_SAV4_11N 0xA74 +#define ODM_REG_BB_PWR_SAV4_11N 0xA74 //PAGE B #define ODM_REG_LNA_SWITCH_11N 0xB2C #define ODM_REG_PATH_SWITCH_11N 0xB30 @@ -90,9 +98,9 @@ #define ODM_REG_BB_RX_PATH_11N 0xC04 #define ODM_REG_TRMUX_11N 0xC08 #define ODM_REG_OFDM_FA_RSTC_11N 0xC0C -#define ODM_REG_RXIQI_MATRIX_11N 0xC14 +#define ODM_REG_RXIQI_MATRIX_11N 0xC14 #define ODM_REG_TXIQK_MATRIX_LSB1_11N 0xC4C -#define ODM_REG_IGI_A_11N 0xC50 +#define ODM_REG_IGI_A_11N 0xC50 #define ODM_REG_ANTDIV_PARA2_11N 0xC54 #define ODM_REG_IGI_B_11N 0xC58 #define ODM_REG_ANTDIV_PARA3_11N 0xC5C @@ -108,9 +116,11 @@ #define ODM_REG_OFDM_FA_TYPE1_11N 0xCF0 //PAGE D #define ODM_REG_OFDM_FA_RSTD_11N 0xD00 +#define ODM_REG_BB_ATC_11N 0xD2C #define ODM_REG_OFDM_FA_TYPE2_11N 0xDA0 #define ODM_REG_OFDM_FA_TYPE3_11N 0xDA4 #define ODM_REG_OFDM_FA_TYPE4_11N 0xDA8 +#define ODM_REG_RPT_11N 0xDF4 //PAGE E #define ODM_REG_TXAGC_A_6_18_11N 0xE00 #define ODM_REG_TXAGC_A_24_54_11N 0xE04 @@ -143,12 +153,8 @@ #define ODM_REG_STANDBY_11N 0xEDC #define ODM_REG_SLEEP_11N 0xEE0 #define ODM_REG_PMPD_ANAEN_11N 0xEEC - - - - - - +#define ODM_REG_IGI_C_11N 0xF84 +#define ODM_REG_IGI_D_11N 0xF88 //2 MAC REG LIST #define ODM_REG_BB_RST_11N 0x02 @@ -161,14 +167,15 @@ #define ODM_REG_EDCA_BK_11N 0x50C #define ODM_REG_TXPAUSE_11N 0x522 #define ODM_REG_RESP_TX_11N 0x6D8 -#define ODM_REG_ANT_TRAIN_PARA1_11N 0x7b0 -#define ODM_REG_ANT_TRAIN_PARA2_11N 0x7b4 +#define ODM_REG_ANT_TRAIN_PARA1_11N 0x7b0 +#define ODM_REG_ANT_TRAIN_PARA2_11N 0x7b4 //DIG Related #define ODM_BIT_IGI_11N 0x0000007F #define ODM_BIT_CCK_RPT_FORMAT_11N BIT9 #define ODM_BIT_BB_RX_PATH_11N 0xF +#define ODM_BIT_BB_ATC_11N BIT11 #endif diff --git a/hal/OUTSRC/odm_debug.c b/hal/OUTSRC/odm_debug.c index 1547ff1..1ed97cf 100644 --- a/hal/OUTSRC/odm_debug.c +++ b/hal/OUTSRC/odm_debug.c @@ -22,6 +22,7 @@ // include files //============================================================ +#include "Mp_Precomp.h" #include "odm_precomp.h" @@ -30,7 +31,7 @@ ODM_InitDebugSetting( IN PDM_ODM_T pDM_Odm ) { -pDM_Odm->DebugLevel = ODM_DBG_LOUD; +pDM_Odm->DebugLevel = ODM_DBG_TRACE; pDM_Odm->DebugComponents = \ @@ -50,7 +51,9 @@ pDM_Odm->DebugComponents = // ODM_COMP_DYNAMIC_PRICCA | // ODM_COMP_RXHP | // ODM_COMP_MP | -// ODM_COMP_DYNAMIC_ATC | +// ODM_COMP_CFO_TRACKING | +// ODM_COMP_ACS | +// PHYDM_COMP_ADAPTIVITY | //MAC Functions // ODM_COMP_EDCA_TURBO | @@ -67,563 +70,669 @@ pDM_Odm->DebugComponents = 0; } -#if 0 -/*------------------Declare variable----------------------- -// Define debug flag array for common debug print macro. */ -u4Byte ODM_DBGP_Type[ODM_DBGP_TYPE_MAX]; +#if(DM_ODM_SUPPORT_TYPE & ODM_WIN) -/* Define debug print header for every service module. */ -ODM_DBGP_HEAD_T ODM_DBGP_Head; - - -/*----------------------------------------------------------------------------- - * Function: DBGP_Flag_Init - * - * Overview: Refresh all debug print control flag content to zero. - * - * Input: NONE - * - * Output: NONE - * - * Return: NONE - * - * Revised History: - * When Who Remark - * 10/20/2006 MHC Create Version 0. - * - *---------------------------------------------------------------------------*/ -extern void ODM_DBGP_Flag_Init(void) -{ - u1Byte i; - - for (i = 0; i < ODM_DBGP_TYPE_MAX; i++) - { - ODM_DBGP_Type[i] = 0; - } - -#ifndef ADSL_AP_BUILD_WORKAROUND -#if DBG - // 2010/06/02 MH Free build driver can not out any debug message!!! - // Init Debug flag enable condition - - ODM_DBGP_Type[FINIT] = \ -// INIT_EEPROM | -// INIT_TxPower | -// INIT_IQK | -// INIT_RF | - 0; - - ODM_DBGP_Type[FDM] = \ -// WA_IOT | -// DM_PWDB | -// DM_Monitor | -// DM_DIG | -// DM_EDCA_Turbo | -// DM_BT30 | - 0; - - ODM_DBGP_Type[FIOCTL] = \ -// IOCTL_IRP | -// IOCTL_IRP_DETAIL | -// IOCTL_IRP_STATISTICS | -// IOCTL_IRP_HANDLE | -// IOCTL_BT_HCICMD | -// IOCTL_BT_HCICMD_DETAIL | -// IOCTL_BT_HCICMD_EXT | -// IOCTL_BT_EVENT | -// IOCTL_BT_EVENT_DETAIL | -// IOCTL_BT_EVENT_PERIODICAL | -// IOCTL_BT_TX_ACLDATA | -// IOCTL_BT_TX_ACLDATA_DETAIL | -// IOCTL_BT_RX_ACLDATA | -// IOCTL_BT_RX_ACLDATA_DETAIL | -// IOCTL_BT_TP | -// IOCTL_STATE | -// IOCTL_BT_LOGO | -// IOCTL_CALLBACK_FUN | -// IOCTL_PARSE_BT_PKT | - 0; - - ODM_DBGP_Type[FBT] = \ -// BT_TRACE | - 0; - - ODM_DBGP_Type[FEEPROM] = \ -// EEPROM_W | -// EFUSE_PG | -// EFUSE_READ_ALL | -// EFUSE_ANALYSIS | -// EFUSE_PG_DETAIL | - 0; - - ODM_DBGP_Type[FDBG_CTRL] = \ -// DBG_CTRL_TRACE | -// DBG_CTRL_INBAND_NOISE | - 0; - - // 2011/07/20 MH Add for short cut - ODM_DBGP_Type[FSHORT_CUT] = \ -// SHCUT_TX | -// SHCUT_RX | - 0; - -#endif -#endif - /* Define debug header of every service module. */ - //ODM_DBGP_Head.pMANS = "\n\r[MANS] "; - //ODM_DBGP_Head.pRTOS = "\n\r[RTOS] "; - //ODM_DBGP_Head.pALM = "\n\r[ALM] "; - //ODM_DBGP_Head.pPEM = "\n\r[PEM] "; - //ODM_DBGP_Head.pCMPK = "\n\r[CMPK] "; - //ODM_DBGP_Head.pRAPD = "\n\r[RAPD] "; - //ODM_DBGP_Head.pTXPB = "\n\r[TXPB] "; - //ODM_DBGP_Head.pQUMG = "\n\r[QUMG] "; - -} /* DBGP_Flag_Init */ - -#endif - - -#if 0 -u4Byte GlobalDebugLevel = DBG_LOUD; -// -// 2009/06/22 MH Allow Fre build to print none debug info at init time. -// -#if DBG -u8Byte GlobalDebugComponents = \ -// COMP_TRACE | -// COMP_DBG | -// COMP_INIT | -// COMP_OID_QUERY | -// COMP_OID_SET | -// COMP_RECV | -// COMP_SEND | -// COMP_IO | -// COMP_POWER | -// COMP_MLME | -// COMP_SCAN | -// COMP_SYSTEM | -// COMP_SEC | -// COMP_AP | -// COMP_TURBO | -// COMP_QOS | -// COMP_AUTHENTICATOR | -// COMP_BEACON | -// COMP_ANTENNA | -// COMP_RATE | -// COMP_EVENTS | -// COMP_FPGA | -// COMP_RM | -// COMP_MP | -// COMP_RXDESC | -// COMP_CKIP | -// COMP_DIG | -// COMP_TXAGC | -// COMP_HIPWR | -// COMP_HALDM | -// COMP_RSNA | -// COMP_INDIC | -// COMP_LED | -// COMP_RF | -// COMP_DUALMACSWITCH | -// COMP_EASY_CONCURRENT | - -//1!!!!!!!!!!!!!!!!!!!!!!!!!!! -//1//1Attention Please!!!<11n or 8190 specific code should be put below this line> -//1!!!!!!!!!!!!!!!!!!!!!!!!!!! - -// COMP_HT | -// COMP_POWER_TRACKING | -// COMP_RX_REORDER | -// COMP_AMSDU | -// COMP_WPS | -// COMP_RATR | -// COMP_RESET | -// COMP_CMD | -// COMP_EFUSE | -// COMP_MESH_INTERWORKING | -// COMP_CCX | -// COMP_IOCTL | -// COMP_GP | -// COMP_TXAGG | -// COMP_BB_POWERSAVING | -// COMP_SWAS | -// COMP_P2P | -// COMP_MUX | -// COMP_FUNC | -// COMP_TDLS | -// COMP_OMNIPEEK | -// COMP_PSD | - 0; - - -#else -u8Byte GlobalDebugComponents = 0; -#endif - -#if (RT_PLATFORM==PLATFORM_LINUX) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) -EXPORT_SYMBOL(GlobalDebugComponents); -EXPORT_SYMBOL(GlobalDebugLevel); -#endif -#endif - -/*------------------Declare variable----------------------- -// Define debug flag array for common debug print macro. */ -u4Byte DBGP_Type[DBGP_TYPE_MAX]; - -/* Define debug print header for every service module. */ -DBGP_HEAD_T DBGP_Head; - - -/*----------------------------------------------------------------------------- - * Function: DBGP_Flag_Init - * - * Overview: Refresh all debug print control flag content to zero. - * - * Input: NONE - * - * Output: NONE - * - * Return: NONE - * - * Revised History: - * When Who Remark - * 10/20/2006 MHC Create Version 0. - * - *---------------------------------------------------------------------------*/ -extern void DBGP_Flag_Init(void) -{ - u1Byte i; - - for (i = 0; i < DBGP_TYPE_MAX; i++) - { - DBGP_Type[i] = 0; - } - -#if DBG - // 2010/06/02 MH Free build driver can not out any debug message!!! - // Init Debug flag enable condition - - DBGP_Type[FINIT] = \ -// INIT_EEPROM | -// INIT_TxPower | -// INIT_IQK | -// INIT_RF | - 0; - - DBGP_Type[FDM] = \ -// WA_IOT | -// DM_PWDB | -// DM_Monitor | -// DM_DIG | -// DM_EDCA_Turbo | -// DM_BT30 | - 0; - - DBGP_Type[FIOCTL] = \ -// IOCTL_IRP | -// IOCTL_IRP_DETAIL | -// IOCTL_IRP_STATISTICS | -// IOCTL_IRP_HANDLE | -// IOCTL_BT_HCICMD | -// IOCTL_BT_HCICMD_DETAIL | -// IOCTL_BT_HCICMD_EXT | -// IOCTL_BT_EVENT | -// IOCTL_BT_EVENT_DETAIL | -// IOCTL_BT_EVENT_PERIODICAL | -// IOCTL_BT_TX_ACLDATA | -// IOCTL_BT_TX_ACLDATA_DETAIL | -// IOCTL_BT_RX_ACLDATA | -// IOCTL_BT_RX_ACLDATA_DETAIL | -// IOCTL_BT_TP | -// IOCTL_STATE | -// IOCTL_BT_LOGO | -// IOCTL_CALLBACK_FUN | -// IOCTL_PARSE_BT_PKT | - 0; - - DBGP_Type[FBT] = \ -// BT_TRACE | - 0; - - DBGP_Type[FEEPROM] = \ -// EEPROM_W | -// EFUSE_PG | -// EFUSE_READ_ALL | -// EFUSE_ANALYSIS | -// EFUSE_PG_DETAIL | - 0; - - DBGP_Type[FDBG_CTRL] = \ -// DBG_CTRL_TRACE | -// DBG_CTRL_INBAND_NOISE | - 0; - - // 2011/07/20 MH Add for short cut - DBGP_Type[FSHORT_CUT] = \ -// SHCUT_TX | -// SHCUT_RX | - 0; - -#endif - /* Define debug header of every service module. */ - DBGP_Head.pMANS = "\n\r[MANS] "; - DBGP_Head.pRTOS = "\n\r[RTOS] "; - DBGP_Head.pALM = "\n\r[ALM] "; - DBGP_Head.pPEM = "\n\r[PEM] "; - DBGP_Head.pCMPK = "\n\r[CMPK] "; - DBGP_Head.pRAPD = "\n\r[RAPD] "; - DBGP_Head.pTXPB = "\n\r[TXPB] "; - DBGP_Head.pQUMG = "\n\r[QUMG] "; - -} /* DBGP_Flag_Init */ - - -/*----------------------------------------------------------------------------- - * Function: DBG_PrintAllFlag - * - * Overview: Print All debug flag - * - * Input: NONE - * - * Output: NONE - * - * Return: NONE - * - * Revised History: - * When Who Remark - * 12/10/2008 MHC Create Version 0. - * - *---------------------------------------------------------------------------*/ -extern void DBG_PrintAllFlag(void) +static u1Byte BbDbgBuf[BB_TMP_BUF_SIZE]; +VOID +odm_BB_Debug_Info(IN PDM_ODM_T pDM_Odm) { - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 0 FQoS\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 1 FTX\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 2 FRX\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 3 FSEC\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 4 FMGNT\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 5 FMLME\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 6 FRESOURCE\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 7 FBEACON\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 8 FISR\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 9 FPHY\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 11 FMP\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 12 FPWR\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 13 FDM\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 14 FDBG_CTRL\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 15 FC2H\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("DBGFLAG 16 FBT\n")); -} // DBG_PrintAllFlag + + u1Byte RX_HT_BW, RX_VHT_BW, RXSC, RX_HT, RX_BW; + static u1Byte vRX_BW ; + u4Byte value32, value32_1, value32_2, value32_3; + s4Byte SFO_A, SFO_B, SFO_C, SFO_D; + s4Byte LFO_A, LFO_B, LFO_C, LFO_D; + static u1Byte MCSS,Tail,Parity,rsv,vrsv,idx,smooth,htsound,agg,stbc,vstbc,fec,fecext,sgi,sgiext,htltf,vgid,vNsts,vtxops,vrsv2,vbrsv,bf,vbcrc; + static u2Byte HLength,htcrc8,Length; + static u2Byte vpaid; + static u2Byte vLength,vhtcrc8,vMCSS,vTail,vbTail; + static u1Byte HMCSS,HRX_BW; -extern void DBG_PrintAllComp(void) -{ - u1Byte i; + u1Byte pwDB; + s1Byte RXEVM_0, RXEVM_1, RXEVM_2 ; + u1Byte RF_gain_pathA, RF_gain_pathB, RF_gain_pathC, RF_gain_pathD; + u1Byte RX_SNR_pathA, RX_SNR_pathB, RX_SNR_pathC, RX_SNR_pathD; + s4Byte sig_power; + const char *RXHT_table[] = {"legacy", "HT", "VHT"}; + const char *BW_table[] = {"20M", "40M", "80M"}; + const char *RXSC_table[] = {"duplicate/full bw", "usc20-1", "lsc20-1", "usc20-2", "lsc20-2", "usc40", "lsc40"}; + + const char *L_rate[]={"6M","9M","12M","18M","24M","36M","48M","54M"}; + - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("GlobalDebugComponents Definition\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT0 COMP_TRACE\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT1 COMP_DBG\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT2 COMP_INIT\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT3 COMP_OID_QUERY\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT4 COMP_OID_SET\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT5 COMP_RECV\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT6 COMP_SEND\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT7 COMP_IO\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT8 COMP_POWER\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT9 COMP_MLME\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT10 COMP_SCAN\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT11 COMP_SYSTEM\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT12 COMP_SEC\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT13 COMP_AP\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT14 COMP_TURBO\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT15 COMP_QOS\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT16 COMP_AUTHENTICATOR\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT17 COMP_BEACON\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT18 COMP_BEACON\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT19 COMP_RATE\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT20 COMP_EVENTS\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT21 COMP_FPGA\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT22 COMP_RM\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT23 COMP_MP\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT24 COMP_RXDESC\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT25 COMP_CKIP\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT26 COMP_DIG\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT27 COMP_TXAGC\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT28 COMP_HIPWR\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT29 COMP_HALDM\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT30 COMP_RSNA\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT31 COMP_INDIC\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT32 COMP_LED\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT33 COMP_RF\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT34 COMP_HT\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT35 COMP_POWER_TRACKING\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT36 COMP_POWER_TRACKING\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT37 COMP_AMSDU\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT38 COMP_WPS\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT39 COMP_RATR\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT40 COMP_RESET\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT41 COMP_CMD\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT42 COMP_EFUSE\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT43 COMP_MESH_INTERWORKING\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT43 COMP_CCX\n")); + /* + const double evm_comp_20M = 0.579919469776867; //10*log10(64.0/56.0) + const double evm_comp_40M = 0.503051183113957; //10*log10(128.0/114.0) + const double evm_comp_80M = 0.244245993314183; //10*log10(256.0/242.0) + const double evm_comp_160M = 0.244245993314183; //10*log10(512.0/484.0) + */ + + if(pDM_Odm->SupportICType & ODM_IC_11N_SERIES) + return; + + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s \n", "BB Report Info"); + DCMD_Printf(BbDbgBuf); + + //BW & Mode Detection + /////////////////////////////////////////////////////// + value32 = ODM_GetBBReg(pDM_Odm, 0xf80 ,bMaskDWord); + value32_2 =value32; + RX_HT_BW = (u1Byte)(value32&0x1) ; + RX_VHT_BW = (u1Byte)((value32>>1)&0x3); + RXSC = (u1Byte)(value32&0x78); + value32_1= (value32&0x180)>>7; + RX_HT = (u1Byte)(value32_1); + /* + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d", "F80", value32_2); + DCMD_Printf(BbDbgBuf); + + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d", "RX_HT_BW", RX_HT_BW); + DCMD_Printf(BbDbgBuf); + + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d", "RX_VHT_BW", RX_VHT_BW); + DCMD_Printf(BbDbgBuf); + + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d", "RX_SC", RXSC); + DCMD_Printf(BbDbgBuf); + + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d", "RX_HT", RX_HT); + DCMD_Printf(BbDbgBuf); + */ - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("GlobalDebugComponents = %"i64fmt"x\n", GlobalDebugComponents)); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("Enable DBG COMP =")); - for (i = 0; i < 64; i++) + //rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n RX_HT:%s ", RXHT_table[RX_HT]); + //DCMD_Printf(BbDbgBuf); + RX_BW = 0; + + if(RX_HT == 2) { - if (GlobalDebugComponents & ((u8Byte)0x1 << i) ) + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n Mode: VHT Mode"); + DCMD_Printf(BbDbgBuf); + if(RX_VHT_BW==0) { - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT%02d |\n", i)); + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, " BW=20M"); + DCMD_Printf(BbDbgBuf); + } + else if(RX_VHT_BW==1) + { + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, " BW=40M"); + DCMD_Printf(BbDbgBuf); } + else +{ + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, " BW=80M"); + DCMD_Printf(BbDbgBuf); + } + RX_BW = RX_VHT_BW; } - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("\n")); + else if(RX_HT == 1) + { + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n Mode: HT Mode"); + DCMD_Printf(BbDbgBuf); + if(RX_HT_BW==0) + { + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, " BW=20M"); + DCMD_Printf(BbDbgBuf); + } + else if(RX_HT_BW==1) + { + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, " BW=40M"); + DCMD_Printf(BbDbgBuf); + } + RX_BW = RX_HT_BW; + } + else + { + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n Mode: Legeacy Mode"); + DCMD_Printf(BbDbgBuf); + } + + if(RX_HT !=0) + { + if(RXSC==0) + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n duplicate/full bw"); + else if(RXSC==1) + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n usc20-1"); + else if(RXSC==2) + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n lsc20-1"); + else if(RXSC==3) + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n usc20-2"); + else if(RXSC==4) + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n lsc20-2"); + else if(RXSC==9) + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n usc40"); + else if(RXSC==10) + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n lsc40"); + DCMD_Printf(BbDbgBuf); + } + /* + if(RX_HT == 2){ + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, " BW:%s", BW_table[RX_VHT_BW]); + RX_BW = RX_VHT_BW; + } + else if(RX_HT == 1){ + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, " BW:%s", BW_table[RX_HT_BW]); + RX_BW = RX_HT_BW; + } + else + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, ""); + + DCMD_Printf(BbDbgBuf); + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, " RXSC:%s", RXSC_table[RXSC]); + DCMD_Printf(BbDbgBuf); + */ + /////////////////////////////////////////////////////// + +// rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d", "dB Conversion: 10log(65)", ODM_PWdB_Conversion(65,10,0)); +// DCMD_Printf(BbDbgBuf); + + // RX signal power and AGC related info + /////////////////////////////////////////////////////// + value32 = ODM_GetBBReg(pDM_Odm, 0xF90 ,bMaskDWord); + pwDB = (u1Byte) ((value32 & bMaskByte1) >> 8); + pwDB=pwDB>>1; + sig_power = -110+pwDB; + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d", "OFDM RX Signal Power(dB)", sig_power); + DCMD_Printf(BbDbgBuf); + + + value32 = ODM_GetBBReg(pDM_Odm, 0xd14 ,bMaskDWord); + RX_SNR_pathA = (u1Byte)(value32&0xFF)>>1; + RF_gain_pathA = (s1Byte) ((value32 & bMaskByte1) >> 8); + RF_gain_pathA *=2; + value32 = ODM_GetBBReg(pDM_Odm, 0xd54 ,bMaskDWord); + RX_SNR_pathB = (u1Byte)(value32&0xFF)>>1; + RF_gain_pathB = (s1Byte) ((value32 & bMaskByte1) >> 8); + RF_gain_pathB *=2; + value32 = ODM_GetBBReg(pDM_Odm, 0xd94 ,bMaskDWord); + RX_SNR_pathC = (u1Byte)(value32&0xFF)>>1; + RF_gain_pathC = (s1Byte) ((value32 & bMaskByte1) >> 8); + RF_gain_pathC *=2; + value32 = ODM_GetBBReg(pDM_Odm, 0xdd4 ,bMaskDWord); + RX_SNR_pathD = (u1Byte)(value32&0xFF)>>1; + RF_gain_pathD = (s1Byte) ((value32 & bMaskByte1) >> 8); + RF_gain_pathD *=2; + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d / %d / %d / %d", "OFDM RX RF Gain(A/B/C/D)", RF_gain_pathA, RF_gain_pathA, RF_gain_pathC, RF_gain_pathD); + DCMD_Printf(BbDbgBuf); + /////////////////////////////////////////////////////// + + // RX Counter related info + /////////////////////////////////////////////////////// + value32 = ODM_GetBBReg(pDM_Odm, 0xF08 ,bMaskDWord); + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d", "OFDM CCA Counter", ((value32&0xFFFF0000)>>16)); + DCMD_Printf(BbDbgBuf); + + value32 = ODM_GetBBReg(pDM_Odm, 0xFD0 ,bMaskDWord); + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d", "OFDM SBD Fail Counter", value32&0xFFFF); + DCMD_Printf(BbDbgBuf); -} // DBG_PrintAllComp + value32 = ODM_GetBBReg(pDM_Odm, 0xFC4 ,bMaskDWord); + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d / %d", "VHT SIGA/SIGB CRC8 Fail Counter", value32&0xFFFF, ((value32&0xFFFF0000)>>16)); + DCMD_Printf(BbDbgBuf); + + value32 = ODM_GetBBReg(pDM_Odm, 0xFCC ,bMaskDWord); + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d", "CCK CCA Counter", value32&0xFFFF); + DCMD_Printf(BbDbgBuf); + + value32 = ODM_GetBBReg(pDM_Odm, 0xFBC ,bMaskDWord); + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d / %d", "LSIG (\"Parity Fail\"/\"Rate Illegal\") Counter", value32&0xFFFF, ((value32&0xFFFF0000)>>16)); + DCMD_Printf(BbDbgBuf); + value32_1 = ODM_GetBBReg(pDM_Odm, 0xFC8 ,bMaskDWord); + value32_2 = ODM_GetBBReg(pDM_Odm, 0xFC0 ,bMaskDWord); + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d / %d", "HT/VHT MCS NOT SUPPORT counter", ((value32_2&0xFFFF0000)>>16), value32_1&0xFFFF); + DCMD_Printf(BbDbgBuf); + /////////////////////////////////////////////////////// -/*----------------------------------------------------------------------------- - * Function: DBG_PrintFlagEvent - * - * Overview: Print dedicated debug flag event - * - * Input: NONE - * - * Output: NONE - * - * Return: NONE - * - * Revised History: - * When Who Remark - * 12/10/2008 MHC Create Version 0. - * - *---------------------------------------------------------------------------*/ -extern void DBG_PrintFlagEvent(u1Byte DbgFlag) -{ - switch(DbgFlag) + // PostFFT related info + /////////////////////////////////////////////////////// + + value32 = ODM_GetBBReg(pDM_Odm, 0xF8c ,bMaskDWord); + RXEVM_0 = (s1Byte) ((value32 & bMaskByte2) >> 16); + RXEVM_0 /=2; + if(RXEVM_0 < -63) + RXEVM_0=0; + + DCMD_Printf(BbDbgBuf); + RXEVM_1 = (s1Byte) ((value32 & bMaskByte3) >> 24); + RXEVM_1 /=2; + value32 = ODM_GetBBReg(pDM_Odm, 0xF88 ,bMaskDWord); + RXEVM_2 = (s1Byte) ((value32 & bMaskByte2) >> 16); + RXEVM_2 /=2; + + if(RXEVM_1 < -63) + RXEVM_1=0; + if(RXEVM_2 < -63) + RXEVM_2=0; + + /* + if(RX_BW == 0){ + RXEVM_0 -= evm_comp_20M; + RXEVM_1 -= evm_comp_20M; + RXEVM_2 -= evm_comp_20M; + } + else if(RX_BW == 1){ + RXEVM_0 -= evm_comp_40M; + RXEVM_1 -= evm_comp_40M; + RXEVM_2 -= evm_comp_40M; + } + else if (RX_BW == 2){ + RXEVM_0 -= evm_comp_80M; + RXEVM_1 -= evm_comp_80M; + RXEVM_2 -= evm_comp_80M; + } + */ + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d / %d / %d", "RXEVM (1ss/2ss/3ss)", RXEVM_0, RXEVM_1, RXEVM_2); + DCMD_Printf(BbDbgBuf); + +// value32 = ODM_GetBBReg(pDM_Odm, 0xD14 ,bMaskDWord); + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d / %d / %d / %d", "RXSNR(A/B/C/D, dB)", RX_SNR_pathA, RX_SNR_pathB, RX_SNR_pathC, RX_SNR_pathD); + DCMD_Printf(BbDbgBuf); +// rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d", "B_RXSNR", (value32&0xFF00)>>9); +// DCMD_Printf(BbDbgBuf); + + value32 = ODM_GetBBReg(pDM_Odm, 0xF8C ,bMaskDWord); + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d / %d", "CSI_1st /CSI_2nd", value32&0xFFFF, ((value32&0xFFFF0000)>>16)); + DCMD_Printf(BbDbgBuf); + /////////////////////////////////////////////////////// + + //BW & Mode Detection + + //Reset Page F Counter + ODM_SetBBReg(pDM_Odm, 0xB58 ,BIT0, 1); + ODM_SetBBReg(pDM_Odm, 0xB58 ,BIT0, 0); + + //CFO Report Info + //Short CFO + value32 = ODM_GetBBReg(pDM_Odm, 0xd0c ,bMaskDWord); + value32_1 = ODM_GetBBReg(pDM_Odm, 0xd4c ,bMaskDWord); + value32_2 = ODM_GetBBReg(pDM_Odm, 0xd8c ,bMaskDWord); + value32_3 = ODM_GetBBReg(pDM_Odm, 0xdcc ,bMaskDWord); + + SFO_A=(s4Byte)(value32&bMask12Bits); + SFO_B=(s4Byte)(value32_1&bMask12Bits); + SFO_C=(s4Byte)(value32_2&bMask12Bits); + SFO_D=(s4Byte)(value32_3&bMask12Bits); + + LFO_A=(s4Byte)(value32>>16); + LFO_B=(s4Byte)(value32_1>>16); + LFO_C=(s4Byte)(value32_2>>16); + LFO_D=(s4Byte)(value32_3>>16); + + //SFO 2's to dec + if(SFO_A >2047) +{ + SFO_A=SFO_A-4096; + } + SFO_A=(SFO_A*312500)/2048; + + if(SFO_B >2047) { - case FQoS: - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 QoS_INIT\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 QoS_VISTA\n")); - break; + SFO_B=SFO_B-4096; + } + SFO_B=(SFO_B*312500)/2048; + if(SFO_C >2047) + { + SFO_C=SFO_C-4096; + } + SFO_C=(SFO_C*312500)/2048; + if(SFO_D >2047) + { + SFO_D=SFO_D-4096; + } + SFO_D=(SFO_D*312500)/2048; + + //LFO 2's to dec - case FTX: - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 TX_DESC\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 TX_DESC_TID\n")); - break; + if(LFO_A >4095) + { + LFO_A=LFO_A-8192; + } - case FRX: - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 RX_DATA\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 RX_PHY_STS\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 2 RX_PHY_SS\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 3 RX_PHY_SQ\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 4 RX_PHY_ASTS\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 5 RX_ERR_LEN\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 6 RX_DEFRAG\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 7 RX_ERR_RATE\n")); - break; + if(LFO_B >4095) + { + LFO_B=LFO_B-8192; + } - case FSEC: - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("NA\n")); - break; + if(LFO_C>4095) + { + LFO_C=LFO_C-8192; + } - case FMGNT: - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("NA\n")); - break; + if(LFO_D >4095) + { + LFO_D=LFO_D-8192; + } + LFO_A=LFO_A*312500/4096; + LFO_B=LFO_B*312500/4096; + LFO_C=LFO_C*312500/4096; + LFO_D=LFO_D*312500/4096; + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "CFO Report Info"); + DCMD_Printf(BbDbgBuf); - case FMLME: - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 MEDIA_STS\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 LINK_STS\n")); - break; + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d / %d/ %d/ %d", " Short CFO(Hz) ", SFO_A,SFO_B,SFO_C,SFO_D); + DCMD_Printf(BbDbgBuf); - case FRESOURCE: - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 OS_CHK\n")); - break; + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d / %d/ %d/ %d", " Long CFO(Hz) ", LFO_A,LFO_B,LFO_C,LFO_D); + DCMD_Printf(BbDbgBuf); + + //SCFO + value32 = ODM_GetBBReg(pDM_Odm, 0xd10 ,bMaskDWord); + value32_1 = ODM_GetBBReg(pDM_Odm, 0xd50 ,bMaskDWord); + value32_2 = ODM_GetBBReg(pDM_Odm, 0xd90 ,bMaskDWord); + value32_3 = ODM_GetBBReg(pDM_Odm, 0xdd0 ,bMaskDWord); + + SFO_A=(s4Byte)(value32&0x7ff); + SFO_B=(s4Byte)(value32_1&0x7ff); + SFO_C=(s4Byte)(value32_2&0x7ff); + SFO_D=(s4Byte)(value32_3&0x7ff); + + if(SFO_A >1023) + { + SFO_A=SFO_A-2048; + } - case FBEACON: - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 BCN_SHOW\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 BCN_PEER\n")); - break; + if(SFO_B >2047) + { + SFO_B=SFO_B-4096; +} - case FISR: - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 ISR_CHK\n")); - break; + if(SFO_C >2047) + { + SFO_C=SFO_C-4096; + } - case FPHY: - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 PHY_BBR\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 PHY_BBW\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 2 PHY_RFR\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 3 PHY_RFW\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 4 PHY_MACR\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 5 PHY_MACW\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 6 PHY_ALLR\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 7 PHY_ALLW\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 8 PHY_TXPWR\n")); - break; + if(SFO_D >2047) +{ + SFO_D=SFO_D-4096; + } + + SFO_A=SFO_A*312500/1024; + SFO_B=SFO_B*312500/1024; + SFO_C=SFO_C*312500/1024; + SFO_D=SFO_D*312500/1024; - case FMP: - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 MP_RX\n")); - break; - - case FEEPROM: - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 EEPROM_W\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 EFUSE_PG\n")); - break; - - case FPWR: - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 LPS\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 IPS\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 2 PWRSW\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 3 PWRHW\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 4 PWRHAL\n")); - break; + LFO_A=(s4Byte)(value32>>16); + LFO_B=(s4Byte)(value32_1>>16); + LFO_C=(s4Byte)(value32_2>>16); + LFO_D=(s4Byte)(value32_3>>16); - case FDM: - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 WA_IOT\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 DM_PWDB\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 2 DM_Monitor\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 3 DM_DIG\n")); - break; + if(LFO_A >4095) +{ + LFO_A=LFO_A-8192; + } + + if(LFO_B >4095) + { + LFO_B=LFO_B-8192; + } + + if(LFO_C>4095) + { + LFO_C=LFO_C-8192; + } - case FDBG_CTRL: - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 DBG_CTRL_TRACE\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 DBG_CTRL_INBAND_NOISE\n")); + if(LFO_D >4095) + { + LFO_D=LFO_D-8192; + } + LFO_A=LFO_A*312500/4096; + LFO_B=LFO_B*312500/4096; + LFO_C=LFO_C*312500/4096; + LFO_D=LFO_D*312500/4096; + + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d / %d/ %d/ %d", " Value SCFO(Hz) ", SFO_A,SFO_B,SFO_C,SFO_D); + DCMD_Printf(BbDbgBuf); + + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d / %d/ %d/ %d", " ACQ CFO(Hz) ", LFO_A,LFO_B,LFO_C,LFO_D); + DCMD_Printf(BbDbgBuf); + + value32 = ODM_GetBBReg(pDM_Odm, 0xd14 ,bMaskDWord); + value32_1 = ODM_GetBBReg(pDM_Odm, 0xd54 ,bMaskDWord); + value32_2 = ODM_GetBBReg(pDM_Odm, 0xd94 ,bMaskDWord); + value32_3 = ODM_GetBBReg(pDM_Odm, 0xdd4 ,bMaskDWord); + + LFO_A=(s4Byte)(value32>>16); + LFO_B=(s4Byte)(value32_1>>16); + LFO_C=(s4Byte)(value32_2>>16); + LFO_D=(s4Byte)(value32_3>>16); + + if(LFO_A >4095) + { + LFO_A=LFO_A-8192; + } + + if(LFO_B >4095) + { + LFO_B=LFO_B-8192; + } + + if(LFO_C>4095) + { + LFO_C=LFO_C-8192; + } + + if(LFO_D >4095) +{ + LFO_D=LFO_D-8192; + } + LFO_A=LFO_A*312500/4096; + LFO_B=LFO_B*312500/4096; + LFO_C=LFO_C*312500/4096; + LFO_D=LFO_D*312500/4096; + + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d / %d/ %d/ %d", " End CFO(Hz) ", LFO_A,LFO_B,LFO_C,LFO_D); + DCMD_Printf(BbDbgBuf); + + value32 = ODM_GetBBReg(pDM_Odm, 0xf20 ,bMaskDWord); //L SIG + + Tail=(u1Byte)((value32&0xfc0000)>>16); + Parity = (u1Byte)((value32&0x20000)>>16); + Length =(u2Byte)((value32&0x1ffe00)>>8); + rsv = (u1Byte)(value32&0x10); + MCSS=(u1Byte)(value32&0x0f); + + switch(MCSS) + { + case 0x0b: + idx=0; break; - - case FC2H: - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 C2H_Summary\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 C2H_PacketData\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 2 C2H_ContentData\n")); + case 0x0f: + idx=1; + break; + case 0x0a: + idx=2; + break; + case 0x0e: + idx=3; + break; + case 0x09: + idx=4; + break; + case 0x08: + idx=5; + break; + case 0x0c: + idx=6; break; - - case FBT: - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 0 BT_TRACE\n")); - ODM_RT_TRACE(pDM_Odm,COMP_CMD, DBG_LOUD, ("BIT 1 BT_RFPoll\n")); - break; - default: - break; + idx=6; + break; + } -} // DBG_PrintFlagEvent + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "L-SIG"); + DCMD_Printf(BbDbgBuf); + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n Rate:%s", L_rate[idx]); + DCMD_Printf(BbDbgBuf); + + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %x/ %x /%x", " Rsv/Length/Parity",rsv,RX_BW,Length); + DCMD_Printf(BbDbgBuf); + + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "HT-SIG1"); + DCMD_Printf(BbDbgBuf); -extern void DBG_DumpMem(const u1Byte DbgComp, - const u1Byte DbgLevel, - pu1Byte pMem, - u2Byte Len) -{ - u2Byte i; - - for (i=0;i<((Len>>3) + 1);i++) + value32 = ODM_GetBBReg(pDM_Odm, 0xf2c ,bMaskDWord); //HT SIG + if(RX_HT == 1) { - ODM_RT_TRACE(pDM_Odm,DbgComp, DbgLevel, ("%02X %02X %02X %02X %02X %02X %02X %02X\n", - *(pMem+(i*8)), *(pMem+(i*8+1)), *(pMem+(i*8+2)), *(pMem+(i*8+3)), - *(pMem+(i*8+4)), *(pMem+(i*8+5)), *(pMem+(i*8+6)), *(pMem+(i*8+7)))); + + HMCSS=(u1Byte)(value32&0x7F); + HRX_BW = (u1Byte)(value32&0x80); + HLength =(u2Byte)((value32>>8)&0xffff); + } + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %x / %x/ %x", " MCS/BW/Length",HMCSS,HRX_BW,HLength); + DCMD_Printf(BbDbgBuf); + + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "HT-SIG2"); + DCMD_Printf(BbDbgBuf); + + value32 = ODM_GetBBReg(pDM_Odm, 0xf30 ,bMaskDWord); //HT SIG + + if(RX_HT == 1) + { + smooth = (u1Byte)(value32&0x01); + htsound = (u1Byte)(value32&0x02); + rsv=(u1Byte)(value32&0x04); + agg =(u1Byte)(value32&0x08); + stbc =(u1Byte)(value32&0x30); + fec=(u1Byte)(value32&0x40); + sgi=(u1Byte)(value32&0x80); + htltf=(u1Byte)((value32&0x300)>>8); + htcrc8=(u2Byte)((value32&0x3fc00)>>8); + Tail=(u1Byte)((value32&0xfc0000)>>16); + + + } + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %x / %x/ %x/ %x/ %x/ %x", " Smooth/NoSound/Rsv/Aggregate/STBC/LDPC",smooth,htsound,rsv,agg,stbc,fec); + DCMD_Printf(BbDbgBuf); + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %x / %x/ %x/ %x", " SGI/E-HT-LTFs/CRC/Tail",sgi,htltf,htcrc8,Tail); + DCMD_Printf(BbDbgBuf); + + + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "VHT-SIG-A1"); + DCMD_Printf(BbDbgBuf); + value32 = ODM_GetBBReg(pDM_Odm, 0xf2c ,bMaskDWord); //VHT SIG A1 + if(RX_HT == 2) + { + //value32 = ODM_GetBBReg(pDM_Odm, 0xf2c ,bMaskDWord); //VHT SIG A1 + vRX_BW=(u1Byte)(value32&0x03); + vrsv=(u1Byte)(value32&0x04); + vstbc =(u1Byte)(value32&0x08); + vgid = (u1Byte)((value32&0x3f0)>>4); + vNsts = (u1Byte)(((value32&0x1c00)>>8)+1); + vpaid = (u2Byte)(value32&0x3fe); + vtxops =(u1Byte)((value32&0x400000)>>20); + vrsv2 = (u1Byte)((value32&0x800000)>>20); + } + + //rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %x", "F2C", value32); + //DCMD_Printf(BbDbgBuf); + + + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %x / %x/ %x/ %x/ %x/ %x /%x /%x", " BW/Rsv1/STBC/GID/Nsts/PAID/TXOPPS/Rsv2",vRX_BW,vrsv,vstbc,vgid,vNsts,vpaid,vtxops,vrsv2); + DCMD_Printf(BbDbgBuf); + + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "VHT-SIG-A2"); + DCMD_Printf(BbDbgBuf); + value32 = ODM_GetBBReg(pDM_Odm, 0xf30 ,bMaskDWord); //VHT SIG + + + if(RX_HT == 2) +{ + //value32 = ODM_GetBBReg(pDM_Odm, 0xf30 ,bMaskDWord); //VHT SIG + + //sgi=(u1Byte)(value32&0x01); + sgiext =(u1Byte)(value32&0x03); + //fec = (u1Byte)(value32&0x04); + fecext = (u1Byte)(value32&0x0C); + + vMCSS =(u1Byte)(value32&0xf0); + bf = (u1Byte)((value32&0x100)>>8); + vrsv =(u1Byte)((value32&0x200)>>8); + vhtcrc8=(u2Byte)((value32&0x3fc00)>>8); + vTail=(u1Byte)((value32&0xfc0000)>>16); + } + //rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %x", "F30", value32); + //DCMD_Printf(BbDbgBuf); + + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %x / %x/ %x/ %x/ %x/ %x/ %x", " SGI/FEC/MCS/BF/Rsv/CRC/Tail",sgiext,fecext,vMCSS,bf,vrsv,vhtcrc8,vTail); + DCMD_Printf(BbDbgBuf); + + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "VHT-SIG-B"); + DCMD_Printf(BbDbgBuf); + value32 = ODM_GetBBReg(pDM_Odm, 0xf34 ,bMaskDWord); //VHT SIG + { + vLength=(u2Byte)(value32&0x1fffff); + vbrsv = (u1Byte)((value32&0x600000)>>20); + vbTail =(u2Byte)((value32&0x1f800000)>>20); + vbcrc = (u1Byte)((value32&0x80000000)>>28); } + //rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %x", "F34", value32); + //DCMD_Printf(BbDbgBuf); + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %x / %x/ %x/ %x/", " Length/Rsv/Tail/CRC",vLength,vbrsv,vbTail,vbcrc); + DCMD_Printf(BbDbgBuf); + + } -#endif +VOID odm_BasicProfile( + IN PVOID pDM_VOID + ) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + PADAPTER Adapter = pDM_Odm->Adapter; + char* Cut = NULL; + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s \n", "Basic Profile"); + DCMD_Printf(BbDbgBuf); + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s: %s", "IsMPChip", pDM_Odm->bIsMPChip?"Yes":"No"); + DCMD_Printf(BbDbgBuf); + + if(pDM_Odm->CutVersion==ODM_CUT_A) + Cut = "A"; + else if(pDM_Odm->CutVersion==ODM_CUT_B) + Cut = "B"; + else if(pDM_Odm->CutVersion==ODM_CUT_C) + Cut = "C"; + else if(pDM_Odm->CutVersion==ODM_CUT_D) + Cut = "D"; + else if(pDM_Odm->CutVersion==ODM_CUT_E) + Cut = "E"; + else if(pDM_Odm->CutVersion==ODM_CUT_F) + Cut = "F"; + else if(pDM_Odm->CutVersion==ODM_CUT_I) + Cut = "I"; + + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s: %s","Cut Version", Cut); + DCMD_Printf(BbDbgBuf); + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s: %d","PHY REG Version", ODM_GetHWImgVersion(pDM_Odm)); + DCMD_Printf(BbDbgBuf); + rsprintf(BbDbgBuf, BT_TMP_BUF_SIZE, "\r\n %-35s: %d (Subversion: %d)","FW Version", Adapter->MgntInfo.FirmwareVersion, Adapter->MgntInfo.FirmwareSubVersion); + DCMD_Printf(BbDbgBuf); + +} +#endif +VOID +odm_BasicDbgMessage +( + IN PVOID pDM_VOID + ) +{ +#if( DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + PFALSE_ALARM_STATISTICS FalseAlmCnt = &(pDM_Odm->FalseAlmCnt); + pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("odm_BasicDbgMsg==>\n")); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("bLinked = %d, RSSI_Min = %d, CurrentIGI = 0x%x \n", + pDM_Odm->bLinked, pDM_Odm->RSSI_Min, pDM_DigTable->CurIGValue) ); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("Cnt_Cck_fail = %d, Cnt_Ofdm_fail = %d, Total False Alarm = %d\n", + FalseAlmCnt->Cnt_Cck_fail, FalseAlmCnt->Cnt_Ofdm_fail, FalseAlmCnt->Cnt_all)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("RxRate = 0x%x, RSSI_A = %d, RSSI_B = %d\n", + pDM_Odm->RxRate, pDM_Odm->RSSI_A, pDM_Odm->RSSI_B)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("RSSI_C = %d, RSSI_D = %d\n", pDM_Odm->RSSI_C, pDM_Odm->RSSI_D)); +#endif +} diff --git a/hal/OUTSRC/odm_debug.h b/hal/OUTSRC/odm_debug.h index 0a32f85..2fa3750 100644 --- a/hal/OUTSRC/odm_debug.h +++ b/hal/OUTSRC/odm_debug.h @@ -70,32 +70,34 @@ // //----------------------------------------------------------------------------- //BB Functions -#define ODM_COMP_DIG BIT0 -#define ODM_COMP_RA_MASK BIT1 +#define ODM_COMP_DIG BIT0 +#define ODM_COMP_RA_MASK BIT1 #define ODM_COMP_DYNAMIC_TXPWR BIT2 #define ODM_COMP_FA_CNT BIT3 #define ODM_COMP_RSSI_MONITOR BIT4 #define ODM_COMP_CCK_PD BIT5 -#define ODM_COMP_ANT_DIV BIT6 +#define ODM_COMP_ANT_DIV BIT6 #define ODM_COMP_PWR_SAVE BIT7 #define ODM_COMP_PWR_TRAIN BIT8 #define ODM_COMP_RATE_ADAPTIVE BIT9 -#define ODM_COMP_PATH_DIV BIT10 -#define ODM_COMP_PSD BIT11 +#define ODM_COMP_PATH_DIV BIT10 +#define ODM_COMP_PSD BIT11 #define ODM_COMP_DYNAMIC_PRICCA BIT12 -#define ODM_COMP_RXHP BIT13 +#define ODM_COMP_RXHP BIT13 #define ODM_COMP_MP BIT14 -#define ODM_COMP_DYNAMIC_ATC BIT15 +#define ODM_COMP_CFO_TRACKING BIT15 +#define ODM_COMP_ACS BIT16 +#define PHYDM_COMP_ADAPTIVITY BIT17 //MAC Functions -#define ODM_COMP_EDCA_TURBO BIT16 -#define ODM_COMP_EARLY_MODE BIT17 +#define ODM_COMP_EDCA_TURBO BIT20 +#define ODM_COMP_EARLY_MODE BIT21 //RF Functions #define ODM_COMP_TX_PWR_TRACK BIT24 #define ODM_COMP_RX_GAIN_TRACK BIT25 -#define ODM_COMP_CALIBRATION BIT26 +#define ODM_COMP_CALIBRATION BIT26 //Common Functions #define ODM_COMP_COMMON BIT30 -#define ODM_COMP_INIT BIT31 +#define ODM_COMP_INIT BIT31 /*------------------------Export Marco Definition---------------------------*/ #if (DM_ODM_SUPPORT_TYPE == ODM_WIN) @@ -117,6 +119,22 @@ #define ODM_RT_TRACE(pDM_Odm, comp, level, fmt) \ if(((comp) & pDM_Odm->DebugComponents) && (level <= pDM_Odm->DebugLevel || level == ODM_DBG_SERIOUS)) \ { \ + if(pDM_Odm->SupportICType == ODM_RTL8192C) \ + DbgPrint("[ODM-92C] "); \ + else if(pDM_Odm->SupportICType == ODM_RTL8192D) \ + DbgPrint("[ODM-92D] "); \ + else if(pDM_Odm->SupportICType == ODM_RTL8723A) \ + DbgPrint("[ODM-8723A] "); \ + else if(pDM_Odm->SupportICType == ODM_RTL8188E) \ + DbgPrint("[ODM-8188E] "); \ + else if(pDM_Odm->SupportICType == ODM_RTL8192E) \ + DbgPrint("[ODM-8192E] "); \ + else if(pDM_Odm->SupportICType == ODM_RTL8812) \ + DbgPrint("[ODM-8812] "); \ + else if(pDM_Odm->SupportICType == ODM_RTL8821) \ + DbgPrint("[ODM-8821] "); \ + else if(pDM_Odm->SupportICType == ODM_RTL8814A) \ + DbgPrint("[ODM-8814] "); \ RT_PRINTK fmt; \ } @@ -161,732 +179,11 @@ VOID -ODM_InitDebugSetting( - IN PDM_ODM_T pDM_Odm - ); - - - -#if 0 -#if DBG -#define DbgPrint printk - -#define PRINT_DATA(_TitleString, _HexData, _HexDataLen) \ - { \ - char *szTitle = _TitleString; \ - pu1Byte pbtHexData = _HexData; \ - u4Byte u4bHexDataLen = _HexDataLen; \ - u4Byte __i; \ - DbgPrint("%s", szTitle); \ - for (__i=0;__i=' ' &&_ch<='~' ) // I want to see ASCII 33 to 126 only. Otherwise, I print '?'. Annie, 2005-11-22. - -#define RT_PRINT_STR(_Comp, _Level, _TitleString, _Ptr, _Len) \ - if(((_Comp) & ODM_GlobalDebugComponents) && (_Level <= ODM_GlobalDebugLevel)) \ - { \ - int __i; \ - u1Byte buffer[MAX_STR_LEN]; \ - int length = (_Len\n", _Len, buffer); \ - } - -#else // of #if DBG -#define DbgPrint(...) -#define PRINT_DATA(_TitleString, _HexData, _HexDataLen) -#define RT_PRINT_DATA(_Comp, _Level, _TitleString, _HexData, _HexDataLen) -#define RT_PRINT_ADDR(_Comp, _Level, _TitleString, _Ptr) -#define RT_PRINT_ADDRS(_Comp, _Level, _TitleString, _Ptr, _AddNum) -#define RT_PRINT_STR(_Comp, _Level, _TitleString, _Ptr, _Len) -#endif // of #if DBG - -#endif - - -#if 0 -/* Define debug print header for every service module.*/ -typedef struct tag_ODM_DBGP_Service_Module_Header_Name_Structure -{ - const char *pMANS; - const char *pRTOS; - const char *pALM; - const char *pPEM; - const char *pCMPK; - const char *pRAPD; - const char *pTXPB; - const char *pQUMG; -}ODM_DBGP_HEAD_T; - - -/* Define different debug flag for dedicated service modules in debug flag array. */ -// Each module has independt 32 bit debug flag you cnn define the flag as yout require. -typedef enum tag_ODM_DBGP_Flag_Type_Definition -{ - ODM_FTX = 0, - ODM_FRX , - ODM_FPHY , - ODM_FPWR , - ODM_FDM , - ODM_FC2H , - ODM_FBT , - ODM_DBGP_TYPE_MAX -}ODM_DBGP_FLAG_E; - - -// Define TX relative debug bit --> FTX -#define ODM_TX_DESC BIT0 -#define ODM_TX_DESC_TID BIT1 -#define ODM_TX_PATH BIT2 - -// Define RX relative debug bit --> FRX -#define ODM_RX_DATA BIT0 -#define ODM_RX_PHY_STS BIT1 -#define ODM_RX_PHY_SS BIT2 -#define ODM_RX_PHY_SQ BIT3 -#define ODM_RX_PHY_ASTS BIT4 -#define ODM_RX_ERR_LEN BIT5 -#define ODM_RX_DEFRAG BIT6 -#define ODM_RX_ERR_RATE BIT7 -#define ODM_RX_PATH BIT8 -#define ODM_RX_BEACON BIT9 - -// Define PHY-BB/RF/MAC check module bit --> FPHY -#define ODM_PHY_BBR BIT0 -#define ODM_PHY_BBW BIT1 -#define ODM_PHY_RFR BIT2 -#define ODM_PHY_RFW BIT3 -#define ODM_PHY_MACR BIT4 -#define ODM_PHY_MACW BIT5 -#define ODM_PHY_ALLR BIT6 -#define ODM_PHY_ALLW BIT7 -#define ODM_PHY_TXPWR BIT8 -#define ODM_PHY_PWRDIFF BIT9 -#define ODM_PHY_SICR BIT10 -#define ODM_PHY_SICW BIT11 - - - - -extern u4Byte ODM_GlobalDebugLevel; - - -#if DBG -extern u8Byte ODM_GlobalDebugComponents; -#endif -#endif -#if 0 - -//----------------------------------------------------------------------------- -// Define the debug levels -// -// 1. DBG_TRACE and DBG_LOUD are used for normal cases. -// So that, they can help SW engineer to develope or trace states changed -// and also help HW enginner to trace every operation to and from HW, -// e.g IO, Tx, Rx. -// -// 2. DBG_WARNNING and DBG_SERIOUS are used for unusual or error cases, -// which help us to debug SW or HW. -// -//----------------------------------------------------------------------------- -// -// Never used in a call to ODM_RT_TRACE(pDM_Odm,)! -// -#define DBG_OFF 0 - -// -// Deprecated! Don't use it! -// TODO: fix related debug message! -// -//#define DBG_SEC 1 - -// -// Fatal bug. -// For example, Tx/Rx/IO locked up, OS hangs, memory access violation, -// resource allocation failed, unexpected HW behavior, HW BUG and so on. -// -#define DBG_SERIOUS 2 - -// -// Abnormal, rare, or unexpeted cases. -// For example, IRP/Packet/OID canceled, device suprisely unremoved and so on. -// -#define DBG_WARNING 3 - -// -// Normal case with useful information about current SW or HW state. -// For example, Tx/Rx descriptor to fill, Tx/Rx descriptor completed status, -// SW protocol state change, dynamic mechanism state change and so on. -// -#define DBG_LOUD 4 - -// -// Normal case with detail execution flow or information. -// -#define DBG_TRACE 5 - - - -//----------------------------------------------------------------------------- -// Define the tracing components -// -//----------------------------------------------------------------------------- -#define COMP_TRACE BIT0 // For function call tracing. -#define COMP_DBG BIT1 // Only for temporary debug message. -#define COMP_INIT BIT2 // during driver initialization / halt / reset. -#define COMP_OID_QUERY BIT3 // Query OID. -#define COMP_OID_SET BIT4 // Set OID. -#define COMP_RECV BIT5 // Reveive part data path. -#define COMP_SEND BIT6 // Send part path. -#define COMP_IO BIT7 // I/O Related. Added by Annie, 2006-03-02. -#define COMP_POWER BIT8 // 802.11 Power Save mode or System/Device Power state related. -#define COMP_MLME BIT9 // 802.11 link related: join/start BSS, leave BSS. -#define COMP_SCAN BIT10 // For site survey. -#define COMP_SYSTEM BIT11 // For general platform function. -#define COMP_SEC BIT12 // For Security. -#define COMP_AP BIT13 // For AP mode related. -#define COMP_TURBO BIT14 // For Turbo Mode related. By Annie, 2005-10-21. -#define COMP_QOS BIT15 // For QoS. -#define COMP_AUTHENTICATOR BIT16 // For AP mode Authenticator. Added by Annie, 2006-01-30. -#define COMP_BEACON BIT17 // For Beacon related, by rcnjko. -#define COMP_ANTENNA BIT18 // For Antenna diversity related, by rcnjko. -#define COMP_RATE BIT19 // For Rate Adaptive mechanism, 2006.07.02, by rcnjko. #define COMP_EVENTS 0x00000080 // Event handling -#define COMP_EVENTS BIT20 // Event handling -#define COMP_FPGA BIT21 // For FPGA verfication -#define COMP_RM BIT22 // For Radio Measurement. -#define COMP_MP BIT23 // For mass production test, by shien chang, 2006.07.13 -#define COMP_RXDESC BIT24 // Show Rx desc information for SD3 debug. Added by Annie, 2006-07-15. -#define COMP_CKIP BIT25 // For CCX 1 S13: CKIP. Added by Annie, 2006-08-14. -#define COMP_DIG BIT26 // For DIG, 2006.09.25, by rcnjko. -#define COMP_TXAGC BIT27 // For Tx power, 060928, by rcnjko. -#define COMP_HIPWR BIT28 // For High Power Mechanism, 060928, by rcnjko. -#define COMP_HALDM BIT29 // For HW Dynamic Mechanism, 061010, by rcnjko. -#define COMP_RSNA BIT30 // For RSNA IBSS , 061201, by CCW. -#define COMP_INDIC BIT31 // For link indication -#define COMP_LED BIT32 // For LED. -#define COMP_RF BIT33 // For RF. -//1!!!!!!!!!!!!!!!!!!!!!!!!!!! -//1//1Attention Please!!!<11n or 8190 specific code should be put below this line> -//1!!!!!!!!!!!!!!!!!!!!!!!!!!! - -#define COMP_HT BIT34 // For 802.11n HT related information. by Emily 2006-8-11 -#define COMP_POWER_TRACKING BIT35 //FOR 8190 TX POWER TRACKING -#define COMP_RX_REORDER BIT36 // 8190 Rx Reorder -#define COMP_AMSDU BIT37 // For A-MSDU Debugging -#define COMP_WPS BIT38 //WPS Debug Message -#define COMP_RATR BIT39 -#define COMP_RESET BIT40 -// For debug command to print on dbgview!! -#define COMP_CMD BIT41 -#define COMP_EFUSE BIT42 -#define COMP_MESH_INTERWORKING BIT43 -#define COMP_CCX BIT44 //CCX Debug Flag -#define COMP_IOCTL BIT45 // IO Control -#define COMP_GP BIT46 // For generic parser. -#define COMP_TXAGG BIT47 -#define COMP_HVL BIT48 // For Ndis 6.2 Context Swirch and Hardware Virtualiztion Layer -#define COMP_TEST BIT49 -#define COMP_BB_POWERSAVING BIT50 -#define COMP_SWAS BIT51 // For SW Antenna Switch -#define COMP_P2P BIT52 -#define COMP_MUX BIT53 -#define COMP_FUNC BIT54 -#define COMP_TDLS BIT55 -#define COMP_OMNIPEEK BIT56 -#define COMP_DUALMACSWITCH BIT60 // 2010/12/27 Add for Dual mac mode debug -#define COMP_EASY_CONCURRENT BIT61 // 2010/12/27 Add for easy cncurrent mode debug -#define COMP_PSD BIT63 //2011/3/9 Add for WLAN PSD for BT AFH - -#define COMP_DFS BIT62 - -#define COMP_ALL UINT64_C(0xFFFFFFFFFFFFFFFF) // All components -// For debug print flag to use -/*------------------------------Define structure----------------------------*/ -/* 2007/07/13 MH *//*------For DeBuG Print modeue------*/ - -/* Defnie structure to store different debug flag variable. Every debug flag - is a UINT32 integer and you can assign 32 different events. */ -typedef struct tag_DBGP_Debug_Flag_Structure -{ - u4Byte Mans; /* Main Scheduler module. */ - u4Byte Rtos; /* RTOS module. */ - u4Byte Alarm; /* Alarm module. */ - u4Byte Pm; /* Performance monitor module. */ -}DBGP_FLAG_T; - -/* Define debug print header for every service module.*/ -typedef struct tag_DBGP_Service_Module_Header_Name_Structure -{ - const char *pMANS; - const char *pRTOS; - const char *pALM; - const char *pPEM; - const char *pCMPK; - const char *pRAPD; - const char *pTXPB; - const char *pQUMG; -}DBGP_HEAD_T; - - -/* Define different debug flag for dedicated service modules in debug flag array. */ -// Each module has independt 32 bit debug flag you cnn define the flag as yout require. -typedef enum tag_DBGP_Flag_Type_Definition -{ - FQoS = 0, - FTX = 1, - FRX = 2, - FSEC = 3, - FMGNT = 4, - FMLME = 5, - FRESOURCE = 6, - FBEACON = 7, - FISR = 8, - FPHY = 9, - FMP = 10, - FEEPROM = 11, - FPWR = 12, - FDM = 13, - FDBG_CTRL = 14, - FC2H = 15, - FBT = 16, - FINIT = 17, - FIOCTL = 18, - FSHORT_CUT = 19, - DBGP_TYPE_MAX -}DBGP_FLAG_E; - - -// Define Qos Relative debug flag bit --> FQoS -#define QoS_INIT BIT0 -#define QoS_VISTA BIT1 - -// Define TX relative debug bit --> FTX -#define TX_DESC BIT0 -#define TX_DESC_TID BIT1 -#define TX_PATH BIT2 - -// Define RX relative debug bit --> FRX -#define RX_DATA BIT0 -#define RX_PHY_STS BIT1 -#define RX_PHY_SS BIT2 -#define RX_PHY_SQ BIT3 -#define RX_PHY_ASTS BIT4 -#define RX_ERR_LEN BIT5 -#define RX_DEFRAG BIT6 -#define RX_ERR_RATE BIT7 -#define RX_PATH BIT8 -#define RX_BEACON BIT9 - -// Define Security relative debug bit --> FSEC - -// Define MGNT relative debug bit --> FMGNT - -// Define MLME relative debug bit --> FMLME -#define MEDIA_STS BIT0 -#define LINK_STS BIT1 - -// Define OS resource check module bit --> FRESOURCE -#define OS_CHK BIT0 - -// Define beacon content check module bit --> FBEACON -#define BCN_SHOW BIT0 -#define BCN_PEER BIT1 - -// Define ISR/IMR check module bit --> FISR -#define ISR_CHK BIT0 - -// Define PHY-BB/RF/MAC check module bit --> FPHY -#define PHY_BBR BIT0 -#define PHY_BBW BIT1 -#define PHY_RFR BIT2 -#define PHY_RFW BIT3 -#define PHY_MACR BIT4 -#define PHY_MACW BIT5 -#define PHY_ALLR BIT6 -#define PHY_ALLW BIT7 -#define PHY_TXPWR BIT8 -#define PHY_PWRDIFF BIT9 -#define PHY_SICR BIT10 -#define PHY_SICW BIT11 - -// Define MPT driver check module bit --> FMP -#define MP_RX BIT0 -#define MP_SWICH_CH BIT1 - -// Define EEPROM and EFUSE check module bit --> FEEPROM -#define EEPROM_W BIT0 -#define EFUSE_PG BIT1 -#define EFUSE_READ_ALL BIT2 -#define EFUSE_ANALYSIS BIT3 -#define EFUSE_PG_DETAIL BIT4 - -// Define power save check module bit --> FPWR -#define LPS BIT0 -#define IPS BIT1 -#define PWRSW BIT2 -#define PWRHW BIT3 -#define PWRHAL BIT4 - -// Define Dynamic Mechanism check module bit --> FDM -#define WA_IOT BIT0 -#define DM_PWDB BIT1 -#define DM_Monitor BIT2 -#define DM_DIG BIT3 -#define DM_EDCA_Turbo BIT4 -#define DM_BT30 BIT5 - -// Define Dbg Control module bit --> FDBG_CTRL -#define DBG_CTRL_TRACE BIT0 -#define DBG_CTRL_INBAND_NOISE BIT1 - -// Define FW C2H Cmd check module bit --> FC2H -#define C2H_Summary BIT0 -#define C2H_PacketData BIT1 -#define C2H_ContentData BIT2 -// Define BT Cmd check module bit --> FBT -#define BT_TRACE BIT0 -#define BT_RFPoll BIT1 - -// Define init check for module bit --> FINIT -#define INIT_EEPROM BIT0 -#define INIT_TxPower BIT1 -#define INIT_IQK BIT2 -#define INIT_RF BIT3 - -// Define IOCTL Cmd check module bit --> FIOCTL -// section 1 : IRP related -#define IOCTL_IRP BIT0 -#define IOCTL_IRP_DETAIL BIT1 -#define IOCTL_IRP_STATISTICS BIT2 -#define IOCTL_IRP_HANDLE BIT3 -// section 2 : HCI command/event -#define IOCTL_BT_HCICMD BIT8 -#define IOCTL_BT_HCICMD_DETAIL BIT9 -#define IOCTL_BT_HCICMD_EXT BIT10 -#define IOCTL_BT_EVENT BIT11 -#define IOCTL_BT_EVENT_DETAIL BIT12 -#define IOCTL_BT_EVENT_PERIODICAL BIT13 -// section 3 : BT tx/rx data and throughput -#define IOCTL_BT_TX_ACLDATA BIT16 -#define IOCTL_BT_TX_ACLDATA_DETAIL BIT17 -#define IOCTL_BT_RX_ACLDATA BIT18 -#define IOCTL_BT_RX_ACLDATA_DETAIL BIT19 -#define IOCTL_BT_TP BIT20 -// section 4 : BT connection state machine. -#define IOCTL_STATE BIT21 -#define IOCTL_BT_LOGO BIT22 -// section 5 : BT function trace -#define IOCTL_CALLBACK_FUN BIT24 -#define IOCTL_PARSE_BT_PKT BIT25 -#define IOCTL_BT_TX_PKT BIT26 -#define IOCTL_BT_FLAG_MON BIT27 - -// -// Define init check for module bit --> FSHORT_CUT -// 2011/07/20 MH Add for short but definition. -// -#define SHCUT_TX BIT0 -#define SHCUT_RX BIT1 - - -/* 2007/07/13 MH *//*------For DeBuG Print modeue------*/ -/*------------------------------Define structure----------------------------*/ - - -/*------------------------Export Marco Definition---------------------------*/ -#if (DM_ODM_SUPPORT_TYPE != ODM_WIN) -#define RT_PRINTK(fmt, args...) printk( "%s(): " fmt, __FUNCTION__, ## args); - -#if DBG -#define ODM_RT_TRACE(pDM_Odm,comp, level, fmt) \ - if(((comp) & GlobalDebugComponents) && (level <= GlobalDebugLevel)) \ - { \ - RT_PRINTK fmt; \ - } - -#define RT_TRACE_F(comp, level, fmt) \ - if(((comp) & GlobalDebugComponents) && (level <= GlobalDebugLevel)) \ - { \ - RT_PRINTK fmt; \ - } - -#define RT_ASSERT(expr,fmt) \ - if(!(expr)) { \ - printk( "Assertion failed! %s at ......\n", #expr); \ - printk( " ......%s,%s,line=%d\n",__FILE__,__FUNCTION__,__LINE__); \ - } -#define dbg_enter() { printk("==> %s\n", __FUNCTION__); } -#define dbg_exit() { printk("<== %s\n", __FUNCTION__); } -#define dbg_trace(str) { printk("%s:%s\n", __FUNCTION__, str); } -#else -#define ODM_RT_TRACE(pDM_Odm,comp, level, fmt) -#define RT_TRACE_F(comp, level, fmt) -#define RT_ASSERT(expr, fmt) -#define dbg_enter() -#define dbg_exit() -#define dbg_trace(str) -#endif - -#if DBG -#define DbgPrint printk - -#define PRINT_DATA(_TitleString, _HexData, _HexDataLen) \ - { \ - char *szTitle = _TitleString; \ - pu1Byte pbtHexData = _HexData; \ - u4Byte u4bHexDataLen = _HexDataLen; \ - u4Byte __i; \ - DbgPrint("%s", szTitle); \ - for (__i=0;__i=' ' &&_ch<='~' ) // I want to see ASCII 33 to 126 only. Otherwise, I print '?'. Annie, 2005-11-22. - -#define RT_PRINT_STR(_Comp, _Level, _TitleString, _Ptr, _Len) \ - if(((_Comp) & GlobalDebugComponents) && (_Level <= GlobalDebugLevel)) \ - { \ - int __i; \ - u1Byte buffer[MAX_STR_LEN]; \ - int length = (_Len\n", _Len, buffer); \ - } - -#else // of #if DBG -#define DbgPrint(...) -#define PRINT_DATA(_TitleString, _HexData, _HexDataLen) -#define RT_PRINT_DATA(_Comp, _Level, _TitleString, _HexData, _HexDataLen) -#define RT_PRINT_ADDR(_Comp, _Level, _TitleString, _Ptr) -#define RT_PRINT_ADDRS(_Comp, _Level, _TitleString, _Ptr, _AddNum) -#define RT_PRINT_STR(_Comp, _Level, _TitleString, _Ptr, _Len) -#endif // of #if DBG - - - -#endif // #if (DM_ODM_SUPPORT_TYPE != ODM_WIN) - -#define DEBUG_PRINT 1 - -// Please add new OS's print API by yourself - -//#if (RT_PLATFORM==PLATFORM_WINDOWS) -#if (DEBUG_PRINT == 1) && DBG -#define RT_DISP(dbgtype, dbgflag, printstr)\ -{\ - if (DBGP_Type[dbgtype] & dbgflag)\ - {\ - DbgPrint printstr;\ - }\ -} - -#define RT_DISP_ADDR(dbgtype, dbgflag, printstr, _Ptr)\ -{\ - if (DBGP_Type[dbgtype] & dbgflag)\ - {\ - int __i; \ - pu1Byte ptr = (pu1Byte)_Ptr; \ - DbgPrint printstr; \ - DbgPrint(" "); \ - for( __i=0; __i<6; __i++ ) \ - DbgPrint("%02X%s", ptr[__i], (__i==5)?"":"-"); \ - DbgPrint("\n"); \ - }\ -} - -#define RT_DISP_DATA(dbgtype, dbgflag, _TitleString, _HexData, _HexDataLen)\ -{\ - if (DBGP_Type[dbgtype] & dbgflag)\ - {\ - int __i; \ - pu1Byte ptr = (pu1Byte)_HexData; \ - DbgPrint(_TitleString); \ - for( __i=0; __i<(int)_HexDataLen; __i++ ) \ - { \ - DbgPrint("%02X%s", ptr[__i], (((__i + 1) % 4) == 0)?" ":" ");\ - if (((__i + 1) % 16) == 0) DbgPrint("\n");\ - } \ - DbgPrint("\n"); \ - }\ -} - -#define FunctionIn(_comp) ODM_RT_TRACE(pDM_Odm,(_comp), DBG_LOUD, ("==========> %s\n", __FUNCTION__)) -#define FunctionOut(_comp) ODM_RT_TRACE(pDM_Odm,(_comp), DBG_LOUD, ("<========== %s\n", __FUNCTION__)) - - -#else - -#define RT_DISP(dbgtype, dbgflag, printstr) -#define RT_DISP_ADDR(dbgtype, dbgflag, printstr, _Ptr) -#define RT_DISP_DATA(dbgtype, dbgflag, _TitleString, _HexData, _HexDataLen) - -#define FunctionIn(_comp) -#define FunctionOut(_comp) -#endif -/*------------------------Export Marco Definition---------------------------*/ - - -/*------------------------Export global variable----------------------------*/ -extern u4Byte DBGP_Type[DBGP_TYPE_MAX]; -extern DBGP_HEAD_T DBGP_Head; - -/*------------------------Export global variable----------------------------*/ - - -/*--------------------------Exported Function prototype---------------------*/ -extern void DBGP_Flag_Init(void); -extern void DBG_PrintAllFlag(void); -extern void DBG_PrintAllComp(void); -extern void DBG_PrintFlagEvent(u1Byte DbgFlag); -extern void DBG_DumpMem(const u1Byte DbgComp, - const u1Byte DbgLevel, - pu1Byte pMem, - u2Byte Len); - -/*--------------------------Exported Function prototype---------------------*/ - - - - - - - - - -extern u4Byte GlobalDebugLevel; -extern u8Byte GlobalDebugComponents; - - -#endif - +ODM_InitDebugSetting(IN PDM_ODM_T pDM_Odm); +#define BB_TMP_BUF_SIZE 100 +VOID odm_BB_Debug_Info(IN PDM_ODM_T pDM_Odm); +VOID odm_BasicProfile(IN PVOID pDM_VOID); +VOID odm_BasicDbgMessage( IN PVOID pDM_VOID); #endif // __ODM_DBG_H__ diff --git a/hal/OUTSRC/odm_interface.c b/hal/OUTSRC/odm_interface.c index 555fd7d..914d60c 100644 --- a/hal/OUTSRC/odm_interface.c +++ b/hal/OUTSRC/odm_interface.c @@ -22,7 +22,7 @@ // include files //============================================================ - +#include "Mp_Precomp.h" #include "odm_precomp.h" // @@ -177,12 +177,9 @@ ODM_GetMACReg( ) { #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - return PHY_QueryMacReg(pDM_Odm->priv, RegAddr, BitMask); -#elif(DM_ODM_SUPPORT_TYPE & (ODM_WIN)) - PADAPTER Adapter = pDM_Odm->Adapter; - return PHY_QueryMacReg(Adapter, RegAddr, BitMask); -#elif(DM_ODM_SUPPORT_TYPE & (ODM_CE)) - return PHY_QueryBBReg(pDM_Odm->Adapter, RegAddr, BitMask); + return PHY_QueryBBReg(pDM_Odm->priv, RegAddr, BitMask); +#elif(DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) + return PHY_QueryMacReg(pDM_Odm->Adapter, RegAddr, BitMask); #endif } @@ -304,7 +301,7 @@ ODM_MoveMemory( ) { #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - + memcpy(pDest, pSrc, Length); #elif (DM_ODM_SUPPORT_TYPE & ODM_CE ) _rtw_memcpy(pDest, pSrc, Length); #elif(DM_ODM_SUPPORT_TYPE & ODM_WIN) @@ -312,6 +309,20 @@ ODM_MoveMemory( #endif } +void ODM_Memory_Set + (IN PDM_ODM_T pDM_Odm, + IN PVOID pbuf, + IN s1Byte value, + IN u4Byte length) +{ +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + +#elif (DM_ODM_SUPPORT_TYPE & ODM_CE ) + _rtw_memset(pbuf,value, length); +#elif(DM_ODM_SUPPORT_TYPE & ODM_WIN) + PlatformFillMemory(pbuf,length,value); +#endif +} s4Byte ODM_CompareMemory( IN PDM_ODM_T pDM_Odm, IN PVOID pBuf1, @@ -342,7 +353,8 @@ ODM_AcquireSpinLock( #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) #elif(DM_ODM_SUPPORT_TYPE & ODM_CE) - + PADAPTER Adapter = pDM_Odm->Adapter; + rtw_odm_acquirespinlock(Adapter, type); #elif(DM_ODM_SUPPORT_TYPE & ODM_WIN) PADAPTER Adapter = pDM_Odm->Adapter; PlatformAcquireSpinLock(Adapter, type); @@ -357,7 +369,8 @@ ODM_ReleaseSpinLock( #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) #elif (DM_ODM_SUPPORT_TYPE & ODM_CE ) - + PADAPTER Adapter = pDM_Odm->Adapter; + rtw_odm_releasespinlock(Adapter, type); #elif(DM_ODM_SUPPORT_TYPE & ODM_WIN) PADAPTER Adapter = pDM_Odm->Adapter; PlatformReleaseSpinLock(Adapter, type); @@ -534,7 +547,7 @@ ODM_SetTimer( ) { #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) - mod_timer(pTimer, jiffies + (msDelay+9)/10); + mod_timer(pTimer, jiffies + RTL_MILISECONDS_TO_JIFFIES(msDelay)); #elif(DM_ODM_SUPPORT_TYPE & ODM_CE) _set_timer(pTimer,msDelay ); //ms #elif(DM_ODM_SUPPORT_TYPE & ODM_WIN) @@ -554,9 +567,10 @@ ODM_InitializeTimer( ) { #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + init_timer(pTimer); pTimer->function = CallBackFunc; pTimer->data = (unsigned long)pDM_Odm; - init_timer(pTimer); + mod_timer(pTimer, jiffies+RTL_MILISECONDS_TO_JIFFIES(10)); #elif(DM_ODM_SUPPORT_TYPE & ODM_CE) PADAPTER Adapter = pDM_Odm->Adapter; _init_timer(pTimer,Adapter->pnetdev,CallBackFunc,pDM_Odm); @@ -614,81 +628,152 @@ ODM_ReleaseTimer( // // ODM FW relative API. // -#if (DM_ODM_SUPPORT_TYPE & ODM_WIN) +#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) VOID ODM_FillH2CCmd( - IN PADAPTER Adapter, - IN u1Byte ElementID, - IN u4Byte CmdLen, - IN pu1Byte pCmdBuffer + IN PDM_ODM_T pDM_Odm, + IN u1Byte ElementID, + IN u4Byte CmdLen, + IN pu1Byte pCmdBuffer ) { - if(IS_HARDWARE_TYPE_JAGUAR(Adapter)) - { - switch(ElementID) - { - case ODM_H2C_RSSI_REPORT: - FillH2CCmd8812(Adapter, H2C_8812_RSSI_REPORT, CmdLen, pCmdBuffer); - break; - default: - break; - } + PADAPTER Adapter = pDM_Odm->Adapter; - } - else if(IS_HARDWARE_TYPE_8192E(Adapter)) + if(pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) { - switch(ElementID) - { - case ODM_H2C_RSSI_REPORT: - FillH2CCmd8812(Adapter, H2C_8812_RSSI_REPORT, CmdLen, pCmdBuffer); - break; - default: - break; - } - } - else if(IS_HARDWARE_TYPE_8723B(Adapter)) - { - // - // We should take RTL8723B into consideration, 2012.10.08 - // switch(ElementID) { case ODM_H2C_RSSI_REPORT: - FillH2CCmd8723B(Adapter, H2C_8723B_RSSI_REPORT, CmdLen, pCmdBuffer); - break; - + +#if(DM_ODM_SUPPORT_TYPE & ODM_WIN) + FillH2CCmd8812(Adapter, H2C_8812_RSSI_REPORT, CmdLen, pCmdBuffer); +#else + #if((RTL8812A_SUPPORT==1) ||(RTL8821A_SUPPORT==1)) + FillH2CCmd_8812(Adapter, H2C_8812_RSSI_REPORT, CmdLen, pCmdBuffer); + #endif +#endif + break; + case ODM_H2C_IQ_CALIBRATION: +#if(DM_ODM_SUPPORT_TYPE & ODM_WIN) + FillH2CCmd8812(Adapter, H2C_8812_IQ_CALIBRATION, CmdLen, pCmdBuffer); +#else + #if((RTL8812A_SUPPORT==1) ||(RTL8821A_SUPPORT==1)) + FillH2CCmd_8812(Adapter, H2C_8812_IQ_CALIBRATION, CmdLen, pCmdBuffer); + #endif +#endif + break; default: - break; + break; } } - else if(IS_HARDWARE_TYPE_8188E(Adapter)) + else if(pDM_Odm->SupportICType == ODM_RTL8192E) { switch(ElementID) { - case ODM_H2C_PSD_RESULT: - FillH2CCmd88E(Adapter, H2C_88E_PSD_RESULT, CmdLen, pCmdBuffer); - break; - case ODM_H2C_RSSI_REPORT: - if(IS_VENDOR_8188E_I_CUT_SERIES(Adapter)) - FillH2CCmd88E(Adapter, H2C_88E_RSSI_REPORT, CmdLen, pCmdBuffer); - break; - default: - break; + case ODM_H2C_RSSI_REPORT: +#if(DM_ODM_SUPPORT_TYPE & ODM_WIN) + FillH2CCmd8812(Adapter, H2C_8812_RSSI_REPORT, CmdLen, pCmdBuffer); +#else + #if(RTL8192E_SUPPORT==1) + FillH2CCmd_8192E(Adapter, H2C_8192E_RSSI_REPORT, CmdLen, pCmdBuffer); + #endif +#endif + break; + default: + break; + } + } + else if(pDM_Odm->SupportICType == ODM_RTL8723B) + { + switch(ElementID) + { + case ODM_H2C_RSSI_REPORT: +#if(DM_ODM_SUPPORT_TYPE & ODM_WIN) + FillH2CCmd8723B(Adapter, H2C_8723B_RSSI_REPORT, CmdLen, pCmdBuffer); +#else + #if(RTL8723B_SUPPORT==1) + FillH2CCmd8723B(Adapter, H2C_8723B_RSSI_SETTING, CmdLen, pCmdBuffer); + #endif +#endif + break; + case ODM_H2C_WIFI_CALIBRATION: +#if(DM_ODM_SUPPORT_TYPE & ODM_WIN) + FillH2CCmd8723B(Adapter, H2C_8723B_WIFI_CALIBRATION, CmdLen, pCmdBuffer); +#else + #if(RTL8723B_SUPPORT==1) + FillH2CCmd8723B(Adapter, H2C_8723B_BT_WLAN_CALIBRATION, CmdLen, pCmdBuffer); + #endif +#endif + break; + default: + break; + } + + } + else if(pDM_Odm->SupportICType == ODM_RTL8188E) + { + switch(ElementID) + { + case ODM_H2C_RSSI_REPORT: + //if((pDM_Odm->CutVersion == ODM_CUT_I) && (!pDM_Odm->RaSupport88E)){ + if(!pDM_Odm->RaSupport88E){ +#if(DM_ODM_SUPPORT_TYPE & ODM_WIN) + FillH2CCmd88E(Adapter, H2C_88E_RSSI_REPORT, CmdLen, pCmdBuffer); +#else + #if(RTL8188E_SUPPORT==1) + FillH2CCmd_88E(Adapter, H2C_RSSI_REPORT, CmdLen, pCmdBuffer); + #endif +#endif + } + break; + default: + break; } } +#if(DM_ODM_SUPPORT_TYPE & ODM_CE) + else if(pDM_Odm->SupportICType == ODM_RTL8723A) + { + switch(ElementID) + { + case ODM_H2C_RSSI_REPORT: + #if(RTL8723A_SUPPORT==1) + FillH2CCmd(Adapter, RSSI_SETTING_EID, CmdLen, pCmdBuffer); + #endif + break; + default: + break; + } + } + else if(pDM_Odm->SupportICType == ODM_RTL8192D) + { + switch(ElementID) + { + case ODM_H2C_RSSI_REPORT: + #if(RTL8192D_SUPPORT==1) + FillH2CCmd92D(Adapter, H2C_RSSI_REPORT, CmdLen, pCmdBuffer); + #endif + break; + default: + break; + } + } +#endif else { switch(ElementID) { - case ODM_H2C_RSSI_REPORT: - FillH2CCmd92C(Adapter, H2C_RSSI_REPORT, CmdLen, pCmdBuffer); - break; - case ODM_H2C_PSD_RESULT: - FillH2CCmd92C(Adapter, H2C_92C_PSD_RESULT, CmdLen, pCmdBuffer); - break; - default: - break; + case ODM_H2C_RSSI_REPORT: +#if(DM_ODM_SUPPORT_TYPE & ODM_WIN) + FillH2CCmd92C(Adapter, H2C_RSSI_REPORT, CmdLen, pCmdBuffer); +#else + #if(RTL8192C_SUPPORT==1) + rtl8192c_FillH2CCmd(Adapter, RSSI_SETTING_EID, CmdLen, pCmdBuffer); + #endif +#endif + break; + default: + break; } } } @@ -718,7 +803,7 @@ ODM_FillH2CCmd( #endif -u4Byte +u8Byte ODM_GetCurrentTime( IN PDM_ODM_T pDM_Odm ) @@ -726,24 +811,24 @@ ODM_GetCurrentTime( #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) return 0; #elif(DM_ODM_SUPPORT_TYPE & ODM_CE) - return rtw_get_current_time(); + return (u8Byte)rtw_get_current_time(); #elif(DM_ODM_SUPPORT_TYPE & ODM_WIN) - return 0; + return PlatformGetCurrentTime(); #endif } -s4Byte +u8Byte ODM_GetProgressingTime( IN PDM_ODM_T pDM_Odm, - IN u4Byte Start_Time + IN u8Byte Start_Time ) { #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) return 0; #elif(DM_ODM_SUPPORT_TYPE & ODM_CE) - return rtw_get_passing_time_ms(Start_Time); + return rtw_get_passing_time_ms((u4Byte)Start_Time); #elif(DM_ODM_SUPPORT_TYPE & ODM_WIN) - return 0; + return (PlatformGetCurrentTime() - Start_Time)>>10; #endif } diff --git a/hal/OUTSRC/odm_interface.h b/hal/OUTSRC/odm_interface.h index 8c0303b..6a6d50c 100644 --- a/hal/OUTSRC/odm_interface.h +++ b/hal/OUTSRC/odm_interface.h @@ -60,36 +60,50 @@ ODM_REG(DIG,_pDM_Odm) #define _bit_11N(_name) ODM_BIT_##_name##_11N #define _bit_11AC(_name) ODM_BIT_##_name##_11AC -#if 1 //TODO: enable it if we need to support run-time to differentiate between 92C_SERIES and JAGUAR_SERIES. +#ifdef __ECOS +#define _rtk_cat(_name, _ic_type, _func) \ + ( \ + ((_ic_type) & ODM_IC_11N_SERIES)? _func##_11N(_name): \ + _func##_11AC(_name) \ + ) +#else + #define _cat(_name, _ic_type, _func) \ ( \ ((_ic_type) & ODM_IC_11N_SERIES)? _func##_11N(_name): \ _func##_11AC(_name) \ ) #endif -#if 0 // only sample code -#define _cat(_name, _ic_type, _func) \ - ( \ - ((_ic_type) & ODM_RTL8192C)? _func##_ic(_name, _8192C): \ - ((_ic_type) & ODM_RTL8192D)? _func##_ic(_name, _8192D): \ - ((_ic_type) & ODM_RTL8192S)? _func##_ic(_name, _8192S): \ - ((_ic_type) & ODM_RTL8723A)? _func##_ic(_name, _8723A): \ - ((_ic_type) & ODM_RTL8188E)? _func##_ic(_name, _8188E): \ - _func##_ic(_name, _8195) \ - ) -#endif +/* +// only sample code +//#define _cat(_name, _ic_type, _func) \ +// ( \ +// ((_ic_type) & ODM_RTL8192C)? _func##_ic(_name, _8192C): \ +// ((_ic_type) & ODM_RTL8192D)? _func##_ic(_name, _8192D): \ +// ((_ic_type) & ODM_RTL8192S)? _func##_ic(_name, _8192S): \ +// ((_ic_type) & ODM_RTL8723A)? _func##_ic(_name, _8723A): \ +// ((_ic_type) & ODM_RTL8188E)? _func##_ic(_name, _8188E): \ +// _func##_ic(_name, _8195) \ +// ) +*/ // _name: name of register or bit. // Example: "ODM_REG(R_A_AGC_CORE1, pDM_Odm)" // gets "ODM_R_A_AGC_CORE1" or "ODM_R_A_AGC_CORE1_8192C", depends on SupportICType. +#ifdef __ECOS +#define ODM_REG(_name, _pDM_Odm) _rtk_cat(_name, _pDM_Odm->SupportICType, _reg) +#define ODM_BIT(_name, _pDM_Odm) _rtk_cat(_name, _pDM_Odm->SupportICType, _bit) +#else #define ODM_REG(_name, _pDM_Odm) _cat(_name, _pDM_Odm->SupportICType, _reg) #define ODM_BIT(_name, _pDM_Odm) _cat(_name, _pDM_Odm->SupportICType, _bit) - +#endif typedef enum _ODM_H2C_CMD { ODM_H2C_RSSI_REPORT = 0, ODM_H2C_PSD_RESULT=1, - ODM_H2C_PathDiv = 2, + ODM_H2C_PathDiv = 2, + ODM_H2C_WIFI_CALIBRATION = 3, + ODM_H2C_IQ_CALIBRATION = 4, ODM_MAX_H2CCMD }ODM_H2C_CMD; @@ -251,6 +265,12 @@ s4Byte ODM_CompareMemory( IN PVOID pBuf2, IN u4Byte length ); + +void ODM_Memory_Set + (IN PDM_ODM_T pDM_Odm, + IN PVOID pbuf, + IN s1Byte value, + IN u4Byte length); // // ODM MISC-spin lock relative API. @@ -359,13 +379,13 @@ ODM_ReleaseTimer( // // ODM FW relative API. // -#if (DM_ODM_SUPPORT_TYPE & ODM_WIN) +#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE)) VOID ODM_FillH2CCmd( - IN PADAPTER Adapter, - IN u1Byte ElementID, - IN u4Byte CmdLen, - IN pu1Byte pCmdBuffer + IN PDM_ODM_T pDM_Odm, + IN u1Byte ElementID, + IN u4Byte CmdLen, + IN pu1Byte pCmdBuffer ); #else u4Byte @@ -380,14 +400,14 @@ ODM_FillH2CCmd( ); #endif -u4Byte +u8Byte ODM_GetCurrentTime( IN PDM_ODM_T pDM_Odm ); -s4Byte +u8Byte ODM_GetProgressingTime( IN PDM_ODM_T pDM_Odm, - IN u4Byte Start_Time + IN u8Byte Start_Time ); #endif // __ODM_INTERFACE_H__ diff --git a/hal/OUTSRC/odm_precomp.h b/hal/OUTSRC/odm_precomp.h index e3c71d2..dc0f4c1 100644 --- a/hal/OUTSRC/odm_precomp.h +++ b/hal/OUTSRC/odm_precomp.h @@ -145,6 +145,22 @@ #include "odm_RegDefine11AC.h" #include "odm_RegDefine11N.h" #include "odm_AntDiv.h" +#include "odm_EdcaTurboCheck.h" +#include "odm_DIG.h" +#include "odm_PathDiv.h" +#include "odm_DynamicBBPowerSaving.h" +#include "odm_PowerTracking.h" +#include "odm_RaInfo.h" +#include "odm_DynamicTxPower.h" +#include "odm_CfoTracking.h" +#include "odm_ACS.h" +#include "odm_PowerTracking.h" +#include "odm_NoiseMonitor.h" +#include "PhyDM_Adaptivity.h" + +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) +#include "odm_RXHP.h" +#endif #if (DM_ODM_SUPPORT_TYPE == ODM_AP) #if (RTL8192C_SUPPORT==1) @@ -197,7 +213,8 @@ #if (RTL8821A_SUPPORT==1) #include "rtl8821a/HalPhyRf_8821A.h"//for IQK,LCK,Power-tracking #include "rtl8812a/HalPhyRf_8812A.h"//for IQK,LCK,Power-tracking - #include "rtl8812a_hal.h" + #include "rtl8812a_hal.h" + #include "rtl8821a/PhyDM_IQK_8821A.h" #endif #if (RTL8723B_SUPPORT==1) @@ -280,11 +297,6 @@ #include "rtl8812a/HalHWImg8812A_FW.h" #include "rtl8812a/odm_RegConfig8812A.h" #include "rtl8812a/odm_RTL8812A.h" -#if (TESTCHIP_SUPPORT == 1) -#include "rtl8812a/HalHWImg8812A_TestChip_MAC.h" -#include "rtl8812a/HalHWImg8812A_TestChip_RF.h" -#include "rtl8812a/HalHWImg8812A_TestChip_BB.h" -#endif #endif @@ -295,12 +307,6 @@ #include "rtl8821a/HalHWImg8821A_FW.h" #include "rtl8821a/odm_RegConfig8821A.h" #include "rtl8821a/odm_RTL8821A.h" -#if (TESTCHIP_SUPPORT == 1) -#include "rtl8821a/HalHWImg8821A_TestChip_MAC.h" -#include "rtl8821a/HalHWImg8821A_TestChip_RF.h" -#include "rtl8821a/HalHWImg8821A_TestChip_BB.h" -#include "rtl8821a/HalHWImg8821A_TestChip_FW.h" -#endif #endif #endif // __ODM_PRECOMP_H__ diff --git a/hal/OUTSRC/odm_reg.h b/hal/OUTSRC/odm_reg.h index 16999a1..8deff91 100644 --- a/hal/OUTSRC/odm_reg.h +++ b/hal/OUTSRC/odm_reg.h @@ -49,6 +49,7 @@ #define ODM_FPGA_PHY0_PAGE8 0x800 #define ODM_PSD_SETTING 0x808 #define ODM_AFE_SETTING 0x818 +#define ODM_TXAGC_B_6_18 0x830 #define ODM_TXAGC_B_24_54 0x834 #define ODM_TXAGC_B_MCS32_5 0x838 #define ODM_TXAGC_B_MCS0_MCS3 0x83c @@ -98,6 +99,11 @@ //RF REG #define ODM_GAIN_SETTING 0x00 #define ODM_CHANNEL 0x18 +#define ODM_RF_T_METER 0x24 +#define ODM_RF_T_METER_92D 0x42 +#define ODM_RF_T_METER_88E 0x42 +#define ODM_RF_T_METER_92E 0x42 +#define ODM_RF_T_METER_8812 0x42 //Ant Detect Reg #define ODM_DPDT 0x300 @@ -113,6 +119,86 @@ // // Bitmap Definition // +#if(DM_ODM_SUPPORT_TYPE & (ODM_AP)) +// TX AGC +#define rTxAGC_A_CCK11_CCK1_JAguar 0xc20 +#define rTxAGC_A_Ofdm18_Ofdm6_JAguar 0xc24 +#define rTxAGC_A_Ofdm54_Ofdm24_JAguar 0xc28 +#define rTxAGC_A_MCS3_MCS0_JAguar 0xc2c +#define rTxAGC_A_MCS7_MCS4_JAguar 0xc30 +#define rTxAGC_A_MCS11_MCS8_JAguar 0xc34 +#define rTxAGC_A_MCS15_MCS12_JAguar 0xc38 +#define rTxAGC_A_Nss1Index3_Nss1Index0_JAguar 0xc3c +#define rTxAGC_A_Nss1Index7_Nss1Index4_JAguar 0xc40 +#define rTxAGC_A_Nss2Index1_Nss1Index8_JAguar 0xc44 +#define rTxAGC_A_Nss2Index5_Nss2Index2_JAguar 0xc48 +#define rTxAGC_A_Nss2Index9_Nss2Index6_JAguar 0xc4c +#if defined(CONFIG_WLAN_HAL_8814AE) +#define rTxAGC_A_MCS19_MCS16_JAguar 0xcd8 +#define rTxAGC_A_MCS23_MCS20_JAguar 0xcdc +#define rTxAGC_A_Nss3Index3_Nss3Index0_JAguar 0xce0 +#define rTxAGC_A_Nss3Index7_Nss3Index4_JAguar 0xce4 +#define rTxAGC_A_Nss3Index9_Nss3Index8_JAguar 0xce8 +#endif +#define rTxAGC_B_CCK11_CCK1_JAguar 0xe20 +#define rTxAGC_B_Ofdm18_Ofdm6_JAguar 0xe24 +#define rTxAGC_B_Ofdm54_Ofdm24_JAguar 0xe28 +#define rTxAGC_B_MCS3_MCS0_JAguar 0xe2c +#define rTxAGC_B_MCS7_MCS4_JAguar 0xe30 +#define rTxAGC_B_MCS11_MCS8_JAguar 0xe34 +#define rTxAGC_B_MCS15_MCS12_JAguar 0xe38 +#define rTxAGC_B_Nss1Index3_Nss1Index0_JAguar 0xe3c +#define rTxAGC_B_Nss1Index7_Nss1Index4_JAguar 0xe40 +#define rTxAGC_B_Nss2Index1_Nss1Index8_JAguar 0xe44 +#define rTxAGC_B_Nss2Index5_Nss2Index2_JAguar 0xe48 +#define rTxAGC_B_Nss2Index9_Nss2Index6_JAguar 0xe4c +#if defined(CONFIG_WLAN_HAL_8814AE) +#define rTxAGC_B_MCS19_MCS16_JAguar 0xed8 +#define rTxAGC_B_MCS23_MCS20_JAguar 0xedc +#define rTxAGC_B_Nss3Index3_Nss3Index0_JAguar 0xee0 +#define rTxAGC_B_Nss3Index7_Nss3Index4_JAguar 0xee4 +#define rTxAGC_B_Nss3Index9_Nss3Index8_JAguar 0xee8 +#define rTxAGC_C_CCK11_CCK1_JAguar 0x1820 +#define rTxAGC_C_Ofdm18_Ofdm6_JAguar 0x1824 +#define rTxAGC_C_Ofdm54_Ofdm24_JAguar 0x1828 +#define rTxAGC_C_MCS3_MCS0_JAguar 0x182c +#define rTxAGC_C_MCS7_MCS4_JAguar 0x1830 +#define rTxAGC_C_MCS11_MCS8_JAguar 0x1834 +#define rTxAGC_C_MCS15_MCS12_JAguar 0x1838 +#define rTxAGC_C_Nss1Index3_Nss1Index0_JAguar 0x183c +#define rTxAGC_C_Nss1Index7_Nss1Index4_JAguar 0x1840 +#define rTxAGC_C_Nss2Index1_Nss1Index8_JAguar 0x1844 +#define rTxAGC_C_Nss2Index5_Nss2Index2_JAguar 0x1848 +#define rTxAGC_C_Nss2Index9_Nss2Index6_JAguar 0x184c +#define rTxAGC_C_MCS19_MCS16_JAguar 0x18d8 +#define rTxAGC_C_MCS23_MCS20_JAguar 0x18dc +#define rTxAGC_C_Nss3Index3_Nss3Index0_JAguar 0x18e0 +#define rTxAGC_C_Nss3Index7_Nss3Index4_JAguar 0x18e4 +#define rTxAGC_C_Nss3Index9_Nss3Index8_JAguar 0x18e8 +#define rTxAGC_D_CCK11_CCK1_JAguar 0x1a20 +#define rTxAGC_D_Ofdm18_Ofdm6_JAguar 0x1a24 +#define rTxAGC_D_Ofdm54_Ofdm24_JAguar 0x1a28 +#define rTxAGC_D_MCS3_MCS0_JAguar 0x1a2c +#define rTxAGC_D_MCS7_MCS4_JAguar 0x1a30 +#define rTxAGC_D_MCS11_MCS8_JAguar 0x1a34 +#define rTxAGC_D_MCS15_MCS12_JAguar 0x1a38 +#define rTxAGC_D_Nss1Index3_Nss1Index0_JAguar 0x1a3c +#define rTxAGC_D_Nss1Index7_Nss1Index4_JAguar 0x1a40 +#define rTxAGC_D_Nss2Index1_Nss1Index8_JAguar 0x1a44 +#define rTxAGC_D_Nss2Index5_Nss2Index2_JAguar 0x1a48 +#define rTxAGC_D_Nss2Index9_Nss2Index6_JAguar 0x1a4c +#define rTxAGC_D_MCS19_MCS16_JAguar 0x1ad8 +#define rTxAGC_D_MCS23_MCS20_JAguar 0x1adc +#define rTxAGC_D_Nss3Index3_Nss3Index0_JAguar 0x1ae0 +#define rTxAGC_D_Nss3Index7_Nss3Index4_JAguar 0x1ae4 +#define rTxAGC_D_Nss3Index9_Nss3Index8_JAguar 0x1ae8 +#endif + +#define bTxAGC_byte0_Jaguar 0xff +#define bTxAGC_byte1_Jaguar 0xff00 +#define bTxAGC_byte2_Jaguar 0xff0000 +#define bTxAGC_byte3_Jaguar 0xff000000 +#endif #define BIT_FA_RESET BIT0 diff --git a/hal/OUTSRC/odm_types.h b/hal/OUTSRC/odm_types.h index 27cecce..ddeb1a8 100644 --- a/hal/OUTSRC/odm_types.h +++ b/hal/OUTSRC/odm_types.h @@ -20,6 +20,101 @@ #ifndef __ODM_TYPES_H__ #define __ODM_TYPES_H__ + + + +#define ODM_RATEMCS15_SG 0x1c +#define ODM_RATEMCS32 0x20 + + +// CCK Rates, TxHT = 0 +#define ODM_RATE1M 0x00 +#define ODM_RATE2M 0x01 +#define ODM_RATE5_5M 0x02 +#define ODM_RATE11M 0x03 +// OFDM Rates, TxHT = 0 +#define ODM_RATE6M 0x04 +#define ODM_RATE9M 0x05 +#define ODM_RATE12M 0x06 +#define ODM_RATE18M 0x07 +#define ODM_RATE24M 0x08 +#define ODM_RATE36M 0x09 +#define ODM_RATE48M 0x0A +#define ODM_RATE54M 0x0B +// MCS Rates, TxHT = 1 +#define ODM_RATEMCS0 0x0C +#define ODM_RATEMCS1 0x0D +#define ODM_RATEMCS2 0x0E +#define ODM_RATEMCS3 0x0F +#define ODM_RATEMCS4 0x10 +#define ODM_RATEMCS5 0x11 +#define ODM_RATEMCS6 0x12 +#define ODM_RATEMCS7 0x13 +#define ODM_RATEMCS8 0x14 +#define ODM_RATEMCS9 0x15 +#define ODM_RATEMCS10 0x16 +#define ODM_RATEMCS11 0x17 +#define ODM_RATEMCS12 0x18 +#define ODM_RATEMCS13 0x19 +#define ODM_RATEMCS14 0x1A +#define ODM_RATEMCS15 0x1B +#define ODM_RATEMCS16 0x1C +#define ODM_RATEMCS17 0x1D +#define ODM_RATEMCS18 0x1E +#define ODM_RATEMCS19 0x1F +#define ODM_RATEMCS20 0x20 +#define ODM_RATEMCS21 0x21 +#define ODM_RATEMCS22 0x22 +#define ODM_RATEMCS23 0x23 +#define ODM_RATEMCS24 0x24 +#define ODM_RATEMCS25 0x25 +#define ODM_RATEMCS26 0x26 +#define ODM_RATEMCS27 0x27 +#define ODM_RATEMCS28 0x28 +#define ODM_RATEMCS29 0x29 +#define ODM_RATEMCS30 0x2A +#define ODM_RATEMCS31 0x2B +#define ODM_RATEVHTSS1MCS0 0x2C +#define ODM_RATEVHTSS1MCS1 0x2D +#define ODM_RATEVHTSS1MCS2 0x2E +#define ODM_RATEVHTSS1MCS3 0x2F +#define ODM_RATEVHTSS1MCS4 0x30 +#define ODM_RATEVHTSS1MCS5 0x31 +#define ODM_RATEVHTSS1MCS6 0x32 +#define ODM_RATEVHTSS1MCS7 0x33 +#define ODM_RATEVHTSS1MCS8 0x34 +#define ODM_RATEVHTSS1MCS9 0x35 +#define ODM_RATEVHTSS2MCS0 0x36 +#define ODM_RATEVHTSS2MCS1 0x37 +#define ODM_RATEVHTSS2MCS2 0x38 +#define ODM_RATEVHTSS2MCS3 0x39 +#define ODM_RATEVHTSS2MCS4 0x3A +#define ODM_RATEVHTSS2MCS5 0x3B +#define ODM_RATEVHTSS2MCS6 0x3C +#define ODM_RATEVHTSS2MCS7 0x3D +#define ODM_RATEVHTSS2MCS8 0x3E +#define ODM_RATEVHTSS2MCS9 0x3F +#define ODM_RATEVHTSS3MCS0 0x40 +#define ODM_RATEVHTSS3MCS1 0x41 +#define ODM_RATEVHTSS3MCS2 0x42 +#define ODM_RATEVHTSS3MCS3 0x43 +#define ODM_RATEVHTSS3MCS4 0x44 +#define ODM_RATEVHTSS3MCS5 0x45 +#define ODM_RATEVHTSS3MCS6 0x46 +#define ODM_RATEVHTSS3MCS7 0x47 +#define ODM_RATEVHTSS3MCS8 0x48 +#define ODM_RATEVHTSS3MCS9 0x49 +#define ODM_RATEVHTSS4MCS0 0x4A +#define ODM_RATEVHTSS4MCS1 0x4B +#define ODM_RATEVHTSS4MCS2 0x4C +#define ODM_RATEVHTSS4MCS3 0x4D +#define ODM_RATEVHTSS4MCS4 0x4E +#define ODM_RATEVHTSS4MCS5 0x4F +#define ODM_RATEVHTSS4MCS6 0x50 +#define ODM_RATEVHTSS4MCS7 0x51 +#define ODM_RATEVHTSS4MCS8 0x52 +#define ODM_RATEVHTSS4MCS9 0x53 + // // Define Different SW team support // @@ -34,6 +129,12 @@ #define ODM_ENDIAN_BIG 0 #define ODM_ENDIAN_LITTLE 1 +#if (DM_ODM_SUPPORT_TYPE == ODM_WIN) +#define GET_PDM_ODM(__pAdapter) ((PDM_ODM_T)(&((GET_HAL_DATA(__pAdapter))->DM_OutSrc))) +#elif (DM_ODM_SUPPORT_TYPE == ODM_CE) +#define GET_PDM_ODM(__pAdapter) ((PDM_ODM_T)(&((GET_HAL_DATA(__pAdapter))->odmpriv))) +#endif + #if (DM_ODM_SUPPORT_TYPE != ODM_WIN) #define RT_PCI_INTERFACE 1 #define RT_USB_INTERFACE 2 @@ -51,8 +152,10 @@ typedef enum _HAL_STATUS{ RT_STATUS_OS_API_FAILED,*/ }HAL_STATUS,*PHAL_STATUS; - -#if( (DM_ODM_SUPPORT_TYPE == ODM_AP) ||(DM_ODM_SUPPORT_TYPE == ODM_ADSL) || (DM_ODM_SUPPORT_TYPE == ODM_CE)) +#if( DM_ODM_SUPPORT_TYPE == ODM_AP) +#define MP_DRIVER 0 +#endif +#if(DM_ODM_SUPPORT_TYPE != ODM_WIN) #define VISTA_USB_RX_REVISE 0 @@ -77,6 +180,8 @@ typedef enum _RT_SPINLOCK_TYPE{ #endif //Shall we define Ndis 6.2 SpinLock Here ? RT_PORT_SPINLOCK=16, + RT_VNIC_SPINLOCK=17, + RT_HVL_SPINLOCK=18, RT_H2C_SPINLOCK = 20, // For H2C cmd. Added by tynli. 2009.11.09. RT_BTData_SPINLOCK=25, @@ -99,6 +204,8 @@ typedef enum _RT_SPINLOCK_TYPE{ RT_PENDED_OID_SPINLOCK = 39, RT_CHNLLIST_SPINLOCK = 40, RT_INDIC_SPINLOCK = 41, //protect indication + RT_RFD_SPINLOCK = 42, + RT_LAST_SPINLOCK, }RT_SPINLOCK_TYPE; #endif @@ -117,9 +224,29 @@ typedef enum _RT_SPINLOCK_TYPE{ // To let ADSL/AP project compile ok; it should be removed after all conflict are solved. Added by Annie, 2011-10-07. #define ADSL_AP_BUILD_WORKAROUND #define AP_BUILD_WORKAROUND - // -#ifdef CONFIG_ANT_SWITCH + + //2 [ Configure Antenna Diversity ] +#if defined(CONFIG_RTL_8881A_ANT_SWITCH) || defined(CONFIG_SLOT_0_ANT_SWITCH) || defined(CONFIG_SLOT_1_ANT_SWITCH) #define CONFIG_HW_ANTENNA_DIVERSITY + #define ODM_EVM_ENHANCE_ANTDIV + + //---------- + #if(!defined(CONFIG_NO_2G_DIVERSITY) && !defined(CONFIG_2G_CGCS_RX_DIVERSITY) && !defined(CONFIG_2G_CG_TRX_DIVERSITY) && !defined(CONFIG_2G_CG_SMART_ANT_DIVERSITY)) + #define CONFIG_NO_2G_DIVERSITY + #endif + + #ifdef CONFIG_NO_5G_DIVERSITY_8881A + #define CONFIG_NO_5G_DIVERSITY + #elif defined(CONFIG_5G_CGCS_RX_DIVERSITY_8881A) + #define CONFIG_5G_CGCS_RX_DIVERSITY + #elif defined(CONFIG_5G_CG_TRX_DIVERSITY_8881A) + #define CONFIG_5G_CG_TRX_DIVERSITY + #endif + + #if(!defined(CONFIG_NO_5G_DIVERSITY) && !defined(CONFIG_5G_CGCS_RX_DIVERSITY) && !defined(CONFIG_5G_CG_TRX_DIVERSITY) && !defined(CONFIG_5G_CG_SMART_ANT_DIVERSITY)) + #define CONFIG_NO_5G_DIVERSITY + #endif + //---------- #if ( defined(CONFIG_NO_2G_DIVERSITY) && defined(CONFIG_NO_5G_DIVERSITY) ) #define CONFIG_NOT_SUPPORT_ANTDIV #elif( !defined(CONFIG_NO_2G_DIVERSITY) && defined(CONFIG_NO_5G_DIVERSITY) ) @@ -129,8 +256,8 @@ typedef enum _RT_SPINLOCK_TYPE{ #elif( !defined(CONFIG_NO_2G_DIVERSITY) && !defined(CONFIG_NO_5G_DIVERSITY) ) #define CONFIG_2G5G_SUPPORT_ANTDIV #endif + //---------- #endif - #ifdef AP_BUILD_WORKAROUND #include "../typedef.h" #else @@ -140,7 +267,13 @@ typedef enum _RT_SPINLOCK_TYPE{ typedef unsigned short u2Byte,*pu2Byte; typedef unsigned int u4Byte,*pu4Byte; typedef unsigned long long u8Byte,*pu8Byte; +#if 1 +/* In ARM platform, system would use the type -- "char" as "unsigned char" + * And we only use s1Byte/ps1Byte as INT8 now, so changes the type of s1Byte.*/ + typedef signed char s1Byte,*ps1Byte; +#else typedef char s1Byte,*ps1Byte; +#endif typedef short s2Byte,*ps2Byte; typedef long s4Byte,*ps4Byte; typedef long long s8Byte,*ps8Byte; @@ -151,7 +284,9 @@ typedef enum _RT_SPINLOCK_TYPE{ typedef struct timer_list RT_TIMER, *PRT_TIMER; typedef void * RT_TIMER_CALL_BACK; +#ifdef CONFIG_PCI_HCI #define DEV_BUS_TYPE RT_PCI_INTERFACE +#endif #define _TRUE 1 #define _FALSE 0 @@ -168,7 +303,13 @@ typedef enum _RT_SPINLOCK_TYPE{ typedef unsigned short u2Byte,*pu2Byte; typedef unsigned int u4Byte,*pu4Byte; typedef unsigned long long u8Byte,*pu8Byte; +#if 1 +/* In ARM platform, system would use the type -- "char" as "unsigned char" + * And we only use s1Byte/ps1Byte as INT8 now, so changes the type of s1Byte.*/ + typedef signed char s1Byte,*ps1Byte; +#else typedef char s1Byte,*ps1Byte; +#endif typedef short s2Byte,*ps2Byte; typedef long s4Byte,*ps4Byte; typedef long long s8Byte,*ps8Byte; @@ -260,6 +401,9 @@ typedef enum _RT_SPINLOCK_TYPE{ #define RTL8881A_SUPPORT 0 #endif +#define READ_NEXT_PAIR(v1, v2, i) do { if (i+2 >= ArrayLen) break; i += 2; v1 = Array[i]; v2 = Array[i+1]; } while(0) +#define COND_ELSE 2 +#define COND_ENDIF 3 #endif // __ODM_TYPES_H__ diff --git a/hal/OUTSRC/rtl8192e/Hal8192EReg.h b/hal/OUTSRC/rtl8192e/Hal8192EReg.h index d132277..37dbb6d 100644 --- a/hal/OUTSRC/rtl8192e/Hal8192EReg.h +++ b/hal/OUTSRC/rtl8192e/Hal8192EReg.h @@ -59,12 +59,14 @@ #define REG_FSISR_8192E 0x0054 #define REG_HSIMR_8192E 0x0058 #define REG_HSISR_8192E 0x005c +#define REG_PAD_CTRL1_8192E 0x0064 #define REG_WL_BT_PWR_CTRL_8192E 0x0068 #define REG_SDM_DEBUG_8192E 0x006C #define REG_SDIO_CTRL_8192E 0x0070 #define REG_HCI_OPT_CTRL_8192E 0x0074 #define REG_AFE_CTRL4_8192E 0x0078 -#define REG_8051FW_CTRL_8192E 0x0080 +#define REG_8051FW_CTRL_8192E 0x0080 +#define REG_WLLPS_CTRL_8192E 0x0090 #define REG_HIMR0_8192E 0x00B0 #define REG_HISR0_8192E 0x00B4 #define REG_HIMR1_8192E 0x00B8 @@ -363,7 +365,10 @@ #define REG_RXFLTMAP1_8192E 0x06A2 #define REG_RXFLTMAP2_8192E 0x06A4 #define REG_BCN_PSR_RPT_8192E 0x06A8 -#define REG_BT_COEX_TABLE_8192E 0x06C0 +#define REG_BT_COEX_TABLE0_8192E 0x06C0 +#define REG_BT_COEX_TABLE1_8192E 0x06C4 +#define REG_BT_COEX_TABLE2_8192E 0x06C8 +#define REG_BT_COEX_TABLE3_8192E 0x06CC #define REG_ASSOCIATED_BFMER0_INFO_8192E 0x06E4 #define REG_ASSOCIATED_BFMER1_INFO_8192E 0x06EC #define REG_CSI_RPT_PARAM_BW20_8192E 0x06F4 @@ -376,6 +381,11 @@ #define REG_ASSOCIATED_BFMEE_SEL_8192E 0x0714 #define REG_SND_PTCL_CTRL_8192E 0x0718 +// BT +#define REG_BT_STATISTICS_CTRL_8192E 0x076E // bit0~bit3 for REG_BT_STATISTICS_CTRL , bit4~bit15 for REG_BT_COEX_ENH_INTF_CTRL +#define REG_BT_STATISTICS_OTH_CTRL_8192E 0x0778 +#define REG_TDMA_TIME_AND_RPT_SAM_SET_8192E 0x0790 + //----------------------------------------------------- // diff --git a/hal/OUTSRC/rtl8192e/HalHWImg8192E_BB.c b/hal/OUTSRC/rtl8192e/HalHWImg8192E_BB.c index 9ede2f7..7ae3075 100644 --- a/hal/OUTSRC/rtl8192e/HalHWImg8192E_BB.c +++ b/hal/OUTSRC/rtl8192e/HalHWImg8192E_BB.c @@ -18,102 +18,221 @@ * ******************************************************************************/ - +#include "Mp_Precomp.h" #include "../odm_precomp.h" #if (RTL8192E_SUPPORT == 1) static BOOLEAN -CheckCondition( - const u4Byte Condition, - const u4Byte Hex +CheckPositive( + IN PDM_ODM_T pDM_Odm, + IN const u4Byte Condition1, + IN const u4Byte Condition2 ) { - u4Byte _board = (Hex & 0x000000FF); - u4Byte _interface = (Hex & 0x0000FF00) >> 8; - u4Byte _platform = (Hex & 0x00FF0000) >> 16; - u4Byte cond = Condition; + u1Byte _BoardType = ((pDM_Odm->BoardType & BIT4) >> 4) << 0 | // _GLNA + ((pDM_Odm->BoardType & BIT3) >> 3) << 1 | // _GPA + ((pDM_Odm->BoardType & BIT7) >> 7) << 2 | // _ALNA + ((pDM_Odm->BoardType & BIT6) >> 6) << 3 | // _APA + ((pDM_Odm->BoardType & BIT2) >> 2) << 4; // _BT - if ( Condition == 0xCDCDCDCD ) - return TRUE; + u4Byte cond1 = Condition1, cond2 = Condition2; + u4Byte driver1 = pDM_Odm->CutVersion << 24 | + pDM_Odm->SupportPlatform << 16 | + pDM_Odm->PackageType << 12 | + pDM_Odm->SupportInterface << 8 | + _BoardType; - 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) ) + u4Byte driver2 = pDM_Odm->TypeGLNA << 0 | + pDM_Odm->TypeGPA << 8 | + pDM_Odm->TypeALNA << 16 | + pDM_Odm->TypeAPA << 24; + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, + ("===> [8812A] CheckPositive (cond1, cond2) = (0x%X 0x%X)\n", cond1, cond2)); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, + ("===> [8812A] CheckPositive (driver1, driver2) = (0x%X 0x%X)\n", driver1, driver2)); + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, + (" (Platform, Interface) = (0x%X, 0x%X)\n", pDM_Odm->SupportPlatform, pDM_Odm->SupportInterface)); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, + (" (Board, Package) = (0x%X, 0x%X)\n", pDM_Odm->BoardType, pDM_Odm->PackageType)); + + + //============== Value Defined Check ===============// + //QFN Type [15:12] and Cut Version [27:24] need to do value check + + if(((cond1 & 0x0000F000) != 0) &&((cond1 & 0x0000F000) != (driver1 & 0x0000F000))) + return FALSE; + if(((cond1 & 0x0F000000) != 0) &&((cond1 & 0x0F000000) != (driver1 & 0x0F000000))) + return FALSE; + + //=============== Bit Defined Check ================// + // We don't care [31:28] and [23:20] + // + cond1 &= 0x000F0FFF; + driver1 &= 0x000F0FFF; + + if ((cond1 & driver1) == cond1) + { + u4Byte bitMask = 0; + if ((cond1 & 0x0F) == 0) // BoardType is DONTCARE + return TRUE; + + if ((cond1 & BIT0) != 0) //GLNA + bitMask |= 0x000000FF; + if ((cond1 & BIT1) != 0) //GPA + bitMask |= 0x0000FF00; + if ((cond1 & BIT2) != 0) //ALNA + bitMask |= 0x00FF0000; + if ((cond1 & BIT3) != 0) //APA + bitMask |= 0xFF000000; + + if ((cond2 & bitMask) == (driver2 & bitMask)) // BoardType of each RF path is matched + return TRUE; + else + return FALSE; + } + else + { return FALSE; + } +} +static BOOLEAN +CheckNegative( + IN PDM_ODM_T pDM_Odm, + IN const u4Byte Condition1, + IN const u4Byte Condition2 + ) +{ return TRUE; } - /****************************************************************************** * AGC_TAB.TXT ******************************************************************************/ u4Byte Array_MP_8192E_AGC_TAB[] = { - 0xFF010718, 0xABCD, - 0xC78, 0xFA000001, - 0xC78, 0xF9010001, - 0xC78, 0xF8020001, - 0xC78, 0xF7030001, - 0xC78, 0xF6040001, - 0xC78, 0xF5050001, - 0xC78, 0xF4060001, - 0xC78, 0xF3070001, - 0xC78, 0xF2080001, - 0xC78, 0xF1090001, - 0xC78, 0xF00A0001, - 0xC78, 0xEF0B0001, - 0xC78, 0xEE0C0001, - 0xC78, 0xED0D0001, - 0xC78, 0xEC0E0001, - 0xC78, 0xEB0F0001, - 0xC78, 0xEA100001, - 0xC78, 0xE9110001, - 0xC78, 0xE8120001, - 0xC78, 0xE7130001, - 0xC78, 0xE6140001, - 0xC78, 0xE5150001, - 0xC78, 0xE4160001, - 0xC78, 0xE3170001, - 0xC78, 0xE2180001, - 0xC78, 0xE1190001, - 0xC78, 0x8A1A0001, - 0xC78, 0x891B0001, - 0xC78, 0x881C0001, - 0xC78, 0x871D0001, - 0xC78, 0x861E0001, - 0xC78, 0x851F0001, - 0xC78, 0x84200001, - 0xC78, 0x83210001, - 0xC78, 0x82220001, - 0xC78, 0x6A230001, - 0xC78, 0x69240001, - 0xC78, 0x68250001, - 0xC78, 0x67260001, - 0xC78, 0x66270001, - 0xC78, 0x65280001, - 0xC78, 0x64290001, - 0xC78, 0x632A0001, - 0xC78, 0x622B0001, - 0xC78, 0x612C0001, - 0xC78, 0x602D0001, - 0xC78, 0x472E0001, - 0xC78, 0x462F0001, - 0xC78, 0x45300001, - 0xC78, 0x44310001, - 0xC78, 0x43320001, - 0xC78, 0x42330001, - 0xC78, 0x41340001, - 0xC78, 0x40350001, - 0xC78, 0x40360001, + 0x80000400,0x00000000,0x40000000,0x00000000, + 0xC78, 0xFB000001, + 0xC78, 0xFB010001, + 0xC78, 0xFB020001, + 0xC78, 0xFB030001, + 0xC78, 0xFB040001, + 0xC78, 0xFB050001, + 0xC78, 0xFB060001, + 0xC78, 0xFB070001, + 0xC78, 0xFA080001, + 0xC78, 0xF9090001, + 0xC78, 0xF80A0001, + 0xC78, 0xF70B0001, + 0xC78, 0xF60C0001, + 0xC78, 0xF50D0001, + 0xC78, 0xF40E0001, + 0xC78, 0xF30F0001, + 0xC78, 0xF2100001, + 0xC78, 0xF1110001, + 0xC78, 0xF0120001, + 0xC78, 0xEF130001, + 0xC78, 0xEE140001, + 0xC78, 0xED150001, + 0xC78, 0xEC160001, + 0xC78, 0xEB170001, + 0xC78, 0xEA180001, + 0xC78, 0xE9190001, + 0xC78, 0xC81A0001, + 0xC78, 0xC71B0001, + 0xC78, 0xC61C0001, + 0xC78, 0x071D0001, + 0xC78, 0x061E0001, + 0xC78, 0x051F0001, + 0xC78, 0x04200001, + 0xC78, 0x03210001, + 0xC78, 0xAA220001, + 0xC78, 0xA9230001, + 0xC78, 0xA8240001, + 0xC78, 0xA7250001, + 0xC78, 0xA6260001, + 0xC78, 0x85270001, + 0xC78, 0x84280001, + 0xC78, 0x83290001, + 0xC78, 0x252A0001, + 0xC78, 0x242B0001, + 0xC78, 0x232C0001, + 0xC78, 0x222D0001, + 0xC78, 0x672E0001, + 0xC78, 0x662F0001, + 0xC78, 0x65300001, + 0xC78, 0x64310001, + 0xC78, 0x63320001, + 0xC78, 0x62330001, + 0xC78, 0x61340001, + 0xC78, 0x45350001, + 0xC78, 0x44360001, + 0xC78, 0x43370001, + 0xC78, 0x42380001, + 0xC78, 0x41390001, + 0xC78, 0x403A0001, + 0xC78, 0x403B0001, + 0xC78, 0x403C0001, + 0xC78, 0x403D0001, + 0xC78, 0x403E0001, + 0xC78, 0x403F0001, + 0x90010003,0x00000000,0x40000000,0x00000000, + 0xC78, 0xFB000001, + 0xC78, 0xFB010001, + 0xC78, 0xFA020001, + 0xC78, 0xF9030001, + 0xC78, 0xF8040001, + 0xC78, 0xF7050001, + 0xC78, 0xF6060001, + 0xC78, 0xF5070001, + 0xC78, 0xF4080001, + 0xC78, 0xF3090001, + 0xC78, 0xF20A0001, + 0xC78, 0xF10B0001, + 0xC78, 0xF00C0001, + 0xC78, 0xEF0D0001, + 0xC78, 0xEE0E0001, + 0xC78, 0xED0F0001, + 0xC78, 0xEC100001, + 0xC78, 0xEB110001, + 0xC78, 0xEA120001, + 0xC78, 0xE9130001, + 0xC78, 0xE8140001, + 0xC78, 0xE7150001, + 0xC78, 0xE6160001, + 0xC78, 0xE5170001, + 0xC78, 0xE4180001, + 0xC78, 0xE3190001, + 0xC78, 0xE21A0001, + 0xC78, 0xE11B0001, + 0xC78, 0x8A1C0001, + 0xC78, 0x891D0001, + 0xC78, 0x881E0001, + 0xC78, 0x871F0001, + 0xC78, 0x86200001, + 0xC78, 0x85210001, + 0xC78, 0x84220001, + 0xC78, 0x83230001, + 0xC78, 0x82240001, + 0xC78, 0x6A250001, + 0xC78, 0x69260001, + 0xC78, 0x68270001, + 0xC78, 0x67280001, + 0xC78, 0x66290001, + 0xC78, 0x652A0001, + 0xC78, 0x642B0001, + 0xC78, 0x632C0001, + 0xC78, 0x622D0001, + 0xC78, 0x612E0001, + 0xC78, 0x602F0001, + 0xC78, 0x47300001, + 0xC78, 0x46310001, + 0xC78, 0x45320001, + 0xC78, 0x44330001, + 0xC78, 0x43340001, + 0xC78, 0x42350001, + 0xC78, 0x41360001, 0xC78, 0x40370001, 0xC78, 0x40380001, 0xC78, 0x40390001, @@ -123,7 +242,7 @@ u4Byte Array_MP_8192E_AGC_TAB[] = { 0xC78, 0x403D0001, 0xC78, 0x403E0001, 0xC78, 0x403F0001, - 0xCDCDCDCD, 0xCDCD, + 0x90010002,0x00000000,0x40000000,0x00000000, 0xC78, 0xFB000001, 0xC78, 0xFB010001, 0xC78, 0xFB020001, @@ -188,75 +307,138 @@ u4Byte Array_MP_8192E_AGC_TAB[] = { 0xC78, 0x403D0001, 0xC78, 0x403E0001, 0xC78, 0x403F0001, - 0xFF010718, 0xDEAD, - 0xFF010718, 0xABCD, - 0xC78, 0xFA400001, - 0xC78, 0xF9410001, - 0xC78, 0xF8420001, - 0xC78, 0xF7430001, - 0xC78, 0xF6440001, - 0xC78, 0xF5450001, - 0xC78, 0xF4460001, - 0xC78, 0xF3470001, - 0xC78, 0xF2480001, - 0xC78, 0xF1490001, - 0xC78, 0xF04A0001, - 0xC78, 0xEF4B0001, - 0xC78, 0xEE4C0001, - 0xC78, 0xED4D0001, - 0xC78, 0xEC4E0001, - 0xC78, 0xEB4F0001, - 0xC78, 0xEA500001, - 0xC78, 0xE9510001, - 0xC78, 0xE8520001, - 0xC78, 0xE7530001, - 0xC78, 0xE6540001, - 0xC78, 0xE5550001, - 0xC78, 0xE4560001, - 0xC78, 0xE3570001, - 0xC78, 0xE2580001, - 0xC78, 0xE1590001, - 0xC78, 0x8A5A0001, - 0xC78, 0x895B0001, - 0xC78, 0x885C0001, - 0xC78, 0x875D0001, - 0xC78, 0x865E0001, - 0xC78, 0x855F0001, - 0xC78, 0x84600001, - 0xC78, 0x83610001, - 0xC78, 0x82620001, - 0xC78, 0x6A630001, - 0xC78, 0x69640001, - 0xC78, 0x68650001, - 0xC78, 0x67660001, - 0xC78, 0x66670001, - 0xC78, 0x65680001, - 0xC78, 0x64690001, - 0xC78, 0x636A0001, - 0xC78, 0x626B0001, - 0xC78, 0x616C0001, - 0xC78, 0x606D0001, - 0xC78, 0x476E0001, - 0xC78, 0x466F0001, - 0xC78, 0x45700001, - 0xC78, 0x44710001, - 0xC78, 0x43720001, - 0xC78, 0x42730001, - 0xC78, 0x41740001, - 0xC78, 0x40750001, - 0xC78, 0x40760001, - 0xC78, 0x40770001, - 0xC78, 0x40780001, - 0xC78, 0x40790001, - 0xC78, 0x407A0001, - 0xC78, 0x407B0001, - 0xC78, 0x407C0001, - 0xC78, 0x407D0001, - 0xC78, 0x407E0001, - 0xC78, 0x407F0001, - 0xC50, 0x00040222, - 0xC50, 0x00040220, - 0xCDCDCDCD, 0xCDCD, + 0x90010001,0x00000000,0x40000000,0x00000000, + 0xC78, 0xFB000001, + 0xC78, 0xFB010001, + 0xC78, 0xFA020001, + 0xC78, 0xF9030001, + 0xC78, 0xF8040001, + 0xC78, 0xF7050001, + 0xC78, 0xF6060001, + 0xC78, 0xF5070001, + 0xC78, 0xF4080001, + 0xC78, 0xF3090001, + 0xC78, 0xF20A0001, + 0xC78, 0xF10B0001, + 0xC78, 0xF00C0001, + 0xC78, 0xEF0D0001, + 0xC78, 0xEE0E0001, + 0xC78, 0xED0F0001, + 0xC78, 0xEC100001, + 0xC78, 0xEB110001, + 0xC78, 0xEA120001, + 0xC78, 0xE9130001, + 0xC78, 0xE8140001, + 0xC78, 0xE7150001, + 0xC78, 0xE6160001, + 0xC78, 0xE5170001, + 0xC78, 0xE4180001, + 0xC78, 0xE3190001, + 0xC78, 0xE21A0001, + 0xC78, 0xE11B0001, + 0xC78, 0x8A1C0001, + 0xC78, 0x891D0001, + 0xC78, 0x881E0001, + 0xC78, 0x871F0001, + 0xC78, 0x86200001, + 0xC78, 0x85210001, + 0xC78, 0x84220001, + 0xC78, 0x83230001, + 0xC78, 0x82240001, + 0xC78, 0x6A250001, + 0xC78, 0x69260001, + 0xC78, 0x68270001, + 0xC78, 0x67280001, + 0xC78, 0x66290001, + 0xC78, 0x652A0001, + 0xC78, 0x642B0001, + 0xC78, 0x632C0001, + 0xC78, 0x622D0001, + 0xC78, 0x612E0001, + 0xC78, 0x602F0001, + 0xC78, 0x47300001, + 0xC78, 0x46310001, + 0xC78, 0x45320001, + 0xC78, 0x44330001, + 0xC78, 0x43340001, + 0xC78, 0x42350001, + 0xC78, 0x41360001, + 0xC78, 0x40370001, + 0xC78, 0x40380001, + 0xC78, 0x40390001, + 0xC78, 0x403A0001, + 0xC78, 0x403B0001, + 0xC78, 0x403C0001, + 0xC78, 0x403D0001, + 0xC78, 0x403E0001, + 0xC78, 0x403F0001, + 0xA0000000,0x00000000, + 0xC78, 0xFB000001, + 0xC78, 0xFB010001, + 0xC78, 0xFB020001, + 0xC78, 0xFB030001, + 0xC78, 0xFB040001, + 0xC78, 0xFB050001, + 0xC78, 0xFA060001, + 0xC78, 0xF9070001, + 0xC78, 0xF8080001, + 0xC78, 0xF7090001, + 0xC78, 0xF60A0001, + 0xC78, 0xF50B0001, + 0xC78, 0xF40C0001, + 0xC78, 0xF30D0001, + 0xC78, 0xF20E0001, + 0xC78, 0xF10F0001, + 0xC78, 0xF0100001, + 0xC78, 0xEF110001, + 0xC78, 0xEE120001, + 0xC78, 0xED130001, + 0xC78, 0xEC140001, + 0xC78, 0xEB150001, + 0xC78, 0xEA160001, + 0xC78, 0xE9170001, + 0xC78, 0xE8180001, + 0xC78, 0xE7190001, + 0xC78, 0xC81A0001, + 0xC78, 0xC71B0001, + 0xC78, 0xC61C0001, + 0xC78, 0x071D0001, + 0xC78, 0x061E0001, + 0xC78, 0x051F0001, + 0xC78, 0x04200001, + 0xC78, 0x03210001, + 0xC78, 0xAA220001, + 0xC78, 0xA9230001, + 0xC78, 0xA8240001, + 0xC78, 0xA7250001, + 0xC78, 0xA6260001, + 0xC78, 0x85270001, + 0xC78, 0x84280001, + 0xC78, 0x83290001, + 0xC78, 0x252A0001, + 0xC78, 0x242B0001, + 0xC78, 0x232C0001, + 0xC78, 0x222D0001, + 0xC78, 0x672E0001, + 0xC78, 0x662F0001, + 0xC78, 0x65300001, + 0xC78, 0x64310001, + 0xC78, 0x63320001, + 0xC78, 0x62330001, + 0xC78, 0x61340001, + 0xC78, 0x45350001, + 0xC78, 0x44360001, + 0xC78, 0x43370001, + 0xC78, 0x42380001, + 0xC78, 0x41390001, + 0xC78, 0x403A0001, + 0xC78, 0x403B0001, + 0xC78, 0x403C0001, + 0xC78, 0x403D0001, + 0xC78, 0x403E0001, + 0xC78, 0x403F0001, + 0xB0000000,0x00000000, + 0x80000400,0x00000000,0x40000000,0x00000000, 0xC78, 0xFB400001, 0xC78, 0xFB410001, 0xC78, 0xFB420001, @@ -323,7 +505,275 @@ u4Byte Array_MP_8192E_AGC_TAB[] = { 0xC78, 0x407F0001, 0xC50, 0x00040022, 0xC50, 0x00040020, - 0xFF010718, 0xDEAD, + 0x90010003,0x00000000,0x40000000,0x00000000, + 0xC78, 0xF7400001, + 0xC78, 0xF6410001, + 0xC78, 0xF5420001, + 0xC78, 0xF4430001, + 0xC78, 0xF3440001, + 0xC78, 0xF2450001, + 0xC78, 0xF1460001, + 0xC78, 0xF0470001, + 0xC78, 0xEF480001, + 0xC78, 0xEE490001, + 0xC78, 0xED4A0001, + 0xC78, 0xEC4B0001, + 0xC78, 0xEB4C0001, + 0xC78, 0xEA4D0001, + 0xC78, 0xCE4E0001, + 0xC78, 0xCD4F0001, + 0xC78, 0xCC500001, + 0xC78, 0xCB510001, + 0xC78, 0xCA520001, + 0xC78, 0xC9530001, + 0xC78, 0xC8540001, + 0xC78, 0xC7550001, + 0xC78, 0xC6560001, + 0xC78, 0x55570001, + 0xC78, 0xC4580001, + 0xC78, 0xC3590001, + 0xC78, 0x885A0001, + 0xC78, 0x875B0001, + 0xC78, 0x865C0001, + 0xC78, 0x855D0001, + 0xC78, 0x845E0001, + 0xC78, 0x6B5F0001, + 0xC78, 0x6A600001, + 0xC78, 0x69610001, + 0xC78, 0x68620001, + 0xC78, 0x67630001, + 0xC78, 0x66640001, + 0xC78, 0x65650001, + 0xC78, 0x64660001, + 0xC78, 0x63670001, + 0xC78, 0x4A680001, + 0xC78, 0x49690001, + 0xC78, 0x486A0001, + 0xC78, 0x476B0001, + 0xC78, 0x466C0001, + 0xC78, 0x456D0001, + 0xC78, 0x446E0001, + 0xC78, 0x436F0001, + 0xC78, 0x42700001, + 0xC78, 0x41710001, + 0xC78, 0x40720001, + 0xC78, 0x40730001, + 0xC78, 0x40740001, + 0xC78, 0x40750001, + 0xC78, 0x40760001, + 0xC78, 0x40770001, + 0xC78, 0x40780001, + 0xC78, 0x40790001, + 0xC78, 0x407A0001, + 0xC78, 0x407B0001, + 0xC78, 0x407C0001, + 0xC78, 0x407D0001, + 0xC78, 0x407E0001, + 0xC78, 0x407F0001, + 0xC50, 0x00040222, + 0xC50, 0x00040220, + 0x90010002,0x00000000,0x40000000,0x00000000, + 0xC78, 0xFB400001, + 0xC78, 0xFB410001, + 0xC78, 0xFB420001, + 0xC78, 0xFB430001, + 0xC78, 0xFB440001, + 0xC78, 0xFB450001, + 0xC78, 0xFA460001, + 0xC78, 0xF9470001, + 0xC78, 0xF8480001, + 0xC78, 0xF7490001, + 0xC78, 0xF64A0001, + 0xC78, 0xF54B0001, + 0xC78, 0xF44C0001, + 0xC78, 0xF34D0001, + 0xC78, 0xF24E0001, + 0xC78, 0xF14F0001, + 0xC78, 0xF0500001, + 0xC78, 0xEF510001, + 0xC78, 0xEE520001, + 0xC78, 0xED530001, + 0xC78, 0xEC540001, + 0xC78, 0xEB550001, + 0xC78, 0xEA560001, + 0xC78, 0xE9570001, + 0xC78, 0xE8580001, + 0xC78, 0xE7590001, + 0xC78, 0xE65A0001, + 0xC78, 0xE55B0001, + 0xC78, 0xE45C0001, + 0xC78, 0xE35D0001, + 0xC78, 0xE25E0001, + 0xC78, 0xE15F0001, + 0xC78, 0x8A600001, + 0xC78, 0x89610001, + 0xC78, 0x88620001, + 0xC78, 0x87630001, + 0xC78, 0x86640001, + 0xC78, 0x85650001, + 0xC78, 0x84660001, + 0xC78, 0x83670001, + 0xC78, 0x82680001, + 0xC78, 0x6B690001, + 0xC78, 0x6A6A0001, + 0xC78, 0x696B0001, + 0xC78, 0x686C0001, + 0xC78, 0x676D0001, + 0xC78, 0x666E0001, + 0xC78, 0x656F0001, + 0xC78, 0x64700001, + 0xC78, 0x63710001, + 0xC78, 0x62720001, + 0xC78, 0x61730001, + 0xC78, 0x49740001, + 0xC78, 0x48750001, + 0xC78, 0x47760001, + 0xC78, 0x46770001, + 0xC78, 0x45780001, + 0xC78, 0x44790001, + 0xC78, 0x437A0001, + 0xC78, 0x427B0001, + 0xC78, 0x417C0001, + 0xC78, 0x407D0001, + 0xC78, 0x407E0001, + 0xC78, 0x407F0001, + 0xC50, 0x00040222, + 0xC50, 0x00040220, + 0x90010001,0x00000000,0x40000000,0x00000000, + 0xC78, 0xF7400001, + 0xC78, 0xF6410001, + 0xC78, 0xF5420001, + 0xC78, 0xF4430001, + 0xC78, 0xF3440001, + 0xC78, 0xF2450001, + 0xC78, 0xF1460001, + 0xC78, 0xF0470001, + 0xC78, 0xEF480001, + 0xC78, 0xEE490001, + 0xC78, 0xED4A0001, + 0xC78, 0xEC4B0001, + 0xC78, 0xEB4C0001, + 0xC78, 0xEA4D0001, + 0xC78, 0xCE4E0001, + 0xC78, 0xCD4F0001, + 0xC78, 0xCC500001, + 0xC78, 0xCB510001, + 0xC78, 0xCA520001, + 0xC78, 0xC9530001, + 0xC78, 0xC8540001, + 0xC78, 0xC7550001, + 0xC78, 0xC6560001, + 0xC78, 0x55570001, + 0xC78, 0xC4580001, + 0xC78, 0xC3590001, + 0xC78, 0x885A0001, + 0xC78, 0x875B0001, + 0xC78, 0x865C0001, + 0xC78, 0x855D0001, + 0xC78, 0x845E0001, + 0xC78, 0x6B5F0001, + 0xC78, 0x6A600001, + 0xC78, 0x69610001, + 0xC78, 0x68620001, + 0xC78, 0x67630001, + 0xC78, 0x66640001, + 0xC78, 0x65650001, + 0xC78, 0x64660001, + 0xC78, 0x63670001, + 0xC78, 0x4A680001, + 0xC78, 0x49690001, + 0xC78, 0x486A0001, + 0xC78, 0x476B0001, + 0xC78, 0x466C0001, + 0xC78, 0x456D0001, + 0xC78, 0x446E0001, + 0xC78, 0x436F0001, + 0xC78, 0x42700001, + 0xC78, 0x41710001, + 0xC78, 0x40720001, + 0xC78, 0x40730001, + 0xC78, 0x40740001, + 0xC78, 0x40750001, + 0xC78, 0x40760001, + 0xC78, 0x40770001, + 0xC78, 0x40780001, + 0xC78, 0x40790001, + 0xC78, 0x407A0001, + 0xC78, 0x407B0001, + 0xC78, 0x407C0001, + 0xC78, 0x407D0001, + 0xC78, 0x407E0001, + 0xC78, 0x407F0001, + 0xC50, 0x00040222, + 0xC50, 0x00040220, + 0xA0000000,0x00000000, + 0xC78, 0xFB400001, + 0xC78, 0xFB410001, + 0xC78, 0xFB420001, + 0xC78, 0xFB430001, + 0xC78, 0xFB440001, + 0xC78, 0xFB450001, + 0xC78, 0xFA460001, + 0xC78, 0xF9470001, + 0xC78, 0xF8480001, + 0xC78, 0xF7490001, + 0xC78, 0xF64A0001, + 0xC78, 0xF54B0001, + 0xC78, 0xF44C0001, + 0xC78, 0xF34D0001, + 0xC78, 0xF24E0001, + 0xC78, 0xF14F0001, + 0xC78, 0xF0500001, + 0xC78, 0xEF510001, + 0xC78, 0xEE520001, + 0xC78, 0xED530001, + 0xC78, 0xEC540001, + 0xC78, 0xEB550001, + 0xC78, 0xEA560001, + 0xC78, 0xE9570001, + 0xC78, 0xE8580001, + 0xC78, 0xE7590001, + 0xC78, 0xE65A0001, + 0xC78, 0xE55B0001, + 0xC78, 0xE45C0001, + 0xC78, 0xE35D0001, + 0xC78, 0xE25E0001, + 0xC78, 0xE15F0001, + 0xC78, 0x8A600001, + 0xC78, 0x89610001, + 0xC78, 0x88620001, + 0xC78, 0x87630001, + 0xC78, 0x86640001, + 0xC78, 0x85650001, + 0xC78, 0x84660001, + 0xC78, 0x83670001, + 0xC78, 0x82680001, + 0xC78, 0x6B690001, + 0xC78, 0x6A6A0001, + 0xC78, 0x696B0001, + 0xC78, 0x686C0001, + 0xC78, 0x676D0001, + 0xC78, 0x666E0001, + 0xC78, 0x656F0001, + 0xC78, 0x64700001, + 0xC78, 0x63710001, + 0xC78, 0x62720001, + 0xC78, 0x61730001, + 0xC78, 0x49740001, + 0xC78, 0x48750001, + 0xC78, 0x47760001, + 0xC78, 0x46770001, + 0xC78, 0x45780001, + 0xC78, 0x44790001, + 0xC78, 0x437A0001, + 0xC78, 0x427B0001, + 0xC78, 0x417C0001, + 0xC78, 0x407D0001, + 0xC78, 0x407E0001, + 0xC78, 0x407F0001, + 0xC50, 0x00040022, + 0xC50, 0x00040020, + 0xB0000000,0x00000000, }; @@ -332,69 +782,70 @@ ODM_ReadAndConfig_MP_8192E_AGC_TAB( IN PDM_ODM_T pDM_Odm ) { - #define READ_NEXT_PAIR(v1, v2, i) do { i += 2; v1 = Array[i]; v2 = Array[i+1]; } while(0) - - u4Byte hex = 0; - u4Byte i = 0; - u2Byte count = 0; - pu4Byte ptr_array = NULL; - u1Byte platform = pDM_Odm->SupportPlatform; - u1Byte _interface = pDM_Odm->SupportInterface; - u1Byte board = pDM_Odm->BoardType; - u4Byte ArrayLen = sizeof(Array_MP_8192E_AGC_TAB)/sizeof(u4Byte); - pu4Byte Array = Array_MP_8192E_AGC_TAB; - - - hex += board; - hex += _interface << 8; - hex += platform << 16; - hex += 0xFF000000; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8192E_AGC_TAB, hex = 0x%X\n", hex)); - - for (i = 0; i < ArrayLen; i += 2 ) - { - u4Byte v1 = Array[i]; - u4Byte v2 = Array[i+1]; + u4Byte i = 0; + u1Byte cCond; + BOOLEAN bMatched = TRUE, bSkipped = FALSE; +//ask by Luke.Lee + u4Byte ArrayLen = sizeof(Array_MP_8192E_AGC_TAB)/sizeof(u4Byte); + pu4Byte Array = Array_MP_8192E_AGC_TAB; - // This (offset, data) pair meets the condition. - if ( v1 < 0xCDCDCDCD ) - { - odm_ConfigBB_AGC_8192E(pDM_Odm, v1, bMaskDWord, v2); - continue; - } + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("===> ODM_ReadAndConfig_MP_8192E_AGC_TAB\n")); + + while(( i+1) < ArrayLen) + { + u4Byte v1 = Array[i]; + u4Byte v2 = Array[i+1]; + + if(v1 & (BIT31|BIT30)) //positive & negative condition + { + if(v1 & BIT31) // positive condition + { + cCond = (u1Byte)((v1 & (BIT29|BIT28)) >> 28); + if(cCond == COND_ENDIF) //end + { + bMatched = TRUE; + bSkipped = FALSE; + } + else if(cCond == COND_ELSE) //else + { + bMatched = bSkipped?FALSE:TRUE; + } + else //if , else if + { + if(bSkipped) + bMatched = FALSE; + else + { + if(CheckPositive(pDM_Odm, v1, v2)) + { + bMatched = TRUE; + bSkipped = TRUE; + } + else + { + bMatched = FALSE; + bSkipped = FALSE; + } + } + } + } + else if(v1 & BIT30){ //negative condition + //do nothing + } + } 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_ConfigBB_AGC_8192E(pDM_Odm, v1, bMaskDWord, v2); - READ_NEXT_PAIR(v1, v2, i); - } - - while (v2 != 0xDEAD && i < ArrayLen -2) - { - READ_NEXT_PAIR(v1, v2, i); - } - - } - } + { + if(bMatched) + odm_ConfigBB_AGC_8192E(pDM_Odm, v1, bMaskDWord, v2); + } + i = i + 2; } +} +u4Byte +ODM_GetVersion_MP_8192E_AGC_TAB(void) +{ + return 36; } /****************************************************************************** @@ -460,16 +911,26 @@ u4Byte Array_MP_8192E_PHY_REG[] = { 0x944, 0x00000000, 0x94C, 0x00000008, 0xA00, 0x00D0C7C8, - 0xA04, 0x81FF000C, + 0xA04, 0x81FF800C, 0xA08, 0x8C838300, 0xA0C, 0x2E68120F, 0xA10, 0x95009B78, 0xA14, 0x1114D028, 0xA18, 0x00881117, 0xA1C, 0x89140F00, + 0x80010003,0x00000000,0x40000000,0x00000000, + 0xA20, 0x12130000, + 0xA24, 0x060A0D10, + 0xA28, 0x00000103, + 0x90010002,0x00000000,0x40000000,0x00000000, + 0xA20, 0x12130000, + 0xA24, 0x060A0D10, + 0xA28, 0x00000103, + 0xA0000000,0x00000000, 0xA20, 0x1A1B0000, 0xA24, 0x090E1317, 0xA28, 0x00000204, + 0xB0000000,0x00000000, 0xA2C, 0x00D30000, 0xA70, 0x101FFF00, 0xA74, 0x00000007, @@ -497,17 +958,25 @@ u4Byte Array_MP_8192E_PHY_REG[] = { 0xC44, 0x000100B7, 0xC48, 0xEC020107, 0xC4C, 0x007F037F, - 0xFF010718, 0xABCD, + 0x80010003,0x00000000,0x40000000,0x00000000, 0xC50, 0x00340220, - 0xCDCDCDCD, 0xCDCD, + 0x90010002,0x00000000,0x40000000,0x00000000, + 0xC50, 0x00340220, + 0x90010001,0x00000000,0x40000000,0x00000000, + 0xC50, 0x00340220, + 0xA0000000,0x00000000, 0xC50, 0x00340020, - 0xFF010718, 0xDEAD, + 0xB0000000,0x00000000, 0xC54, 0x0080801F, - 0xFF010718, 0xABCD, + 0x80010003,0x00000000,0x40000000,0x00000000, 0xC58, 0x00000220, - 0xCDCDCDCD, 0xCDCD, + 0x90010002,0x00000000,0x40000000,0x00000000, + 0xC58, 0x00000220, + 0x90010001,0x00000000,0x40000000,0x00000000, + 0xC58, 0x00000220, + 0xA0000000,0x00000000, 0xC58, 0x00000020, - 0xFF010718, 0xDEAD, + 0xB0000000,0x00000000, 0xC5C, 0x00248492, 0xC60, 0x00000000, 0xC64, 0x7112848B, @@ -517,17 +986,21 @@ u4Byte Array_MP_8192E_PHY_REG[] = { 0xC74, 0x02013169, 0xC78, 0x0000001F, 0xC7C, 0x00B91612, - 0xFF010718, 0xABCD, + 0x80010003,0x00000000,0x40000000,0x00000000, 0xC80, 0x2D4000B5, - 0xCDCDCDCD, 0xCDCD, + 0x90010002,0x00000000,0x40000000,0x00000000, + 0xC80, 0x2D4000B5, + 0xA0000000,0x00000000, 0xC80, 0x40000100, - 0xFF010718, 0xDEAD, + 0xB0000000,0x00000000, 0xC84, 0x21F60000, - 0xFF010718, 0xABCD, + 0x80010003,0x00000000,0x40000000,0x00000000, 0xC88, 0x2D4000B5, - 0xCDCDCDCD, 0xCDCD, + 0x90010002,0x00000000,0x40000000,0x00000000, + 0xC88, 0x2D4000B5, + 0xA0000000,0x00000000, 0xC88, 0x40000100, - 0xFF010718, 0xDEAD, + 0xB0000000,0x00000000, 0xC8C, 0xA0E40000, 0xC90, 0x00121820, 0xC94, 0x00000000, @@ -634,69 +1107,70 @@ ODM_ReadAndConfig_MP_8192E_PHY_REG( IN PDM_ODM_T pDM_Odm ) { - #define READ_NEXT_PAIR(v1, v2, i) do { i += 2; v1 = Array[i]; v2 = Array[i+1]; } while(0) - - u4Byte hex = 0; - u4Byte i = 0; - u2Byte count = 0; - pu4Byte ptr_array = NULL; - u1Byte platform = pDM_Odm->SupportPlatform; - u1Byte _interface = pDM_Odm->SupportInterface; - u1Byte board = pDM_Odm->BoardType; - u4Byte ArrayLen = sizeof(Array_MP_8192E_PHY_REG)/sizeof(u4Byte); - pu4Byte Array = Array_MP_8192E_PHY_REG; - - - hex += board; - hex += _interface << 8; - hex += platform << 16; - hex += 0xFF000000; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8192E_PHY_REG, hex = 0x%X\n", hex)); - - for (i = 0; i < ArrayLen; i += 2 ) - { - u4Byte v1 = Array[i]; - u4Byte v2 = Array[i+1]; + u4Byte i = 0; + u1Byte cCond; + BOOLEAN bMatched = TRUE, bSkipped = FALSE; +//ask by Luke.Lee + u4Byte ArrayLen = sizeof(Array_MP_8192E_PHY_REG)/sizeof(u4Byte); + pu4Byte Array = Array_MP_8192E_PHY_REG; - // This (offset, data) pair meets the condition. - if ( v1 < 0xCDCDCDCD ) - { - odm_ConfigBB_PHY_8192E(pDM_Odm, v1, bMaskDWord, v2); - continue; - } + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("===> ODM_ReadAndConfig_MP_8192E_PHY_REG\n")); + + while(( i+1) < ArrayLen) + { + u4Byte v1 = Array[i]; + u4Byte v2 = Array[i+1]; + + if(v1 & (BIT31|BIT30)) //positive & negative condition + { + if(v1 & BIT31) // positive condition + { + cCond = (u1Byte)((v1 & (BIT29|BIT28)) >> 28); + if(cCond == COND_ENDIF) //end + { + bMatched = TRUE; + bSkipped = FALSE; + } + else if(cCond == COND_ELSE) //else + { + bMatched = bSkipped?FALSE:TRUE; + } + else //if , else if + { + if(bSkipped) + bMatched = FALSE; + else + { + if(CheckPositive(pDM_Odm, v1, v2)) + { + bMatched = TRUE; + bSkipped = TRUE; + } + else + { + bMatched = FALSE; + bSkipped = FALSE; + } + } + } + } + else if(v1 & BIT30){ //negative condition + //do nothing + } + } 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_ConfigBB_PHY_8192E(pDM_Odm, v1, bMaskDWord, v2); - READ_NEXT_PAIR(v1, v2, i); - } - - while (v2 != 0xDEAD && i < ArrayLen -2) - { - READ_NEXT_PAIR(v1, v2, i); - } - - } - } + { + if(bMatched) + odm_ConfigBB_PHY_8192E(pDM_Odm, v1, bMaskDWord, v2); + } + i = i + 2; } +} +u4Byte +ODM_GetVersion_MP_8192E_PHY_REG(void) +{ + return 36; } /****************************************************************************** @@ -739,22 +1213,15 @@ ODM_ReadAndConfig_MP_8192E_PHY_REG_PG( IN PDM_ODM_T pDM_Odm ) { - u4Byte hex = 0; - u4Byte i = 0; - u2Byte count = 0; - pu4Byte ptr_array = NULL; - u1Byte platform = pDM_Odm->SupportPlatform; - u1Byte _interface = pDM_Odm->SupportInterface; - u1Byte board = pDM_Odm->BoardType; - u4Byte ArrayLen = sizeof(Array_MP_8192E_PHY_REG_PG)/sizeof(u4Byte); - pu4Byte Array = Array_MP_8192E_PHY_REG_PG; + u4Byte i = 0; + u4Byte ArrayLen = sizeof(Array_MP_8192E_PHY_REG_PG)/sizeof(u4Byte); + pu4Byte Array = Array_MP_8192E_PHY_REG_PG; + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("===> ODM_ReadAndConfig_MP_8192E_PHY_REG_PG\n")); pDM_Odm->PhyRegPgVersion = 1; pDM_Odm->PhyRegPgValueType = PHY_REG_PG_EXACT_VALUE; - hex += board; - hex += _interface << 8; - hex += platform << 16; - hex += 0xFF000000; + for (i = 0; i < ArrayLen; i += 6 ) { u4Byte v1 = Array[i]; @@ -764,29 +1231,7 @@ ODM_ReadAndConfig_MP_8192E_PHY_REG_PG( u4Byte v5 = Array[i+4]; u4Byte v6 = Array[i+5]; - // this line is a line of pure_body - if ( v1 < 0xCDCDCDCD ) - { - odm_ConfigBB_PHY_REG_PG_8192E(pDM_Odm, v1, v2, v3, v4, v5, v6); - continue; - } - else - { // this line is the start of branch - if ( !CheckCondition(Array[i], hex) ) - { // don't need the hw_body - i += 2; // skip the pair of expression - v1 = Array[i]; - v2 = Array[i+1]; - v3 = Array[i+2]; - while (v2 != 0xDEAD) - { - i += 3; - v1 = Array[i]; - v2 = Array[i+1]; - v3 = Array[i+1]; - } - } - } + odm_ConfigBB_PHY_REG_PG_8192E(pDM_Odm, v1, v2, v3, v4, v5, v6); } } diff --git a/hal/OUTSRC/rtl8192e/HalHWImg8192E_BB.h b/hal/OUTSRC/rtl8192e/HalHWImg8192E_BB.h index e86f145..462cebb 100644 --- a/hal/OUTSRC/rtl8192e/HalHWImg8192E_BB.h +++ b/hal/OUTSRC/rtl8192e/HalHWImg8192E_BB.h @@ -22,7 +22,6 @@ #ifndef __INC_MP_BB_HW_IMG_8192E_H #define __INC_MP_BB_HW_IMG_8192E_H -//static BOOLEAN CheckCondition(const u4Byte Condition, const u4Byte Hex); /****************************************************************************** * AGC_TAB.TXT @@ -32,6 +31,7 @@ void ODM_ReadAndConfig_MP_8192E_AGC_TAB( // TC: Test Chip, MP: MP Chip IN PDM_ODM_T pDM_Odm ); +u4Byte ODM_GetVersion_MP_8192E_AGC_TAB(void); /****************************************************************************** * PHY_REG.TXT @@ -41,6 +41,7 @@ void ODM_ReadAndConfig_MP_8192E_PHY_REG( // TC: Test Chip, MP: MP Chip IN PDM_ODM_T pDM_Odm ); +u4Byte ODM_GetVersion_MP_8192E_PHY_REG(void); /****************************************************************************** * PHY_REG_PG.TXT @@ -50,6 +51,7 @@ void ODM_ReadAndConfig_MP_8192E_PHY_REG_PG( // TC: Test Chip, MP: MP Chip IN PDM_ODM_T pDM_Odm ); +u4Byte ODM_GetVersion_MP_8192E_PHY_REG_PG(void); #endif #endif // end of HWIMG_SUPPORT diff --git a/hal/OUTSRC/rtl8192e/HalHWImg8192E_FW.c b/hal/OUTSRC/rtl8192e/HalHWImg8192E_FW.c index 3a87087..32359dc 100644 --- a/hal/OUTSRC/rtl8192e/HalHWImg8192E_FW.c +++ b/hal/OUTSRC/rtl8192e/HalHWImg8192E_FW.c @@ -18,7 +18,7 @@ * ******************************************************************************/ -//#include "Mp_Precomp.h" +#include "Mp_Precomp.h" #include "../odm_precomp.h" #if (RTL8192E_SUPPORT == 1) diff --git a/hal/OUTSRC/rtl8192e/HalHWImg8192E_FW_v18.c b/hal/OUTSRC/rtl8192e/HalHWImg8192E_FW_v18.c deleted file mode 100644 index 646257a..0000000 --- a/hal/OUTSRC/rtl8192e/HalHWImg8192E_FW_v18.c +++ /dev/null @@ -1,4831 +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 "Mp_Precomp.h" -#include "../odm_precomp.h" - -#if (RTL8192E_SUPPORT == 1) -#ifdef CONFIG_AP_WOWLAN -u1Byte Array_MP_8192E_FW_AP_WoWLAN[] = { -0xE1, 0x92, 0x20, 0x00, 0x12, 0x00, 0x00, 0x00, 0x12, 0x23, 0x15, 0x30, 0x90, 0x62, 0x00, 0x00, -0xA0, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x02, 0x49, 0x0D, 0x02, 0x67, 0xE5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x02, 0x51, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x02, 0x6F, 0xD6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x02, 0x67, 0xE6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x68, 0x4F, 0x00, 0x00, -0x00, 0x00, 0x00, 0x02, 0x6F, 0xD5, 0x15, 0xF0, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x15, 0xF0, 0x0F, -0x00, 0x00, 0x00, 0x00, 0x05, 0xF0, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x05, 0xF0, 0x0F, 0x00, 0x00, -0x00, 0x00, 0x10, 0xF0, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x10, 0xF0, 0x0F, 0x00, 0x00, 0x00, 0x00, -0xF5, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xF0, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x10, 0xF0, 0x3F, 0x00, -0x00, 0x00, 0x00, 0x0A, 0x08, 0x03, 0x03, 0x00, 0x04, 0x09, 0x07, 0x03, 0x03, 0x00, 0x04, 0x08, -0x06, 0x03, 0x02, 0x00, 0x04, 0x08, 0x05, 0x03, 0x01, 0x00, 0x04, 0x0D, 0x0A, 0x07, 0x05, 0x00, -0x08, 0x0C, 0x0A, 0x07, 0x04, 0x00, 0x08, 0x0B, 0x0A, 0x06, 0x05, 0x00, 0x08, 0x0B, 0x0A, 0x05, -0x03, 0x00, 0x08, 0x0B, 0x0A, 0x03, 0x02, 0x00, 0x08, 0x14, 0x12, 0x0C, 0x04, 0x00, 0x10, 0x14, -0x12, 0x09, 0x04, 0x00, 0x10, 0x24, 0x22, 0x1C, 0x12, 0x00, 0x20, 0x24, 0x22, 0x18, 0x0C, 0x00, -0x20, 0x24, 0x22, 0x14, 0x06, 0x00, 0x20, 0x24, 0x22, 0x0F, 0x04, 0x00, 0x20, 0x24, 0x21, 0x0A, -0x04, 0x00, 0x20, 0x23, 0x21, 0x0C, 0x04, 0x00, 0x20, 0x23, 0x1F, 0x0A, 0x04, 0x00, 0x20, 0x22, -0x1F, 0x0F, 0x04, 0x00, 0x20, 0x21, 0x1F, 0x16, 0x0C, 0x00, 0x20, 0x31, 0x2F, 0x20, 0x14, 0x00, -0x30, 0x31, 0x2F, 0x18, 0x10, 0x00, 0x30, 0x31, 0x2C, 0x18, 0x0C, 0x00, 0x30, 0x31, 0x2A, 0x14, -0x0C, 0x00, 0x30, 0x31, 0x28, 0x14, 0x00, 0x00, 0x30, 0x31, 0x24, 0x14, 0x00, 0x00, 0x30, 0x31, -0x1E, 0x14, 0x00, 0x00, 0x30, 0x02, 0x02, 0x02, 0x05, 0x02, 0x04, 0x05, 0x07, 0x07, 0x07, 0x08, -0x0A, 0x01, 0x02, 0x04, 0x06, 0x07, 0x0A, 0x0B, 0x0D, 0x02, 0x03, 0x04, 0x07, 0x08, 0x0B, 0x0D, -0x0F, 0x05, 0x05, 0x07, 0x07, 0x08, 0x0B, 0x0D, 0x0F, 0x05, 0x05, 0x07, 0x07, 0x08, 0x0B, 0x0D, -0x0F, 0x01, 0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x02, 0x03, 0x04, 0x07, 0x08, -0x0B, 0x0C, 0x0D, 0x0E, 0x10, 0x05, 0x05, 0x07, 0x07, 0x08, 0x0B, 0x0D, 0x0F, 0x0F, 0x0F, 0x05, -0x05, 0x07, 0x07, 0x08, 0x0B, 0x0D, 0x0F, 0x0F, 0x0F, 0x04, 0x04, 0x04, 0x05, 0x07, 0x07, 0x09, -0x09, 0x0C, 0x0E, 0x10, 0x12, 0x04, 0x05, 0x06, 0x07, 0x0B, 0x0D, 0x11, 0x13, 0x04, 0x05, 0x06, -0x07, 0x0B, 0x0D, 0x11, 0x13, 0x09, 0x09, 0x09, 0x09, 0x0C, 0x0E, 0x11, 0x13, 0x09, 0x09, 0x09, -0x09, 0x0C, 0x0E, 0x11, 0x13, 0x04, 0x08, 0x09, 0x0A, 0x0C, 0x0E, 0x10, 0x12, 0x13, 0x14, 0x04, -0x08, 0x0A, 0x0C, 0x0E, 0x10, 0x11, 0x13, 0x14, 0x16, 0x09, 0x09, 0x09, 0x09, 0x0C, 0x0E, 0x11, -0x13, 0x13, 0x13, 0x09, 0x09, 0x09, 0x09, 0x0C, 0x0E, 0x11, 0x13, 0x13, 0x13, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x26, 0x2A, 0x00, 0x00, 0x00, 0x1F, 0x21, 0x25, 0x27, -0x28, 0x00, 0x00, 0x00, 0x00, 0x23, 0x26, 0x28, 0x2A, 0x00, 0x00, 0x00, 0x00, 0x23, 0x26, 0x28, -0x2A, 0x00, 0x00, 0x00, 0x00, 0x23, 0x26, 0x28, 0x2A, 0x00, 0x00, 0x00, 0x00, 0x20, 0x25, 0x27, -0x29, 0x29, 0x2A, 0x00, 0x00, 0x00, 0x00, 0x20, 0x25, 0x27, 0x29, 0x29, 0x2A, 0x00, 0x00, 0x00, -0x00, 0x23, 0x26, 0x28, 0x2A, 0x2A, 0x2A, 0x00, 0x00, 0x00, 0x1F, 0x23, 0x26, 0x28, 0x2A, 0x2A, -0x2A, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, -0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, -0x48, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, -0xD8, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, -0xA0, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x01, 0x90, 0x00, 0x00, 0x01, -0xE0, 0x00, 0x00, 0x00, 0xA0, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x01, -0x90, 0x00, 0x00, 0x02, 0x58, 0x00, 0x00, 0x03, 0x20, 0x00, 0x00, 0x06, 0x40, 0x00, 0x00, 0x07, -0xD0, 0x00, 0x00, 0x00, 0xC8, 0x00, 0x00, 0x01, 0x18, 0x00, 0x00, 0x01, 0xE0, 0x00, 0x00, 0x02, -0xD0, 0x00, 0x00, 0x03, 0xE8, 0x00, 0x00, 0x04, 0xB0, 0x00, 0x00, 0x06, 0x40, 0x00, 0x00, 0x07, -0xD0, 0x00, 0x00, 0x00, 0xC8, 0x00, 0x00, 0x01, 0x18, 0x00, 0x00, 0x01, 0xE0, 0x00, 0x00, 0x02, -0xD0, 0x00, 0x00, 0x03, 0xE8, 0x00, 0x00, 0x04, 0xB0, 0x00, 0x00, 0x06, 0x40, 0x00, 0x00, 0x07, -0xD0, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, -0xA0, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x01, 0x90, 0x00, 0x00, 0x01, -0xE0, 0x00, 0x00, 0x04, 0xB0, 0x00, 0x00, 0x09, 0x60, 0x00, 0x00, 0x00, 0xC8, 0x00, 0x00, 0x01, -0x18, 0x00, 0x00, 0x01, 0xE0, 0x00, 0x00, 0x02, 0xD0, 0x00, 0x00, 0x03, 0xE8, 0x00, 0x00, 0x07, -0xD0, 0x00, 0x00, 0x0B, 0xB8, 0x00, 0x00, 0x13, 0x88, 0x00, 0x00, 0x17, 0x70, 0x00, 0x00, 0x1F, -0x40, 0x00, 0x00, 0x00, 0xC8, 0x00, 0x00, 0x01, 0x18, 0x00, 0x00, 0x01, 0xE0, 0x00, 0x00, 0x02, -0xD0, 0x00, 0x00, 0x03, 0xE8, 0x00, 0x00, 0x04, 0xB0, 0x00, 0x00, 0x06, 0x40, 0x00, 0x00, 0x07, -0xD0, 0x00, 0x00, 0x07, 0xD0, 0x00, 0x00, 0x07, 0xD0, 0x00, 0x00, 0x00, 0xC8, 0x00, 0x00, 0x01, -0x18, 0x00, 0x00, 0x01, 0xE0, 0x00, 0x00, 0x02, 0xD0, 0x00, 0x00, 0x03, 0xE8, 0x00, 0x00, 0x04, -0xB0, 0x00, 0x00, 0x06, 0x40, 0x00, 0x00, 0x07, 0xD0, 0x00, 0x00, 0x07, 0xD0, 0x00, 0x00, 0x07, -0xD0, 0x00, 0x02, 0x00, 0x02, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x12, 0x00, 0x18, 0x00, -0x24, 0x00, 0x30, 0x00, 0x48, 0x00, 0x60, 0x00, 0x6C, 0x00, 0x1E, 0x00, 0x32, 0x00, 0x3C, 0x00, -0x50, 0x00, 0x78, 0x00, 0xA0, 0x00, 0xC8, 0x00, 0xF0, 0x00, 0x50, 0x00, 0x78, 0x00, 0xA0, 0x00, -0xC8, 0x01, 0x2C, 0x01, 0x90, 0x03, 0x84, 0x05, 0x14, 0x00, 0x64, 0x00, 0x8C, 0x00, 0xF0, 0x01, -0x68, 0x01, 0xF4, 0x02, 0x58, 0x03, 0x20, 0x03, 0xE8, 0x00, 0x64, 0x00, 0x8C, 0x00, 0xF0, 0x01, -0x68, 0x01, 0xF4, 0x02, 0x58, 0x03, 0x20, 0x03, 0xE8, 0x00, 0x1E, 0x00, 0x32, 0x00, 0x3C, 0x00, -0x50, 0x00, 0x78, 0x00, 0xA0, 0x00, 0xC8, 0x00, 0xF0, 0x02, 0x58, 0x04, 0xB0, 0x00, 0x64, 0x00, -0x8C, 0x00, 0xF0, 0x01, 0x68, 0x01, 0xF4, 0x03, 0xE8, 0x05, 0xDC, 0x09, 0xC4, 0x0B, 0xB8, 0x0F, -0xA0, 0x00, 0x64, 0x00, 0x8C, 0x00, 0xF0, 0x01, 0x68, 0x01, 0xF4, 0x02, 0x58, 0x03, 0x20, 0x03, -0xE8, 0x03, 0xE8, 0x03, 0xE8, 0x00, 0x64, 0x00, 0x8C, 0x00, 0xF0, 0x01, 0x68, 0x01, 0xF4, 0x02, -0x58, 0x03, 0x20, 0x03, 0xE8, 0x03, 0xE8, 0x03, 0xE8, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x10, -0x18, 0x20, 0x30, 0x40, 0x50, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x04, 0x04, 0x05, -0x05, 0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x05, 0x05, 0x02, 0x02, 0x03, 0x03, 0x05, 0x05, 0x06, -0x06, 0x05, 0x06, 0x06, 0x07, 0x07, 0x08, 0x09, 0x0A, 0x05, 0x06, 0x06, 0x07, 0x07, 0x08, 0x09, -0x0A, 0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x05, 0x05, 0x06, 0x07, 0x02, 0x02, 0x03, 0x03, 0x05, -0x05, 0x06, 0x06, 0x08, 0x09, 0x05, 0x06, 0x06, 0x07, 0x07, 0x08, 0x09, 0x0A, 0x0A, 0x0B, 0x05, -0x06, 0x06, 0x07, 0x07, 0x08, 0x09, 0x0A, 0x0A, 0x0B, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x03, -0x04, 0x05, 0x06, 0x07, 0x08, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x05, 0x06, 0x06, -0x07, 0x08, 0x0A, 0x0B, 0x0C, 0x05, 0x06, 0x06, 0x07, 0x08, 0x0A, 0x0B, 0x0C, 0x05, 0x06, 0x07, -0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x05, 0x06, 0x06, 0x07, 0x08, 0x09, 0x0B, 0x0C, 0x0C, 0x0C, 0x05, -0x06, 0x06, 0x07, 0x08, 0x09, 0x0B, 0x0C, 0x0C, 0x0C, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, -0x0C, 0x0C, 0x0C, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0C, 0x0C, 0x19, 0x06, 0x04, -0x02, 0x00, 0x18, 0x14, 0x0D, 0x15, 0x0E, 0x15, 0x0F, 0x16, 0x10, 0x17, 0x11, 0x18, 0x12, 0x18, -0x13, 0x18, 0x1C, 0x15, 0x0E, 0x16, 0x10, 0x17, 0x11, 0x18, 0x12, 0x19, 0x1C, 0x1A, 0x1C, 0x1B, -0x1C, 0x14, 0x0C, 0x14, 0x0D, 0x0E, 0x14, 0x15, 0x0F, 0x16, 0x10, 0x17, 0x11, 0x12, 0x17, 0x0C, -0x1C, 0x0E, 0x14, 0x15, 0x0F, 0x16, 0x10, 0x13, 0x17, 0x18, 0x13, 0x19, 0x18, 0x1A, 0x19, 0x00, -0xC2, 0xAF, 0x80, 0xFE, 0x32, 0x12, 0x45, 0x34, 0x85, 0xD0, 0x0B, 0x75, 0xD0, 0x08, 0xAA, 0xE0, -0xC2, 0x8C, 0xE5, 0x8A, 0x24, 0x67, 0xF5, 0x8A, 0xE5, 0x8C, 0x34, 0x79, 0xF5, 0x8C, 0xD2, 0x8C, -0xEC, 0x24, 0x87, 0xF8, 0xE6, 0xBC, 0x02, 0x02, 0x74, 0xFF, 0xC3, 0x95, 0x81, 0xB4, 0x40, 0x00, -0x40, 0xCE, 0x79, 0x03, 0x78, 0x80, 0x16, 0xE6, 0x08, 0x70, 0x0B, 0xC2, 0xAF, 0xE6, 0x30, 0xE1, -0x03, 0x44, 0x18, 0xF6, 0xD2, 0xAF, 0x08, 0xD9, 0xED, 0xEA, 0x8B, 0xD0, 0x22, 0xE5, 0x0C, 0xFF, -0x23, 0x24, 0x81, 0xF8, 0x0F, 0x08, 0x08, 0xBF, 0x03, 0x04, 0x7F, 0x00, 0x78, 0x81, 0xE6, 0x30, -0xE4, 0xF2, 0x00, 0xE5, 0x0C, 0xC3, 0x9F, 0x50, 0x20, 0x05, 0x0C, 0x74, 0x86, 0x25, 0x0C, 0xF8, -0xE6, 0xFD, 0xA6, 0x81, 0x08, 0xE6, 0xAE, 0x0C, 0xBE, 0x02, 0x02, 0x74, 0xFF, 0xCD, 0xF8, 0xE8, -0x6D, 0x60, 0xE0, 0x08, 0xE6, 0xC0, 0xE0, 0x80, 0xF6, 0xE5, 0x0C, 0xD3, 0x9F, 0x40, 0x27, 0xE5, -0x0C, 0x24, 0x87, 0xF8, 0xE6, 0xAE, 0x0C, 0xBE, 0x02, 0x02, 0x74, 0xFF, 0xFD, 0x18, 0xE6, 0xCD, -0xF8, 0xE5, 0x81, 0x6D, 0x60, 0x06, 0xD0, 0xE0, 0xF6, 0x18, 0x80, 0xF5, 0xE5, 0x0C, 0x24, 0x86, -0xC8, 0xF6, 0x15, 0x0C, 0x80, 0xD3, 0xE5, 0x0C, 0x23, 0x24, 0x81, 0xF8, 0x7F, 0x04, 0xC2, 0xAF, -0xE6, 0x30, 0xE0, 0x03, 0x10, 0xE2, 0x0C, 0x7F, 0x00, 0x30, 0xE1, 0x07, 0x30, 0xE3, 0x04, 0x7F, -0x08, 0x54, 0xF4, 0x54, 0x7C, 0xC6, 0xD2, 0xAF, 0x54, 0x80, 0x42, 0x07, 0x22, 0x78, 0x86, 0xA6, -0x81, 0x74, 0x02, 0x60, 0x06, 0xFF, 0x08, 0x76, 0xFF, 0xDF, 0xFB, 0x7F, 0x03, 0xE4, 0x78, 0x80, -0xF6, 0x08, 0xF6, 0x08, 0xDF, 0xFA, 0x78, 0x81, 0x76, 0x30, 0x90, 0x49, 0x2F, 0x74, 0x01, 0x93, -0xC0, 0xE0, 0xE4, 0x93, 0xC0, 0xE0, 0x43, 0x89, 0x01, 0x75, 0x8A, 0x60, 0x75, 0x8C, 0x79, 0xD2, -0x8C, 0xD2, 0xAF, 0x22, 0x02, 0xEF, 0xD3, 0x94, 0x02, 0x40, 0x03, 0x7F, 0xFF, 0x22, 0x74, 0x81, -0x2F, 0x2F, 0xF8, 0xE6, 0x20, 0xE5, 0xF4, 0xC2, 0xAF, 0xE6, 0x44, 0x30, 0xF6, 0xD2, 0xAF, 0xAE, -0x0C, 0xEE, 0xC3, 0x9F, 0x50, 0x21, 0x0E, 0x74, 0x86, 0x2E, 0xF8, 0xE6, 0xF9, 0x08, 0xE6, 0x18, -0xBE, 0x02, 0x02, 0x74, 0xFF, 0xFD, 0xED, 0x69, 0x60, 0x09, 0x09, 0xE7, 0x19, 0x19, 0xF7, 0x09, -0x09, 0x80, 0xF3, 0x16, 0x16, 0x80, 0xDA, 0xEE, 0xD3, 0x9F, 0x40, 0x04, 0x05, 0x81, 0x05, 0x81, -0xEE, 0xD3, 0x9F, 0x40, 0x22, 0x74, 0x86, 0x2E, 0xF8, 0x08, 0xE6, 0xF9, 0xEE, 0xB5, 0x0C, 0x02, -0xA9, 0x81, 0x18, 0x06, 0x06, 0xE6, 0xFD, 0xED, 0x69, 0x60, 0x09, 0x19, 0x19, 0xE7, 0x09, 0x09, -0xF7, 0x19, 0x80, 0xF3, 0x1E, 0x80, 0xD9, 0xEF, 0x24, 0x86, 0xF8, 0xE6, 0x04, 0xF8, 0xEF, 0x2F, -0x04, 0x90, 0x49, 0x2F, 0x93, 0xF6, 0x08, 0xEF, 0x2F, 0x93, 0xF6, 0x7F, 0x00, 0x22, 0xEF, 0xD3, -0x94, 0x02, 0x40, 0x03, 0x7F, 0xFF, 0x22, 0xEF, 0x23, 0x24, 0x81, 0xF8, 0xE6, 0x30, 0xE5, 0xF4, -0xC2, 0xAF, 0xE6, 0x54, 0x8C, 0xF6, 0xD2, 0xAF, 0xE5, 0x0C, 0xB5, 0x07, 0x0A, 0x74, 0x86, 0x2F, -0xF8, 0xE6, 0xF5, 0x81, 0x02, 0x45, 0x7D, 0x50, 0x2E, 0x74, 0x87, 0x2F, 0xF8, 0xE6, 0xBF, 0x02, -0x02, 0x74, 0xFF, 0xFD, 0x18, 0xE6, 0xF9, 0x74, 0x86, 0x2F, 0xF8, 0xFB, 0xE6, 0xFC, 0xE9, 0x6C, -0x60, 0x08, 0xA8, 0x05, 0xE7, 0xF6, 0x1D, 0x19, 0x80, 0xF4, 0xA8, 0x03, 0xA6, 0x05, 0x1F, 0xE5, -0x0C, 0xB5, 0x07, 0xE3, 0x7F, 0x00, 0x22, 0x74, 0x87, 0x2F, 0xF8, 0xE6, 0xFD, 0x18, 0x86, 0x01, -0x0F, 0x74, 0x86, 0x2F, 0xF8, 0xA6, 0x01, 0x08, 0x86, 0x04, 0xE5, 0x0C, 0xB5, 0x07, 0x02, 0xAC, -0x81, 0xED, 0x6C, 0x60, 0x08, 0x0D, 0x09, 0xA8, 0x05, 0xE6, 0xF7, 0x80, 0xF4, 0xE5, 0x0C, 0xB5, -0x07, 0xDE, 0x89, 0x81, 0x7F, 0x00, 0x22, 0xEF, 0xD3, 0x94, 0x02, 0x40, 0x03, 0x7F, 0xFF, 0x22, -0xEF, 0x23, 0x24, 0x81, 0xF8, 0xC2, 0xAF, 0xE6, 0x30, 0xE5, 0x05, 0x30, 0xE0, 0x02, 0xD2, 0xE4, -0xD2, 0xE2, 0xC6, 0xD2, 0xAF, 0x7F, 0x00, 0x30, 0xE2, 0x01, 0x0F, 0x02, 0x45, 0x7C, 0x8F, 0xF0, -0xE4, 0xFF, 0xFE, 0xE5, 0x0C, 0x23, 0x24, 0x80, 0xF8, 0xC2, 0xA9, 0x30, 0xF7, 0x0D, 0x7F, 0x08, -0xE6, 0x60, 0x0B, 0x2D, 0xF6, 0x60, 0x30, 0x50, 0x2E, 0x80, 0x07, 0x30, 0xF1, 0x06, 0xED, 0xF6, -0x60, 0x25, 0x7E, 0x02, 0x08, 0x30, 0xF0, 0x10, 0xC2, 0xAF, 0xE6, 0x10, 0xE7, 0x23, 0x0E, 0x30, -0xE2, 0x0C, 0xD2, 0xAF, 0x7F, 0x04, 0x80, 0x12, 0xC2, 0xAF, 0xE6, 0x10, 0xE7, 0x13, 0x54, 0xEC, -0x4E, 0xF6, 0xD2, 0xAF, 0x02, 0x45, 0x7D, 0x7F, 0x08, 0x08, 0xEF, 0x44, 0x83, 0xF4, 0xC2, 0xAF, -0x56, 0xC6, 0xD2, 0xAF, 0x54, 0x80, 0x4F, 0xFF, 0x22, 0xEF, 0x2B, 0xFF, 0xEE, 0x3A, 0xFE, 0xED, -0x39, 0xFD, 0xEC, 0x38, 0xFC, 0x22, 0xEF, 0x5B, 0xFF, 0xEE, 0x5A, 0xFE, 0xED, 0x59, 0xFD, 0xEC, -0x58, 0xFC, 0x22, 0xEF, 0x4B, 0xFF, 0xEE, 0x4A, 0xFE, 0xED, 0x49, 0xFD, 0xEC, 0x48, 0xFC, 0x22, -0xEB, 0x9F, 0xF5, 0xF0, 0xEA, 0x9E, 0x42, 0xF0, 0xE9, 0x9D, 0x42, 0xF0, 0xE8, 0x9C, 0x45, 0xF0, -0x22, 0xE0, 0xFC, 0xA3, 0xE0, 0xFD, 0xA3, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x22, 0xE4, 0x93, 0xFC, -0x74, 0x01, 0x93, 0xFD, 0x74, 0x02, 0x93, 0xFE, 0x74, 0x03, 0x93, 0xFF, 0x22, 0xE0, 0xF8, 0xA3, -0xE0, 0xF9, 0xA3, 0xE0, 0xFA, 0xA3, 0xE0, 0xFB, 0x22, 0xE4, 0x93, 0xF8, 0x74, 0x01, 0x93, 0xF9, -0x74, 0x02, 0x93, 0xFA, 0x74, 0x03, 0x93, 0xFB, 0x22, 0xA4, 0x25, 0x82, 0xF5, 0x82, 0xE5, 0xF0, -0x35, 0x83, 0xF5, 0x83, 0x22, 0xE0, 0xFB, 0xA3, 0xE0, 0xFA, 0xA3, 0xE0, 0xF9, 0x22, 0xEB, 0xF0, -0xA3, 0xEA, 0xF0, 0xA3, 0xE9, 0xF0, 0x22, 0xD0, 0x83, 0xD0, 0x82, 0xF8, 0xE4, 0x93, 0x70, 0x12, -0x74, 0x01, 0x93, 0x70, 0x0D, 0xA3, 0xA3, 0x93, 0xF8, 0x74, 0x01, 0x93, 0xF5, 0x82, 0x88, 0x83, -0xE4, 0x73, 0x74, 0x02, 0x93, 0x68, 0x60, 0xEF, 0xA3, 0xA3, 0xA3, 0x80, 0xDF, 0x02, 0x46, 0x0D, -0xE4, 0x93, 0xA3, 0xF8, 0xE4, 0x93, 0xA3, 0x40, 0x03, 0xF6, 0x80, 0x01, 0xF2, 0x08, 0xDF, 0xF4, -0x80, 0x29, 0xE4, 0x93, 0xA3, 0xF8, 0x54, 0x07, 0x24, 0x0C, 0xC8, 0xC3, 0x33, 0xC4, 0x54, 0x0F, -0x44, 0x20, 0xC8, 0x83, 0x40, 0x04, 0xF4, 0x56, 0x80, 0x01, 0x46, 0xF6, 0xDF, 0xE4, 0x80, 0x0B, -0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x90, 0x49, 0x10, 0xE4, 0x7E, 0x01, 0x93, 0x60, -0xBC, 0xA3, 0xFF, 0x54, 0x3F, 0x30, 0xE5, 0x09, 0x54, 0x1F, 0xFE, 0xE4, 0x93, 0xA3, 0x60, 0x01, -0x0E, 0xCF, 0x54, 0xC0, 0x25, 0xE0, 0x60, 0xA8, 0x40, 0xB8, 0xE4, 0x93, 0xA3, 0xFA, 0xE4, 0x93, -0xA3, 0xF8, 0xE4, 0x93, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCA, 0xC5, 0x83, 0xCA, 0xF0, 0xA3, 0xC8, -0xC5, 0x82, 0xC8, 0xCA, 0xC5, 0x83, 0xCA, 0xDF, 0xE9, 0xDE, 0xE7, 0x80, 0xBE, 0x02, 0x48, 0xC8, -0x00, 0x41, 0xA7, 0x0A, 0x00, 0x41, 0xA7, 0x0B, 0x00, 0x44, 0xA6, 0xDD, 0x41, 0x4E, 0x59, 0x00, -0x44, 0xA6, 0xD9, 0x61, 0x6E, 0x79, 0x00, 0x41, 0xA7, 0x18, 0x00, 0x41, 0xA7, 0x19, 0x01, 0x4E, -0xCC, 0x58, 0x4E, 0x5F, 0xDD, 0x31, 0x88, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0xE4, 0xFF, -0x90, 0xA6, 0xC3, 0xF0, 0x90, 0x01, 0xC7, 0xE0, 0x64, 0xAD, 0x70, 0x37, 0xF0, 0x90, 0xA6, 0xD0, -0x74, 0x0F, 0xF0, 0x90, 0xA6, 0xC2, 0x74, 0x0A, 0xF0, 0xA3, 0xE0, 0x04, 0xF0, 0x90, 0xA6, 0xC3, -0xE0, 0x2F, 0xFE, 0x74, 0xC4, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xA6, 0xF5, 0x83, 0xEE, 0xF0, 0x0F, -0xEF, 0xB4, 0x0F, 0xE9, 0x90, 0x01, 0x3F, 0x74, 0x04, 0xF0, 0x7B, 0x01, 0x7A, 0xA6, 0x79, 0xC2, -0x12, 0x98, 0x93, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x7F, -0x8F, 0x71, 0xC2, 0xEF, 0x20, 0xE6, 0x02, 0x61, 0x89, 0x90, 0x00, 0x8C, 0xE0, 0xF5, 0x6D, 0x7F, -0x8D, 0x71, 0xC2, 0x90, 0x00, 0x8E, 0xE0, 0xF5, 0x6E, 0xEF, 0x24, 0xFC, 0x60, 0x12, 0x24, 0xFC, -0x70, 0x02, 0x41, 0xB3, 0x24, 0x07, 0x60, 0x02, 0x61, 0x7B, 0xAF, 0x6D, 0xF1, 0x78, 0x61, 0x7B, -0x74, 0x17, 0x25, 0x6D, 0xF5, 0x82, 0xE4, 0x34, 0x9C, 0xF5, 0x83, 0xE0, 0xFB, 0xE4, 0xFD, 0xFF, -0x71, 0x93, 0x75, 0xF0, 0x05, 0xE5, 0x6D, 0x90, 0x97, 0x9A, 0x11, 0x49, 0xE0, 0x13, 0x13, 0x54, -0x03, 0xFB, 0x0D, 0xE4, 0xFF, 0x71, 0x93, 0x75, 0xF0, 0x05, 0xE5, 0x6D, 0x90, 0x97, 0x9A, 0x11, -0x49, 0xE0, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0xFB, 0x0D, 0xE4, 0xFF, 0x71, 0x93, 0x75, 0xF0, -0x05, 0xE5, 0x6D, 0x90, 0x97, 0x9A, 0x11, 0x49, 0xE0, 0xC4, 0x54, 0x03, 0xFB, 0x0D, 0xE4, 0xFF, -0x71, 0x93, 0x75, 0xF0, 0x05, 0xE5, 0x6D, 0x90, 0x97, 0x97, 0x11, 0x49, 0xE0, 0xFB, 0xE4, 0xFD, -0x0F, 0x71, 0x93, 0x75, 0xF0, 0x05, 0xE5, 0x6D, 0x90, 0x97, 0x98, 0x71, 0x8E, 0x75, 0xF0, 0x05, -0xE5, 0x6D, 0x90, 0x97, 0x99, 0x11, 0x49, 0xE0, 0xC4, 0x13, 0x54, 0x01, 0xFB, 0x0D, 0x7F, 0x01, -0x71, 0x93, 0x75, 0xF0, 0x05, 0xE5, 0x6D, 0x90, 0x97, 0x99, 0x11, 0x49, 0xE0, 0x54, 0x1F, 0xFB, -0x0D, 0x71, 0x93, 0x75, 0xF0, 0x08, 0xE5, 0x6D, 0x90, 0x89, 0x00, 0x11, 0x49, 0xE0, 0xFB, 0xE4, -0xFD, 0x0F, 0x71, 0x93, 0x75, 0xF0, 0x08, 0xE5, 0x6D, 0x90, 0x89, 0x01, 0x71, 0x8E, 0x75, 0xF0, -0x08, 0xE5, 0x6D, 0x90, 0x89, 0x02, 0x71, 0x8E, 0x75, 0xF0, 0x08, 0xE5, 0x6D, 0x90, 0x89, 0x03, -0x71, 0x8E, 0x75, 0xF0, 0x08, 0xE5, 0x6D, 0x90, 0x89, 0x04, 0x11, 0x49, 0xE0, 0xFB, 0xE4, 0xFD, -0x0F, 0x71, 0x93, 0x75, 0xF0, 0x08, 0xE5, 0x6D, 0x90, 0x89, 0x05, 0x71, 0x8E, 0x75, 0xF0, 0x08, -0xE5, 0x6D, 0x90, 0x89, 0x06, 0x71, 0x8E, 0x75, 0xF0, 0x08, 0xE5, 0x6D, 0x90, 0x89, 0x07, 0x11, -0x49, 0x61, 0x76, 0x90, 0xA5, 0x33, 0xE0, 0xFB, 0xE4, 0xFD, 0xFF, 0x71, 0x93, 0x90, 0xA5, 0x31, -0xE0, 0x54, 0x0F, 0xFB, 0x0D, 0x71, 0x93, 0x90, 0xA5, 0x35, 0xE0, 0xFB, 0x0D, 0x71, 0x93, 0x90, -0xA5, 0x36, 0xE0, 0xFB, 0x0D, 0x71, 0x93, 0x74, 0xAF, 0x25, 0x6D, 0xF5, 0x82, 0xE4, 0x34, 0xA4, -0xF5, 0x83, 0xE0, 0xFB, 0xE4, 0xFD, 0x0F, 0x71, 0x93, 0x90, 0xA5, 0x2F, 0xE0, 0x54, 0x01, 0xFB, -0x0D, 0x71, 0x93, 0x90, 0xA5, 0x2F, 0xE0, 0xC4, 0x13, 0x13, 0x54, 0x01, 0xFB, 0x0D, 0x7F, 0x01, -0x71, 0x93, 0x7B, 0xDE, 0x0D, 0x71, 0x93, 0x90, 0xA5, 0x30, 0xE0, 0x54, 0x01, 0xFB, 0xE4, 0xFD, -0x0F, 0x71, 0x93, 0x90, 0xA5, 0x30, 0xE0, 0xC3, 0x13, 0x54, 0x01, 0xFB, 0x0D, 0x7F, 0x02, 0x71, -0x93, 0x90, 0xA5, 0x2F, 0xE0, 0x13, 0x13, 0x13, 0x54, 0x01, 0xFB, 0x0D, 0x7F, 0x02, 0x71, 0x93, -0x90, 0xA3, 0x9A, 0xE0, 0xFB, 0x0D, 0x71, 0x93, 0x90, 0xA5, 0x3A, 0xE0, 0xFB, 0x1D, 0x71, 0x93, -0x90, 0xA5, 0x39, 0xE0, 0xFB, 0x0D, 0x71, 0x93, 0x90, 0xA5, 0x31, 0xE0, 0xC4, 0x54, 0x0F, 0xFB, -0xE4, 0xFD, 0x7F, 0x03, 0x71, 0x93, 0x90, 0xA5, 0x30, 0xE0, 0x13, 0x13, 0x54, 0x01, 0xFB, 0x0D, -0x7F, 0x03, 0x71, 0x93, 0x90, 0xA5, 0x30, 0xE0, 0x13, 0x13, 0x13, 0x54, 0x01, 0xFB, 0x0D, 0x7F, -0x03, 0x71, 0x93, 0x90, 0xA3, 0x9C, 0xE0, 0xFB, 0x0D, 0x71, 0x93, 0x7F, 0x8F, 0x71, 0xC2, 0xEF, -0x30, 0xE0, 0x06, 0xE4, 0xFD, 0x7F, 0x8D, 0x91, 0xF2, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x11, 0x49, -0xE0, 0xFB, 0x0D, 0xEF, 0x70, 0x04, 0x74, 0xF0, 0x80, 0x16, 0xEF, 0xB4, 0x01, 0x04, 0x74, 0xF4, -0x80, 0x0E, 0xEF, 0xB4, 0x02, 0x04, 0x74, 0xF8, 0x80, 0x06, 0xEF, 0xB4, 0x03, 0x0C, 0x74, 0xFC, -0x2D, 0xF5, 0x82, 0xE4, 0x34, 0x02, 0xF5, 0x83, 0xEB, 0xF0, 0x22, 0xFD, 0x7F, 0x63, 0x91, 0xF2, -0x7F, 0x62, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x8F, 0x82, 0x75, 0x83, 0x00, 0xE0, 0x90, -0xA7, 0x1C, 0xF0, 0x7F, 0x10, 0x7E, 0x00, 0x12, 0x3E, 0x87, 0x90, 0xA7, 0x1C, 0xE0, 0xFF, 0xD0, -0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0xA7, 0x15, 0xED, 0xF0, -0x90, 0xA7, 0x14, 0xEF, 0xF0, 0xD3, 0x94, 0x07, 0x50, 0x6D, 0x7F, 0x47, 0x71, 0xC2, 0x90, 0xA7, -0x14, 0xE0, 0xFE, 0x74, 0x01, 0xA8, 0x06, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0x5F, -0xFD, 0x7F, 0x47, 0x91, 0xF2, 0x7F, 0x46, 0x71, 0xC2, 0x90, 0xA7, 0x14, 0xE0, 0xFE, 0x74, 0x01, -0xA8, 0x06, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0x4F, 0xFD, 0x7F, 0x46, 0x91, 0xF2, 0x90, -0xA7, 0x15, 0xE0, 0x60, 0x17, 0x7F, 0x45, 0x71, 0xC2, 0x90, 0xA7, 0x14, 0xE0, 0xFE, 0x74, 0x01, -0xA8, 0x06, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0x4F, 0x80, 0x16, 0x7F, 0x45, 0x71, 0xC2, -0x90, 0xA7, 0x14, 0xE0, 0xFE, 0x74, 0x01, 0xA8, 0x06, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, -0xF4, 0x5F, 0xFD, 0x7F, 0x45, 0x80, 0x6E, 0x90, 0xA7, 0x14, 0xE0, 0x24, 0xF8, 0xF0, 0x7F, 0x63, -0x71, 0xC2, 0x90, 0xA7, 0x14, 0xE0, 0xFE, 0x74, 0x01, 0xA8, 0x06, 0x08, 0x80, 0x02, 0xC3, 0x33, -0xD8, 0xFC, 0xF4, 0x5F, 0x71, 0xBB, 0x90, 0xA7, 0x14, 0xE0, 0xFE, 0x74, 0x01, 0xA8, 0x06, 0x08, -0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0x4F, 0xFD, 0x7F, 0x62, 0x91, 0xF2, 0x90, 0xA7, 0x15, 0xE0, -0x60, 0x1A, 0x7F, 0x61, 0x71, 0xC2, 0x90, 0xA7, 0x14, 0xE0, 0xFE, 0x74, 0x01, 0xA8, 0x06, 0x08, -0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0x4F, 0xFD, 0x7F, 0x61, 0x80, 0x19, 0x7F, 0x61, 0x71, 0xC2, -0x90, 0xA7, 0x14, 0xE0, 0xFE, 0x74, 0x01, 0xA8, 0x06, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, -0xF4, 0x5F, 0xFD, 0x7F, 0x61, 0x91, 0xF2, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x7F, 0x02, 0x71, 0xC2, -0xEF, 0x44, 0x01, 0xFD, 0x7F, 0x02, 0x91, 0xF2, 0x7F, 0x02, 0x71, 0xC2, 0xEF, 0x54, 0xFE, 0xFD, -0x7F, 0x02, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x8F, 0x82, 0x75, 0x83, 0x00, 0xED, 0xF0, -0x7F, 0x10, 0x7E, 0x00, 0x12, 0x3E, 0x87, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x7F, 0xFF, 0x12, 0x5A, -0xBC, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x12, 0x5F, 0x7F, 0x91, 0xE8, 0x91, 0xDC, 0x91, -0xDC, 0x90, 0x01, 0x00, 0x74, 0x3F, 0xF0, 0xA3, 0xE0, 0x54, 0xFD, 0xF0, 0x90, 0x05, 0x53, 0xE0, -0x44, 0x20, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x12, 0x06, 0x89, 0xFF, 0x54, 0x80, 0xFE, 0x90, -0xA5, 0x69, 0xE0, 0x54, 0x7F, 0x4E, 0xFE, 0xF0, 0xEF, 0x54, 0x40, 0xFF, 0xEE, 0x54, 0xBF, 0x4F, -0xFF, 0xF0, 0x12, 0x06, 0x89, 0xFE, 0x54, 0x20, 0xFD, 0xEF, 0x54, 0xDF, 0x4D, 0xFF, 0x90, 0xA5, -0x69, 0xF0, 0xEE, 0x54, 0x10, 0xFE, 0xEF, 0x54, 0xEF, 0x4E, 0xFF, 0xF0, 0x12, 0x06, 0x89, 0x54, -0x0F, 0xFE, 0xEF, 0x54, 0xF0, 0x4E, 0x90, 0xA5, 0x69, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x06, 0xA2, -0xFF, 0x54, 0x7F, 0x90, 0xA5, 0x6B, 0xF0, 0xEF, 0x54, 0x80, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, -0xFF, 0x90, 0xA5, 0x6A, 0xE0, 0x54, 0xFE, 0x4F, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x06, 0xA2, 0x90, -0xA5, 0x6C, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x06, 0xA2, 0x54, 0x01, 0x25, 0xE0, 0xFF, 0x90, 0xA5, -0x6A, 0xE0, 0x54, 0xFD, 0x4F, 0xF0, 0x90, 0xA5, 0x69, 0xE0, 0x54, 0x0F, 0xFF, 0xBF, 0x0E, 0x18, -0x7F, 0x4E, 0x71, 0xC2, 0xEF, 0x54, 0xBF, 0xFD, 0x7F, 0x4E, 0x91, 0xF2, 0x7F, 0x4A, 0x71, 0xC2, -0xEF, 0x54, 0xFB, 0xFD, 0x7F, 0x4A, 0x91, 0xF2, 0x90, 0xA5, 0x6A, 0xE0, 0xC3, 0x13, 0x30, 0xE0, -0x1D, 0x7F, 0x49, 0x71, 0xC2, 0xEF, 0x44, 0x20, 0xFD, 0x7F, 0x49, 0x91, 0xF2, 0x7F, 0x63, 0x71, -0xC2, 0xEF, 0x44, 0x20, 0x71, 0xBB, 0xEF, 0x54, 0xDF, 0xFD, 0x7F, 0x62, 0x91, 0xF2, 0x90, 0xA5, -0x69, 0xE0, 0xFE, 0x54, 0x0F, 0xFF, 0xEE, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x7D, 0x00, 0x20, 0xE0, -0x02, 0x7D, 0x01, 0x61, 0xE4, 0x90, 0xA5, 0x6A, 0xE0, 0xC3, 0x13, 0x30, 0xE0, 0x6D, 0x7F, 0x60, -0x71, 0xC2, 0xEF, 0x54, 0x20, 0x90, 0xA5, 0xFA, 0xF0, 0x90, 0x00, 0xCC, 0xE0, 0x44, 0x04, 0x90, -0xA5, 0xFB, 0xF0, 0xE0, 0xFD, 0x7F, 0xCC, 0x91, 0xF2, 0x90, 0xA5, 0xFA, 0xE0, 0x60, 0x0E, 0x7F, -0x02, 0x71, 0xC2, 0xEF, 0x44, 0x04, 0xFD, 0x7F, 0x02, 0x91, 0xF2, 0x80, 0x2E, 0x7F, 0x02, 0x71, -0xC2, 0xEF, 0x54, 0xFB, 0xFD, 0x7F, 0x02, 0x91, 0xF2, 0x7F, 0x49, 0x71, 0xC2, 0xEF, 0x54, 0xDF, -0xFD, 0x7F, 0x49, 0x91, 0xF2, 0x90, 0xA5, 0x66, 0xE0, 0xC3, 0x13, 0x30, 0xE0, 0x0D, 0x90, 0xA5, -0x3D, 0x74, 0xD0, 0xF0, 0x90, 0xA5, 0x2F, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x00, 0xCC, 0xE0, 0x54, -0xFB, 0x90, 0xA5, 0xFB, 0xF0, 0xE0, 0xFD, 0x7F, 0xCC, 0x91, 0xF2, 0x22, 0x7F, 0x54, 0x71, 0xC2, -0xE5, 0x0D, 0x5F, 0xF5, 0x11, 0x7F, 0x55, 0x71, 0xC2, 0xE5, 0x0E, 0x5F, 0xF5, 0x12, 0x7F, 0x56, -0x71, 0xC2, 0xE5, 0x0F, 0x5F, 0xF5, 0x13, 0x7F, 0x57, 0x71, 0xC2, 0xE5, 0x10, 0x5F, 0xF5, 0x14, -0xAD, 0x11, 0x7F, 0x54, 0x91, 0xF2, 0xAD, 0x12, 0x7F, 0x55, 0x91, 0xF2, 0xAD, 0x13, 0x7F, 0x56, -0x91, 0xF2, 0xAD, 0x14, 0x7F, 0x57, 0x91, 0xF2, 0x53, 0x91, 0xEF, 0x22, 0x7F, 0x81, 0x71, 0xC2, -0xEF, 0x54, 0xFE, 0xFD, 0x7F, 0x81, 0x91, 0xF2, 0x7F, 0x80, 0x71, 0xC2, 0xEF, 0x44, 0x80, 0xFD, -0x7F, 0x80, 0x91, 0xF2, 0x12, 0x99, 0xCB, 0x12, 0x3E, 0x48, 0x12, 0x99, 0xD8, 0x12, 0x9A, 0xA4, -0x7F, 0x01, 0x12, 0x46, 0x45, 0x90, 0xA5, 0x68, 0x74, 0x02, 0xF0, 0xFF, 0x12, 0x46, 0x45, 0x90, -0xA5, 0x68, 0xE0, 0x04, 0xF0, 0x12, 0x50, 0x5F, 0x12, 0xA0, 0x18, 0x7F, 0x80, 0x71, 0xC2, 0xEF, -0x44, 0x40, 0xFD, 0x7F, 0x80, 0x91, 0xF2, 0x75, 0x28, 0xFF, 0x12, 0x58, 0x47, 0x12, 0x9A, 0x19, -0x7F, 0x81, 0x71, 0xC2, 0xEF, 0x44, 0x04, 0xFD, 0x7F, 0x81, 0x91, 0xF2, 0x12, 0x9A, 0xB2, 0xE4, -0xFF, 0x02, 0x46, 0xCE, 0x90, 0xA5, 0x3D, 0xE0, 0xFD, 0x7F, 0x93, 0x91, 0xF2, 0x90, 0xA5, 0x34, -0xE0, 0x60, 0x12, 0x90, 0x01, 0x2F, 0xE0, 0x30, 0xE7, 0x05, 0x74, 0x10, 0xF0, 0x80, 0x06, 0x90, -0x01, 0x2F, 0x74, 0x90, 0xF0, 0x7F, 0x08, 0x71, 0xC2, 0xEF, 0x44, 0x10, 0xFD, 0x7F, 0x08, 0x91, -0xF2, 0x7F, 0x01, 0xF1, 0xEA, 0x7F, 0x90, 0x71, 0xC2, 0xEF, 0x44, 0x01, 0xFD, 0x7F, 0x90, 0x91, -0xF2, 0x7F, 0x14, 0x7E, 0x00, 0x02, 0x3E, 0x87, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, -0xA7, 0x12, 0xEF, 0xF0, 0x7F, 0x8F, 0x71, 0xC2, 0xEF, 0x30, 0xE6, 0x48, 0x7F, 0x8D, 0x71, 0xC2, -0xEF, 0x64, 0x01, 0x70, 0x3F, 0x90, 0xA7, 0x13, 0xF0, 0x90, 0xA7, 0x13, 0xE0, 0xFD, 0x90, 0xA7, -0x12, 0xE0, 0x75, 0xF0, 0x10, 0x90, 0x81, 0x00, 0x11, 0x49, 0xE5, 0x82, 0x2D, 0xF5, 0x82, 0xE4, -0x35, 0x83, 0xF5, 0x83, 0xE0, 0xFB, 0xE4, 0xFF, 0x71, 0x93, 0x90, 0xA7, 0x13, 0xE0, 0x04, 0xF0, -0xE0, 0xC3, 0x94, 0x10, 0x40, 0xD3, 0x7F, 0x8F, 0x71, 0xC2, 0xEF, 0x30, 0xE0, 0x06, 0xE4, 0xFD, -0x7F, 0x8D, 0x91, 0xF2, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x12, 0x9B, 0x8F, 0x7F, 0x08, 0x71, 0xC2, -0xEF, 0x54, 0xEF, 0xFD, 0x7F, 0x08, 0x91, 0xF2, 0xE4, 0xFF, 0x90, 0xA7, 0x07, 0xEF, 0xF0, 0xE4, -0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0x09, 0xE0, 0x7F, 0x00, 0x30, 0xE7, 0x02, 0x7F, 0x01, 0x90, -0xA7, 0x07, 0xE0, 0x6F, 0x60, 0x3E, 0xC3, 0x90, 0xA7, 0x09, 0xE0, 0x94, 0x88, 0x90, 0xA7, 0x08, -0xE0, 0x94, 0x13, 0x40, 0x08, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x10, 0xF0, 0x22, 0x90, 0xA7, 0x08, -0xE4, 0x75, 0xF0, 0x01, 0x12, 0x08, 0xD6, 0x7F, 0x14, 0x7E, 0x00, 0x12, 0x3E, 0x87, 0xD3, 0x90, -0xA7, 0x09, 0xE0, 0x94, 0x32, 0x90, 0xA7, 0x08, 0xE0, 0x94, 0x00, 0x40, 0xB7, 0x90, 0x01, 0xC6, -0xE0, 0x30, 0xE0, 0xB0, 0x22, 0x7F, 0xF4, 0x12, 0x4B, 0xC2, 0xEF, 0x20, 0xE5, 0x0E, 0x7F, 0xF4, -0x12, 0x4B, 0xC2, 0xEF, 0x7F, 0x01, 0x20, 0xE4, 0x05, 0x7F, 0x02, 0x22, 0x7F, 0x03, 0x22, 0x11, -0x45, 0x90, 0xA3, 0x9D, 0xEF, 0xF0, 0x11, 0x78, 0x90, 0x01, 0x64, 0x74, 0x01, 0xF0, 0x90, 0x04, -0x23, 0xE0, 0x44, 0x80, 0xF0, 0x02, 0x37, 0xF8, 0x11, 0xE7, 0x31, 0x17, 0x11, 0xA9, 0x11, 0xC8, -0xE4, 0xF5, 0x0D, 0xF5, 0x0E, 0xF5, 0x0F, 0x75, 0x10, 0x80, 0x43, 0x10, 0x02, 0xAD, 0x0D, 0x7F, -0x50, 0x12, 0x4C, 0xF2, 0xAD, 0x0E, 0x7F, 0x51, 0x12, 0x4C, 0xF2, 0xAD, 0x0F, 0x7F, 0x52, 0x12, -0x4C, 0xF2, 0xAD, 0x10, 0x7F, 0x53, 0x02, 0x4C, 0xF2, 0x75, 0x15, 0x12, 0xE4, 0xF5, 0x16, 0x75, -0x17, 0x87, 0x75, 0x18, 0x73, 0x90, 0x01, 0x30, 0xE5, 0x15, 0xF0, 0xA3, 0xE5, 0x16, 0xF0, 0xA3, -0xE5, 0x17, 0xF0, 0xA3, 0xE5, 0x18, 0xF0, 0x22, 0x75, 0x1D, 0x06, 0x75, 0x1E, 0x01, 0x75, 0x1F, -0x03, 0x75, 0x20, 0x62, 0x90, 0x01, 0x38, 0xE5, 0x1D, 0xF0, 0xA3, 0xE5, 0x1E, 0xF0, 0xA3, 0xE5, -0x1F, 0xF0, 0xA3, 0xE5, 0x20, 0xF0, 0x22, 0x90, 0x01, 0x30, 0xE4, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, -0xA3, 0xF0, 0x90, 0x01, 0x38, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xFD, 0x7F, 0x50, 0x12, -0x4C, 0xF2, 0xE4, 0xFD, 0x7F, 0x51, 0x12, 0x4C, 0xF2, 0xE4, 0xFD, 0x7F, 0x52, 0x12, 0x4C, 0xF2, -0xE4, 0xFD, 0x7F, 0x53, 0x02, 0x4C, 0xF2, 0x90, 0x01, 0x34, 0x74, 0xFF, 0xF0, 0xA3, 0xF0, 0xA3, -0xF0, 0xA3, 0xF0, 0x90, 0x01, 0x3C, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xFD, 0x7F, 0x54, -0x12, 0x4C, 0xF2, 0x7D, 0xFF, 0x7F, 0x55, 0x12, 0x4C, 0xF2, 0x7D, 0xFF, 0x7F, 0x56, 0x12, 0x4C, -0xF2, 0x7D, 0xFF, 0x7F, 0x57, 0x02, 0x4C, 0xF2, 0x90, 0x01, 0xCF, 0xE0, 0x90, 0xA5, 0xFC, 0xF0, -0xE0, 0xFF, 0x30, 0xE0, 0x07, 0x90, 0x01, 0xCF, 0xE0, 0x54, 0xFE, 0xF0, 0xEF, 0x30, 0xE5, 0x22, -0x90, 0x01, 0xCF, 0xE0, 0x54, 0xDF, 0xF0, 0x90, 0x01, 0x34, 0x74, 0x20, 0xF0, 0xE4, 0xF5, 0xA8, -0xF5, 0xE8, 0x11, 0xE7, 0x90, 0x00, 0x03, 0xE0, 0x54, 0xFB, 0xFD, 0x7F, 0x03, 0x12, 0x4C, 0xF2, -0x80, 0xFE, 0x22, 0xC0, 0xE0, 0xC0, 0xF0, 0xC0, 0x83, 0xC0, 0x82, 0xC0, 0xD0, 0x75, 0xD0, 0x00, -0xC0, 0x00, 0xC0, 0x01, 0xC0, 0x02, 0xC0, 0x03, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, -0x12, 0x9A, 0xBC, 0xE5, 0x19, 0x30, 0xE1, 0x02, 0xB1, 0x9B, 0xE5, 0x19, 0x30, 0xE3, 0x02, 0xF1, -0x8D, 0xE5, 0x19, 0x30, 0xE4, 0x02, 0xF1, 0x79, 0xE5, 0x19, 0x30, 0xE5, 0x02, 0x31, 0x48, 0xE5, -0x1B, 0x30, 0xE0, 0x03, 0x12, 0x6F, 0x6C, 0xE5, 0x1B, 0x30, 0xE1, 0x03, 0x12, 0x6E, 0x83, 0xE5, -0x1B, 0x30, 0xE2, 0x03, 0x12, 0x5E, 0xFD, 0xE5, 0x1B, 0x30, 0xE3, 0x03, 0x12, 0x6B, 0x93, 0xE5, -0x1B, 0x30, 0xE4, 0x03, 0x12, 0x9A, 0xF2, 0xE5, 0x1B, 0x30, 0xE5, 0x03, 0x12, 0x67, 0xC8, 0xE5, -0x1B, 0x30, 0xE6, 0x03, 0x12, 0x9B, 0x21, 0xE5, 0x1B, 0x30, 0xE7, 0x03, 0x12, 0x9B, 0x3D, 0xE5, -0x1C, 0x30, 0xE0, 0x03, 0x12, 0x9B, 0x4F, 0xE5, 0x1C, 0x30, 0xE1, 0x02, 0xF1, 0xB4, 0xE5, 0x1C, -0x30, 0xE4, 0x02, 0xD1, 0x1E, 0xE5, 0x1C, 0x30, 0xE5, 0x02, 0x51, 0x3E, 0xE5, 0x1C, 0x30, 0xE6, -0x02, 0xB1, 0x5A, 0xD0, 0x07, 0xD0, 0x06, 0xD0, 0x05, 0xD0, 0x04, 0xD0, 0x03, 0xD0, 0x02, 0xD0, -0x01, 0xD0, 0x00, 0xD0, 0xD0, 0xD0, 0x82, 0xD0, 0x83, 0xD0, 0xF0, 0xD0, 0xE0, 0x32, 0xE4, 0xF5, -0x65, 0x74, 0x81, 0x25, 0x65, 0xF5, 0x82, 0xE4, 0x34, 0x94, 0xF5, 0x83, 0xE0, 0xFF, 0x54, 0x03, -0xF5, 0x66, 0xEF, 0x54, 0x04, 0x13, 0x13, 0x54, 0x3F, 0xF5, 0x67, 0x74, 0xAF, 0x25, 0x65, 0xF5, -0x82, 0xE4, 0x34, 0xA4, 0xF5, 0x83, 0xE0, 0x70, 0x02, 0x61, 0xB8, 0xE5, 0x65, 0x13, 0x13, 0x13, -0x54, 0x1F, 0x90, 0xA5, 0xFC, 0xF0, 0xE5, 0x65, 0x54, 0x07, 0xA3, 0xF0, 0x90, 0xA5, 0xFC, 0xE0, -0x24, 0x01, 0xF5, 0x82, 0xE4, 0x34, 0x95, 0xF5, 0x83, 0xE0, 0x90, 0xA5, 0xFE, 0xF0, 0xFD, 0x90, -0xA5, 0xFD, 0xE0, 0xFF, 0x74, 0x01, 0x7E, 0x00, 0xA8, 0x07, 0x08, 0x80, 0x05, 0xC3, 0x33, 0xCE, -0x33, 0xCE, 0xD8, 0xF9, 0xFF, 0xEF, 0x5D, 0x70, 0x02, 0x61, 0xB8, 0x75, 0xF0, 0x10, 0xE5, 0x65, -0x90, 0x81, 0x01, 0x12, 0x48, 0x49, 0xE0, 0x20, 0xE7, 0x02, 0x80, 0x13, 0x75, 0xF0, 0x10, 0xE5, -0x65, 0x90, 0x81, 0x02, 0x12, 0x48, 0x49, 0xE0, 0x90, 0xA5, 0xFF, 0xF0, 0x20, 0xE7, 0x09, 0x90, -0x01, 0xC1, 0xE0, 0x44, 0x20, 0xF0, 0x61, 0xB8, 0x90, 0xA5, 0xFF, 0xE0, 0x30, 0xE6, 0x38, 0x74, -0x81, 0x25, 0x65, 0xF5, 0x82, 0xE4, 0x34, 0x94, 0xF5, 0x83, 0xE0, 0x54, 0xF8, 0xF0, 0x75, 0xF0, -0x10, 0xE5, 0x65, 0x90, 0x81, 0x00, 0x12, 0x48, 0x49, 0xE0, 0xFD, 0x75, 0xF0, 0x05, 0xE5, 0x65, -0x90, 0x97, 0x9A, 0x12, 0x48, 0x49, 0xE0, 0x13, 0x13, 0x54, 0x03, 0x90, 0xA6, 0xD4, 0xF0, 0xE4, -0xFB, 0xAF, 0x65, 0x71, 0xC8, 0x61, 0xB8, 0xE5, 0x66, 0x60, 0x45, 0x15, 0x66, 0x74, 0x81, 0x25, -0x65, 0xF5, 0x82, 0xE4, 0x34, 0x94, 0xF5, 0x83, 0xE0, 0x54, 0xFC, 0x45, 0x66, 0xFF, 0x74, 0x81, -0x25, 0x65, 0xF5, 0x82, 0xE4, 0x34, 0x94, 0xF5, 0x83, 0xEF, 0xF0, 0x75, 0xF0, 0x05, 0xE5, 0x65, -0x90, 0x97, 0x9A, 0x12, 0x48, 0x49, 0xE0, 0x13, 0x13, 0x54, 0x03, 0x90, 0xA6, 0xD4, 0xF0, 0x74, -0x18, 0x25, 0x65, 0xF5, 0x82, 0xE4, 0x34, 0xA3, 0xF5, 0x83, 0xE0, 0xFD, 0x7B, 0x01, 0x80, 0x4F, -0xE5, 0x67, 0x64, 0x01, 0x70, 0x4D, 0xF5, 0x67, 0x74, 0x81, 0x25, 0x65, 0xF5, 0x82, 0xE4, 0x34, -0x94, 0xF5, 0x83, 0xE0, 0x54, 0xFB, 0xFF, 0xE5, 0x67, 0x25, 0xE0, 0x25, 0xE0, 0x4F, 0xFF, 0x74, -0x81, 0x25, 0x65, 0xF5, 0x82, 0xE4, 0x34, 0x94, 0xF5, 0x83, 0xEF, 0xF0, 0x75, 0xF0, 0x05, 0xE5, -0x65, 0x90, 0x97, 0x9A, 0x12, 0x48, 0x49, 0xE0, 0x13, 0x13, 0x54, 0x03, 0x90, 0xA6, 0xD4, 0xF0, -0x74, 0x18, 0x25, 0x65, 0xF5, 0x82, 0xE4, 0x34, 0x9E, 0xF5, 0x83, 0xE0, 0xFD, 0xE4, 0xFB, 0xAF, -0x65, 0x80, 0x15, 0xAF, 0x65, 0x12, 0x75, 0xE3, 0x05, 0x65, 0xE5, 0x65, 0xC3, 0x94, 0x80, 0x50, -0x02, 0x41, 0x41, 0x22, 0xAD, 0x62, 0xAF, 0x61, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, -0xA6, 0xD1, 0xEF, 0xF0, 0x90, 0xA6, 0xD3, 0xEB, 0xF0, 0x90, 0xA6, 0xD2, 0xED, 0xF0, 0x90, 0xA6, -0xD1, 0xE0, 0xFF, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x90, 0xA6, 0xD5, 0xF0, 0xEF, 0x54, 0x07, 0x90, -0xA6, 0xD7, 0xF0, 0x90, 0xA6, 0xD1, 0xE0, 0x75, 0xF0, 0x10, 0x90, 0x81, 0x01, 0x12, 0x48, 0x49, -0xE0, 0x90, 0xA6, 0xD8, 0xF0, 0xED, 0x54, 0x7F, 0xFE, 0x90, 0xA6, 0xD6, 0xF0, 0xFD, 0x12, 0x83, -0x36, 0x90, 0xA6, 0xD3, 0xE0, 0x70, 0x33, 0x90, 0xA6, 0xD5, 0xE0, 0x24, 0x01, 0xF5, 0x82, 0xE4, -0x34, 0x95, 0xF5, 0x83, 0xC0, 0x83, 0xC0, 0x82, 0xE0, 0xFF, 0x90, 0xA6, 0xD7, 0xE0, 0xFE, 0x74, -0x01, 0xA8, 0x06, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0x5F, 0xD0, 0x82, 0xD0, 0x83, -0xF0, 0x90, 0xA6, 0xD8, 0xE0, 0x54, 0x7F, 0xF0, 0x80, 0x70, 0x90, 0xA6, 0xD6, 0xE0, 0xFF, 0xC3, -0x94, 0x19, 0x40, 0x0E, 0xEF, 0xD3, 0x94, 0x1B, 0x50, 0x08, 0x90, 0x04, 0xCF, 0x74, 0x02, 0xF0, -0x80, 0x05, 0x90, 0x04, 0xCF, 0xE4, 0xF0, 0x90, 0xA6, 0xD5, 0xE0, 0x24, 0x01, 0xF5, 0x82, 0xE4, -0x34, 0x95, 0xF5, 0x83, 0xC0, 0x83, 0xC0, 0x82, 0xE0, 0xFF, 0x90, 0xA6, 0xD7, 0xE0, 0xFE, 0x74, -0x01, 0xA8, 0x06, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0x4F, 0xD0, 0x82, 0xD0, 0x83, 0xF0, -0x90, 0xA6, 0xD1, 0xE0, 0x75, 0xF0, 0x10, 0x90, 0x81, 0x01, 0x12, 0x48, 0x49, 0xE0, 0x54, 0x07, -0xFF, 0x90, 0xA6, 0xD8, 0xF0, 0x90, 0xA6, 0xD6, 0xE0, 0x90, 0x44, 0x45, 0x93, 0x33, 0x33, 0x33, -0x54, 0xF8, 0x4F, 0x90, 0xA6, 0xD8, 0xF0, 0x44, 0x80, 0xF0, 0x90, 0xA6, 0xD6, 0xE0, 0xFB, 0x25, -0xE0, 0x24, 0x91, 0xF5, 0x82, 0xE4, 0x34, 0x43, 0xF5, 0x83, 0xE4, 0x93, 0xFE, 0x74, 0x01, 0x93, -0xFF, 0xE4, 0xFC, 0xFD, 0x75, 0xF0, 0x04, 0xEB, 0x90, 0x42, 0x41, 0x12, 0x48, 0x49, 0x12, 0x48, -0x39, 0x12, 0x47, 0xD9, 0x78, 0x01, 0x12, 0x08, 0x47, 0x90, 0xA6, 0xD1, 0xE0, 0xFD, 0x25, 0xE0, -0x24, 0x16, 0xF5, 0x82, 0xE4, 0x34, 0x96, 0xF5, 0x83, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0xA6, -0xD2, 0xE0, 0xFF, 0x75, 0xF0, 0x10, 0xED, 0x90, 0x81, 0x00, 0x12, 0x48, 0x49, 0xEF, 0xF0, 0xED, -0x70, 0x05, 0x90, 0x01, 0xC8, 0xEF, 0xF0, 0x90, 0xA6, 0xD8, 0xE0, 0xFF, 0x90, 0xA6, 0xD1, 0xE0, -0xFE, 0x75, 0xF0, 0x10, 0x90, 0x81, 0x01, 0x12, 0x48, 0x49, 0xEF, 0xF0, 0x75, 0xF0, 0x10, 0xEE, -0x90, 0x81, 0x05, 0x12, 0x48, 0x49, 0xE0, 0x54, 0xFC, 0xFF, 0x90, 0xA6, 0xD4, 0xE0, 0x4F, 0xFE, -0x90, 0xA6, 0xD1, 0xE0, 0xFF, 0x75, 0xF0, 0x10, 0x90, 0x81, 0x05, 0x12, 0x48, 0x49, 0xEE, 0xF0, -0x7D, 0x01, 0x12, 0x81, 0x7D, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x07, 0x1F, 0xE0, 0x54, 0x7F, -0xF0, 0x90, 0x07, 0x1C, 0xE0, 0x54, 0x01, 0xFF, 0x90, 0xA5, 0xFE, 0xF0, 0x90, 0xA5, 0xFC, 0x74, -0x02, 0xF0, 0x90, 0xA6, 0x0A, 0x14, 0xF0, 0xFB, 0x7A, 0xA5, 0x79, 0xFC, 0xF1, 0xDD, 0x7F, 0x04, -0x90, 0xA7, 0x1D, 0xEF, 0xF0, 0x7F, 0x02, 0x12, 0x47, 0x57, 0x90, 0xA3, 0x98, 0xE0, 0xFF, 0x90, -0xA7, 0x1D, 0xE0, 0xFE, 0xEF, 0x4E, 0x90, 0xA3, 0x98, 0xF0, 0x22, 0xE4, 0xFF, 0x90, 0xA5, 0xFC, -0xEF, 0xF0, 0x90, 0x04, 0x7E, 0xE0, 0xF5, 0x66, 0xA3, 0xE0, 0xF5, 0x67, 0x65, 0x66, 0x60, 0x6D, -0x90, 0xA5, 0xFD, 0x74, 0x03, 0xF0, 0x90, 0xA6, 0x0B, 0x74, 0x08, 0xF0, 0xE5, 0x67, 0x04, 0x54, -0x0F, 0xF5, 0x68, 0xE4, 0xF5, 0x65, 0xE5, 0x68, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x00, 0xF5, 0x82, -0xE4, 0x34, 0x80, 0xF5, 0x83, 0xE5, 0x82, 0x25, 0x65, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, -0xE0, 0xFF, 0x74, 0xFF, 0x25, 0x65, 0xF5, 0x82, 0xE4, 0x34, 0xA5, 0xF5, 0x83, 0xEF, 0xF0, 0x05, -0x65, 0xE5, 0x65, 0xB4, 0x08, 0xD0, 0x7B, 0x01, 0x7A, 0xA5, 0x79, 0xFD, 0xF1, 0xDD, 0xE5, 0x67, -0x04, 0x54, 0x0F, 0xF5, 0x67, 0xB4, 0x0F, 0x03, 0xE4, 0xF5, 0x67, 0x90, 0x04, 0x7F, 0xE5, 0x67, -0xF0, 0x90, 0xA5, 0xFC, 0xE0, 0x7F, 0x04, 0x70, 0x02, 0xE1, 0x7E, 0xB1, 0x80, 0x22, 0xE4, 0xFF, -0x90, 0xA6, 0x1B, 0xEF, 0xF0, 0xE4, 0xA3, 0xF0, 0x90, 0xA6, 0x1C, 0xE0, 0xFF, 0xC3, 0x94, 0x80, -0x50, 0x48, 0x74, 0x1D, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xA6, 0xF5, 0x83, 0xE4, 0xF0, 0x75, 0xF0, -0x10, 0xEF, 0x90, 0x81, 0x03, 0x12, 0x48, 0x49, 0xE0, 0x90, 0xA6, 0x1C, 0x30, 0xE7, 0x0E, 0xE0, -0x24, 0x81, 0xF5, 0x82, 0xE4, 0x34, 0x93, 0xF5, 0x83, 0xE4, 0xF0, 0x80, 0x15, 0xE0, 0xFF, 0x12, -0x9B, 0xAE, 0x90, 0xA6, 0x1C, 0xE0, 0x24, 0x1D, 0xF5, 0x82, 0xE4, 0x34, 0xA6, 0xF5, 0x83, 0x74, -0x01, 0xF0, 0x90, 0xA6, 0x1C, 0xE0, 0x04, 0xF0, 0x80, 0xAE, 0x7F, 0x0C, 0x7E, 0x00, 0x12, 0x3E, -0x87, 0xE4, 0x90, 0xA6, 0x1C, 0xF0, 0x90, 0xA6, 0x1C, 0xE0, 0xFF, 0xC3, 0x94, 0x80, 0x40, 0x02, -0xE1, 0x78, 0x74, 0x1D, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xA6, 0xF5, 0x83, 0xE0, 0x70, 0x02, 0xE1, -0x70, 0x90, 0xA6, 0x1C, 0xE0, 0xFF, 0x75, 0xF0, 0x10, 0x90, 0x81, 0x06, 0x12, 0x48, 0x49, 0xE0, -0xFD, 0x75, 0xF0, 0x10, 0xEF, 0x90, 0x81, 0x07, 0x12, 0x48, 0x49, 0xE0, 0xFE, 0xED, 0xFF, 0x90, -0xA6, 0x1C, 0xE0, 0xFC, 0x25, 0xE0, 0x24, 0x01, 0xF5, 0x82, 0xE4, 0x34, 0x92, 0xF5, 0x83, 0xEE, -0xF0, 0xA3, 0xEF, 0xF0, 0x75, 0xF0, 0x10, 0xEC, 0x90, 0x81, 0x0A, 0x12, 0x48, 0x49, 0xE0, 0xFD, -0x75, 0xF0, 0x10, 0xEC, 0x90, 0x81, 0x0B, 0x12, 0x48, 0x49, 0xE0, 0xFE, 0xED, 0xFF, 0x90, 0xA6, -0x1C, 0xE0, 0x75, 0xF0, 0x0A, 0x90, 0x8D, 0x01, 0x12, 0x48, 0x49, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, -0x7F, 0x01, 0x90, 0xA6, 0x1C, 0xE0, 0xFE, 0x75, 0xF0, 0x10, 0x90, 0x81, 0x0B, 0x12, 0x48, 0x49, -0xE5, 0x82, 0x2F, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE0, 0xFD, 0x75, 0xF0, 0x0A, 0xEE, -0x90, 0x8D, 0x01, 0x12, 0x48, 0x49, 0x75, 0xF0, 0x02, 0xEF, 0x12, 0x48, 0x49, 0xE4, 0xF0, 0xA3, -0xED, 0xF0, 0x0F, 0xEF, 0xB4, 0x05, 0xCB, 0x90, 0xA6, 0x1C, 0xE0, 0xFF, 0x75, 0xF0, 0x10, 0x90, -0x81, 0x09, 0x12, 0x48, 0x49, 0xE0, 0xFE, 0x74, 0x97, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x9A, 0xF5, -0x83, 0xEE, 0xF0, 0x90, 0xA6, 0x1C, 0xE0, 0xFF, 0x90, 0xA6, 0x1B, 0xE0, 0xFD, 0x12, 0x81, 0x7D, -0x90, 0xA6, 0x1C, 0xE0, 0x24, 0x81, 0xF5, 0x82, 0xE4, 0x34, 0x93, 0xF5, 0x83, 0x74, 0x01, 0xF0, -0x90, 0xA6, 0x1C, 0xE0, 0x04, 0xF0, 0xC1, 0x86, 0x22, 0x12, 0x96, 0x84, 0x7F, 0x02, 0x8F, 0x6F, -0x7F, 0x02, 0x12, 0x47, 0x57, 0x90, 0xA3, 0x98, 0xE0, 0x45, 0x6F, 0xF0, 0x22, 0x90, 0xA4, 0x90, -0xE0, 0x60, 0x04, 0x7F, 0x20, 0xF1, 0x7E, 0x22, 0xE4, 0x90, 0xA6, 0x0E, 0xF0, 0x90, 0xA6, 0x0C, -0x74, 0x14, 0xF0, 0x90, 0xA6, 0x1A, 0x74, 0x01, 0xF0, 0xFB, 0x7A, 0xA6, 0x79, 0x0C, 0xF1, 0xDD, -0x7F, 0x04, 0xA1, 0x80, 0x90, 0xA5, 0x33, 0xE0, 0x60, 0x02, 0xF1, 0xBD, 0x22, 0x90, 0xA5, 0x33, -0xE0, 0x64, 0x01, 0x70, 0x17, 0x90, 0xA5, 0x31, 0xE0, 0x54, 0x0F, 0x60, 0x06, 0x12, 0x5A, 0xB3, -0x02, 0x6A, 0x10, 0x90, 0xA5, 0x36, 0xE0, 0x70, 0x03, 0x12, 0x58, 0x9E, 0x22, 0xD3, 0x10, 0xAF, -0x01, 0xC3, 0xC0, 0xD0, 0x90, 0xA4, 0x8C, 0xE0, 0xFF, 0x70, 0x06, 0xA3, 0xE0, 0x64, 0x09, 0x60, -0x0A, 0xEF, 0x14, 0xFF, 0x90, 0xA4, 0x8D, 0xE0, 0xB5, 0x07, 0x04, 0x7F, 0x01, 0x80, 0x02, 0x7F, -0x00, 0xEF, 0x60, 0x09, 0x90, 0x01, 0xC1, 0xE0, 0x44, 0x02, 0xF0, 0x80, 0x35, 0xC0, 0x01, 0x90, -0xA4, 0x8D, 0xE0, 0x75, 0xF0, 0x0F, 0xA4, 0x24, 0xF6, 0xF9, 0x74, 0xA3, 0x35, 0xF0, 0xA8, 0x01, -0xFC, 0x7D, 0x01, 0xD0, 0x01, 0x7E, 0x00, 0x7F, 0x0F, 0x12, 0x06, 0x63, 0x90, 0xA4, 0x8D, 0xE0, -0x04, 0xF0, 0xE0, 0x7F, 0x00, 0xB4, 0x0A, 0x02, 0x7F, 0x01, 0xEF, 0x60, 0x05, 0xE4, 0x90, 0xA4, -0x8D, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x75, 0xE8, 0x03, 0x75, 0xA8, 0x85, 0x22, 0xE4, 0x90, -0xA5, 0x71, 0xF0, 0x90, 0xA5, 0x71, 0xE0, 0x64, 0x01, 0xF0, 0x24, 0x4E, 0x90, 0x01, 0xC4, 0xF0, -0x74, 0x58, 0xA3, 0xF0, 0x12, 0x3E, 0x7B, 0xBF, 0x01, 0x03, 0x12, 0x31, 0xF7, 0x90, 0xA5, 0x33, -0xE0, 0x60, 0x0E, 0x90, 0xA5, 0x36, 0xE0, 0xFF, 0x90, 0xA5, 0x35, 0xE0, 0x6F, 0x60, 0x02, 0x11, -0x95, 0xC2, 0xAF, 0x12, 0x9A, 0x73, 0xBF, 0x01, 0x02, 0xF1, 0xD2, 0xD2, 0xAF, 0x12, 0x49, 0x35, -0x12, 0x45, 0x7D, 0x80, 0xBE, 0x90, 0xA5, 0x35, 0xE0, 0xFF, 0x7D, 0x01, 0x80, 0x04, 0x7D, 0x01, -0x7F, 0x04, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0xA7, 0x22, 0xED, 0xF0, 0x90, 0xA5, -0x2F, 0xE0, 0xFE, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, 0x02, 0x21, 0xF9, 0xEE, 0xC4, 0x13, -0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x02, 0x21, 0xF9, 0x90, 0xA5, 0x36, 0xE0, 0xFE, 0x6F, 0x70, -0x02, 0x21, 0xF9, 0xEF, 0x70, 0x02, 0x21, 0x61, 0x24, 0xFE, 0x70, 0x02, 0x21, 0x9A, 0x24, 0xFE, -0x60, 0x47, 0x24, 0xFC, 0x70, 0x02, 0x21, 0xD4, 0x24, 0xFC, 0x60, 0x02, 0x21, 0xE9, 0xEE, 0xB4, -0x0E, 0x02, 0x51, 0x78, 0x90, 0xA5, 0x36, 0xE0, 0x70, 0x04, 0x7F, 0x01, 0x51, 0x9B, 0x90, 0xA5, -0x36, 0xE0, 0xB4, 0x06, 0x02, 0x51, 0x57, 0x90, 0xA5, 0x36, 0xE0, 0xB4, 0x04, 0x0D, 0x90, 0xA7, -0x22, 0xE0, 0xFF, 0x60, 0x04, 0x71, 0x96, 0x80, 0x02, 0xB1, 0xC9, 0x90, 0xA5, 0x36, 0xE0, 0x64, -0x08, 0x60, 0x02, 0x21, 0xE9, 0x71, 0x71, 0x21, 0xE9, 0x90, 0xA5, 0x36, 0xE0, 0x70, 0x04, 0x7F, -0x01, 0x51, 0x9B, 0x90, 0xA5, 0x36, 0xE0, 0xB4, 0x06, 0x02, 0x51, 0x57, 0x90, 0xA5, 0x36, 0xE0, -0xB4, 0x0E, 0x07, 0x31, 0xFE, 0xBF, 0x01, 0x02, 0x51, 0x78, 0x90, 0xA5, 0x36, 0xE0, 0x64, 0x0C, -0x60, 0x02, 0x21, 0xE9, 0x31, 0xFE, 0xEF, 0x64, 0x01, 0x60, 0x02, 0x21, 0xE9, 0x51, 0xC7, 0x21, -0xE9, 0x90, 0xA5, 0x36, 0xE0, 0xB4, 0x0E, 0x07, 0x31, 0xFE, 0xBF, 0x01, 0x02, 0x51, 0x78, 0x90, -0xA5, 0x36, 0xE0, 0xB4, 0x06, 0x02, 0x51, 0x57, 0x90, 0xA5, 0x36, 0xE0, 0xB4, 0x0C, 0x07, 0x31, -0xFE, 0xBF, 0x01, 0x02, 0x51, 0xC7, 0x90, 0xA5, 0x36, 0xE0, 0x64, 0x04, 0x70, 0x5B, 0x12, 0xA1, -0x1C, 0xEF, 0x64, 0x01, 0x70, 0x53, 0x71, 0x7E, 0x80, 0x4F, 0x90, 0xA5, 0x36, 0xE0, 0xB4, 0x0E, -0x07, 0x31, 0xFE, 0xBF, 0x01, 0x02, 0x51, 0x78, 0x90, 0xA5, 0x36, 0xE0, 0xB4, 0x06, 0x02, 0x51, -0x57, 0x90, 0xA5, 0x36, 0xE0, 0xB4, 0x0C, 0x07, 0x31, 0xFE, 0xBF, 0x01, 0x02, 0x51, 0xC7, 0x90, -0xA5, 0x36, 0xE0, 0x70, 0x04, 0x7F, 0x01, 0x51, 0x9B, 0x90, 0xA5, 0x36, 0xE0, 0xB4, 0x04, 0x19, -0xB1, 0xBD, 0x80, 0x15, 0x90, 0xA5, 0x36, 0xE0, 0xB4, 0x0C, 0x0E, 0x90, 0xA5, 0x30, 0xE0, 0xFF, -0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x02, 0xB1, 0xB2, 0x90, 0xA5, 0x36, 0xE0, 0x90, 0x01, 0xBA, -0xF0, 0x90, 0xA5, 0x35, 0xE0, 0x90, 0x01, 0xBB, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x12, 0xA1, -0x03, 0xEF, 0x64, 0x01, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x01, 0xF0, 0x80, 0x40, 0x90, 0xA5, -0x2F, 0xE0, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x02, 0xF0, -0x80, 0x2C, 0x90, 0xA5, 0x35, 0xE0, 0xD3, 0x94, 0x04, 0x40, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x08, -0xF0, 0x80, 0x1B, 0x90, 0xA5, 0x66, 0xE0, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x08, 0x90, 0x01, -0xB8, 0x74, 0x11, 0xF0, 0x80, 0x08, 0x90, 0x01, 0xB8, 0xE4, 0xF0, 0x7F, 0x01, 0x22, 0x90, 0x01, -0xB9, 0x74, 0x02, 0xF0, 0x7F, 0x00, 0x22, 0x90, 0xA5, 0x30, 0xE0, 0x90, 0x06, 0x04, 0x20, 0xE0, -0x08, 0xE0, 0x44, 0x40, 0xF0, 0x7D, 0x04, 0x80, 0x06, 0xE0, 0x54, 0x7F, 0xF0, 0x7D, 0x0C, 0x7F, -0x01, 0x71, 0x02, 0xE4, 0xFD, 0xFF, 0x80, 0x44, 0x90, 0xA5, 0x30, 0xE0, 0xC3, 0x13, 0x20, 0xE0, -0x04, 0x7D, 0x0C, 0x80, 0x0D, 0x90, 0x06, 0x04, 0xE0, 0x44, 0x40, 0xF0, 0xE0, 0x44, 0x80, 0xF0, -0x7D, 0x04, 0x7F, 0x01, 0x71, 0x02, 0xE4, 0xFD, 0xFF, 0x80, 0x21, 0x90, 0xA7, 0x21, 0xEF, 0xF0, -0xB1, 0xFC, 0x90, 0xA7, 0x21, 0xE0, 0x60, 0x05, 0xE4, 0xFD, 0xFF, 0x51, 0xBC, 0x7D, 0x04, 0x7F, -0x01, 0x80, 0x4F, 0xE4, 0xFD, 0x7F, 0x0C, 0x11, 0xA2, 0xE4, 0xFD, 0xFF, 0x90, 0x05, 0x22, 0xEF, -0xF0, 0x90, 0xA3, 0x9C, 0xED, 0xF0, 0x22, 0x90, 0xA4, 0xAF, 0xE0, 0x64, 0x01, 0x70, 0x2E, 0x90, -0xA5, 0x30, 0xE0, 0x54, 0xFD, 0xF0, 0x7D, 0x2C, 0x7F, 0x6F, 0x51, 0xBC, 0x7D, 0x08, 0x7F, 0x01, -0x71, 0xD8, 0xBF, 0x01, 0x0D, 0x90, 0xA5, 0x2F, 0xE0, 0x44, 0x80, 0xF0, 0x7D, 0x0E, 0x7F, 0x01, -0x80, 0x10, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, 0x04, 0xF0, 0x22, 0x7D, 0x0C, -0x7F, 0x01, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0xA7, 0x20, 0xEF, 0xF0, 0x14, 0x60, -0x15, 0x14, 0x60, 0x19, 0x24, 0x02, 0x70, 0x1A, 0xED, 0x54, 0x01, 0xFF, 0x90, 0xA5, 0x2F, 0xE0, -0x54, 0xFE, 0x4F, 0xF0, 0x80, 0x0C, 0x90, 0xA5, 0x36, 0xED, 0xF0, 0x80, 0x05, 0x90, 0xA5, 0x35, -0xED, 0xF0, 0x7F, 0x8F, 0x12, 0x4B, 0xC2, 0xEF, 0x30, 0xE4, 0x31, 0x90, 0xA7, 0x20, 0xE0, 0x14, -0x60, 0x07, 0x14, 0x60, 0x1D, 0x24, 0x02, 0x70, 0x23, 0x90, 0xA5, 0x2F, 0xE0, 0x54, 0x01, 0xC4, -0x33, 0x33, 0x33, 0x54, 0x80, 0xFF, 0x90, 0xA5, 0x36, 0xE0, 0x54, 0x7F, 0x4F, 0xFD, 0x7F, 0x88, -0x80, 0x07, 0x90, 0xA5, 0x35, 0xE0, 0xFD, 0x7F, 0x89, 0x12, 0x4C, 0xF2, 0xD0, 0xD0, 0x92, 0xAF, -0x22, 0xB1, 0xFC, 0xE4, 0xFD, 0xFF, 0x51, 0xBC, 0x7D, 0x0C, 0x7F, 0x01, 0x80, 0x84, 0x7D, 0x2D, -0xF1, 0x7B, 0x90, 0x01, 0x37, 0x74, 0x02, 0xF0, 0xFD, 0x7F, 0x03, 0xD1, 0xC6, 0x12, 0x4D, 0x11, -0xE4, 0xFD, 0x7F, 0x01, 0x61, 0x02, 0xEF, 0x60, 0x3A, 0x90, 0xA4, 0xAF, 0xE0, 0x64, 0x01, 0x70, -0x32, 0x90, 0xA5, 0x30, 0xE0, 0x54, 0xFE, 0xF0, 0x7D, 0x2B, 0x7F, 0x0F, 0x51, 0xBC, 0x90, 0x06, -0x04, 0xE0, 0x54, 0xBF, 0xF0, 0x71, 0xD4, 0xBF, 0x01, 0x0D, 0x90, 0xA5, 0x2F, 0xE0, 0x44, 0x40, -0xF0, 0x7D, 0x06, 0x7F, 0x01, 0x61, 0x02, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, -0x74, 0x08, 0xF0, 0x22, 0x7D, 0x08, 0xE4, 0xFF, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, -0xA6, 0xED, 0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0x90, 0xA3, 0x9A, 0xE0, 0x04, 0xF0, 0x90, 0x04, 0x1D, -0xE0, 0x60, 0x21, 0x90, 0x05, 0x22, 0xE0, 0x90, 0xA6, 0xF1, 0xF0, 0x7D, 0x26, 0xF1, 0x7B, 0xEF, -0x64, 0x01, 0x70, 0x03, 0x12, 0xA0, 0x56, 0x90, 0xA6, 0xF1, 0xE0, 0xFF, 0x7D, 0x27, 0x51, 0xBC, -0x91, 0x26, 0x80, 0x05, 0x91, 0x26, 0x12, 0xA0, 0x56, 0x90, 0x04, 0x1F, 0x74, 0x20, 0xF0, 0x7F, -0x01, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0xA6, 0xED, 0xE0, 0xFF, 0xD3, 0x10, 0xAF, 0x01, 0xC3, -0xC0, 0xD0, 0x90, 0xA7, 0x1F, 0xEF, 0xF0, 0x90, 0xA3, 0xA0, 0xE0, 0xFF, 0x90, 0x04, 0x1C, 0xE0, -0x6F, 0x70, 0x4B, 0x90, 0xA5, 0x36, 0xE0, 0x64, 0x0E, 0x70, 0x18, 0x90, 0xA7, 0x1F, 0xE0, 0x70, -0x3D, 0x90, 0xA5, 0x2F, 0xE0, 0x54, 0x7F, 0xF0, 0x90, 0x06, 0x04, 0xE0, 0x54, 0x7F, 0xF0, 0x51, -0xFE, 0x80, 0x26, 0x90, 0xA5, 0x36, 0xE0, 0x64, 0x06, 0x70, 0x23, 0x90, 0xA7, 0x1F, 0xE0, 0x60, -0x1D, 0x90, 0xA5, 0x2F, 0xE0, 0x54, 0xBF, 0xF0, 0x90, 0x06, 0x04, 0xE0, 0x44, 0x40, 0xF0, 0xE0, -0x44, 0x80, 0xF0, 0x90, 0xA5, 0x36, 0x74, 0x04, 0xF0, 0xE4, 0xFD, 0xFF, 0x51, 0xBC, 0xD0, 0xD0, -0x92, 0xAF, 0x22, 0x12, 0x6A, 0x10, 0x90, 0xA5, 0x36, 0xE0, 0x64, 0x0C, 0x60, 0x04, 0x51, 0xB3, -0x71, 0xD4, 0x22, 0xE4, 0x90, 0xA5, 0x33, 0xF0, 0xA3, 0xF0, 0x90, 0xA5, 0x31, 0xE0, 0x54, 0x0F, -0xF0, 0xA3, 0x74, 0x02, 0xF0, 0x90, 0xA5, 0x31, 0xE0, 0x54, 0xF0, 0xF0, 0x90, 0xA5, 0x2F, 0xE0, -0x54, 0xFD, 0xF0, 0x54, 0xEF, 0xF0, 0x54, 0xF7, 0xF0, 0x90, 0xA5, 0x39, 0x74, 0x01, 0xF0, 0xA3, -0xF0, 0x90, 0xA5, 0x2F, 0xE0, 0x54, 0xFB, 0xF0, 0xA3, 0xE0, 0x54, 0xFB, 0xF0, 0xE4, 0x90, 0xA5, -0x3C, 0xF0, 0x90, 0xA5, 0x3B, 0x74, 0x08, 0xF0, 0x90, 0xA5, 0x3E, 0xE4, 0xF0, 0xA3, 0x74, 0x02, -0xF0, 0xE4, 0x90, 0xA5, 0x37, 0xF0, 0x90, 0xA5, 0x2F, 0xE0, 0x54, 0xDF, 0xF0, 0xE4, 0xFD, 0xFF, -0x71, 0x02, 0x7D, 0x0C, 0x7F, 0x02, 0x71, 0x02, 0x51, 0xFE, 0x90, 0xA5, 0x2F, 0xE0, 0x54, 0xBF, -0xF0, 0x54, 0x7F, 0xF0, 0xA3, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0xFD, 0xF0, 0x54, 0xF7, 0xF0, 0x90, -0xA5, 0x40, 0x12, 0x08, 0x79, 0x00, 0x00, 0x00, 0x00, 0xE4, 0x90, 0xA5, 0x5E, 0xF0, 0x90, 0xA5, -0x44, 0xF0, 0x90, 0xA3, 0x9D, 0xE0, 0xB4, 0x01, 0x08, 0x90, 0xA5, 0x3D, 0x74, 0xDD, 0xF0, 0x80, -0x12, 0x90, 0xA3, 0x9D, 0xE0, 0x90, 0xA5, 0x3D, 0xB4, 0x03, 0x05, 0x74, 0xD5, 0xF0, 0x80, 0x03, -0x74, 0x40, 0xF0, 0x90, 0xA5, 0x5F, 0x74, 0x03, 0xF0, 0xA3, 0x74, 0x05, 0xF0, 0xA3, 0xE0, 0x54, -0x01, 0x44, 0x28, 0xF0, 0xA3, 0x74, 0x05, 0xF0, 0xE4, 0x90, 0xA5, 0x45, 0xF0, 0x90, 0xA5, 0x5E, -0xE0, 0x24, 0x04, 0x90, 0xA5, 0x48, 0xF0, 0xA3, 0x74, 0x08, 0xF0, 0xE4, 0xA3, 0xF0, 0x90, 0xA5, -0x63, 0xF0, 0xA3, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0xFD, 0xF0, 0x54, 0xFB, 0xF0, 0x54, 0xF7, 0xF0, -0x54, 0xEF, 0xF0, 0x54, 0xDF, 0xF0, 0x54, 0xBF, 0xF0, 0x90, 0x06, 0x04, 0xE0, 0x54, 0x7F, 0xF0, -0x90, 0x06, 0x0A, 0xE0, 0x54, 0xF8, 0xF0, 0xE4, 0xFD, 0xFF, 0x51, 0xBC, 0xE4, 0x90, 0xA5, 0x65, -0xF0, 0x22, 0x7D, 0x2F, 0x12, 0x4D, 0x0C, 0x7D, 0x08, 0x7F, 0x01, 0x61, 0x02, 0x7D, 0x2E, 0x7F, -0x6F, 0x51, 0xBC, 0x7D, 0x02, 0x7F, 0x01, 0x61, 0x02, 0x90, 0x06, 0x04, 0xE0, 0x54, 0x7F, 0xF0, -0xE4, 0xFD, 0xFF, 0x51, 0xBC, 0x7D, 0x0C, 0x7F, 0x01, 0x61, 0x02, 0x90, 0xA5, 0x66, 0xE0, 0x30, -0xE0, 0x19, 0xE4, 0xFD, 0xFF, 0x51, 0xBC, 0xB1, 0xFC, 0x90, 0xA5, 0x66, 0xE0, 0xC3, 0x13, 0x30, -0xE0, 0x02, 0x51, 0xFE, 0x90, 0xA5, 0x66, 0xE0, 0x44, 0x04, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, -0xC3, 0xC0, 0xD0, 0x90, 0x01, 0x01, 0xE0, 0x44, 0x02, 0xF0, 0x90, 0x01, 0x00, 0x74, 0xFF, 0xF0, -0x90, 0x06, 0xB7, 0x74, 0x09, 0xF0, 0x90, 0x06, 0xB4, 0x74, 0x86, 0xF0, 0x7F, 0x02, 0x12, 0x4B, -0xC2, 0xEF, 0x44, 0x01, 0xFD, 0x7F, 0x02, 0x12, 0x4C, 0xF2, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xEF, -0x70, 0x4C, 0x7D, 0x78, 0x7F, 0x02, 0xD1, 0xE5, 0x7D, 0x02, 0x7F, 0x03, 0xD1, 0xE5, 0x7D, 0xC8, -0x7F, 0x02, 0x12, 0x9B, 0xBD, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0xF0, -0x90, 0xA4, 0xAF, 0xE0, 0x70, 0x13, 0xB1, 0xFC, 0xB1, 0xC9, 0x90, 0xA5, 0x2F, 0xE0, 0x54, 0xF7, -0xF0, 0x54, 0xBF, 0xF0, 0x54, 0x7F, 0xF0, 0x80, 0x06, 0x7D, 0x01, 0x7F, 0x0C, 0x11, 0xA2, 0x90, -0xA5, 0x2F, 0xE0, 0x54, 0xF7, 0xF0, 0x90, 0x06, 0x0A, 0xE0, 0x54, 0xF8, 0xF0, 0x22, 0x90, 0x01, -0x36, 0x74, 0x78, 0xF0, 0xA3, 0x74, 0x02, 0xF0, 0x7D, 0x78, 0xFF, 0xD1, 0xC6, 0x7D, 0x02, 0x7F, -0x03, 0xD1, 0xC6, 0x90, 0x06, 0x0A, 0xE0, 0x44, 0x07, 0xF0, 0x90, 0xA5, 0x3E, 0xA3, 0xE0, 0x90, -0x05, 0x58, 0xF0, 0x90, 0xA4, 0xAF, 0xE0, 0xB4, 0x01, 0x14, 0x90, 0xA5, 0x30, 0xE0, 0x54, 0xFB, -0xF0, 0x90, 0xA5, 0x36, 0xE0, 0x20, 0xE2, 0x0D, 0x7D, 0x01, 0x7F, 0x04, 0x01, 0xA2, 0x90, 0xA5, -0x30, 0xE0, 0x44, 0x04, 0xF0, 0x22, 0x74, 0x15, 0x2F, 0xF8, 0xE6, 0x4D, 0xFE, 0xF6, 0x74, 0x30, -0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0x7D, 0x02, 0x7F, 0x02, 0xD1, -0xE5, 0x7D, 0x01, 0x7F, 0x02, 0x74, 0x15, 0x2F, 0xF8, 0xE6, 0xFE, 0xED, 0xF4, 0x5E, 0xFE, 0xF6, -0x74, 0x30, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0x90, 0xA5, 0x36, -0xE0, 0x64, 0x02, 0x60, 0x2A, 0x12, 0x6D, 0xC6, 0x90, 0xA5, 0x30, 0xE0, 0x13, 0x13, 0x13, 0x54, -0x1F, 0x30, 0xE0, 0x15, 0x90, 0xA5, 0x39, 0xE0, 0xFF, 0xA3, 0xE0, 0x6F, 0x70, 0x0B, 0x12, 0x6E, -0x5F, 0xD1, 0xDB, 0x90, 0xA5, 0x3A, 0xE0, 0x14, 0xF0, 0x90, 0x01, 0xE6, 0xE0, 0x04, 0xF0, 0x22, -0x74, 0x09, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0x3F, 0xF0, 0xEF, 0x60, -0x1D, 0x74, 0x29, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x10, 0xF0, 0x74, -0x09, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x80, 0xF0, 0x22, 0x74, 0x29, -0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xEF, 0xF0, 0x74, 0x09, 0x2D, 0xF5, -0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x40, 0xF0, 0x22, 0x7F, 0xFF, 0x51, 0xBC, 0xE4, -0x90, 0xA7, 0x10, 0xF0, 0xA3, 0xF0, 0x90, 0x05, 0xF8, 0xE0, 0x70, 0x0F, 0xA3, 0xE0, 0x70, 0x0B, -0xA3, 0xE0, 0x70, 0x07, 0xA3, 0xE0, 0x70, 0x03, 0x7F, 0x01, 0x22, 0xD3, 0x90, 0xA7, 0x11, 0xE0, -0x94, 0xE8, 0x90, 0xA7, 0x10, 0xE0, 0x94, 0x03, 0x40, 0x0A, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x20, -0xF0, 0x7F, 0x00, 0x22, 0x7F, 0x32, 0x7E, 0x00, 0x12, 0x3E, 0x87, 0x90, 0xA7, 0x10, 0xE4, 0x75, -0xF0, 0x01, 0x12, 0x08, 0xD6, 0x80, 0xBF, 0xE4, 0xFD, 0xFF, 0x51, 0xBC, 0x7D, 0x04, 0x7F, 0x01, -0x61, 0x02, 0x90, 0xA5, 0x2F, 0xE0, 0x30, 0xE0, 0x03, 0x12, 0xA1, 0xFC, 0x22, 0xE4, 0xFB, 0xFA, -0xFD, 0x7F, 0x01, 0x12, 0x47, 0x7E, 0xEF, 0x60, 0xF4, 0x90, 0xA3, 0x98, 0xE0, 0x60, 0xEE, 0xC2, -0xAF, 0x30, 0xE0, 0x0B, 0x54, 0xFE, 0xF0, 0xE4, 0xFF, 0x12, 0x56, 0x20, 0x12, 0x78, 0x7E, 0xD2, -0xAF, 0xC2, 0xAF, 0x90, 0xA3, 0x98, 0xE0, 0xFF, 0x30, 0xE1, 0x06, 0x54, 0xFD, 0xF0, 0x12, 0x8E, -0x53, 0xD2, 0xAF, 0xC2, 0xAF, 0x90, 0xA3, 0x98, 0xE0, 0xFF, 0x30, 0xE2, 0x05, 0x54, 0xFB, 0xF0, -0xF1, 0x47, 0xD2, 0xAF, 0xC2, 0xAF, 0x90, 0xA3, 0x98, 0xE0, 0xFF, 0x30, 0xE5, 0x0B, 0x54, 0xDF, -0xF0, 0x12, 0xA2, 0x27, 0xBF, 0x01, 0x02, 0x11, 0x3D, 0xD2, 0xAF, 0x80, 0xAC, 0x90, 0xA4, 0xA9, -0xE0, 0x90, 0xA5, 0xD5, 0xF0, 0x90, 0xA4, 0xAA, 0xE0, 0x90, 0xA5, 0xD6, 0xF0, 0x90, 0xA4, 0xAB, -0xE0, 0x90, 0xA5, 0xD7, 0xF0, 0x90, 0xA4, 0xAC, 0xE0, 0x90, 0xA5, 0xD8, 0xF0, 0x90, 0xA4, 0xAD, -0xE0, 0x90, 0xA5, 0xD9, 0xF0, 0x90, 0xA4, 0x9A, 0xE0, 0x90, 0xA5, 0xDA, 0xF0, 0x90, 0xA4, 0x9B, -0xE0, 0x90, 0xA5, 0xDB, 0xF0, 0x90, 0xA4, 0x9C, 0xE0, 0x90, 0xA5, 0xDC, 0xF0, 0x90, 0xA4, 0x9D, -0xE0, 0x90, 0xA5, 0xDD, 0xF0, 0x90, 0xA4, 0x9E, 0xE0, 0x90, 0xA5, 0xDE, 0xF0, 0x90, 0xA4, 0x9F, -0xE0, 0x90, 0xA5, 0xDF, 0xF0, 0x90, 0xA4, 0xA0, 0xE0, 0x90, 0xA5, 0xE0, 0xF0, 0x90, 0xA4, 0xA1, -0xE0, 0x90, 0xA5, 0xE1, 0xF0, 0x90, 0xA4, 0xA2, 0xE0, 0x90, 0xA5, 0xE2, 0xF0, 0x90, 0xA4, 0xA3, -0xE0, 0x90, 0xA5, 0xE3, 0xF0, 0xE4, 0x90, 0xA5, 0x7E, 0xF0, 0x90, 0xA5, 0xE9, 0xF0, 0xA3, 0xF0, -0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0xA5, 0x7D, 0xF0, 0x90, 0xA4, 0x97, 0xE0, 0xFF, 0x90, -0xA5, 0x7D, 0xE0, 0xFE, 0xC3, 0x9F, 0x50, 0x15, 0x74, 0xE9, 0x2E, 0xF5, 0x82, 0xE4, 0x34, 0xA5, -0xF5, 0x83, 0x74, 0x01, 0xF0, 0x90, 0xA5, 0x7D, 0xE0, 0x04, 0xF0, 0x80, 0xDD, 0x90, 0x01, 0x1F, -0xE0, 0xFE, 0x90, 0x01, 0x1E, 0xE0, 0x7C, 0x00, 0x24, 0x00, 0xFF, 0xEC, 0x3E, 0x90, 0xA5, 0x72, -0xF0, 0xA3, 0xEF, 0xF0, 0xE4, 0x90, 0xA5, 0x7D, 0xF0, 0x90, 0xA4, 0x97, 0xE0, 0xFF, 0x90, 0xA5, -0x7D, 0xE0, 0xFE, 0xC3, 0x9F, 0x40, 0x02, 0x21, 0x9D, 0xD1, 0x53, 0x90, 0xA5, 0x7D, 0xE0, 0xFE, -0x24, 0xE4, 0xF5, 0x82, 0xE4, 0x34, 0xA5, 0xF5, 0x83, 0xEF, 0xF0, 0x74, 0xE4, 0x2E, 0xF5, 0x82, -0xE4, 0x34, 0xA5, 0xF5, 0x83, 0xE0, 0x24, 0x4D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, -0xFF, 0x74, 0x7F, 0x2E, 0xF5, 0x82, 0xE4, 0x34, 0xA5, 0xF5, 0x83, 0xEF, 0xF0, 0x74, 0xE4, 0x2E, -0xF5, 0x82, 0xE4, 0x34, 0xA5, 0xF5, 0x83, 0xE0, 0x24, 0x4E, 0xF9, 0xE4, 0x34, 0xFC, 0xFA, 0x7B, -0x01, 0xEE, 0x75, 0xF0, 0x03, 0xA4, 0x24, 0x84, 0xF5, 0x82, 0xE4, 0x34, 0xA5, 0xF5, 0x83, 0x12, -0x48, 0x5E, 0x74, 0xE4, 0x2E, 0xF5, 0x82, 0xE4, 0x34, 0xA5, 0xF5, 0x83, 0xE0, 0x24, 0x38, 0xF9, -0xE4, 0x34, 0xFC, 0xFA, 0xEE, 0x75, 0xF0, 0x03, 0xA4, 0x24, 0xC6, 0xF5, 0x82, 0xE4, 0x34, 0xA5, -0xF5, 0x83, 0x12, 0x48, 0x5E, 0x90, 0xA5, 0x7D, 0xE0, 0x04, 0xF0, 0x21, 0x09, 0x90, 0x02, 0x87, -0xE0, 0x70, 0x02, 0xC1, 0x10, 0x90, 0xA4, 0x90, 0xE0, 0x64, 0x01, 0x60, 0x02, 0xC1, 0x10, 0x90, -0xA5, 0xEE, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0xA5, 0x72, 0xE0, 0xFF, -0xA3, 0xE0, 0xA3, 0xCF, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0xA5, 0x74, 0xE0, 0xFC, 0xA3, 0xE0, 0xFD, -0xEC, 0x90, 0xFD, 0x11, 0xF0, 0x74, 0x01, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, -0xFE, 0x74, 0x00, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x7A, 0x00, 0x24, 0x00, -0xFF, 0xEA, 0x3E, 0x54, 0x3F, 0x90, 0xA5, 0x76, 0xF0, 0xA3, 0xEF, 0xF0, 0x74, 0x02, 0x2D, 0xF5, -0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x54, 0x0F, 0x33, 0x33, 0x33, 0x54, 0xF8, 0x90, 0xA5, -0x79, 0xF0, 0xFC, 0x74, 0x07, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x54, 0xC0, -0x90, 0xA5, 0x7B, 0xF0, 0xEC, 0x24, 0x18, 0x90, 0xA5, 0x78, 0xF0, 0xFD, 0x90, 0xA5, 0x74, 0xE0, -0xFE, 0xA3, 0xE0, 0xFF, 0xD1, 0x15, 0xEF, 0x54, 0xFC, 0x90, 0xA5, 0x7A, 0xF0, 0x90, 0xA5, 0x79, -0xE0, 0x24, 0x18, 0xFF, 0xE4, 0x33, 0x90, 0xA5, 0x76, 0x8F, 0xF0, 0x12, 0x08, 0xD6, 0x90, 0xA5, -0x76, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12, 0xA2, 0x64, 0x90, 0xA5, 0x72, 0xEE, 0x8F, 0xF0, 0x12, -0x08, 0xD6, 0x90, 0xA4, 0x8E, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x90, 0xA5, 0x72, 0xE0, 0xFC, 0xA3, -0xE0, 0xFD, 0xD3, 0x9F, 0xEC, 0x9E, 0x40, 0x1B, 0x90, 0xA4, 0x8F, 0xE0, 0x24, 0x01, 0xFF, 0x90, -0xA4, 0x8E, 0xE0, 0x34, 0x00, 0xFE, 0xC3, 0xED, 0x9F, 0xFF, 0xEC, 0x9E, 0x90, 0xA5, 0x72, 0xF0, -0xA3, 0xEF, 0xF0, 0x90, 0xA5, 0x7A, 0xE0, 0x24, 0xC0, 0x60, 0x02, 0xA1, 0x12, 0x90, 0xA5, 0x74, -0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x90, 0xA5, 0x78, 0xE0, 0x24, 0x18, 0xFD, 0xD1, 0x15, 0xEF, 0x60, -0x02, 0xC1, 0x04, 0x90, 0xA5, 0x74, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x90, 0xA5, 0x78, 0xE0, 0x24, -0x19, 0xFD, 0xD1, 0x15, 0x90, 0xA5, 0x93, 0xEF, 0xF0, 0xE4, 0x90, 0xA5, 0x7C, 0xF0, 0x90, 0xA5, -0x93, 0xE0, 0xFF, 0x90, 0xA5, 0x7C, 0xE0, 0xFD, 0xC3, 0x9F, 0x50, 0x27, 0x90, 0xA5, 0x74, 0xE0, -0xFE, 0xA3, 0xE0, 0xFF, 0x90, 0xA5, 0x78, 0xE0, 0x24, 0x1A, 0xD1, 0x11, 0x90, 0xA5, 0x7C, 0xE0, -0x24, 0x94, 0xF5, 0x82, 0xE4, 0x34, 0xA5, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0xA5, 0x7C, 0xE0, 0x04, -0xF0, 0x80, 0xCB, 0x90, 0xA5, 0x93, 0xE0, 0x70, 0x02, 0x81, 0x20, 0xE4, 0x90, 0xA5, 0x7D, 0xF0, -0x90, 0xA4, 0x97, 0xE0, 0xFF, 0x90, 0xA5, 0x7D, 0xE0, 0xFE, 0xC3, 0x9F, 0x40, 0x02, 0x81, 0x08, -0xD1, 0x53, 0x90, 0xA5, 0x7D, 0xE0, 0xFF, 0x24, 0x7F, 0xF5, 0x82, 0xE4, 0x34, 0xA5, 0xF5, 0x83, -0xE0, 0xFE, 0x90, 0xA5, 0x93, 0xE0, 0xFD, 0xEE, 0x6D, 0x70, 0x35, 0xEF, 0x75, 0xF0, 0x03, 0xA4, -0x24, 0x84, 0xF5, 0x82, 0xE4, 0x34, 0xA5, 0xF5, 0x83, 0x12, 0x48, 0x55, 0xC0, 0x03, 0xC0, 0x02, -0xC0, 0x01, 0x7B, 0x01, 0x7A, 0xA5, 0x79, 0x94, 0x90, 0xA5, 0xF6, 0x12, 0x48, 0x5E, 0x90, 0xA5, -0xF9, 0xED, 0xF0, 0xD0, 0x01, 0xD0, 0x02, 0xD0, 0x03, 0xD1, 0x67, 0xEF, 0x60, 0x02, 0x80, 0x67, -0x90, 0xA5, 0x93, 0xE0, 0x64, 0x03, 0x70, 0x79, 0x7B, 0x01, 0x7A, 0xA5, 0x79, 0x94, 0x90, 0xA5, -0xF6, 0x12, 0x48, 0x5E, 0x90, 0xA5, 0xF9, 0x74, 0x03, 0xF0, 0x7A, 0xA6, 0x79, 0xDD, 0xD1, 0x67, -0xEF, 0x70, 0x1B, 0x7B, 0x01, 0x7A, 0xA5, 0x79, 0x94, 0x90, 0xA5, 0xF6, 0x12, 0x48, 0x5E, 0x90, -0xA5, 0xF9, 0x74, 0x03, 0xF0, 0x7A, 0xA6, 0x79, 0xD9, 0xD1, 0x67, 0xEF, 0x60, 0x3B, 0x90, 0xA5, -0x7D, 0xE0, 0xFF, 0x24, 0xDF, 0xF5, 0x82, 0xE4, 0x34, 0xA5, 0xF5, 0x83, 0xE0, 0x60, 0x02, 0x80, -0x11, 0x90, 0xA5, 0x7D, 0xE0, 0xFF, 0x24, 0xDA, 0xF5, 0x82, 0xE4, 0x34, 0xA5, 0xF5, 0x83, 0xE0, -0x60, 0x05, 0x74, 0xEE, 0x2F, 0x80, 0x20, 0x90, 0xA5, 0x7D, 0xE0, 0x24, 0xEE, 0xF5, 0x82, 0xE4, -0x34, 0xA5, 0xF5, 0x83, 0x74, 0x01, 0xF0, 0x80, 0x17, 0x90, 0xA5, 0x7D, 0xE0, 0x24, 0xEE, 0x80, -0x06, 0x90, 0xA5, 0x7D, 0xE0, 0x24, 0xEE, 0xF5, 0x82, 0xE4, 0x34, 0xA5, 0xF5, 0x83, 0xE4, 0xF0, -0x90, 0xA5, 0x7D, 0xE0, 0x04, 0xF0, 0x61, 0x10, 0x90, 0xA5, 0xEE, 0xE0, 0x70, 0x6D, 0xA3, 0xE0, -0x70, 0x69, 0xA3, 0xE0, 0x70, 0x65, 0xA3, 0xE0, 0x70, 0x61, 0xA3, 0xE0, 0x70, 0x5D, 0xC1, 0x04, -0xE4, 0x90, 0xA5, 0x7D, 0xF0, 0x90, 0xA4, 0x97, 0xE0, 0xFF, 0x90, 0xA5, 0x7D, 0xE0, 0xFE, 0xC3, -0x9F, 0x50, 0x30, 0x74, 0xDA, 0x2E, 0xF5, 0x82, 0xE4, 0x34, 0xA5, 0xF5, 0x83, 0xE0, 0x60, 0x0E, -0x74, 0xEE, 0x2E, 0xF5, 0x82, 0xE4, 0x34, 0xA5, 0xF5, 0x83, 0xE4, 0xF0, 0x80, 0x0D, 0x74, 0xEE, -0x2E, 0xF5, 0x82, 0xE4, 0x34, 0xA5, 0xF5, 0x83, 0x74, 0x01, 0xF0, 0x90, 0xA5, 0x7D, 0xE0, 0x04, -0xF0, 0x80, 0xC2, 0x90, 0xA5, 0xEE, 0xE0, 0x70, 0x12, 0xA3, 0xE0, 0x70, 0x0E, 0xA3, 0xE0, 0x70, -0x0A, 0xA3, 0xE0, 0x70, 0x06, 0xA3, 0xE0, 0x70, 0x02, 0xC1, 0x04, 0xE4, 0x90, 0xA5, 0x7D, 0xF0, -0x90, 0xA4, 0x97, 0xE0, 0xFF, 0x90, 0xA5, 0x7D, 0xE0, 0xFE, 0xC3, 0x9F, 0x40, 0x02, 0xC1, 0x04, -0xD1, 0x53, 0x90, 0xA5, 0x7D, 0xE0, 0x24, 0xEE, 0xF5, 0x82, 0xE4, 0x34, 0xA5, 0xF5, 0x83, 0xE0, -0x60, 0x68, 0x12, 0x9B, 0x61, 0xEF, 0x64, 0x01, 0x70, 0x60, 0x90, 0xA5, 0x7D, 0xE0, 0x24, 0xD5, -0xF5, 0x82, 0xE4, 0x34, 0xA5, 0xF5, 0x83, 0xE0, 0xFF, 0x7B, 0x08, 0x7D, 0x01, 0xD1, 0xA2, 0x90, -0xA5, 0x76, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xE4, 0x90, 0xA5, 0x7C, 0xF0, 0x90, 0xA5, 0x7C, 0xE0, -0xFD, 0xC3, 0x94, 0x06, 0x50, 0x2E, 0x90, 0xA5, 0x74, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x90, 0xA5, -0x78, 0xE0, 0x24, 0x0A, 0xD1, 0x11, 0x90, 0xA5, 0x76, 0xA3, 0xE0, 0xFE, 0x90, 0xA5, 0x7C, 0xE0, -0x2E, 0x24, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0xA5, 0x7C, 0xE0, -0x04, 0xF0, 0x80, 0xC8, 0x90, 0x04, 0x1F, 0x74, 0x20, 0xF0, 0x90, 0xA5, 0x7D, 0xE0, 0x04, 0xF0, -0x81, 0x80, 0x90, 0xA5, 0x7B, 0xE0, 0x60, 0x02, 0xC1, 0x04, 0xE4, 0x90, 0xA5, 0x7D, 0xF0, 0x90, -0xA4, 0x97, 0xE0, 0xFF, 0x90, 0xA5, 0x7D, 0xE0, 0xFE, 0xC3, 0x9F, 0x50, 0x63, 0xD1, 0x53, 0xE4, -0x90, 0xA5, 0x7C, 0xF0, 0x90, 0xA5, 0x7C, 0xE0, 0xFD, 0xC3, 0x94, 0x06, 0x50, 0x4A, 0x90, 0xA5, -0x74, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x90, 0xA5, 0x78, 0xE0, 0x24, 0x04, 0xD1, 0x11, 0x90, 0xA5, -0x7D, 0xE0, 0xFE, 0x75, 0xF0, 0x03, 0xA4, 0x24, 0xC6, 0xF5, 0x82, 0xE4, 0x34, 0xA5, 0xF5, 0x83, -0x12, 0x48, 0x55, 0x90, 0xA5, 0x7C, 0xE0, 0xF5, 0x82, 0x75, 0x83, 0x00, 0x12, 0x06, 0xA2, 0x6F, -0x60, 0x0E, 0x74, 0xE9, 0x2E, 0xF5, 0x82, 0xE4, 0x34, 0xA5, 0xF5, 0x83, 0xE4, 0xF0, 0x80, 0x08, -0x90, 0xA5, 0x7C, 0xE0, 0x04, 0xF0, 0x80, 0xAC, 0x90, 0xA5, 0x7D, 0xE0, 0x04, 0xF0, 0x80, 0x8F, -0x90, 0xA5, 0xE9, 0xE0, 0x64, 0x01, 0x60, 0x17, 0xA3, 0xE0, 0x64, 0x01, 0x60, 0x11, 0xA3, 0xE0, -0x64, 0x01, 0x60, 0x0B, 0xA3, 0xE0, 0x64, 0x01, 0x60, 0x05, 0xA3, 0xE0, 0xB4, 0x01, 0x06, 0x90, -0xA5, 0x7E, 0x74, 0x01, 0xF0, 0x90, 0xA5, 0x7E, 0xE0, 0xB4, 0x01, 0x10, 0x12, 0x93, 0x31, 0x90, -0x01, 0xC7, 0x74, 0x66, 0xF0, 0xE4, 0xFF, 0x12, 0x6B, 0xAE, 0x21, 0x9D, 0xE4, 0x90, 0xA5, 0x7E, -0xF0, 0x90, 0xA5, 0xE9, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0xA5, 0x7D, -0xF0, 0x90, 0xA4, 0x97, 0xE0, 0xFF, 0x90, 0xA5, 0x7D, 0xE0, 0xFE, 0xC3, 0x9F, 0x50, 0x15, 0x74, -0xE9, 0x2E, 0xF5, 0x82, 0xE4, 0x34, 0xA5, 0xF5, 0x83, 0x74, 0x01, 0xF0, 0x90, 0xA5, 0x7D, 0xE0, -0x04, 0xF0, 0x80, 0xDD, 0x90, 0xA5, 0x72, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xF1, 0x9A, 0x21, 0x9D, -0x22, 0xFC, 0xED, 0x2C, 0xFD, 0xAB, 0x07, 0xAA, 0x06, 0xED, 0x2B, 0xFB, 0xE4, 0x3A, 0xFA, 0xC3, -0x90, 0xA4, 0x8F, 0xE0, 0x9B, 0x90, 0xA4, 0x8E, 0xE0, 0x9A, 0x50, 0x13, 0xA3, 0xE0, 0x24, 0x01, -0xFF, 0x90, 0xA4, 0x8E, 0xE0, 0x34, 0x00, 0xFE, 0xC3, 0xEB, 0x9F, 0xFB, 0xEA, 0x9E, 0xFA, 0xEA, -0x90, 0xFD, 0x11, 0xF0, 0xAF, 0x03, 0x74, 0x00, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, -0xE0, 0xFF, 0x22, 0x74, 0xD5, 0x2E, 0xF5, 0x82, 0xE4, 0x34, 0xA5, 0xF5, 0x83, 0xE0, 0xFF, 0x90, -0xFD, 0x10, 0xEF, 0xF0, 0x7F, 0x00, 0x22, 0x90, 0xA5, 0xF3, 0x12, 0x48, 0x5E, 0xE4, 0xFF, 0x90, -0xA5, 0xF9, 0xE0, 0xFE, 0xEF, 0xC3, 0x9E, 0x50, 0x26, 0x90, 0xA5, 0xF6, 0x12, 0x48, 0x55, 0x8F, -0x82, 0x75, 0x83, 0x00, 0x12, 0x06, 0xA2, 0xFE, 0x90, 0xA5, 0xF3, 0x12, 0x48, 0x55, 0x8F, 0x82, -0x75, 0x83, 0x00, 0x12, 0x06, 0xA2, 0x6E, 0x60, 0x03, 0x7F, 0x00, 0x22, 0x0F, 0x80, 0xD0, 0x7F, -0x01, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0xA7, 0x05, 0xED, 0xF0, 0xA3, 0xEB, -0xF0, 0x90, 0xA7, 0x04, 0xEF, 0xF0, 0xE4, 0xFD, 0xFC, 0xD1, 0x5F, 0x7C, 0x00, 0xAD, 0x07, 0x90, -0xA7, 0x04, 0xE0, 0x90, 0x04, 0x25, 0xF0, 0x90, 0xA7, 0x05, 0xE0, 0x60, 0x0E, 0x74, 0x21, 0x2F, -0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x80, 0xF0, 0xAF, 0x05, 0x74, 0x20, 0x2F, -0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xC0, 0xF0, 0x74, 0x21, 0x2F, 0xF5, 0x82, -0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xC0, 0xF0, 0xAF, 0x05, 0x74, 0x12, 0x2F, 0xF5, 0x82, -0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0x01, 0xFE, 0x90, 0xA7, 0x06, 0xE0, 0x25, 0xE0, 0x25, -0xE0, 0xFB, 0xEE, 0x44, 0x02, 0x4B, 0xFE, 0x74, 0x12, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, -0x83, 0xEE, 0xF0, 0x74, 0x11, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0x74, 0xFF, 0xF0, -0x74, 0x29, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xF7, 0xF0, 0xAE, 0x04, -0xAF, 0x05, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0xE4, 0xFF, -0x90, 0xA4, 0x8D, 0xE0, 0xFE, 0x90, 0xA4, 0x8C, 0xE0, 0xFD, 0xB5, 0x06, 0x04, 0x7E, 0x01, 0x80, -0x02, 0x7E, 0x00, 0xEE, 0x64, 0x01, 0x60, 0x2D, 0xED, 0x75, 0xF0, 0x0F, 0xA4, 0x24, 0xF6, 0xF9, -0x74, 0xA3, 0x35, 0xF0, 0xFA, 0x7B, 0x01, 0x12, 0x98, 0x93, 0x7F, 0x01, 0xEF, 0x60, 0x16, 0x90, -0xA4, 0x8C, 0xE0, 0x04, 0xF0, 0xE0, 0xB4, 0x0A, 0x02, 0x80, 0x02, 0x7F, 0x00, 0xEF, 0x60, 0x05, -0xE4, 0x90, 0xA4, 0x8C, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x02, 0x84, 0xEF, 0xF0, 0xEE, -0xA3, 0xF0, 0xA3, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0x90, 0x04, 0x1D, 0xE0, 0x70, 0x19, 0x90, 0xA3, -0x9F, 0xE0, 0xFF, 0x7B, 0x18, 0xE4, 0xFD, 0xD1, 0xA2, 0x90, 0xA7, 0x16, 0xEE, 0xF0, 0xA3, 0xEF, -0xF0, 0x90, 0x04, 0x1F, 0x74, 0x20, 0xF0, 0x22, 0x90, 0xA4, 0xAF, 0xE0, 0xB4, 0x01, 0x15, 0x90, -0xA5, 0x33, 0xE0, 0x60, 0x0F, 0x90, 0xA5, 0x31, 0xE0, 0x54, 0x0F, 0x64, 0x02, 0x60, 0x02, 0x80, -0xC7, 0x12, 0x5C, 0x93, 0x22, 0x32, 0xC0, 0xE0, 0xC0, 0xF0, 0xC0, 0x83, 0xC0, 0x82, 0xC0, 0xD0, -0x75, 0xD0, 0x00, 0xC0, 0x00, 0xC0, 0x01, 0xC0, 0x02, 0xC0, 0x03, 0xC0, 0x04, 0xC0, 0x05, 0xC0, -0x06, 0xC0, 0x07, 0x12, 0x4E, 0x8C, 0xE5, 0x14, 0x30, 0xE7, 0x02, 0x11, 0x30, 0xE5, 0x14, 0x30, -0xE1, 0x03, 0x12, 0x4E, 0x15, 0xD0, 0x07, 0xD0, 0x06, 0xD0, 0x05, 0xD0, 0x04, 0xD0, 0x03, 0xD0, -0x02, 0xD0, 0x01, 0xD0, 0x00, 0xD0, 0xD0, 0xD0, 0x82, 0xD0, 0x83, 0xD0, 0xF0, 0xD0, 0xE0, 0x32, -0x7F, 0x01, 0x7E, 0x00, 0x12, 0x3E, 0x0C, 0x7F, 0xF2, 0x12, 0x4B, 0xC2, 0xEF, 0x20, 0xE6, 0x0E, -0x7F, 0x05, 0x12, 0x4B, 0xC2, 0xEF, 0x44, 0x80, 0xFD, 0x7F, 0x05, 0x12, 0x4C, 0xF2, 0x22, 0xC0, -0xE0, 0xC0, 0xF0, 0xC0, 0x83, 0xC0, 0x82, 0xC0, 0xD0, 0x75, 0xD0, 0x00, 0xC0, 0x00, 0xC0, 0x01, -0xC0, 0x02, 0xC0, 0x03, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, 0x71, 0xDB, 0xE5, 0x21, -0x30, 0xE1, 0x02, 0x11, 0xBD, 0xE5, 0x21, 0x30, 0xE2, 0x02, 0x11, 0xF4, 0xE5, 0x22, 0x30, 0xE0, -0x02, 0x31, 0x78, 0xE5, 0x24, 0x30, 0xE1, 0x05, 0x7F, 0x04, 0x12, 0x57, 0x7E, 0xE5, 0x24, 0x30, -0xE4, 0x02, 0x11, 0xE2, 0xE5, 0x24, 0x30, 0xE5, 0x02, 0x91, 0x0B, 0xE5, 0x24, 0x30, 0xE6, 0x02, -0x91, 0x40, 0xD0, 0x07, 0xD0, 0x06, 0xD0, 0x05, 0xD0, 0x04, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, -0xD0, 0x00, 0xD0, 0xD0, 0xD0, 0x82, 0xD0, 0x83, 0xD0, 0xF0, 0xD0, 0xE0, 0x32, 0x90, 0xA5, 0x33, -0xE0, 0x60, 0x02, 0x91, 0x7B, 0x90, 0xA5, 0x66, 0xE0, 0x30, 0xE0, 0x15, 0x54, 0xFB, 0xF0, 0xE0, -0xC3, 0x13, 0x30, 0xE0, 0x07, 0x7D, 0x04, 0x7F, 0x01, 0x02, 0x5B, 0x02, 0x7D, 0x31, 0x12, 0x4D, -0x0C, 0x22, 0x31, 0x47, 0x90, 0xA5, 0x39, 0xE0, 0x14, 0x90, 0x05, 0x73, 0xF0, 0x7D, 0x02, 0x7F, -0x02, 0x02, 0x5E, 0xC6, 0x90, 0xA5, 0x33, 0xE0, 0x60, 0x15, 0x90, 0x06, 0x92, 0xE0, 0x30, 0xE1, -0x04, 0x51, 0x10, 0x80, 0x0A, 0x90, 0xA5, 0x2F, 0xE0, 0x54, 0xF7, 0xF0, 0x12, 0x58, 0x95, 0x90, -0xA5, 0x69, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x29, 0xEF, 0xC4, 0x54, -0x0F, 0x30, 0xE0, 0x03, 0x12, 0x57, 0x98, 0x90, 0xA5, 0x6A, 0xE0, 0x30, 0xE0, 0x18, 0x90, 0xA5, -0x69, 0xE0, 0xFE, 0x54, 0x0F, 0xFF, 0xEE, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x7D, 0x00, 0x20, 0xE0, -0x02, 0x7D, 0x01, 0x12, 0x4B, 0xE4, 0x22, 0x90, 0xA5, 0x33, 0xE0, 0x60, 0x2A, 0x90, 0xA4, 0xAF, -0xE0, 0x64, 0x01, 0x70, 0x22, 0x90, 0xA5, 0x3A, 0xF0, 0x04, 0x60, 0x1B, 0x90, 0xA5, 0x37, 0xE0, -0x44, 0x10, 0xF0, 0xE4, 0x90, 0xA6, 0xE5, 0xF0, 0x90, 0xA5, 0x3B, 0x51, 0x58, 0x90, 0xA5, 0x36, -0xE0, 0x20, 0xE2, 0x03, 0x12, 0x58, 0x9E, 0x22, 0x91, 0xC5, 0x90, 0xA6, 0x0C, 0xEF, 0xF0, 0x30, -0xE0, 0x05, 0x7D, 0x01, 0xE4, 0x80, 0x02, 0xE4, 0xFD, 0xFF, 0x12, 0x5B, 0x02, 0x90, 0xA6, 0x0C, -0xE0, 0x30, 0xE6, 0x11, 0x90, 0x01, 0x2F, 0xE0, 0x30, 0xE7, 0x04, 0xE4, 0xF0, 0x80, 0x06, 0x90, -0x01, 0x2F, 0x74, 0x80, 0xF0, 0x90, 0xA5, 0x44, 0xE0, 0xFF, 0xA3, 0xE0, 0xFD, 0x90, 0xA5, 0x49, -0xE0, 0xFB, 0xAC, 0x07, 0x90, 0xA5, 0x2F, 0xE0, 0x30, 0xE0, 0x32, 0x90, 0xA5, 0x45, 0xE0, 0xD3, -0x94, 0x03, 0x50, 0x07, 0x90, 0xA5, 0x3B, 0xEB, 0xF0, 0x80, 0x0A, 0xED, 0x24, 0xFD, 0x2B, 0x90, -0xA5, 0x3B, 0xF0, 0x7D, 0x03, 0x90, 0xA5, 0x5E, 0xE0, 0x24, 0x04, 0xC3, 0x9D, 0x2C, 0xFF, 0x90, -0xA5, 0x48, 0xF0, 0x90, 0xA5, 0x3E, 0xE4, 0xF0, 0xA3, 0xEF, 0xF0, 0x80, 0x0E, 0x90, 0xA5, 0x3E, -0xE4, 0xF0, 0xA3, 0x74, 0x02, 0xF0, 0x90, 0xA5, 0x3B, 0xEB, 0xF0, 0x90, 0xA5, 0x3E, 0xA3, 0xE0, -0x90, 0x05, 0x58, 0xF0, 0x90, 0xA5, 0x5E, 0xE0, 0x24, 0x04, 0xFD, 0x7F, 0xFF, 0x02, 0x4C, 0xF2, -0x90, 0xA5, 0x2F, 0xE0, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x05, 0x90, 0x01, 0x5B, 0xE4, -0xF0, 0x90, 0x06, 0x92, 0x74, 0x02, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x04, 0xF0, 0xE4, 0x90, 0xA6, -0xE5, 0xF0, 0x90, 0xA5, 0x61, 0xE0, 0xC3, 0x13, 0x54, 0x7F, 0x90, 0xA6, 0xE6, 0xF0, 0xE4, 0xFB, -0xFD, 0x7F, 0x58, 0x7E, 0x01, 0x51, 0x64, 0x90, 0xA5, 0x2F, 0xE0, 0x44, 0x08, 0xF0, 0x22, 0xF0, -0xE4, 0x90, 0xA6, 0xE5, 0xF0, 0x90, 0xA5, 0x60, 0xE0, 0x90, 0xA6, 0xE6, 0xF0, 0xE4, 0xFB, 0xFD, -0x7F, 0x54, 0x7E, 0x01, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0xA6, 0xE1, 0xEE, 0xF0, -0xA3, 0xEF, 0xF0, 0x90, 0xA6, 0xE5, 0xE0, 0xF5, 0x3B, 0xA3, 0xE0, 0xF5, 0x3C, 0x12, 0x36, 0x9D, -0x90, 0xA6, 0xE1, 0xE0, 0xFE, 0xA3, 0xE0, 0xF5, 0x82, 0x8E, 0x83, 0xA3, 0xA3, 0xA3, 0x74, 0x05, -0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0xA5, 0x66, 0xE0, 0x30, 0xE0, 0x13, 0xE4, 0x90, 0xA6, -0xE5, 0xF0, 0x90, 0xA5, 0x67, 0x51, 0x58, 0x90, 0xA5, 0x66, 0xE0, 0x44, 0x04, 0xF0, 0xB1, 0x10, -0x22, 0xAD, 0x07, 0x90, 0xA5, 0x6B, 0xE0, 0x75, 0xF0, 0x20, 0xA4, 0xFF, 0x90, 0xA6, 0xE7, 0xE5, -0xF0, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0xA5, 0x6C, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0xAE, 0xF0, 0x90, -0xA6, 0xE9, 0xF0, 0xEE, 0xA3, 0xF0, 0x90, 0xA6, 0xE7, 0xE0, 0xFE, 0xA3, 0xE0, 0x90, 0xA6, 0xEB, -0xF0, 0xEE, 0xA3, 0xF0, 0xED, 0x64, 0x01, 0x70, 0x02, 0x61, 0x92, 0x90, 0xA5, 0x69, 0xE0, 0xFE, -0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x20, 0xE0, 0x02, 0x61, 0x92, 0xEE, 0x54, 0x0F, 0xFF, 0xEE, -0xC4, 0x13, 0x13, 0x54, 0x03, 0x7D, 0x00, 0x20, 0xE0, 0x02, 0x7D, 0x01, 0x12, 0x4B, 0xE4, 0x90, -0xA5, 0x69, 0xE0, 0xFE, 0x54, 0x0F, 0xFF, 0xEE, 0xC4, 0x13, 0x13, 0x54, 0x01, 0xFD, 0x12, 0x4B, -0xE4, 0x90, 0xA5, 0x69, 0xE0, 0xC4, 0x13, 0x54, 0x07, 0x30, 0xE0, 0x43, 0xA3, 0xE0, 0x30, 0xE0, -0x1B, 0x90, 0xA6, 0xEC, 0xE0, 0x90, 0xA6, 0xE5, 0xF0, 0x90, 0xA6, 0xEB, 0xE0, 0x90, 0xA6, 0xE6, -0xF0, 0xE4, 0xFB, 0xFD, 0x7F, 0x58, 0x7E, 0x01, 0x51, 0x64, 0x80, 0x23, 0x90, 0xA6, 0xE7, 0xE0, -0xFE, 0xA3, 0xE0, 0xFF, 0x12, 0x3E, 0x87, 0x90, 0xA5, 0x69, 0xE0, 0xFE, 0x54, 0x0F, 0xFF, 0xEE, -0xC4, 0x13, 0x13, 0x54, 0x03, 0x7D, 0x00, 0x20, 0xE0, 0x02, 0x7D, 0x01, 0x12, 0x4B, 0xE4, 0x90, -0xA5, 0x69, 0xE0, 0xC4, 0x54, 0x0F, 0x30, 0xE0, 0x19, 0x90, 0xA6, 0xEA, 0xE0, 0x90, 0xA6, 0xE5, -0xF0, 0x90, 0xA6, 0xE9, 0xE0, 0x90, 0xA6, 0xE6, 0xF0, 0xE4, 0xFB, 0xFD, 0x7F, 0x58, 0x7E, 0x01, -0x51, 0x64, 0x22, 0x90, 0xA4, 0xAF, 0xE0, 0x64, 0x01, 0x70, 0x12, 0x90, 0xA5, 0x33, 0xE0, 0x60, -0x0C, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0x51, 0x4F, 0x22, 0x90, 0xA7, -0x23, 0xEF, 0xF0, 0x90, 0xA3, 0x9D, 0xE0, 0xB4, 0x02, 0x12, 0x90, 0xA7, 0x23, 0xE0, 0xFF, 0x64, -0x01, 0x60, 0x17, 0x90, 0x01, 0x4D, 0xE0, 0x64, 0x80, 0xF0, 0x80, 0x0C, 0x90, 0x06, 0x90, 0xE0, -0x44, 0x01, 0xF0, 0x90, 0xA7, 0x23, 0xE0, 0xFF, 0x51, 0xB1, 0x22, 0x90, 0x01, 0x3C, 0xE0, 0x55, -0x1D, 0xF5, 0x21, 0xA3, 0xE0, 0x55, 0x1E, 0xF5, 0x22, 0xA3, 0xE0, 0x55, 0x1F, 0xF5, 0x23, 0xA3, -0xE0, 0x55, 0x20, 0xF5, 0x24, 0x90, 0x01, 0x3C, 0xE5, 0x21, 0xF0, 0xA3, 0xE5, 0x22, 0xF0, 0xA3, -0xE5, 0x23, 0xF0, 0xA3, 0xE5, 0x24, 0xF0, 0x53, 0x91, 0xDF, 0x22, 0x90, 0xA5, 0x2F, 0xE0, 0xFF, -0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, 0x27, 0xEF, 0x54, 0xBF, 0xF0, 0x90, 0x04, 0xE0, 0xE0, -0x90, 0xA5, 0x30, 0x30, 0xE0, 0x06, 0xE0, 0x44, 0x01, 0xF0, 0x80, 0x10, 0xE0, 0x54, 0xFE, 0xF0, -0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, 0x74, 0x04, 0xF0, 0x12, 0x58, 0x95, 0x22, -0x90, 0xA5, 0x2F, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x2C, 0xEF, 0x54, -0x7F, 0xF0, 0x90, 0x04, 0xE0, 0xE0, 0x90, 0xA5, 0x30, 0x30, 0xE1, 0x06, 0xE0, 0x44, 0x02, 0xF0, -0x80, 0x0F, 0xE0, 0x54, 0xFD, 0xF0, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, 0x04, -0xF0, 0x90, 0xA5, 0x33, 0xE0, 0x60, 0x03, 0x12, 0x58, 0x95, 0x22, 0x90, 0xA5, 0x2F, 0xE0, 0xFF, -0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x11, 0xEF, 0x54, 0xFB, 0xF0, 0x90, 0xA5, 0x37, 0xE0, 0x54, -0xFD, 0xF0, 0x54, 0x07, 0x70, 0x2E, 0x80, 0x29, 0x90, 0xA5, 0x3C, 0xE0, 0x04, 0xF0, 0x90, 0xA5, -0x37, 0xE0, 0x54, 0xEF, 0xF0, 0x90, 0xA5, 0x5F, 0xE0, 0xFF, 0x90, 0xA5, 0x3C, 0xE0, 0xD3, 0x9F, -0x40, 0x0F, 0x90, 0xA4, 0xAF, 0xE0, 0xB4, 0x01, 0x0B, 0x90, 0xA5, 0x30, 0xE0, 0x54, 0xFB, 0xF0, -0x22, 0x12, 0x58, 0x95, 0x22, 0xE4, 0x90, 0xA6, 0x0D, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x7F, 0x83, -0x12, 0x4B, 0xC2, 0x90, 0xA6, 0x0D, 0xEF, 0xF0, 0x7F, 0x83, 0x12, 0x4B, 0xC2, 0xAE, 0x07, 0x90, -0xA6, 0x0D, 0xE0, 0xFF, 0xB5, 0x06, 0x01, 0x22, 0xC3, 0x90, 0xA6, 0x0F, 0xE0, 0x94, 0x64, 0x90, -0xA6, 0x0E, 0xE0, 0x94, 0x00, 0x40, 0x0D, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0xA6, -0x0D, 0xE0, 0xFF, 0x22, 0x90, 0xA6, 0x0E, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x08, 0xD6, 0x80, 0xBE, -0x90, 0xA7, 0x19, 0xE0, 0x60, 0x4C, 0x90, 0xA5, 0x66, 0xE0, 0x30, 0xE0, 0x45, 0x90, 0xA7, 0x18, -0xE0, 0x04, 0xF0, 0xE0, 0xD3, 0x94, 0xC8, 0x40, 0x39, 0x90, 0xA5, 0x3D, 0x74, 0xD0, 0xF0, 0x90, -0x00, 0xCC, 0xE0, 0x44, 0x04, 0xFD, 0x7F, 0xCC, 0x12, 0x4C, 0xF2, 0x90, 0x00, 0x02, 0xE0, 0x54, -0xFB, 0xFD, 0x7F, 0x02, 0x12, 0x4C, 0xF2, 0xE4, 0x90, 0xA7, 0x19, 0xF0, 0x90, 0xA5, 0x66, 0xE0, -0xC3, 0x13, 0x30, 0xE0, 0x0D, 0x90, 0xA5, 0x2F, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0xA5, 0x3D, 0x74, -0xD0, 0xF0, 0x22, 0xE4, 0xF5, 0x65, 0x90, 0x06, 0xA9, 0xE0, 0xF5, 0x65, 0x54, 0xC0, 0x70, 0x0D, -0x90, 0xA5, 0x37, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0xFD, 0xF0, 0x02, 0x58, 0x95, 0xE5, 0x65, 0x30, -0xE6, 0x23, 0x90, 0xA5, 0x33, 0xE0, 0x64, 0x01, 0x70, 0x22, 0x90, 0xA5, 0x37, 0xE0, 0x44, 0x01, -0xF0, 0x90, 0xA5, 0x31, 0xE0, 0x54, 0x0F, 0x64, 0x02, 0x60, 0x05, 0x12, 0x67, 0xA8, 0x80, 0x0C, -0x12, 0x5C, 0x93, 0x80, 0x07, 0x90, 0xA5, 0x37, 0xE0, 0x54, 0xFE, 0xF0, 0xE5, 0x65, 0x90, 0xA5, -0x37, 0x30, 0xE7, 0x0D, 0xE0, 0x44, 0x02, 0x51, 0x4F, 0x90, 0xA5, 0x2F, 0xE0, 0x44, 0x04, 0xF0, -0x22, 0xE0, 0x54, 0xFD, 0xF0, 0x22, 0x90, 0xA4, 0xAF, 0xE0, 0x64, 0x01, 0x60, 0x02, 0xC1, 0x5E, -0x90, 0xA5, 0x33, 0xE0, 0x70, 0x02, 0xC1, 0x5E, 0x90, 0xA5, 0x31, 0xE0, 0xC4, 0x54, 0x0F, 0x64, -0x01, 0x70, 0x26, 0x90, 0x06, 0xAB, 0xE0, 0x90, 0xA5, 0x3A, 0xF0, 0x90, 0x06, 0xAA, 0xE0, 0x04, -0x90, 0xA5, 0x39, 0xF0, 0xA3, 0xE0, 0xFF, 0x70, 0x08, 0x90, 0xA5, 0x39, 0xE0, 0xFE, 0xFF, 0x80, -0x03, 0xEF, 0x04, 0xFF, 0x90, 0xA5, 0x3A, 0xEF, 0xF0, 0x90, 0xA5, 0x30, 0xE0, 0x44, 0x04, 0xF0, -0xE4, 0x90, 0xA5, 0x3C, 0xF0, 0x90, 0xA5, 0x3E, 0xA3, 0xE0, 0x90, 0x05, 0x58, 0xF0, 0x90, 0x01, -0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0xF0, 0x90, 0xA5, 0x37, 0xE0, 0x54, 0xFD, 0xF0, -0x54, 0xEF, 0xF0, 0x90, 0xA5, 0x31, 0xE0, 0xFF, 0xC4, 0x54, 0x0F, 0x24, 0xFD, 0x50, 0x02, 0x80, -0x02, 0xB1, 0x63, 0x90, 0xA5, 0x30, 0xE0, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x0F, 0x90, -0xA5, 0x39, 0xE0, 0xFF, 0xA3, 0xE0, 0xB5, 0x07, 0x05, 0xD1, 0x5F, 0x12, 0x5E, 0xE1, 0x22, 0xEF, -0x14, 0x90, 0x05, 0x73, 0xF0, 0x90, 0x01, 0x3F, 0x74, 0x10, 0xF0, 0xFD, 0x7F, 0x03, 0x74, 0x1D, -0x2F, 0xF8, 0xE6, 0x4D, 0xFE, 0xF6, 0x74, 0x38, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, -0xEE, 0xF0, 0x22, 0x90, 0xA5, 0x33, 0xE0, 0x60, 0x45, 0x90, 0xA5, 0x30, 0xE0, 0x13, 0x13, 0x13, -0x54, 0x1F, 0x30, 0xE0, 0x13, 0x90, 0x01, 0x3B, 0xE0, 0x30, 0xE4, 0x0C, 0x12, 0x5E, 0xDB, 0x90, -0xA5, 0x39, 0xE0, 0x14, 0x90, 0x05, 0x73, 0xF0, 0x90, 0xA7, 0x0E, 0xE4, 0x75, 0xF0, 0x01, 0x12, -0x08, 0xD6, 0xC3, 0x90, 0xA7, 0x0F, 0xE0, 0x94, 0x80, 0x90, 0xA7, 0x0E, 0xE0, 0x64, 0x80, 0x94, -0x80, 0x40, 0x0B, 0x90, 0x01, 0x98, 0xE0, 0x54, 0xFE, 0xF0, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x01, -0x02, 0xE0, 0x54, 0x03, 0xFF, 0xBF, 0x03, 0x0D, 0x90, 0x01, 0xB8, 0xE0, 0x04, 0xF0, 0x90, 0x05, -0x21, 0xE0, 0x44, 0x80, 0xF0, 0x7F, 0x01, 0x12, 0x57, 0x7E, 0x41, 0x96, 0xE4, 0xF5, 0x65, 0x90, -0xA5, 0x33, 0xE0, 0x60, 0x76, 0x90, 0xA4, 0xAF, 0xE0, 0x64, 0x01, 0x70, 0x6E, 0x90, 0xA5, 0x31, -0xE0, 0xC4, 0x54, 0x0F, 0x60, 0x22, 0x24, 0xFE, 0x60, 0x03, 0x04, 0x70, 0x1E, 0x90, 0xA5, 0x3A, -0xE0, 0x14, 0xF0, 0xE0, 0xFF, 0x60, 0x06, 0x90, 0xA5, 0x3C, 0xE0, 0x60, 0x0E, 0xEF, 0x70, 0x08, -0x90, 0xA5, 0x39, 0xE0, 0xA3, 0xF0, 0x80, 0x00, 0x75, 0x65, 0x01, 0xE5, 0x65, 0x60, 0x3C, 0x90, -0xA5, 0x37, 0xE0, 0x44, 0x10, 0xF0, 0x90, 0xA5, 0x3C, 0xE0, 0x60, 0x03, 0xB4, 0x01, 0x0B, 0xE4, -0x90, 0xA6, 0xE5, 0xF0, 0x90, 0xA5, 0x3C, 0xE0, 0x80, 0x0F, 0xE4, 0x90, 0xA6, 0xE5, 0xF0, 0x90, -0xA5, 0x3C, 0xE0, 0x75, 0xF0, 0x03, 0xA4, 0x24, 0xFE, 0xFF, 0x90, 0xA5, 0x3B, 0xE0, 0x2F, 0x51, -0x59, 0x90, 0xA5, 0x36, 0xE0, 0x20, 0xE2, 0x03, 0x12, 0x58, 0x9E, 0x22, 0xD1, 0xEC, 0x90, 0xA4, -0x90, 0xE0, 0x60, 0x02, 0xF1, 0x79, 0x02, 0x5D, 0xDB, 0x90, 0xA4, 0x97, 0xE0, 0xFD, 0x7C, 0x00, -0xA3, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12, 0x07, 0x15, 0xED, 0x4C, 0x70, 0x05, 0x90, 0xA4, 0xA4, -0x80, 0x2A, 0xED, 0x64, 0x01, 0x4C, 0x70, 0x05, 0x90, 0xA4, 0xA5, 0x80, 0x1F, 0xED, 0x64, 0x02, -0x4C, 0x70, 0x05, 0x90, 0xA4, 0xA6, 0x80, 0x14, 0xED, 0x64, 0x03, 0x4C, 0x70, 0x05, 0x90, 0xA4, -0xA7, 0x80, 0x09, 0xED, 0x64, 0x04, 0x4C, 0x70, 0x11, 0x90, 0xA4, 0xA8, 0xE0, 0xFF, 0xF1, 0xCB, -0x90, 0xA4, 0x98, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x08, 0xD6, 0x22, 0x90, 0x04, 0x24, 0xEF, 0xF0, -0x90, 0x04, 0x57, 0xF0, 0x22, 0x32, 0x32, 0xE4, 0xFF, 0xE4, 0xFE, 0x74, 0x97, 0x2F, 0xF5, 0x82, -0xE4, 0x34, 0x9B, 0xF5, 0x83, 0xE0, 0x54, 0xFE, 0xF0, 0x75, 0xF0, 0x10, 0xEF, 0x90, 0x81, 0x00, -0xBE, 0x03, 0x12, 0x12, 0x48, 0x49, 0xE5, 0x82, 0x2E, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, -0x74, 0x80, 0xF0, 0x80, 0x0F, 0x12, 0x48, 0x49, 0xE5, 0x82, 0x2E, 0xF5, 0x82, 0xE4, 0x35, 0x83, -0xF5, 0x83, 0xE4, 0xF0, 0x75, 0xF0, 0x08, 0xEF, 0x90, 0x89, 0x00, 0x12, 0x48, 0x49, 0xE5, 0x82, -0x2E, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE4, 0xF0, 0x0E, 0xBE, 0x10, 0xAD, 0x0F, 0xBF, -0x80, 0xA7, 0xE4, 0x90, 0xAD, 0xE3, 0xF0, 0x90, 0x95, 0x92, 0x12, 0x08, 0x79, 0x00, 0x00, 0x00, -0x00, 0xE4, 0xFF, 0xE4, 0xFE, 0x75, 0xF0, 0x0A, 0xEF, 0x90, 0x8D, 0x01, 0x12, 0x48, 0x49, 0x75, -0xF0, 0x02, 0xEE, 0x12, 0x48, 0x49, 0xE4, 0xF0, 0xA3, 0xF0, 0x0E, 0xBE, 0x05, 0xE7, 0x74, 0x98, -0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xA2, 0xF5, 0x83, 0xE4, 0xF0, 0x74, 0x18, 0x2F, 0xF5, 0x82, 0xE4, -0x34, 0xA3, 0xF5, 0x83, 0xE4, 0xF0, 0x74, 0x18, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x9D, 0xF5, 0x83, -0xE4, 0xF0, 0x74, 0x18, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x9E, 0xF5, 0x83, 0xE4, 0xF0, 0x74, 0x81, -0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x94, 0xF5, 0x83, 0xE4, 0xF0, 0x74, 0x98, 0x2F, 0xF5, 0x82, 0xE4, -0x34, 0x9C, 0xF5, 0x83, 0xE4, 0xF0, 0x74, 0x97, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x9B, 0xF5, 0x83, -0xE0, 0x54, 0x9D, 0xF0, 0x90, 0x95, 0x11, 0x74, 0x01, 0xF0, 0x74, 0x98, 0x2F, 0xF5, 0x82, 0xE4, -0x34, 0xA1, 0xF5, 0x83, 0xE4, 0xF0, 0x74, 0x17, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x9A, 0xF5, 0x83, -0xE4, 0xF0, 0x74, 0x96, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x95, 0xF5, 0x83, 0x74, 0xFF, 0xF0, 0x74, -0x18, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xA1, 0xF5, 0x83, 0x74, 0x1B, 0xF0, 0x74, 0x98, 0x2F, 0xF5, -0x82, 0xE4, 0x34, 0x9D, 0xF5, 0x83, 0xE4, 0xF0, 0x74, 0x01, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x93, -0xF5, 0x83, 0x74, 0xC0, 0xF0, 0xEF, 0x25, 0xE0, 0x24, 0x01, 0xF5, 0x82, 0xE4, 0x34, 0x92, 0xF5, -0x83, 0xE4, 0xF0, 0xA3, 0xF0, 0x74, 0x97, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x9A, 0xF5, 0x83, 0xE4, -0xF0, 0xEF, 0x25, 0xE0, 0x24, 0x98, 0xF5, 0x82, 0xE4, 0x34, 0x9E, 0xF5, 0x83, 0xE4, 0xF0, 0xA3, -0xF0, 0xEF, 0x25, 0xE0, 0x24, 0x98, 0xF5, 0x82, 0xE4, 0x34, 0x9F, 0xF5, 0x83, 0xE4, 0xF0, 0xA3, -0xF0, 0x75, 0xF0, 0x05, 0xEF, 0x90, 0x97, 0x97, 0x12, 0x48, 0x49, 0x74, 0x1B, 0xF0, 0x75, 0xF0, -0x05, 0xEF, 0x90, 0x97, 0x98, 0x12, 0x48, 0x49, 0xE4, 0xF0, 0x75, 0xF0, 0x05, 0xEF, 0x90, 0x97, -0x99, 0x12, 0x48, 0x49, 0xE0, 0x54, 0xE0, 0xF0, 0x75, 0xF0, 0x05, 0xEF, 0x90, 0x97, 0x9A, 0x12, -0x48, 0x49, 0xE0, 0x54, 0xF3, 0xF0, 0x75, 0xF0, 0x05, 0xEF, 0x90, 0x97, 0x9A, 0x12, 0x48, 0x49, -0xE0, 0x54, 0xFC, 0xF0, 0x75, 0xF0, 0x05, 0xEF, 0x90, 0x97, 0x99, 0x12, 0x48, 0x49, 0xE0, 0x44, -0x20, 0xF0, 0x75, 0xF0, 0x05, 0xEF, 0x90, 0x97, 0x9A, 0x12, 0x48, 0x49, 0xE0, 0x54, 0xCF, 0xF0, -0x75, 0xF0, 0x05, 0xEF, 0x90, 0x97, 0x9A, 0x12, 0x48, 0x49, 0xE0, 0x44, 0x40, 0xF0, 0x75, 0xF0, -0x05, 0xEF, 0x90, 0x97, 0x9A, 0x12, 0x48, 0x49, 0xE0, 0x54, 0x7F, 0xF0, 0x75, 0xF0, 0x05, 0xEF, -0x90, 0x97, 0x9B, 0x12, 0x48, 0x49, 0xE0, 0x54, 0xFE, 0xF0, 0x75, 0xF0, 0x05, 0xEF, 0x90, 0x97, -0x98, 0x12, 0x48, 0x49, 0xE0, 0xFE, 0x75, 0xF0, 0x10, 0xEF, 0x90, 0x81, 0x00, 0x12, 0x48, 0x49, -0xEE, 0xF0, 0x0F, 0xEF, 0x64, 0x80, 0x60, 0x02, 0x01, 0x43, 0x90, 0x04, 0x49, 0x74, 0xF0, 0xF0, -0xA3, 0xE4, 0xF0, 0xA3, 0x74, 0xFF, 0xF0, 0x90, 0x04, 0x33, 0x74, 0x02, 0xF0, 0xA3, 0x74, 0x04, -0xF0, 0xA3, 0x04, 0xF0, 0xA3, 0x04, 0xF0, 0xA3, 0x04, 0xF0, 0x22, 0x8F, 0x61, 0x75, 0xF0, 0x05, -0xEF, 0x90, 0x97, 0x9B, 0x12, 0x48, 0x49, 0xE0, 0x54, 0x01, 0xFB, 0x75, 0xF0, 0x10, 0xE5, 0x61, -0x90, 0x81, 0x00, 0x12, 0x48, 0x49, 0xE0, 0xF5, 0x62, 0x54, 0x7F, 0xFA, 0x75, 0xF0, 0x05, 0xE5, -0x61, 0x90, 0x97, 0x97, 0x12, 0x48, 0x49, 0xE0, 0xF9, 0x90, 0xA5, 0x80, 0xF0, 0x75, 0xF0, 0x04, -0xEA, 0x90, 0x42, 0x41, 0x12, 0x48, 0x49, 0x12, 0x48, 0x1D, 0xE5, 0x61, 0x25, 0xE0, 0x24, 0x16, -0xF5, 0x82, 0xE4, 0x34, 0x96, 0xF5, 0x83, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x75, 0xF0, 0x05, 0xE5, -0x61, 0x90, 0x97, 0x9A, 0x12, 0x48, 0x49, 0xE0, 0x13, 0x13, 0x54, 0x03, 0xF5, 0x64, 0xEA, 0xC3, -0x99, 0x40, 0x02, 0x61, 0x11, 0x74, 0x18, 0x25, 0x61, 0xF5, 0x82, 0xE4, 0x34, 0xA2, 0xF5, 0x83, -0xEA, 0xF0, 0x74, 0x18, 0x25, 0x61, 0xF5, 0x82, 0xE4, 0x34, 0xA2, 0xF5, 0x83, 0xE0, 0xF5, 0x63, -0xC3, 0x94, 0x0C, 0x40, 0x23, 0xE5, 0x63, 0x94, 0x1B, 0x50, 0x1D, 0xBB, 0x01, 0x1A, 0xE5, 0x63, -0x24, 0xF4, 0xFD, 0xAF, 0x61, 0x91, 0x31, 0xAD, 0x63, 0xAF, 0x61, 0x71, 0x8F, 0xAA, 0x07, 0xEA, -0x65, 0x63, 0x60, 0x04, 0x8A, 0x62, 0x61, 0x81, 0xEA, 0x04, 0xFD, 0x90, 0xA5, 0x80, 0xE0, 0xFF, -0xED, 0xD3, 0x9F, 0x40, 0x02, 0x61, 0x81, 0xED, 0x13, 0x13, 0x13, 0x54, 0x1F, 0xFF, 0x75, 0xF0, -0x08, 0xE5, 0x61, 0x90, 0x89, 0x00, 0x12, 0x48, 0x49, 0xE5, 0x82, 0x2F, 0xF5, 0x82, 0xE4, 0x35, -0x83, 0xF5, 0x83, 0xE0, 0xF5, 0x82, 0x75, 0x83, 0x00, 0xED, 0x54, 0x07, 0xFF, 0x74, 0x01, 0x7E, -0x00, 0xA8, 0x07, 0x08, 0x80, 0x05, 0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8, 0xF9, 0xFF, 0xEE, 0x55, -0x83, 0xFE, 0xEF, 0x55, 0x82, 0x4E, 0x60, 0x06, 0xAA, 0x05, 0x8A, 0x62, 0x80, 0x73, 0x0D, 0x80, -0xAA, 0x90, 0xA5, 0x80, 0xE0, 0x6A, 0x70, 0x50, 0x74, 0x18, 0x25, 0x61, 0xF5, 0x82, 0xE4, 0x34, -0xA2, 0xF5, 0x83, 0xE5, 0x62, 0xF0, 0x75, 0xF0, 0x05, 0xE5, 0x61, 0x90, 0x97, 0x99, 0x12, 0x48, -0x49, 0xE0, 0xFF, 0xC4, 0x13, 0x54, 0x07, 0x30, 0xE0, 0x0C, 0xE5, 0x62, 0x20, 0xE7, 0x07, 0xEA, -0x44, 0x80, 0xF5, 0x62, 0x80, 0x3B, 0x75, 0xF0, 0x04, 0xEA, 0x90, 0x42, 0x41, 0x12, 0x48, 0x49, -0x12, 0x48, 0x1D, 0xE5, 0x61, 0x25, 0xE0, 0x24, 0x16, 0xF5, 0x82, 0xE4, 0x34, 0x96, 0xF5, 0x83, -0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xAF, 0x62, 0x22, 0x90, 0xA5, 0x80, 0xE0, 0xFF, 0x74, 0x18, 0x25, -0x61, 0xF5, 0x82, 0xE4, 0x34, 0xA2, 0xF5, 0x83, 0xEF, 0xF0, 0xAA, 0x07, 0xEF, 0x54, 0x80, 0xF5, -0x62, 0x90, 0xA6, 0xD4, 0xE5, 0x64, 0xF0, 0x7B, 0x01, 0x12, 0x53, 0xC4, 0xAF, 0x62, 0x22, 0x74, -0x81, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x94, 0xF5, 0x83, 0xE0, 0x54, 0xFC, 0xF0, 0x74, 0x98, 0x2F, -0xF5, 0x82, 0xE4, 0x34, 0xA2, 0xF5, 0x83, 0xE0, 0xFE, 0x60, 0x37, 0x74, 0x18, 0x2F, 0xF5, 0x82, -0xE4, 0x34, 0xA3, 0xF5, 0x83, 0xE0, 0x60, 0x2A, 0xEE, 0x7A, 0x00, 0xFB, 0x90, 0xA5, 0x81, 0xEA, -0xF0, 0xA3, 0xEB, 0xF0, 0x74, 0x81, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x94, 0xF5, 0x83, 0xE0, 0x54, -0xFC, 0x44, 0x02, 0xFE, 0x74, 0x81, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x94, 0xF5, 0x83, 0xEE, 0xF0, -0x80, 0x48, 0x74, 0x98, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xA2, 0xF5, 0x83, 0xE0, 0x70, 0x0F, 0x74, -0x18, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xA3, 0xF5, 0x83, 0xE0, 0x60, 0x02, 0x80, 0x1C, 0x74, 0x98, -0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xA2, 0xF5, 0x83, 0xE0, 0xFE, 0x60, 0x1B, 0x74, 0x18, 0x2F, 0xF5, -0x82, 0xE4, 0x34, 0xA3, 0xF5, 0x83, 0xE0, 0x70, 0x0E, 0xEE, 0x7A, 0x00, 0xFB, 0x90, 0xA5, 0x81, -0xEA, 0xF0, 0xA3, 0xEB, 0xF0, 0x80, 0x03, 0xAF, 0x05, 0x22, 0x90, 0xA5, 0x81, 0xA3, 0xE0, 0xFF, -0x22, 0xAC, 0x07, 0x74, 0x97, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0x9B, 0xF5, 0x83, 0xE0, 0xFF, 0x54, -0x02, 0xC3, 0x13, 0xFE, 0xEF, 0x54, 0x40, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x64, 0x01, 0x70, 0x4D, -0xED, 0xC3, 0x94, 0x00, 0x40, 0x06, 0xED, 0xD3, 0x94, 0x03, 0x40, 0x0C, 0xED, 0xC3, 0x94, 0x08, -0x40, 0x2F, 0xED, 0xD3, 0x94, 0x0A, 0x50, 0x29, 0xED, 0x25, 0xE0, 0x24, 0xF4, 0xF5, 0x82, 0xE4, -0x34, 0x44, 0xF5, 0x83, 0xE4, 0x93, 0xFF, 0x74, 0x98, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xA2, 0xF5, -0x83, 0xEF, 0xF0, 0x74, 0x18, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xA3, 0xF5, 0x83, 0xE4, 0xF0, 0xA1, -0x3C, 0xED, 0x64, 0x05, 0x60, 0x22, 0xED, 0x64, 0x0B, 0x70, 0x44, 0x80, 0x1B, 0xEE, 0x64, 0x01, -0x70, 0x64, 0xED, 0xC3, 0x94, 0x00, 0x40, 0x06, 0xED, 0xD3, 0x94, 0x03, 0x40, 0x0A, 0xED, 0x64, -0x08, 0x60, 0x05, 0xED, 0x64, 0x09, 0x70, 0x27, 0xED, 0x25, 0xE0, 0x24, 0xF4, 0xF5, 0x82, 0xE4, -0x34, 0x44, 0xF5, 0x83, 0xE4, 0x93, 0xFF, 0x74, 0x98, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xA2, 0xF5, -0x83, 0xEF, 0xF0, 0xED, 0x25, 0xE0, 0x24, 0xF3, 0xF5, 0x82, 0xE4, 0x34, 0x44, 0x80, 0x4C, 0xED, -0x25, 0xE0, 0x24, 0xF3, 0xF5, 0x82, 0xE4, 0x34, 0x44, 0xF5, 0x83, 0xE4, 0x93, 0xFF, 0x74, 0x98, -0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xA2, 0xF5, 0x83, 0xEF, 0xF0, 0xED, 0x25, 0xE0, 0x24, 0xF4, 0xF5, -0x82, 0xE4, 0x34, 0x44, 0x80, 0x25, 0xED, 0x25, 0xE0, 0x24, 0xF3, 0xF5, 0x82, 0xE4, 0x34, 0x44, -0xF5, 0x83, 0xE4, 0x93, 0xFF, 0x74, 0x98, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xA2, 0xF5, 0x83, 0xEF, -0xF0, 0xED, 0x25, 0xE0, 0x24, 0xF4, 0xF5, 0x82, 0xE4, 0x34, 0x44, 0xF5, 0x83, 0xE4, 0x93, 0xFF, -0x74, 0x18, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xA3, 0xF5, 0x83, 0xEF, 0xF0, 0x74, 0x98, 0x2C, 0xF5, -0x82, 0xE4, 0x34, 0xA2, 0xF5, 0x83, 0xE0, 0xF9, 0x74, 0x18, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xA3, -0xF5, 0x83, 0xE0, 0xFD, 0xE9, 0x13, 0x13, 0x13, 0x54, 0x1F, 0xFF, 0x75, 0xF0, 0x08, 0xEC, 0x90, -0x89, 0x00, 0x12, 0x48, 0x49, 0xE5, 0x82, 0x2F, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE0, -0xFB, 0x7A, 0x00, 0xE9, 0x54, 0x07, 0xFF, 0x74, 0x01, 0x7E, 0x00, 0xA8, 0x07, 0x08, 0x80, 0x05, -0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8, 0xF9, 0xFF, 0xEE, 0x5A, 0xFE, 0xEF, 0x5B, 0x4E, 0x70, 0x0A, -0x74, 0x98, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xA2, 0x80, 0x44, 0xED, 0x13, 0x13, 0x13, 0x54, 0x1F, -0xFF, 0x75, 0xF0, 0x08, 0xEC, 0x90, 0x89, 0x00, 0x12, 0x48, 0x49, 0xE5, 0x82, 0x2F, 0xF5, 0x82, -0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE0, 0xFB, 0x7A, 0x00, 0xED, 0x54, 0x07, 0xFF, 0x74, 0x01, 0x7E, -0x00, 0xA8, 0x07, 0x08, 0x80, 0x05, 0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8, 0xF9, 0xFF, 0xEE, 0x5A, -0xFE, 0xEF, 0x5B, 0x4E, 0x70, 0x0C, 0x74, 0x18, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xA3, 0xF5, 0x83, -0xE4, 0xF0, 0x22, 0x74, 0x81, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x94, 0xF5, 0x83, 0xE0, 0x54, 0xF0, -0xC4, 0x54, 0x0F, 0xFE, 0x75, 0xF0, 0x10, 0xEF, 0x90, 0x81, 0x05, 0x12, 0x48, 0x49, 0xE0, 0x54, -0x03, 0xFD, 0x75, 0xF0, 0x05, 0xEF, 0x90, 0x97, 0x97, 0x12, 0x48, 0x49, 0xE0, 0xFC, 0x74, 0x18, -0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xA2, 0xF5, 0x83, 0xE0, 0x54, 0x7F, 0xF5, 0x68, 0xD3, 0x94, 0x1B, -0x50, 0x61, 0xE5, 0x68, 0xC3, 0x94, 0x0C, 0x40, 0x5A, 0x0E, 0xEE, 0x94, 0x04, 0x40, 0x34, 0xE4, -0xFE, 0x74, 0x17, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x9C, 0xF5, 0x83, 0xE0, 0xFB, 0x74, 0x12, 0x2F, -0xF5, 0x82, 0xE4, 0x34, 0x95, 0xF5, 0x83, 0xEB, 0xF0, 0x74, 0x17, 0x2F, 0xF5, 0x82, 0xE4, 0x34, -0x9C, 0xF5, 0x83, 0xE0, 0x24, 0x3C, 0xFB, 0x74, 0x98, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x9C, 0xF5, -0x83, 0xEB, 0xF0, 0x74, 0x81, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x94, 0xF5, 0x83, 0xE0, 0x54, 0x0F, -0xFB, 0xEE, 0xC4, 0x54, 0xF0, 0x4B, 0xFE, 0x74, 0x81, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x94, 0xF5, -0x83, 0xEE, 0xF0, 0xE5, 0x68, 0xD3, 0x9C, 0x40, 0x02, 0x8C, 0x68, 0x90, 0xA6, 0xD4, 0xED, 0xF0, -0xE4, 0xFB, 0xAD, 0x68, 0x12, 0x53, 0xC8, 0xAF, 0x68, 0x22, 0x8F, 0x61, 0x74, 0x98, 0x2F, 0xF5, -0x82, 0xE4, 0x34, 0x9C, 0xF5, 0x83, 0xE4, 0xF0, 0x75, 0xF0, 0x05, 0xEF, 0x90, 0x97, 0x9B, 0x12, -0x48, 0x49, 0xE0, 0x54, 0x01, 0xFF, 0x75, 0xF0, 0x10, 0xE5, 0x61, 0x90, 0x81, 0x00, 0x12, 0x48, -0x49, 0xE0, 0xF5, 0x62, 0x54, 0x7F, 0x90, 0xA5, 0x82, 0xF0, 0x75, 0xF0, 0x05, 0xE5, 0x61, 0x90, -0x97, 0x98, 0x12, 0x48, 0x49, 0xE0, 0x90, 0xA5, 0x85, 0xF0, 0x75, 0xF0, 0x05, 0xE5, 0x61, 0x90, -0x97, 0x97, 0x12, 0x48, 0x49, 0xE0, 0xF9, 0x90, 0xA5, 0x86, 0xF0, 0x75, 0xF0, 0x10, 0xE5, 0x61, -0x90, 0x81, 0x05, 0x12, 0x48, 0x49, 0xE0, 0x54, 0x03, 0xF5, 0x63, 0x90, 0xA5, 0x82, 0xE0, 0xFE, -0x25, 0xE0, 0x24, 0x91, 0xF5, 0x82, 0xE4, 0x34, 0x43, 0xF5, 0x83, 0xE4, 0x93, 0xFA, 0x74, 0x01, -0x93, 0xFB, 0xE5, 0x61, 0x25, 0xE0, 0x24, 0x16, 0xF5, 0x82, 0xE4, 0x34, 0x96, 0xF5, 0x83, 0xEA, -0xF0, 0xA3, 0xEB, 0xF0, 0x74, 0x18, 0x25, 0x61, 0xF5, 0x82, 0xE4, 0x34, 0xA2, 0xF5, 0x83, 0xEE, -0xF0, 0x74, 0x18, 0x25, 0x61, 0xF5, 0x82, 0xE4, 0x34, 0xA2, 0xF5, 0x83, 0xE0, 0xF5, 0x64, 0x90, -0xA5, 0x82, 0xE0, 0xD3, 0x99, 0x40, 0x0A, 0x90, 0xA5, 0x86, 0xE0, 0x90, 0xA5, 0x82, 0xF0, 0xF5, -0x62, 0xED, 0x70, 0x03, 0x02, 0x78, 0x70, 0x90, 0xA5, 0x83, 0xED, 0xF0, 0xE5, 0x62, 0x30, 0xE7, -0x0A, 0x90, 0xA5, 0x82, 0xE0, 0xF5, 0x62, 0xA3, 0xE0, 0x14, 0xF0, 0x90, 0xA5, 0x83, 0xE0, 0xFE, -0x70, 0x03, 0x02, 0x78, 0x70, 0x90, 0xA5, 0x85, 0xE0, 0xFD, 0x90, 0xA5, 0x82, 0xE0, 0xD3, 0x9D, -0x50, 0x03, 0x02, 0x78, 0x6A, 0xE4, 0x90, 0xA5, 0x81, 0xF0, 0xE5, 0x64, 0xD3, 0x94, 0x1B, 0x50, -0x5D, 0xE5, 0x64, 0x94, 0x0C, 0x40, 0x57, 0xEF, 0x64, 0x01, 0x70, 0x52, 0xE5, 0x64, 0x24, 0xF4, -0xC3, 0x9E, 0x90, 0xA5, 0x84, 0xF0, 0xFD, 0xAF, 0x61, 0x12, 0x8A, 0x27, 0xAB, 0x63, 0xAD, 0x64, -0xAF, 0x61, 0x12, 0x89, 0x93, 0x8F, 0x62, 0x74, 0x81, 0x25, 0x61, 0xF5, 0x82, 0xE4, 0x34, 0x94, -0xF5, 0x83, 0xE0, 0x54, 0x04, 0xFF, 0xBF, 0x0C, 0x0B, 0x90, 0xA6, 0xD4, 0xE5, 0x63, 0xF0, 0x7B, -0x01, 0x02, 0x78, 0x78, 0x74, 0x81, 0x25, 0x61, 0xF5, 0x82, 0xE4, 0x34, 0x94, 0xF5, 0x83, 0xE0, -0x30, 0xE2, 0x0B, 0x90, 0xA6, 0xD4, 0xE5, 0x63, 0xF0, 0xE4, 0xFB, 0x02, 0x78, 0x78, 0x90, 0xA5, -0x82, 0xE0, 0x14, 0x90, 0xA5, 0x80, 0xF0, 0x90, 0xA5, 0x85, 0xE0, 0xFF, 0x90, 0xA5, 0x80, 0xE0, -0xFD, 0xC3, 0x9F, 0x40, 0x6B, 0xE0, 0xFF, 0x13, 0x13, 0x13, 0x54, 0x1F, 0xFE, 0x75, 0xF0, 0x08, -0xE5, 0x61, 0x90, 0x89, 0x00, 0x12, 0x48, 0x49, 0xE5, 0x82, 0x2E, 0xF5, 0x82, 0xE4, 0x35, 0x83, -0xF5, 0x83, 0xE0, 0xFB, 0x7A, 0x00, 0xEF, 0x54, 0x07, 0xFF, 0x74, 0x01, 0x7E, 0x00, 0xA8, 0x07, -0x08, 0x80, 0x05, 0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8, 0xF9, 0xFF, 0xEE, 0x5A, 0xFE, 0xEF, 0x5B, -0x4E, 0x60, 0x1F, 0x8D, 0x62, 0x90, 0xA5, 0x81, 0xE0, 0x04, 0xF0, 0x90, 0xA5, 0x83, 0xE0, 0xFF, -0x90, 0xA5, 0x81, 0xE0, 0x6F, 0x60, 0x19, 0x90, 0xA5, 0x85, 0xE0, 0xFF, 0xE5, 0x62, 0xD3, 0x9F, -0x40, 0x0E, 0x90, 0xA5, 0x80, 0xE0, 0x14, 0xF0, 0x80, 0x8D, 0x90, 0xA5, 0x85, 0xE0, 0xF5, 0x62, -0x90, 0xA6, 0xD4, 0xE5, 0x63, 0xF0, 0xE4, 0xFB, 0x12, 0x53, 0xC4, 0xAF, 0x62, 0x22, 0xE4, 0xF5, -0x51, 0x74, 0xAF, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0xA4, 0xF5, 0x83, 0xE0, 0x70, 0x03, 0x02, -0x81, 0x4C, 0x75, 0xF0, 0x05, 0xE5, 0x51, 0x90, 0x97, 0x9A, 0x12, 0x48, 0x49, 0xE0, 0xC4, 0x13, -0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x03, 0x02, 0x81, 0x4C, 0x74, 0x81, 0x25, 0x51, 0xF5, 0x82, -0xE4, 0x34, 0x94, 0xF5, 0x83, 0xE0, 0x54, 0xF8, 0xF0, 0x75, 0xF0, 0x05, 0xE5, 0x51, 0x90, 0x97, -0x99, 0x12, 0x48, 0x49, 0xE0, 0x54, 0x1F, 0x90, 0xA5, 0x7C, 0xF0, 0x75, 0xF0, 0x05, 0xE5, 0x51, -0x90, 0x97, 0x9A, 0x12, 0x48, 0x49, 0xE0, 0x13, 0x13, 0x54, 0x03, 0x90, 0xA5, 0x7D, 0xF0, 0xE5, -0x51, 0x25, 0xE0, 0x24, 0x01, 0xF5, 0x82, 0xE4, 0x34, 0x92, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, -0xD3, 0x94, 0x00, 0xEE, 0x94, 0x00, 0x50, 0x03, 0x02, 0x81, 0x4C, 0xE5, 0x51, 0x75, 0xF0, 0x0A, -0xA4, 0x24, 0x01, 0xF9, 0x74, 0x8D, 0x35, 0xF0, 0xFA, 0x7B, 0x01, 0x8B, 0x56, 0xF5, 0x57, 0x89, -0x58, 0xE5, 0x51, 0x25, 0xE0, 0x24, 0x01, 0xF5, 0x82, 0xE4, 0x34, 0x92, 0xF5, 0x83, 0xE0, 0xF5, -0x5B, 0xA3, 0xE0, 0xF5, 0x5C, 0x74, 0x97, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x9A, 0xF5, 0x83, -0xE0, 0xFF, 0x90, 0xA5, 0x73, 0xE4, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x07, 0xAB, -0xFF, 0xAE, 0xF0, 0x12, 0x07, 0x80, 0x2F, 0xFF, 0xE5, 0xF0, 0x3E, 0xFE, 0x90, 0x00, 0x04, 0x12, -0x07, 0xAB, 0x2F, 0xFF, 0xEE, 0x35, 0xF0, 0xFE, 0x90, 0x00, 0x06, 0x12, 0x07, 0xAB, 0x2F, 0xFF, -0xEE, 0x35, 0xF0, 0xFE, 0x90, 0x00, 0x08, 0x12, 0x07, 0xAB, 0x2F, 0xFF, 0xEE, 0x35, 0xF0, 0xFE, -0x90, 0xA5, 0x75, 0xF0, 0xA3, 0xEF, 0xF0, 0x12, 0x07, 0x80, 0xFD, 0xC3, 0xEF, 0x9D, 0xFF, 0xEE, -0x95, 0xF0, 0x90, 0xA5, 0x77, 0xF0, 0xA3, 0xEF, 0xF0, 0xE5, 0x51, 0xD3, 0x94, 0x01, 0x50, 0x4C, -0xAB, 0x56, 0x90, 0x00, 0x08, 0x12, 0x07, 0xAB, 0xFD, 0xE5, 0x5B, 0xC3, 0x13, 0xFE, 0xE5, 0x5C, -0x13, 0xFF, 0xC3, 0xED, 0x9F, 0xE5, 0xF0, 0x9E, 0x50, 0x08, 0x90, 0x95, 0x11, 0x74, 0x01, 0xF0, -0x80, 0x2A, 0x90, 0x00, 0x08, 0x12, 0x07, 0xAB, 0xFB, 0xAA, 0xF0, 0xE5, 0x5C, 0xAE, 0x5B, 0x78, -0x03, 0xCE, 0xC3, 0x13, 0xCE, 0x13, 0xD8, 0xF9, 0xFF, 0x7C, 0x00, 0x7D, 0x05, 0x12, 0x07, 0x03, -0xD3, 0xEB, 0x9F, 0xEA, 0x9E, 0x40, 0x05, 0xE4, 0x90, 0x95, 0x11, 0xF0, 0x75, 0xF0, 0x10, 0xE5, -0x51, 0x90, 0x81, 0x00, 0x12, 0x48, 0x49, 0xE0, 0x90, 0xA5, 0x72, 0xF0, 0x54, 0x7F, 0xF5, 0x52, -0x75, 0xF0, 0x05, 0xE5, 0x51, 0x90, 0x97, 0x97, 0x12, 0x48, 0x49, 0xE0, 0x90, 0xA5, 0x79, 0xF0, -0x74, 0x98, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0xA0, 0xF5, 0x83, 0xE0, 0xC3, 0x94, 0x05, 0x40, -0x02, 0xA1, 0x1C, 0x90, 0xA5, 0x79, 0xE0, 0xFF, 0xE5, 0x52, 0x9F, 0x40, 0x0D, 0x8F, 0x52, 0x90, -0xA5, 0x72, 0xE0, 0x54, 0x80, 0xFE, 0xF0, 0xEF, 0x4E, 0xF0, 0xE5, 0x52, 0x90, 0x41, 0xED, 0x93, -0xFF, 0x74, 0x17, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x9C, 0xF5, 0x83, 0xE0, 0xC3, 0x9F, 0xE5, -0x52, 0x40, 0x05, 0x90, 0x41, 0x45, 0x80, 0x03, 0x90, 0x41, 0x99, 0x93, 0xF5, 0x5D, 0xE5, 0x5D, -0x75, 0xF0, 0x06, 0xA4, 0x24, 0xA3, 0xF9, 0x74, 0x40, 0x35, 0xF0, 0x75, 0x53, 0xFF, 0xF5, 0x54, -0x89, 0x55, 0x90, 0xA5, 0x72, 0xE0, 0x90, 0x44, 0x99, 0x93, 0xFF, 0xD3, 0x90, 0xA5, 0x74, 0xE0, -0x9F, 0x90, 0xA5, 0x73, 0xE0, 0x94, 0x00, 0x40, 0x04, 0x7D, 0x01, 0x80, 0x42, 0x90, 0x04, 0xA9, -0xE5, 0x5C, 0xF0, 0xC3, 0x94, 0x0A, 0xE5, 0x5B, 0x94, 0x00, 0x50, 0x73, 0x90, 0x04, 0xA8, 0xE0, -0x04, 0xF0, 0xAB, 0x56, 0xAA, 0x57, 0xA9, 0x58, 0x90, 0x00, 0x06, 0x12, 0x07, 0xAB, 0xFF, 0xAE, -0xF0, 0x90, 0x00, 0x08, 0x12, 0x07, 0xAB, 0x2F, 0xFD, 0xE5, 0xF0, 0x3E, 0xFC, 0xE5, 0x5B, 0xC3, -0x13, 0xFE, 0xE5, 0x5C, 0x13, 0xFF, 0xD3, 0xED, 0x9F, 0xEC, 0x9E, 0x40, 0x0A, 0x7D, 0x02, 0xAF, -0x51, 0x12, 0x76, 0x9A, 0x02, 0x80, 0x50, 0xE5, 0x5C, 0xAE, 0x5B, 0x78, 0x02, 0xCE, 0xC3, 0x13, -0xCE, 0x13, 0xD8, 0xF9, 0xFD, 0xAC, 0x06, 0xE5, 0x5B, 0xC3, 0x13, 0xFE, 0xE5, 0x5C, 0x13, 0x2D, -0xFF, 0xEE, 0x3C, 0xFE, 0xAB, 0x56, 0xAA, 0x57, 0xA9, 0x58, 0x12, 0x07, 0x80, 0xD3, 0x9F, 0xE5, -0xF0, 0x9E, 0x50, 0x03, 0x02, 0x80, 0x50, 0xAF, 0x51, 0x12, 0x72, 0x0B, 0x02, 0x80, 0x50, 0xAB, -0x56, 0xAA, 0x57, 0xA9, 0x58, 0x90, 0x00, 0x08, 0x12, 0x07, 0xAB, 0xFB, 0xAA, 0xF0, 0xAE, 0x5B, -0xAF, 0x5C, 0x7C, 0x00, 0x7D, 0x03, 0x12, 0x07, 0x03, 0xEF, 0x78, 0x02, 0xCE, 0xC3, 0x13, 0xCE, -0x13, 0xD8, 0xF9, 0xFF, 0xD3, 0xEB, 0x9F, 0xEA, 0x9E, 0x40, 0x15, 0x90, 0x04, 0xA0, 0xE0, 0x04, -0xF0, 0x90, 0xA5, 0x7D, 0xE0, 0xFB, 0xAD, 0x52, 0xAF, 0x51, 0x12, 0x82, 0x5B, 0x02, 0x80, 0x50, -0xE5, 0x51, 0x25, 0xE0, 0x24, 0x16, 0xF5, 0x82, 0xE4, 0x34, 0x96, 0xF5, 0x83, 0xE0, 0xF5, 0x59, -0xA3, 0xE0, 0xF5, 0x5A, 0xD3, 0xE5, 0x5C, 0x94, 0xE8, 0xE5, 0x5B, 0x94, 0x03, 0x40, 0x08, 0x90, -0xA5, 0x7B, 0x74, 0x05, 0xF0, 0x80, 0x18, 0xD3, 0xE5, 0x5C, 0x94, 0x19, 0xE5, 0x5B, 0x94, 0x00, -0x40, 0x08, 0x90, 0xA5, 0x7B, 0x74, 0x02, 0xF0, 0x80, 0x05, 0xE4, 0x90, 0xA5, 0x7B, 0xF0, 0xE4, -0xF5, 0x60, 0xAB, 0x56, 0xAA, 0x57, 0xA9, 0x58, 0x75, 0xF0, 0x02, 0xE5, 0x60, 0xA4, 0xF5, 0x82, -0x85, 0xF0, 0x83, 0x12, 0x07, 0xAB, 0xFF, 0xAE, 0xF0, 0x90, 0xA5, 0x7B, 0xE0, 0xFD, 0xEF, 0xA8, -0x05, 0x08, 0x80, 0x05, 0xCE, 0xC3, 0x13, 0xCE, 0x13, 0xD8, 0xF9, 0xFF, 0xAB, 0x53, 0xAA, 0x54, -0xA9, 0x55, 0x85, 0x60, 0x82, 0x75, 0x83, 0x00, 0x12, 0x06, 0xA2, 0xFD, 0x7C, 0x00, 0x12, 0x07, -0x03, 0xEF, 0x25, 0x5A, 0xF5, 0x5A, 0xEE, 0x35, 0x59, 0xF5, 0x59, 0x05, 0x60, 0xE5, 0x60, 0xB4, -0x05, 0xB0, 0xAB, 0x53, 0xAA, 0x54, 0xA9, 0x55, 0x90, 0x00, 0x05, 0x12, 0x06, 0xA2, 0xFD, 0x7C, -0x00, 0x90, 0xA5, 0x7B, 0xE0, 0xFF, 0xE5, 0x5C, 0xAE, 0x5B, 0xA8, 0x07, 0x08, 0x80, 0x05, 0xCE, -0xC3, 0x13, 0xCE, 0x13, 0xD8, 0xF9, 0xFF, 0x12, 0x07, 0x03, 0xD3, 0xE5, 0x5A, 0x9F, 0xE5, 0x59, -0x9E, 0x40, 0x0C, 0xE5, 0x5A, 0x9F, 0xF5, 0x5A, 0xE5, 0x59, 0x9E, 0xF5, 0x59, 0x80, 0x05, 0xE4, -0xF5, 0x59, 0xF5, 0x5A, 0xE5, 0x51, 0x25, 0xE0, 0x24, 0x16, 0xF5, 0x82, 0xE4, 0x34, 0x96, 0xF5, -0x83, 0xE5, 0x59, 0xF0, 0xA3, 0xE5, 0x5A, 0xF0, 0xAE, 0x59, 0xFF, 0xE4, 0xFC, 0xFD, 0x75, 0xF0, -0x04, 0xE5, 0x52, 0x90, 0x42, 0x41, 0x12, 0x48, 0x49, 0x12, 0x48, 0x39, 0xC3, 0x12, 0x48, 0x00, -0x40, 0x02, 0x81, 0xF6, 0x74, 0x12, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x95, 0xF5, 0x83, 0xE0, -0xFF, 0x74, 0x17, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x9C, 0xF5, 0x83, 0xE0, 0xFE, 0xD3, 0x9F, -0x40, 0x03, 0xEE, 0x80, 0x1A, 0x74, 0x17, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x9C, 0xF5, 0x83, -0xE0, 0xFF, 0x74, 0x12, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x95, 0xF5, 0x83, 0xE0, 0xC3, 0x9F, -0x90, 0xA5, 0x7A, 0xF0, 0x90, 0xA5, 0x7A, 0xE0, 0xD3, 0x94, 0x04, 0x40, 0x04, 0x74, 0x98, 0x80, -0x21, 0x74, 0x98, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x9C, 0xF5, 0x83, 0xE0, 0xD3, 0x94, 0x01, -0x74, 0x98, 0x40, 0x0E, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x9C, 0xF5, 0x83, 0xE0, 0x14, 0xF0, -0x80, 0x0B, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x9C, 0xF5, 0x83, 0xE4, 0xF0, 0x75, 0xF0, 0x04, -0xE5, 0x52, 0x90, 0x42, 0x41, 0x12, 0x48, 0x49, 0x12, 0x48, 0x1D, 0xE5, 0x51, 0x25, 0xE0, 0x24, -0x16, 0xF5, 0x82, 0xE4, 0x34, 0x96, 0xF5, 0x83, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x74, 0x98, 0x25, -0x51, 0xF5, 0x82, 0xE4, 0x34, 0x9C, 0xF5, 0x83, 0xE0, 0x60, 0x03, 0x02, 0x80, 0x24, 0xAF, 0x51, -0x12, 0x72, 0x0B, 0x02, 0x80, 0x24, 0xE5, 0x52, 0x25, 0xE0, 0x24, 0x91, 0xF5, 0x82, 0xE4, 0x34, -0x43, 0xF5, 0x83, 0xD3, 0x74, 0x01, 0x93, 0x95, 0x5A, 0xE4, 0x93, 0x95, 0x59, 0x50, 0x03, 0x02, -0x80, 0x24, 0x7D, 0x01, 0xAF, 0x51, 0x12, 0x76, 0x9A, 0x02, 0x80, 0x24, 0x74, 0x98, 0x25, 0x51, -0xF5, 0x82, 0xE4, 0x34, 0xA0, 0xF5, 0x83, 0xE0, 0x64, 0x05, 0x60, 0x02, 0xC1, 0xBB, 0x7F, 0xC0, -0x7E, 0x0C, 0x12, 0x37, 0xAD, 0xEF, 0x54, 0x01, 0xFF, 0xEF, 0x64, 0x01, 0x70, 0x33, 0x74, 0x98, -0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0xA0, 0xF5, 0x83, 0xE4, 0xF0, 0x74, 0x98, 0x25, 0x51, 0xF5, -0x82, 0xE4, 0x34, 0x9D, 0xF5, 0x83, 0xE4, 0xF0, 0x7F, 0xC0, 0x7E, 0x0C, 0x12, 0x37, 0xAD, 0xE4, -0xFF, 0xE4, 0xFD, 0xFC, 0x78, 0x08, 0x12, 0x08, 0x47, 0x8F, 0x5F, 0x12, 0x81, 0x59, 0x02, 0x80, -0x50, 0xAD, 0x52, 0xAF, 0x51, 0x12, 0x82, 0x0A, 0x75, 0xF0, 0x10, 0xE5, 0x51, 0x90, 0x81, 0x01, -0x12, 0x48, 0x49, 0xE0, 0x54, 0x07, 0xF5, 0x5F, 0x74, 0x17, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, -0x9C, 0xF5, 0x83, 0xE0, 0xFE, 0xC3, 0x94, 0x30, 0x50, 0x11, 0xE4, 0xF5, 0x5F, 0x74, 0x98, 0x25, -0x51, 0xF5, 0x82, 0xE4, 0x34, 0xA0, 0xF5, 0x83, 0xE4, 0xC1, 0x3E, 0xEF, 0x64, 0x01, 0x60, 0x02, -0xC1, 0x67, 0x74, 0x98, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x9D, 0xF5, 0x83, 0xE0, 0x64, 0x0A, -0x60, 0x4D, 0xEE, 0x24, 0x05, 0xFF, 0xE4, 0x33, 0xFE, 0x74, 0x01, 0x25, 0x51, 0xF5, 0x82, 0xE4, -0x34, 0x94, 0xF5, 0x83, 0xE0, 0xFD, 0xD3, 0x9F, 0xEE, 0x64, 0x80, 0xF8, 0x74, 0x80, 0x98, 0x50, -0x2E, 0xED, 0x24, 0x05, 0xFF, 0xE4, 0x33, 0xFE, 0x74, 0x17, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, -0x9C, 0xF5, 0x83, 0xE0, 0xD3, 0x9F, 0xEE, 0x64, 0x80, 0xF8, 0x74, 0x80, 0x98, 0x50, 0x10, 0x74, -0x18, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0xA1, 0xF5, 0x83, 0xE0, 0x65, 0x52, 0x60, 0x3B, 0xE5, -0x5F, 0x70, 0x05, 0x75, 0x5F, 0x01, 0x80, 0x0D, 0xE5, 0x5F, 0xB4, 0x01, 0x05, 0x75, 0x5F, 0x03, -0x80, 0x03, 0x75, 0x5F, 0x05, 0x74, 0x17, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x9C, 0xF5, 0x83, -0xE0, 0xFF, 0x74, 0x01, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x94, 0xF5, 0x83, 0xEF, 0xF0, 0x74, -0x98, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x9D, 0x80, 0x29, 0x74, 0x98, 0x25, 0x51, 0xF5, 0x82, -0xE4, 0x34, 0xA0, 0xF5, 0x83, 0xE4, 0xF0, 0x74, 0x98, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x9D, -0xF5, 0x83, 0xE0, 0x04, 0xF0, 0x80, 0x10, 0xE4, 0xF5, 0x5F, 0x74, 0x98, 0x25, 0x51, 0xF5, 0x82, -0xE4, 0x34, 0xA0, 0xF5, 0x83, 0xE4, 0xF0, 0x74, 0x18, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0xA1, -0xF5, 0x83, 0xE5, 0x52, 0xF0, 0x75, 0xF0, 0x05, 0xE5, 0x51, 0x90, 0x97, 0x9A, 0x12, 0x48, 0x49, -0xE0, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x20, 0xE0, 0x03, 0x02, 0x80, 0x22, 0x74, 0x98, 0x25, 0x51, -0xF5, 0x82, 0xE4, 0x34, 0x9D, 0xF5, 0x83, 0xE4, 0xF0, 0xF5, 0x5F, 0x74, 0x98, 0x25, 0x51, 0xF5, -0x82, 0xE4, 0x34, 0xA0, 0xF5, 0x83, 0xE4, 0xF0, 0x02, 0x80, 0x22, 0x74, 0x98, 0x25, 0x51, 0xF5, -0x82, 0xE4, 0x34, 0xA0, 0xF5, 0x83, 0xE0, 0x64, 0x06, 0x60, 0x03, 0x02, 0x80, 0x24, 0xF5, 0x59, -0xF5, 0x5A, 0x75, 0xF0, 0x10, 0xE5, 0x51, 0x90, 0x81, 0x01, 0x12, 0x48, 0x49, 0xE0, 0x54, 0x07, -0xF5, 0x5F, 0xD3, 0xE5, 0x5C, 0x94, 0xE8, 0xE5, 0x5B, 0x94, 0x03, 0x40, 0x08, 0x90, 0xA5, 0x7B, -0x74, 0x05, 0xF0, 0x80, 0x18, 0xD3, 0xE5, 0x5C, 0x94, 0xFA, 0xE5, 0x5B, 0x94, 0x00, 0x40, 0x08, -0x90, 0xA5, 0x7B, 0x74, 0x02, 0xF0, 0x80, 0x05, 0xE4, 0x90, 0xA5, 0x7B, 0xF0, 0x90, 0xA5, 0x7B, -0xE0, 0xFF, 0xE5, 0x5C, 0xAE, 0x5B, 0xA8, 0x07, 0x08, 0x80, 0x05, 0xCE, 0xC3, 0x13, 0xCE, 0x13, -0xD8, 0xF9, 0xFF, 0x90, 0x44, 0xF2, 0xE4, 0x93, 0xFD, 0x7C, 0x00, 0x12, 0x07, 0x03, 0x90, 0xA5, -0x7E, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xE4, 0xF5, 0x5E, 0xAB, 0x56, 0xAA, 0x57, 0xA9, 0x58, 0x75, -0xF0, 0x02, 0xE5, 0x5E, 0xA4, 0xF5, 0x82, 0x85, 0xF0, 0x83, 0x12, 0x07, 0xAB, 0xFF, 0xAE, 0xF0, -0x90, 0xA5, 0x7B, 0xE0, 0xFD, 0xEF, 0xA8, 0x05, 0x08, 0x80, 0x05, 0xCE, 0xC3, 0x13, 0xCE, 0x13, -0xD8, 0xF9, 0xFF, 0xE5, 0x5E, 0x90, 0x44, 0xED, 0x93, 0xFD, 0x7C, 0x00, 0x12, 0x07, 0x03, 0xEF, -0x25, 0x5A, 0xF5, 0x5A, 0xEE, 0x35, 0x59, 0xF5, 0x59, 0xC3, 0x90, 0xA5, 0x7F, 0xE0, 0x95, 0x5A, -0x90, 0xA5, 0x7E, 0xE0, 0x95, 0x59, 0x40, 0x07, 0x05, 0x5E, 0xE5, 0x5E, 0xB4, 0x05, 0xAA, 0xE5, -0x5E, 0xC3, 0x13, 0xF5, 0x5E, 0xE5, 0x5F, 0x24, 0x01, 0xFF, 0xE4, 0x33, 0xA2, 0xE7, 0x13, 0xEF, -0x13, 0xFF, 0xD3, 0x95, 0x5E, 0x40, 0x06, 0xEF, 0x95, 0x5E, 0xFF, 0x80, 0x02, 0xE4, 0xFF, 0x74, -0x01, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x93, 0xF5, 0x83, 0xE0, 0xC3, 0x13, 0xFE, 0xEF, 0xC4, -0x33, 0x54, 0xE0, 0x2E, 0x04, 0xFE, 0x74, 0x01, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x93, 0xF5, -0x83, 0xEE, 0xF0, 0x74, 0x01, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x93, 0xF5, 0x83, 0xE0, 0xC3, -0x94, 0xC0, 0x40, 0x0E, 0x74, 0x01, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x93, 0xF5, 0x83, 0x74, -0xC0, 0xF0, 0x74, 0x01, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x93, 0xF5, 0x83, 0xE0, 0xC4, 0x13, -0x13, 0x54, 0x03, 0x25, 0xE0, 0xFF, 0x70, 0x04, 0xF5, 0x5F, 0x80, 0x04, 0xEF, 0x14, 0xF5, 0x5F, -0xD3, 0x90, 0xA5, 0x74, 0xE0, 0x94, 0x03, 0x90, 0xA5, 0x73, 0xE0, 0x94, 0x00, 0x40, 0x03, 0xE4, -0xF5, 0x5F, 0x31, 0x59, 0x74, 0x98, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0xA0, 0xF5, 0x83, 0xE0, -0xD3, 0x94, 0x05, 0x74, 0x98, 0x50, 0x0E, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0xA0, 0xF5, 0x83, -0xE0, 0x04, 0xF0, 0x80, 0x0B, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0xA0, 0xF5, 0x83, 0xE4, 0xF0, -0x74, 0x81, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x93, 0xF5, 0x83, 0xE0, 0x64, 0x01, 0x60, 0x02, -0x21, 0x46, 0x90, 0xA5, 0x73, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xC3, 0x74, 0xFF, 0x9F, 0xFD, 0x74, -0xFF, 0x9E, 0xFC, 0xE5, 0x51, 0x25, 0xE0, 0x24, 0x98, 0xF5, 0x82, 0xE4, 0x34, 0x9E, 0xF5, 0x83, -0xE0, 0xFA, 0xA3, 0xE0, 0xD3, 0x9D, 0xEA, 0x9C, 0xE5, 0x51, 0x50, 0x13, 0x25, 0xE0, 0x24, 0x98, -0xF5, 0x82, 0xE4, 0x34, 0x9E, 0xF5, 0x83, 0xEE, 0x8F, 0xF0, 0x12, 0x08, 0xD6, 0x80, 0x10, 0x25, -0xE0, 0x24, 0x98, 0xF5, 0x82, 0xE4, 0x34, 0x9E, 0xF5, 0x83, 0x74, 0xFF, 0xF0, 0xA3, 0xF0, 0x90, -0xA5, 0x75, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xC3, 0x74, 0xFF, 0x9F, 0xFD, 0x74, 0xFF, 0x9E, 0xFC, -0xE5, 0x51, 0x25, 0xE0, 0x24, 0x98, 0xF5, 0x82, 0xE4, 0x34, 0x9F, 0xF5, 0x83, 0xE0, 0xFA, 0xA3, -0xE0, 0xD3, 0x9D, 0xEA, 0x9C, 0xE5, 0x51, 0x50, 0x13, 0x25, 0xE0, 0x24, 0x98, 0xF5, 0x82, 0xE4, -0x34, 0x9F, 0xF5, 0x83, 0xEE, 0x8F, 0xF0, 0x12, 0x08, 0xD6, 0x80, 0x10, 0x25, 0xE0, 0x24, 0x98, -0xF5, 0x82, 0xE4, 0x34, 0x9F, 0xF5, 0x83, 0x74, 0xFF, 0xF0, 0xA3, 0xF0, 0x90, 0xA5, 0x77, 0xE0, -0xFE, 0xA3, 0xE0, 0xFB, 0xC3, 0x74, 0xFF, 0x9B, 0xFF, 0x74, 0xFF, 0x9E, 0xFE, 0x74, 0xFF, 0x94, -0x00, 0xFD, 0x74, 0xFF, 0x94, 0x00, 0xFC, 0x90, 0x95, 0x92, 0x12, 0x48, 0x2D, 0xD3, 0x12, 0x48, -0x00, 0x90, 0x95, 0x92, 0x50, 0x19, 0x12, 0x48, 0x2D, 0x90, 0xA5, 0x77, 0xE0, 0xFE, 0xA3, 0xE0, -0xFF, 0xE4, 0xFC, 0xFD, 0x12, 0x47, 0xD9, 0x90, 0x95, 0x92, 0x12, 0x08, 0x6D, 0x80, 0x07, 0x12, -0x08, 0x79, 0xFF, 0xFF, 0xFF, 0xFF, 0xE4, 0xFD, 0xAF, 0x51, 0x31, 0x7D, 0x05, 0x51, 0xE5, 0x51, -0xC3, 0x94, 0x80, 0x50, 0x03, 0x02, 0x78, 0x81, 0x22, 0xAD, 0x5F, 0xAF, 0x51, 0x75, 0xF0, 0x10, -0xEF, 0x90, 0x81, 0x01, 0x12, 0x48, 0x49, 0xE0, 0x54, 0xF8, 0xF5, 0x61, 0xED, 0x42, 0x61, 0x75, -0xF0, 0x10, 0xEF, 0x90, 0x81, 0x01, 0x12, 0x48, 0x49, 0xE5, 0x61, 0xF0, 0x22, 0xD3, 0x10, 0xAF, -0x01, 0xC3, 0xC0, 0xD0, 0xED, 0x60, 0x62, 0x75, 0xF0, 0x0A, 0xEF, 0x90, 0x8D, 0x01, 0x12, 0x48, -0x49, 0xE4, 0xF0, 0xA3, 0xF0, 0x75, 0xF0, 0x0A, 0xEF, 0x90, 0x8D, 0x03, 0x12, 0x48, 0x49, 0xE4, -0xF0, 0xA3, 0xF0, 0x75, 0xF0, 0x0A, 0xEF, 0x90, 0x8D, 0x05, 0x12, 0x48, 0x49, 0xE4, 0xF0, 0xA3, -0xF0, 0x75, 0xF0, 0x0A, 0xEF, 0x90, 0x8D, 0x07, 0x12, 0x48, 0x49, 0xE4, 0xF0, 0xA3, 0xF0, 0x75, -0xF0, 0x0A, 0xEF, 0x90, 0x8D, 0x09, 0x12, 0x48, 0x49, 0xE4, 0xF0, 0xA3, 0xF0, 0xEF, 0x25, 0xE0, -0x24, 0x01, 0xF5, 0x82, 0xE4, 0x34, 0x92, 0xF5, 0x83, 0xE4, 0xF0, 0xA3, 0xF0, 0x74, 0x97, 0x2F, -0xF5, 0x82, 0xE4, 0x34, 0x9A, 0xF5, 0x83, 0xE4, 0xF0, 0x75, 0xF0, 0x10, 0xEF, 0x90, 0x81, 0x03, -0x12, 0x48, 0x49, 0xE0, 0x54, 0xBF, 0x44, 0x80, 0xFE, 0x75, 0xF0, 0x10, 0xEF, 0x90, 0x81, 0x03, -0x12, 0x48, 0x49, 0xEE, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xE4, 0xF5, 0x61, 0x74, 0x17, 0x2F, -0xF5, 0x82, 0xE4, 0x34, 0x97, 0xF5, 0x83, 0xE0, 0xFE, 0xB4, 0x03, 0x08, 0xED, 0xC3, 0x94, 0x19, -0x40, 0x36, 0x80, 0x2C, 0xEE, 0xB4, 0x02, 0x08, 0xED, 0xC3, 0x94, 0x11, 0x40, 0x2A, 0x80, 0x20, -0x74, 0x17, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x97, 0xF5, 0x83, 0xE0, 0xFE, 0xB4, 0x01, 0x08, 0xED, -0xC3, 0x94, 0x0A, 0x40, 0x13, 0x80, 0x09, 0xEE, 0x70, 0x0B, 0xED, 0xC3, 0x94, 0x03, 0x40, 0x08, -0x75, 0x61, 0x01, 0x80, 0x03, 0xE4, 0xF5, 0x61, 0xAF, 0x61, 0x22, 0x90, 0xA5, 0x80, 0xEF, 0xF0, -0x90, 0xA5, 0x82, 0xEB, 0xF0, 0x90, 0xA5, 0x81, 0xED, 0xF0, 0xC3, 0x94, 0x19, 0x40, 0x19, 0xE0, -0xD3, 0x94, 0x1B, 0x50, 0x13, 0x90, 0xA5, 0x80, 0xE0, 0xFF, 0x90, 0xA5, 0x82, 0xE0, 0x90, 0xA6, -0xD4, 0xF0, 0xE4, 0xFB, 0x7D, 0x17, 0x61, 0x30, 0x90, 0xA5, 0x81, 0xE0, 0xFF, 0xC3, 0x94, 0x11, -0x40, 0x19, 0xEF, 0xD3, 0x94, 0x13, 0x50, 0x13, 0x90, 0xA5, 0x80, 0xE0, 0xFF, 0x90, 0xA5, 0x82, -0xE0, 0x90, 0xA6, 0xD4, 0xF0, 0xE4, 0xFB, 0x7D, 0x0F, 0x61, 0x30, 0x90, 0xA5, 0x81, 0xE0, 0xFF, -0xC3, 0x94, 0x0A, 0x40, 0x19, 0xEF, 0xD3, 0x94, 0x0B, 0x50, 0x13, 0x90, 0xA5, 0x80, 0xE0, 0xFF, -0x90, 0xA5, 0x82, 0xE0, 0x90, 0xA6, 0xD4, 0xF0, 0xE4, 0xFB, 0x7D, 0x08, 0x80, 0x62, 0x90, 0xA5, -0x81, 0xE0, 0xFF, 0xC3, 0x94, 0x17, 0x40, 0x06, 0xEF, 0xD3, 0x94, 0x18, 0x40, 0x0C, 0xEF, 0xC3, -0x94, 0x0F, 0x40, 0x19, 0xEF, 0xD3, 0x94, 0x10, 0x50, 0x13, 0x90, 0xA5, 0x80, 0xE0, 0xFF, 0x90, -0xA5, 0x82, 0xE0, 0x90, 0xA6, 0xD4, 0xF0, 0xE4, 0xFB, 0x7D, 0x0C, 0x80, 0x33, 0x90, 0xA5, 0x81, -0xE0, 0xFF, 0xC3, 0x94, 0x08, 0x40, 0x19, 0xEF, 0xD3, 0x94, 0x09, 0x50, 0x13, 0x90, 0xA5, 0x80, -0xE0, 0xFF, 0x90, 0xA5, 0x82, 0xE0, 0x90, 0xA6, 0xD4, 0xF0, 0xE4, 0xFB, 0x7D, 0x04, 0x80, 0x10, -0x90, 0xA5, 0x80, 0xE0, 0xFF, 0x90, 0xA5, 0x82, 0xE0, 0x90, 0xA6, 0xD4, 0xF0, 0xE4, 0xFB, 0xFD, -0x12, 0x53, 0xC8, 0x7F, 0x00, 0x22, 0xEF, 0xD3, 0x94, 0x01, 0x40, 0x03, 0x7F, 0x00, 0x22, 0x75, -0xF0, 0x05, 0xEF, 0x90, 0x97, 0x9A, 0x12, 0x48, 0x49, 0xE0, 0xC4, 0x54, 0x03, 0x60, 0x02, 0x81, -0xC6, 0xED, 0xC3, 0x94, 0x14, 0x50, 0x02, 0x81, 0x1C, 0xED, 0xD3, 0x94, 0x18, 0x40, 0x02, 0x81, -0x1C, 0x90, 0x95, 0x11, 0xE0, 0x64, 0x01, 0x70, 0x57, 0xED, 0xB4, 0x18, 0x0F, 0x90, 0x04, 0x32, -0xE4, 0xF0, 0xA3, 0xF0, 0xA3, 0x04, 0xF0, 0xA3, 0x74, 0x05, 0x81, 0x70, 0xED, 0xB4, 0x17, 0x0C, -0x90, 0x04, 0x32, 0xE4, 0xF0, 0xA3, 0xF0, 0xA3, 0x74, 0x05, 0x80, 0x0E, 0xED, 0xB4, 0x16, 0x0F, -0x90, 0x04, 0x32, 0xE4, 0xF0, 0xA3, 0xF0, 0xA3, 0x74, 0x06, 0xF0, 0xA3, 0x04, 0x80, 0x19, 0xED, -0x90, 0x04, 0x32, 0xB4, 0x15, 0x09, 0xE4, 0xF0, 0xA3, 0xF0, 0xA3, 0x74, 0x07, 0x80, 0x07, 0xE4, -0xF0, 0xA3, 0xF0, 0xA3, 0x74, 0x08, 0xF0, 0xA3, 0xF0, 0xA3, 0x04, 0xF0, 0xA3, 0xF0, 0x81, 0xC6, -0xED, 0xB4, 0x18, 0x11, 0x90, 0x04, 0x32, 0x74, 0x01, 0xF0, 0xA3, 0x74, 0x05, 0xF0, 0xA3, 0x04, -0xF0, 0xA3, 0x04, 0x81, 0x70, 0xED, 0xB4, 0x17, 0x07, 0x90, 0x04, 0x32, 0x74, 0x05, 0x80, 0x09, -0xED, 0xB4, 0x16, 0x12, 0x90, 0x04, 0x32, 0x74, 0x06, 0xF0, 0xA3, 0x04, 0xF0, 0xA3, 0x04, 0xF0, -0xA3, 0x04, 0xF0, 0xA3, 0x81, 0xC2, 0xED, 0x90, 0x04, 0x32, 0xB4, 0x15, 0x0E, 0x74, 0x07, 0xF0, -0xA3, 0xF0, 0xA3, 0x04, 0xF0, 0xA3, 0xF0, 0xA3, 0x04, 0x81, 0xC2, 0x74, 0x08, 0xF0, 0xA3, 0xF0, -0xA3, 0x04, 0xF0, 0xA3, 0xF0, 0xA3, 0x04, 0xF0, 0x04, 0xF0, 0x81, 0xC6, 0x90, 0x95, 0x11, 0xE0, -0x64, 0x01, 0x70, 0x51, 0xED, 0xB4, 0x1B, 0x12, 0x90, 0x04, 0x32, 0xE4, 0xF0, 0xA3, 0xF0, 0xA3, -0x74, 0x02, 0xF0, 0xA3, 0x04, 0xF0, 0xA3, 0x04, 0x81, 0xC2, 0xED, 0xB4, 0x1A, 0x13, 0x90, 0x04, -0x32, 0xE4, 0xF0, 0xA3, 0xF0, 0xA3, 0x74, 0x02, 0xF0, 0xA3, 0x04, 0xF0, 0xA3, 0x74, 0x05, 0x80, -0x71, 0xED, 0x90, 0x04, 0x32, 0xB4, 0x19, 0x0D, 0xE4, 0xF0, 0xA3, 0xF0, 0xA3, 0x74, 0x02, 0xF0, -0xA3, 0x74, 0x05, 0x80, 0x0B, 0xE4, 0xF0, 0xA3, 0xF0, 0xA3, 0x74, 0x02, 0xF0, 0xA3, 0x74, 0x04, -0xF0, 0xA3, 0x04, 0x80, 0x4D, 0xED, 0xB4, 0x1B, 0x13, 0x90, 0x04, 0x32, 0x74, 0x02, 0xF0, 0xA3, -0x04, 0xF0, 0xA3, 0x04, 0xF0, 0xA3, 0x04, 0xF0, 0xA3, 0x04, 0x80, 0x36, 0xED, 0xB4, 0x1A, 0x14, -0x90, 0x04, 0x32, 0x74, 0x02, 0xF0, 0xA3, 0x04, 0xF0, 0xA3, 0x74, 0x05, 0xF0, 0xA3, 0x04, 0xF0, -0xA3, 0x04, 0x80, 0x1E, 0xED, 0x90, 0x04, 0x32, 0xB4, 0x19, 0x08, 0x74, 0x02, 0xF0, 0xA3, 0x74, -0x05, 0x80, 0x06, 0x74, 0x02, 0xF0, 0xA3, 0x74, 0x04, 0xF0, 0xA3, 0x04, 0xF0, 0xA3, 0x04, 0xF0, -0xA3, 0x04, 0xF0, 0xA3, 0x04, 0xF0, 0x7F, 0x00, 0x22, 0x8F, 0x52, 0x75, 0xF0, 0x05, 0xEF, 0x90, -0x97, 0x9A, 0x12, 0x48, 0x49, 0xE0, 0x13, 0x13, 0x54, 0x03, 0xFF, 0x74, 0x17, 0x25, 0x52, 0xF5, -0x82, 0xE4, 0x34, 0x9C, 0xF5, 0x83, 0xE0, 0xFE, 0xD3, 0x94, 0x32, 0x40, 0x2C, 0x75, 0xF0, 0x05, -0xE5, 0x52, 0x90, 0x97, 0x97, 0x12, 0x48, 0x49, 0xE0, 0xF5, 0x54, 0x75, 0xF0, 0x05, 0xE5, 0x52, -0x90, 0x97, 0x99, 0x12, 0x48, 0x49, 0xE0, 0xFC, 0xC4, 0x13, 0x54, 0x07, 0x20, 0xE0, 0x02, 0xA1, -0x94, 0xE5, 0x54, 0x44, 0x80, 0xF5, 0x53, 0x80, 0x7B, 0xEE, 0xD3, 0x94, 0x1E, 0x40, 0x2F, 0xED, -0x12, 0x48, 0x67, 0x85, 0x3F, 0x00, 0x85, 0x44, 0x01, 0x85, 0x3F, 0x02, 0x85, 0x44, 0x03, 0x85, -0x3F, 0x04, 0x85, 0x44, 0x05, 0x85, 0x49, 0x06, 0x85, 0x49, 0x07, 0x00, 0x00, 0x85, 0x94, 0x75, -0x54, 0x17, 0x80, 0x4D, 0x75, 0x54, 0x10, 0x80, 0x48, 0x75, 0x54, 0x08, 0x80, 0x43, 0x74, 0x17, -0x25, 0x52, 0xF5, 0x82, 0xE4, 0x34, 0x9C, 0xF5, 0x83, 0xE0, 0xD3, 0x94, 0x0A, 0x40, 0x2F, 0xED, -0x12, 0x48, 0x67, 0x85, 0x7F, 0x00, 0x85, 0x84, 0x01, 0x85, 0x7F, 0x02, 0x85, 0x84, 0x03, 0x85, -0x7F, 0x04, 0x85, 0x84, 0x05, 0x85, 0x89, 0x06, 0x85, 0x89, 0x07, 0x00, 0x00, 0x85, 0x94, 0x75, -0x54, 0x14, 0x80, 0x0D, 0x75, 0x54, 0x0C, 0x80, 0x08, 0x75, 0x54, 0x04, 0x80, 0x03, 0xE4, 0xF5, -0x54, 0x85, 0x54, 0x53, 0x90, 0x04, 0xA5, 0xE5, 0x53, 0xF0, 0x90, 0xA6, 0xD4, 0xEF, 0xF0, 0xE4, -0xFB, 0xAD, 0x53, 0xAF, 0x52, 0x12, 0x53, 0xC8, 0x74, 0x96, 0x25, 0x52, 0xF5, 0x82, 0xE4, 0x34, -0x95, 0xF5, 0x83, 0xE0, 0xB5, 0x53, 0x10, 0x74, 0x98, 0x25, 0x52, 0xF5, 0x82, 0xE4, 0x34, 0xA1, -0xF5, 0x83, 0xE0, 0x04, 0xF0, 0x80, 0x1B, 0x74, 0x96, 0x25, 0x52, 0xF5, 0x82, 0xE4, 0x34, 0x95, -0xF5, 0x83, 0xE5, 0x53, 0xF0, 0x74, 0x98, 0x25, 0x52, 0xF5, 0x82, 0xE4, 0x34, 0xA1, 0xF5, 0x83, -0xE4, 0xF0, 0x74, 0x98, 0x25, 0x52, 0xF5, 0x82, 0xE4, 0x34, 0xA1, 0xF5, 0x83, 0xE0, 0xB4, 0x02, -0x1B, 0x74, 0x17, 0x25, 0x52, 0xF5, 0x82, 0xE4, 0x34, 0x9A, 0xF5, 0x83, 0x74, 0x0A, 0xF0, 0x74, -0x98, 0x25, 0x52, 0xF5, 0x82, 0xE4, 0x34, 0xA1, 0xF5, 0x83, 0xE4, 0xF0, 0x22, 0x90, 0xA5, 0x76, -0x12, 0x48, 0x5E, 0x12, 0x06, 0x89, 0xF5, 0x51, 0x24, 0x97, 0xF5, 0x82, 0xE4, 0x34, 0x9B, 0xF5, -0x83, 0xE0, 0x54, 0x9C, 0xF0, 0x74, 0x97, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x9B, 0xF5, 0x83, -0xC0, 0x83, 0xC0, 0x82, 0xE0, 0xFF, 0x90, 0xA5, 0x76, 0x12, 0x48, 0x55, 0x90, 0x00, 0x03, 0x12, -0x06, 0xA2, 0x54, 0x01, 0xFE, 0xEF, 0x4E, 0xD0, 0x82, 0xD0, 0x83, 0xF0, 0x74, 0x97, 0x25, 0x51, -0xF5, 0x82, 0xE4, 0x34, 0x9B, 0xF5, 0x83, 0xC0, 0x83, 0xC0, 0x82, 0xE0, 0xFF, 0x90, 0xA5, 0x76, -0x12, 0x48, 0x55, 0x90, 0x00, 0x03, 0x12, 0x06, 0xA2, 0x54, 0x02, 0xFE, 0xEF, 0x4E, 0xD0, 0x82, -0xD0, 0x83, 0xF0, 0x74, 0x97, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x9B, 0xF5, 0x83, 0xC0, 0x83, -0xC0, 0x82, 0xE0, 0xFF, 0x90, 0xA5, 0x76, 0x12, 0x48, 0x55, 0x90, 0x00, 0x03, 0x12, 0x06, 0xA2, -0x54, 0x20, 0xFE, 0xEF, 0x4E, 0xD0, 0x82, 0xD0, 0x83, 0xF0, 0x74, 0x97, 0x25, 0x51, 0xF5, 0x82, -0xE4, 0x34, 0x9B, 0xF5, 0x83, 0xC0, 0x83, 0xC0, 0x82, 0xE0, 0xFF, 0x90, 0xA5, 0x76, 0x12, 0x48, -0x55, 0x90, 0x00, 0x03, 0x12, 0x06, 0xA2, 0x54, 0x40, 0xFE, 0xEF, 0x4E, 0xD0, 0x82, 0xD0, 0x83, -0xF0, 0x74, 0x97, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x9B, 0xF5, 0x83, 0xE0, 0xFF, 0x54, 0x20, -0xC4, 0x13, 0x54, 0x07, 0xFE, 0x75, 0xF0, 0x05, 0xE5, 0x51, 0x90, 0x97, 0x99, 0x12, 0x48, 0x49, -0xE0, 0x54, 0x1F, 0xFD, 0x90, 0x04, 0xA4, 0xEF, 0xF0, 0xE5, 0x51, 0xC3, 0x94, 0x80, 0x50, 0x16, -0x90, 0x00, 0x02, 0x12, 0x06, 0xA2, 0xFF, 0x74, 0x17, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x9C, -0xF5, 0x83, 0xEF, 0xF0, 0x80, 0x0F, 0xE5, 0x51, 0xB4, 0x80, 0x0A, 0x90, 0x00, 0x02, 0x12, 0x06, -0xA2, 0x90, 0x97, 0x16, 0xF0, 0xEE, 0x60, 0x04, 0xAF, 0x51, 0x91, 0xC9, 0x22, 0xD3, 0x10, 0xAF, -0x01, 0xC3, 0xC0, 0xD0, 0x90, 0xA6, 0xFE, 0xEF, 0xF0, 0x75, 0xF0, 0x05, 0x90, 0x97, 0x99, 0x12, -0x48, 0x49, 0xE0, 0x54, 0x1F, 0xFF, 0x24, 0xF7, 0x50, 0x02, 0x80, 0x5B, 0xE4, 0xF5, 0x69, 0x90, -0xA6, 0xFE, 0xE0, 0xFD, 0x75, 0xF0, 0x08, 0x90, 0x89, 0x00, 0x12, 0x48, 0x49, 0xE5, 0x82, 0x25, -0x69, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE0, 0xFE, 0xEF, 0x75, 0xF0, 0x07, 0xA4, 0x24, -0x56, 0xF5, 0x82, 0xE4, 0x34, 0x40, 0xF5, 0x83, 0xE5, 0x82, 0x25, 0x69, 0xF5, 0x82, 0xE4, 0x35, -0x83, 0xF5, 0x83, 0xE4, 0x93, 0xFC, 0xEE, 0x5C, 0xFE, 0x75, 0xF0, 0x08, 0xED, 0x90, 0x89, 0x00, -0x12, 0x48, 0x49, 0xE5, 0x82, 0x25, 0x69, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xEE, 0xF0, -0x05, 0x69, 0xE5, 0x69, 0xB4, 0x08, 0xA8, 0xE4, 0x90, 0xA6, 0xFF, 0xF0, 0x75, 0x6A, 0x06, 0xE5, -0x6A, 0xB4, 0x06, 0x1D, 0xFF, 0x90, 0xA6, 0xFE, 0xE0, 0x75, 0xF0, 0x08, 0x90, 0x89, 0x00, 0x12, -0x48, 0x49, 0xE5, 0x82, 0x2F, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE0, 0x54, 0x0F, 0x80, -0x19, 0x90, 0xA6, 0xFE, 0xE0, 0x75, 0xF0, 0x08, 0x90, 0x89, 0x00, 0x12, 0x48, 0x49, 0xE5, 0x82, -0x25, 0x6A, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE0, 0x90, 0xA7, 0x00, 0xF0, 0x90, 0xA7, -0x00, 0xE0, 0x60, 0x34, 0x75, 0x69, 0x07, 0x74, 0x01, 0x7E, 0x00, 0xA8, 0x69, 0x08, 0x80, 0x05, -0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8, 0xF9, 0xFF, 0x90, 0xA7, 0x00, 0xE0, 0xFD, 0xEF, 0x5D, 0x60, -0x0E, 0xE5, 0x6A, 0x75, 0xF0, 0x08, 0xA4, 0x25, 0x69, 0x90, 0xA6, 0xFF, 0xF0, 0x80, 0x19, 0x15, -0x69, 0xE5, 0x69, 0xC3, 0x94, 0x00, 0x50, 0xCF, 0xE5, 0x6A, 0x60, 0x0C, 0x15, 0x6A, 0xE5, 0x6A, -0xC3, 0x94, 0x00, 0x40, 0x03, 0x02, 0x87, 0x9F, 0xE4, 0xFD, 0xF5, 0x6A, 0xE5, 0x6A, 0xB4, 0x06, -0x1D, 0xFF, 0x90, 0xA6, 0xFE, 0xE0, 0x75, 0xF0, 0x08, 0x90, 0x89, 0x00, 0x12, 0x48, 0x49, 0xE5, -0x82, 0x2F, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE0, 0x54, 0x0F, 0x80, 0x19, 0x90, 0xA6, -0xFE, 0xE0, 0x75, 0xF0, 0x08, 0x90, 0x89, 0x00, 0x12, 0x48, 0x49, 0xE5, 0x82, 0x25, 0x6A, 0xF5, -0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE0, 0x90, 0xA7, 0x00, 0xF0, 0x90, 0xA7, 0x00, 0xE0, 0x60, -0x2F, 0xE4, 0xF5, 0x69, 0x74, 0x01, 0x7E, 0x00, 0xA8, 0x69, 0x08, 0x80, 0x05, 0xC3, 0x33, 0xCE, -0x33, 0xCE, 0xD8, 0xF9, 0xFF, 0x90, 0xA7, 0x00, 0xE0, 0xFB, 0xEF, 0x5B, 0x60, 0x0B, 0xE5, 0x6A, -0x75, 0xF0, 0x08, 0xA4, 0x25, 0x69, 0xFD, 0x80, 0x0F, 0x05, 0x69, 0xE5, 0x69, 0xB4, 0x08, 0xD4, -0x05, 0x6A, 0xE5, 0x6A, 0x64, 0x07, 0x70, 0x84, 0x90, 0xA6, 0xFF, 0xE0, 0xFE, 0x90, 0xA6, 0xFE, -0xE0, 0xFB, 0x75, 0xF0, 0x05, 0x90, 0x97, 0x97, 0x12, 0x48, 0x49, 0xEE, 0xF0, 0x75, 0xF0, 0x05, -0xEB, 0x90, 0x97, 0x98, 0x12, 0x48, 0x49, 0xED, 0xF0, 0x75, 0xF0, 0x10, 0xEB, 0x90, 0x81, 0x00, -0x12, 0x48, 0x49, 0xE0, 0xFC, 0x54, 0x7F, 0xF5, 0x6B, 0xEC, 0x54, 0x80, 0xF5, 0x6C, 0xE5, 0x6B, -0xD3, 0x9E, 0x40, 0x0A, 0x90, 0xA6, 0xFF, 0xE0, 0x45, 0x6C, 0xF5, 0x6B, 0x80, 0x0B, 0xE5, 0x6B, -0xC3, 0x9D, 0x50, 0x05, 0xE5, 0x6C, 0x4D, 0xF5, 0x6B, 0x90, 0xA6, 0xFE, 0xE0, 0xFE, 0x24, 0x18, -0xF5, 0x82, 0xE4, 0x34, 0xA1, 0xF5, 0x83, 0xE5, 0x6B, 0xF0, 0x75, 0xF0, 0x05, 0xEE, 0x90, 0x97, -0x9A, 0x12, 0x48, 0x49, 0xE0, 0xFE, 0x13, 0x13, 0x54, 0x03, 0x90, 0xA6, 0xD4, 0xF0, 0xAF, 0x03, -0xE4, 0xFB, 0xAD, 0x6B, 0x12, 0x53, 0xC8, 0x90, 0xA6, 0xFE, 0xE0, 0xFF, 0x75, 0xF0, 0x10, 0x90, -0x81, 0x03, 0x12, 0x48, 0x49, 0xE4, 0xF0, 0x90, 0xA6, 0xFF, 0xE0, 0xFE, 0xC3, 0x94, 0x14, 0x40, -0x0F, 0x74, 0x17, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x97, 0xF5, 0x83, 0x74, 0x03, 0xF0, 0x80, 0x3E, -0xEE, 0xD3, 0x94, 0x0C, 0x40, 0x12, 0x90, 0xA6, 0xFE, 0xE0, 0x24, 0x17, 0xF5, 0x82, 0xE4, 0x34, -0x97, 0xF5, 0x83, 0x74, 0x02, 0xF0, 0x80, 0x26, 0x90, 0xA6, 0xFF, 0xE0, 0xC3, 0x94, 0x04, 0x90, -0xA6, 0xFE, 0xE0, 0x40, 0x0E, 0x24, 0x17, 0xF5, 0x82, 0xE4, 0x34, 0x97, 0xF5, 0x83, 0x74, 0x01, -0xF0, 0x80, 0x0B, 0x24, 0x17, 0xF5, 0x82, 0xE4, 0x34, 0x97, 0xF5, 0x83, 0xE4, 0xF0, 0xD0, 0xD0, -0x92, 0xAF, 0x22, 0x90, 0xA5, 0x87, 0xEB, 0xF0, 0x74, 0x81, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x94, -0xF5, 0x83, 0xE0, 0x54, 0xFB, 0xF0, 0x74, 0x18, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x9D, 0xF5, 0x83, -0xE0, 0xFB, 0x60, 0x2F, 0x74, 0x18, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x9E, 0xF5, 0x83, 0xE0, 0x60, -0x22, 0xAE, 0x03, 0xAC, 0x06, 0x74, 0x81, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x94, 0xF5, 0x83, 0xE0, -0x54, 0xFB, 0x44, 0x04, 0xFD, 0x74, 0x81, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x94, 0xF5, 0x83, 0xED, -0xF0, 0x80, 0x41, 0x74, 0x18, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x9D, 0xF5, 0x83, 0xE0, 0x70, 0x10, -0x74, 0x18, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x9E, 0xF5, 0x83, 0xE0, 0x60, 0x03, 0xFC, 0x80, 0x24, -0x74, 0x18, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x9D, 0xF5, 0x83, 0xE0, 0xFB, 0x60, 0x13, 0x74, 0x18, -0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x9E, 0xF5, 0x83, 0xE0, 0x70, 0x06, 0xAE, 0x03, 0xAC, 0x06, 0x80, -0x03, 0xAF, 0x05, 0x22, 0xAF, 0x04, 0x22, 0xAC, 0x07, 0x74, 0x97, 0x2C, 0xF5, 0x82, 0xE4, 0x34, -0x9B, 0xF5, 0x83, 0xE0, 0xFF, 0x54, 0x02, 0xC3, 0x13, 0xFE, 0xEF, 0x54, 0x40, 0xC4, 0x13, 0x13, -0x54, 0x03, 0x64, 0x01, 0x70, 0x5F, 0xED, 0x60, 0x17, 0x64, 0x01, 0x60, 0x13, 0xED, 0x64, 0x03, -0x60, 0x0E, 0xED, 0x64, 0x04, 0x60, 0x09, 0xED, 0x64, 0x09, 0x60, 0x04, 0xED, 0xB4, 0x0A, 0x0C, -0xED, 0x25, 0xE0, 0x24, 0x12, 0xF5, 0x82, 0xE4, 0x34, 0x45, 0x80, 0x18, 0xED, 0x64, 0x02, 0x60, -0x09, 0xED, 0x64, 0x07, 0x60, 0x04, 0xED, 0xB4, 0x08, 0x29, 0xED, 0x25, 0xE0, 0x24, 0x11, 0xF5, -0x82, 0xE4, 0x34, 0x45, 0xF5, 0x83, 0xE4, 0x93, 0xFF, 0x74, 0x18, 0x2C, 0xF5, 0x82, 0xE4, 0x34, -0x9D, 0xF5, 0x83, 0xEF, 0xF0, 0x74, 0x18, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0x9E, 0xF5, 0x83, 0xE4, -0xF0, 0x61, 0x49, 0x80, 0x47, 0xEE, 0x64, 0x01, 0x70, 0x69, 0xED, 0x60, 0x18, 0x64, 0x01, 0x60, -0x14, 0xED, 0x64, 0x03, 0x60, 0x0F, 0xED, 0x64, 0x04, 0x60, 0x0A, 0xED, 0x64, 0x09, 0x60, 0x05, -0xED, 0x64, 0x0A, 0x70, 0x27, 0xED, 0x25, 0xE0, 0x24, 0x12, 0xF5, 0x82, 0xE4, 0x34, 0x45, 0xF5, -0x83, 0xE4, 0x93, 0xFF, 0x74, 0x18, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0x9D, 0xF5, 0x83, 0xEF, 0xF0, -0xED, 0x25, 0xE0, 0x24, 0x11, 0xF5, 0x82, 0xE4, 0x34, 0x45, 0x80, 0x4C, 0xED, 0x25, 0xE0, 0x24, -0x11, 0xF5, 0x82, 0xE4, 0x34, 0x45, 0xF5, 0x83, 0xE4, 0x93, 0xFF, 0x74, 0x18, 0x2C, 0xF5, 0x82, -0xE4, 0x34, 0x9D, 0xF5, 0x83, 0xEF, 0xF0, 0xED, 0x25, 0xE0, 0x24, 0x12, 0xF5, 0x82, 0xE4, 0x34, -0x45, 0x80, 0x25, 0xED, 0x25, 0xE0, 0x24, 0x11, 0xF5, 0x82, 0xE4, 0x34, 0x45, 0xF5, 0x83, 0xE4, -0x93, 0xFF, 0x74, 0x18, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0x9D, 0xF5, 0x83, 0xEF, 0xF0, 0xED, 0x25, -0xE0, 0x24, 0x12, 0xF5, 0x82, 0xE4, 0x34, 0x45, 0xF5, 0x83, 0xE4, 0x93, 0xFF, 0x74, 0x18, 0x2C, -0xF5, 0x82, 0xE4, 0x34, 0x9E, 0xF5, 0x83, 0xEF, 0xF0, 0x74, 0x18, 0x2C, 0xF5, 0x82, 0xE4, 0x34, -0x9D, 0xF5, 0x83, 0xE0, 0xF9, 0x74, 0x18, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0x9E, 0xF5, 0x83, 0xE0, -0xFD, 0xE9, 0x13, 0x13, 0x13, 0x54, 0x1F, 0xFF, 0x75, 0xF0, 0x08, 0xEC, 0x90, 0x89, 0x00, 0x12, -0x48, 0x49, 0xE5, 0x82, 0x2F, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE0, 0xFB, 0x7A, 0x00, -0xE9, 0x54, 0x07, 0xFF, 0x74, 0x01, 0x7E, 0x00, 0xA8, 0x07, 0x08, 0x80, 0x05, 0xC3, 0x33, 0xCE, -0x33, 0xCE, 0xD8, 0xF9, 0xFF, 0xEE, 0x5A, 0xFE, 0xEF, 0x5B, 0x4E, 0x70, 0x0A, 0x74, 0x18, 0x2C, -0xF5, 0x82, 0xE4, 0x34, 0x9D, 0x80, 0x44, 0xED, 0x13, 0x13, 0x13, 0x54, 0x1F, 0xFF, 0x75, 0xF0, -0x08, 0xEC, 0x90, 0x89, 0x00, 0x12, 0x48, 0x49, 0xE5, 0x82, 0x2F, 0xF5, 0x82, 0xE4, 0x35, 0x83, -0xF5, 0x83, 0xE0, 0xFB, 0x7A, 0x00, 0xED, 0x54, 0x07, 0xFF, 0x74, 0x01, 0x7E, 0x00, 0xA8, 0x07, -0x08, 0x80, 0x05, 0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8, 0xF9, 0xFF, 0xEE, 0x5A, 0xFE, 0xEF, 0x5B, -0x4E, 0x70, 0x0C, 0x74, 0x18, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0x9E, 0xF5, 0x83, 0xE4, 0xF0, 0x22, -0x12, 0x06, 0x89, 0x54, 0x7F, 0xFF, 0x90, 0x00, 0x01, 0x12, 0x06, 0xA2, 0xFE, 0x54, 0x1F, 0xFD, -0xEE, 0x54, 0x80, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x90, 0xA5, 0x76, 0xF0, 0x90, 0x00, 0x02, -0x12, 0x06, 0xA2, 0xFE, 0x54, 0x03, 0x90, 0xA5, 0x77, 0xF0, 0xEE, 0x54, 0x30, 0xC4, 0x54, 0x0F, -0x90, 0xA5, 0x79, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x06, 0xA2, 0xFE, 0x54, 0x40, 0xC4, 0x13, 0x13, -0x54, 0x03, 0x90, 0xA5, 0x78, 0xF0, 0xEE, 0x54, 0x80, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0xFE, -0x90, 0x00, 0x02, 0x12, 0x06, 0xA2, 0x54, 0x08, 0xFC, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x90, 0xA5, -0x7A, 0xF0, 0xEE, 0x54, 0x01, 0xC4, 0x33, 0x33, 0x33, 0x54, 0x80, 0xFE, 0x75, 0xF0, 0x05, 0xEF, -0x90, 0x97, 0x9A, 0x12, 0x48, 0x49, 0xE0, 0x54, 0x7F, 0x4E, 0xF0, 0x90, 0xA5, 0x78, 0xE0, 0x54, -0x01, 0xC4, 0x33, 0x33, 0x54, 0xC0, 0xFE, 0x75, 0xF0, 0x05, 0xEF, 0x90, 0x97, 0x9A, 0x12, 0x48, -0x49, 0xE0, 0x54, 0xBF, 0x4E, 0xF0, 0x90, 0xA5, 0x7A, 0xE0, 0x60, 0x02, 0xA1, 0x55, 0xED, 0x60, -0x08, 0x64, 0x02, 0x60, 0x04, 0xED, 0xB4, 0x04, 0x10, 0x75, 0xF0, 0x05, 0xEF, 0x90, 0x97, 0x9B, -0x12, 0x48, 0x49, 0xE0, 0x44, 0x01, 0xF0, 0x80, 0x0E, 0x75, 0xF0, 0x05, 0xEF, 0x90, 0x97, 0x9B, -0x12, 0x48, 0x49, 0xE0, 0x54, 0xFE, 0xF0, 0xED, 0x54, 0x1F, 0xFE, 0x75, 0xF0, 0x05, 0xEF, 0x90, -0x97, 0x99, 0x12, 0x48, 0x49, 0xE0, 0x54, 0xE0, 0x4E, 0xF0, 0x90, 0xA5, 0x77, 0xE0, 0x54, 0x03, -0xFE, 0x75, 0xF0, 0x05, 0xEF, 0x90, 0x97, 0x9A, 0x12, 0x48, 0x49, 0xE0, 0x54, 0xFC, 0x4E, 0xF0, -0xEE, 0x25, 0xE0, 0x25, 0xE0, 0xFE, 0x75, 0xF0, 0x05, 0xEF, 0x90, 0x97, 0x9A, 0x12, 0x48, 0x49, -0xE0, 0x54, 0xF3, 0x4E, 0xF0, 0x90, 0xA5, 0x76, 0xE0, 0x54, 0x01, 0xC4, 0x33, 0x54, 0xE0, 0xFE, -0x75, 0xF0, 0x05, 0xEF, 0x90, 0x97, 0x99, 0x12, 0x48, 0x49, 0xE0, 0x54, 0xDF, 0x4E, 0xF0, 0x90, -0xA5, 0x79, 0xE0, 0x54, 0x03, 0xC4, 0x54, 0xF0, 0xFE, 0x75, 0xF0, 0x05, 0xEF, 0x90, 0x97, 0x9A, -0x12, 0x48, 0x49, 0xE0, 0x54, 0xCF, 0x4E, 0xF0, 0xE4, 0xFE, 0xEE, 0xF5, 0x82, 0x75, 0x83, 0x00, -0xA3, 0xA3, 0xA3, 0x12, 0x06, 0xA2, 0xFD, 0x75, 0xF0, 0x08, 0xEF, 0x90, 0x89, 0x00, 0x12, 0x48, -0x49, 0xE5, 0x82, 0x2E, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xED, 0xF0, 0x0E, 0xEE, 0xB4, -0x04, 0xD8, 0x12, 0x87, 0x1D, 0x22, 0x90, 0xA5, 0x73, 0x12, 0x48, 0x5E, 0x90, 0xA5, 0x72, 0xEF, -0xF0, 0x12, 0x48, 0x67, 0x8D, 0x9B, 0x00, 0x8D, 0xA4, 0x01, 0x8D, 0xAC, 0x08, 0x8D, 0xB5, 0x09, -0x8D, 0xBE, 0x0A, 0x8D, 0xC7, 0x12, 0x8D, 0xCF, 0x13, 0x8D, 0xD8, 0x14, 0x8D, 0xE1, 0x20, 0x8D, -0xEA, 0x21, 0x8D, 0xF3, 0x23, 0x8D, 0xFC, 0x25, 0x8E, 0x05, 0x26, 0x8E, 0x0E, 0x40, 0x8E, 0x16, -0x42, 0x8E, 0x1F, 0x43, 0x8E, 0x27, 0x44, 0x00, 0x00, 0x8E, 0x30, 0x90, 0xA5, 0x73, 0x12, 0x48, -0x55, 0x02, 0x92, 0x46, 0x90, 0xA5, 0x73, 0x12, 0x48, 0x55, 0xC1, 0xB7, 0x90, 0xA5, 0x73, 0x12, -0x48, 0x55, 0x02, 0x92, 0x92, 0x90, 0xA5, 0x73, 0x12, 0x48, 0x55, 0x02, 0x93, 0x9B, 0x90, 0xA5, -0x73, 0x12, 0x48, 0x55, 0x02, 0x93, 0xCB, 0x90, 0xA5, 0x73, 0x12, 0x48, 0x55, 0x80, 0x71, 0x90, -0xA5, 0x73, 0x12, 0x48, 0x55, 0x02, 0x4D, 0x38, 0x90, 0xA5, 0x73, 0x12, 0x48, 0x55, 0x02, 0x93, -0xFB, 0x90, 0xA5, 0x73, 0x12, 0x48, 0x55, 0x02, 0x94, 0x26, 0x90, 0xA5, 0x73, 0x12, 0x48, 0x55, -0x02, 0x95, 0x96, 0x90, 0xA5, 0x73, 0x12, 0x48, 0x55, 0x02, 0x95, 0xDC, 0x90, 0xA5, 0x73, 0x12, -0x48, 0x55, 0x02, 0x95, 0xE4, 0x90, 0xA5, 0x73, 0x12, 0x48, 0x55, 0x02, 0x95, 0xF4, 0x90, 0xA5, -0x73, 0x12, 0x48, 0x55, 0x61, 0xF0, 0x90, 0xA5, 0x73, 0x12, 0x48, 0x55, 0x02, 0x86, 0x0D, 0x90, -0xA5, 0x73, 0x12, 0x48, 0x55, 0xE1, 0xF8, 0x90, 0xA5, 0x73, 0x12, 0x48, 0x55, 0x02, 0x91, 0x95, -0x90, 0x01, 0xC0, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0xA5, 0x72, 0xE0, 0x90, 0x01, 0xC2, 0xF0, 0x22, -0x12, 0x06, 0x89, 0xFF, 0x90, 0xA4, 0xAE, 0xF0, 0xBF, 0x01, 0x07, 0xF1, 0x34, 0xE4, 0x90, 0xA4, -0xAE, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0xA3, 0xF5, 0xE0, 0xFF, 0x90, -0xA3, 0xF4, 0xE0, 0xB5, 0x07, 0x04, 0x7F, 0x01, 0x80, 0x02, 0x7F, 0x00, 0xEF, 0x70, 0x43, 0x90, -0xA3, 0xF4, 0xE0, 0xFE, 0x75, 0xF0, 0x08, 0x90, 0xA3, 0xA4, 0x12, 0x48, 0x49, 0xE0, 0xFD, 0xEE, -0x75, 0xF0, 0x08, 0xA4, 0x24, 0xA5, 0xF9, 0x74, 0xA3, 0x35, 0xF0, 0xFA, 0x7B, 0x01, 0xAF, 0x05, -0xB1, 0x56, 0x90, 0xA3, 0xF4, 0xE0, 0x04, 0xF0, 0xE0, 0x7F, 0x00, 0xB4, 0x0A, 0x02, 0x7F, 0x01, -0xEF, 0x60, 0x05, 0xE4, 0x90, 0xA3, 0xF4, 0xF0, 0x12, 0x96, 0x84, 0x90, 0xA3, 0x98, 0xE0, 0x44, -0x02, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x8B, 0x51, 0x8A, 0x52, 0x89, 0x53, 0x90, 0x00, 0x01, -0x12, 0x06, 0xA2, 0xFF, 0xF5, 0x55, 0x12, 0x06, 0x89, 0xFE, 0xC3, 0x13, 0x30, 0xE0, 0x0A, 0x90, -0x00, 0x02, 0x12, 0x06, 0xA2, 0xF5, 0x56, 0x80, 0x02, 0x8F, 0x56, 0x85, 0x55, 0x54, 0xE5, 0x54, -0xD3, 0x95, 0x56, 0x50, 0x35, 0xAB, 0x51, 0xAA, 0x52, 0xA9, 0x53, 0x12, 0x06, 0x89, 0x54, 0x01, -0xFF, 0x74, 0xAF, 0x25, 0x54, 0xF5, 0x82, 0xE4, 0x34, 0xA4, 0xF5, 0x83, 0xEF, 0xF0, 0x74, 0xAF, -0x25, 0x54, 0xF5, 0x82, 0xE4, 0x34, 0xA4, 0xF5, 0x83, 0xE0, 0xAF, 0x54, 0x70, 0x05, 0x12, 0x99, -0x91, 0x80, 0x03, 0x12, 0x99, 0x80, 0x05, 0x54, 0x80, 0xC4, 0x90, 0xA4, 0xAF, 0xE0, 0x70, 0x13, -0x12, 0x5D, 0xFC, 0x12, 0x5D, 0xC9, 0x90, 0xA5, 0x2F, 0xE0, 0x54, 0xF7, 0xF0, 0x54, 0xBF, 0xF0, -0x54, 0x7F, 0xF0, 0x22, 0x7B, 0x01, 0x7A, 0xA5, 0x79, 0x76, 0x7F, 0xF5, 0x7E, 0x01, 0x12, 0x34, -0xBC, 0xBF, 0x01, 0x06, 0x90, 0xA5, 0x76, 0xE0, 0xA3, 0xF0, 0x7B, 0x01, 0x7A, 0xA5, 0x79, 0x76, -0x7F, 0xF6, 0x7E, 0x01, 0x12, 0x34, 0xBC, 0xBF, 0x01, 0x08, 0x90, 0xA5, 0x76, 0xE0, 0x90, 0xA5, -0x78, 0xF0, 0x7B, 0x01, 0x7A, 0xA5, 0x79, 0x76, 0x7F, 0xF4, 0x7E, 0x01, 0x12, 0x34, 0xBC, 0xBF, -0x01, 0x08, 0x90, 0xA5, 0x76, 0xE0, 0x90, 0xA5, 0x79, 0xF0, 0x7B, 0x01, 0x7A, 0xA5, 0x79, 0x76, -0x7F, 0xF3, 0x7E, 0x01, 0x12, 0x34, 0xBC, 0xBF, 0x01, 0x08, 0x90, 0xA5, 0x76, 0xE0, 0x90, 0xA5, -0x7A, 0xF0, 0x7B, 0x01, 0x7A, 0xA5, 0x79, 0x76, 0x7F, 0xF2, 0x7E, 0x01, 0x12, 0x34, 0xBC, 0xBF, -0x01, 0x08, 0x90, 0xA5, 0x76, 0xE0, 0x90, 0xA5, 0x7B, 0xF0, 0x90, 0xA5, 0x77, 0xE0, 0xFF, 0xA3, -0xE0, 0xFD, 0xA3, 0xE0, 0xFB, 0xA3, 0xE0, 0x90, 0xA5, 0x7F, 0xF0, 0x90, 0xA5, 0x7B, 0xE0, 0x90, -0xA5, 0x80, 0xF0, 0x90, 0xA5, 0x81, 0x74, 0x12, 0xF0, 0x90, 0xA5, 0x8F, 0x74, 0x05, 0xF0, 0x90, -0xA5, 0x83, 0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0xA3, 0xEB, 0xF0, 0x90, 0xA5, 0x7F, 0xE0, 0x90, 0xA5, -0x86, 0xF0, 0x90, 0xA5, 0x80, 0xE0, 0x90, 0xA5, 0x87, 0xF0, 0x7B, 0x01, 0x7A, 0xA5, 0x79, 0x81, -0x12, 0x57, 0xDD, 0x7F, 0x04, 0x02, 0x55, 0x80, 0x12, 0x06, 0x89, 0x90, 0xA5, 0x76, 0xF0, 0x90, -0x00, 0x01, 0x12, 0x06, 0xA2, 0x90, 0xA5, 0x77, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x06, 0xA2, 0x54, -0x01, 0xFF, 0x60, 0x68, 0x90, 0xA5, 0x76, 0xE0, 0xD3, 0x94, 0x80, 0x40, 0x5F, 0xA3, 0xE0, 0xD3, -0x94, 0x80, 0x40, 0x58, 0x90, 0xA5, 0x7A, 0xEF, 0xF0, 0x90, 0x95, 0x92, 0x12, 0x48, 0x11, 0x90, -0xA5, 0x7B, 0xEF, 0xF0, 0x90, 0x95, 0x92, 0x12, 0x48, 0x11, 0x78, 0x08, 0x12, 0x08, 0x47, 0x90, -0xA5, 0x7C, 0xEF, 0xF0, 0x90, 0x95, 0x92, 0x12, 0x48, 0x11, 0x78, 0x10, 0x12, 0x08, 0x47, 0x90, -0xA5, 0x7D, 0xEF, 0xF0, 0x90, 0x95, 0x92, 0x12, 0x48, 0x11, 0x78, 0x18, 0x12, 0x08, 0x47, 0x90, -0xA5, 0x7E, 0xEF, 0xF0, 0x90, 0xA5, 0x78, 0x74, 0x0D, 0xF0, 0x90, 0xA5, 0x86, 0x74, 0x05, 0xF0, -0x90, 0x95, 0x92, 0x12, 0x08, 0x79, 0x00, 0x00, 0x00, 0x00, 0x21, 0x87, 0xEF, 0x60, 0x02, 0x21, -0x87, 0x90, 0xA5, 0x76, 0xE0, 0xFF, 0xD3, 0x94, 0x80, 0x50, 0x47, 0x90, 0xA5, 0x7A, 0xEF, 0xF0, -0x25, 0xE0, 0x24, 0x98, 0xF5, 0x82, 0xE4, 0x34, 0x9F, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0x90, -0xA5, 0x7B, 0xF0, 0xEE, 0xA3, 0xF0, 0x90, 0xA5, 0x76, 0xE0, 0xFD, 0x25, 0xE0, 0x24, 0x98, 0xF5, -0x82, 0xE4, 0x34, 0x9E, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0x90, 0xA5, 0x7D, 0xF0, 0xEE, 0xA3, -0xF0, 0x75, 0xF0, 0x10, 0xED, 0x90, 0x81, 0x00, 0x12, 0x48, 0x49, 0xE0, 0x90, 0xA5, 0x7F, 0xF0, -0x80, 0x08, 0x90, 0xA5, 0x76, 0xE0, 0x90, 0xA5, 0x7A, 0xF0, 0x90, 0xA5, 0x77, 0xE0, 0xFF, 0xC3, -0x94, 0x80, 0x50, 0x47, 0x90, 0xA5, 0x80, 0xEF, 0xF0, 0x25, 0xE0, 0x24, 0x98, 0xF5, 0x82, 0xE4, -0x34, 0x9F, 0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0x90, 0xA5, 0x81, 0xF0, 0xEE, 0xA3, 0xF0, 0x90, -0xA5, 0x77, 0xE0, 0xFD, 0x25, 0xE0, 0x24, 0x98, 0xF5, 0x82, 0xE4, 0x34, 0x9E, 0xF5, 0x83, 0xE0, -0xFE, 0xA3, 0xE0, 0x90, 0xA5, 0x83, 0xF0, 0xEE, 0xA3, 0xF0, 0x75, 0xF0, 0x10, 0xED, 0x90, 0x81, -0x00, 0x12, 0x48, 0x49, 0xE0, 0x90, 0xA5, 0x85, 0xF0, 0x80, 0x08, 0x90, 0xA5, 0x77, 0xE0, 0x90, -0xA5, 0x80, 0xF0, 0x90, 0xA5, 0x78, 0x74, 0x04, 0xF0, 0x90, 0xA5, 0x86, 0x74, 0x0C, 0xF0, 0x90, -0xA5, 0x76, 0xE0, 0xFF, 0x25, 0xE0, 0x24, 0x98, 0xF5, 0x82, 0xE4, 0x34, 0x9F, 0xF5, 0x83, 0xE4, -0xF0, 0xA3, 0xF0, 0x90, 0xA5, 0x77, 0xE0, 0xFE, 0x25, 0xE0, 0x24, 0x98, 0xF5, 0x82, 0xE4, 0x34, -0x9F, 0xF5, 0x83, 0xE4, 0xF0, 0xA3, 0xF0, 0xEF, 0x25, 0xE0, 0x24, 0x98, 0xF5, 0x82, 0xE4, 0x34, -0x9E, 0xF5, 0x83, 0xE4, 0xF0, 0xA3, 0xF0, 0xEE, 0x25, 0xE0, 0x24, 0x98, 0xF5, 0x82, 0xE4, 0x34, -0x9E, 0xF5, 0x83, 0xE4, 0xF0, 0xA3, 0xF0, 0x7B, 0x01, 0x7A, 0xA5, 0x79, 0x78, 0x12, 0x57, 0xDD, -0x7F, 0x04, 0x02, 0x55, 0x80, 0x90, 0xA5, 0x76, 0x12, 0x48, 0x5E, 0xE4, 0x90, 0xA5, 0x7B, 0xF0, -0xFD, 0x90, 0xA5, 0x76, 0x12, 0x48, 0x55, 0x8D, 0x82, 0x75, 0x83, 0x00, 0x12, 0x06, 0xA2, 0xF4, -0x60, 0x4D, 0x90, 0xA5, 0x7B, 0xE0, 0xFF, 0x90, 0xA5, 0x76, 0x12, 0x48, 0x55, 0x8D, 0x82, 0x75, -0x83, 0x00, 0x12, 0x06, 0xA2, 0xFE, 0x75, 0xF0, 0x10, 0x90, 0x81, 0x01, 0x12, 0x48, 0x49, 0xE0, -0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0xFC, 0xA8, 0x05, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, -0x4F, 0x90, 0xA5, 0x7B, 0xF0, 0x75, 0xF0, 0x10, 0xEE, 0x90, 0x81, 0x00, 0x12, 0x48, 0x49, 0xE0, -0xFF, 0x74, 0x7C, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xA5, 0xF5, 0x83, 0xEF, 0xF0, 0x80, 0x0D, 0x74, -0x7C, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xA5, 0xF5, 0x83, 0x74, 0xFF, 0xF0, 0x0D, 0xED, 0xB4, 0x07, -0x90, 0x90, 0xA5, 0x79, 0x74, 0x05, 0xF0, 0x90, 0xA5, 0x87, 0x74, 0x08, 0xF0, 0x7B, 0x01, 0x7A, -0xA5, 0x79, 0x79, 0x12, 0x57, 0xDD, 0x7F, 0x04, 0x02, 0x55, 0x80, 0x90, 0xA7, 0x1E, 0xEF, 0xF0, -0x7F, 0x02, 0x12, 0x47, 0x57, 0x90, 0xA3, 0x99, 0xE0, 0xFF, 0x90, 0xA7, 0x1E, 0xE0, 0xFE, 0xEF, -0x4E, 0x90, 0xA3, 0x99, 0xF0, 0x22, 0x90, 0x02, 0x09, 0xE0, 0xF5, 0x51, 0x12, 0x06, 0x89, 0x25, -0x51, 0x90, 0xA3, 0x9E, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x06, 0xA2, 0x25, 0x51, 0x90, 0xA3, 0x9F, -0xF0, 0x90, 0x00, 0x02, 0x12, 0x06, 0xA2, 0x25, 0x51, 0x90, 0xA3, 0xA0, 0xF0, 0x90, 0x00, 0x03, -0x12, 0x06, 0xA2, 0x25, 0x51, 0x90, 0xA3, 0xA1, 0xF0, 0x90, 0x00, 0x04, 0x12, 0x06, 0xA2, 0x25, -0x51, 0x90, 0xA3, 0xA2, 0xF0, 0x90, 0x00, 0x05, 0x12, 0x06, 0xA2, 0x25, 0x51, 0x90, 0xA3, 0xA3, -0xF0, 0x22, 0x90, 0xA5, 0x76, 0x12, 0x48, 0x5E, 0x12, 0x06, 0x89, 0xB4, 0x01, 0x02, 0x71, 0x58, -0x90, 0xA3, 0x9D, 0xE0, 0xB4, 0x01, 0x09, 0x90, 0xFE, 0x10, 0xE0, 0x44, 0x04, 0xF0, 0x80, 0x02, -0x71, 0x31, 0x90, 0xA5, 0x76, 0x12, 0x48, 0x55, 0x90, 0x00, 0x01, 0x12, 0x06, 0xA2, 0x90, 0xA4, -0x91, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x06, 0xA2, 0x90, 0xA4, 0x92, 0xF0, 0x90, 0xA4, 0x91, 0xE0, -0x54, 0x01, 0x90, 0xA4, 0x9A, 0xF0, 0x90, 0xA4, 0x91, 0xE0, 0x54, 0x02, 0x90, 0xA4, 0x9B, 0xF0, -0x90, 0xA4, 0x91, 0xE0, 0x54, 0x04, 0x90, 0xA4, 0x9C, 0xF0, 0x90, 0xA4, 0x91, 0xE0, 0x54, 0x08, -0x90, 0xA4, 0x9D, 0xF0, 0x90, 0xA4, 0x91, 0xE0, 0x54, 0x10, 0x90, 0xA4, 0x9E, 0xF0, 0x90, 0xA4, -0x92, 0xE0, 0x54, 0x01, 0x90, 0xA4, 0x9F, 0xF0, 0x90, 0xA4, 0x92, 0xE0, 0x54, 0x02, 0x90, 0xA4, -0xA0, 0xF0, 0x90, 0xA4, 0x92, 0xE0, 0x54, 0x04, 0x90, 0xA4, 0xA1, 0xF0, 0x90, 0xA4, 0x92, 0xE0, -0x54, 0x08, 0x90, 0xA4, 0xA2, 0xF0, 0x90, 0xA4, 0x92, 0xE0, 0x54, 0x10, 0x90, 0xA4, 0xA3, 0xF0, -0x22, 0xC2, 0xAF, 0xE4, 0x90, 0xA4, 0x90, 0xF0, 0x7D, 0x08, 0xFF, 0x12, 0x5E, 0xE5, 0x90, 0x02, -0x09, 0xE0, 0x90, 0x04, 0x24, 0xF0, 0x90, 0x02, 0x09, 0xE0, 0x90, 0x04, 0x25, 0xF0, 0xE4, 0x90, -0xA4, 0x98, 0xF0, 0xA3, 0xF0, 0xD2, 0xAF, 0x22, 0x90, 0x01, 0x17, 0xE0, 0xFE, 0x90, 0x01, 0x16, -0xE0, 0x7C, 0x00, 0x24, 0x00, 0xFF, 0xEC, 0x3E, 0x90, 0xA4, 0x8E, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, -0x02, 0x86, 0xE0, 0x44, 0x04, 0xF0, 0x90, 0xA4, 0x90, 0x74, 0x01, 0xF0, 0x7D, 0x08, 0xE4, 0xFF, -0x12, 0x5E, 0xC6, 0x90, 0x05, 0x52, 0xE0, 0x54, 0x07, 0x04, 0x90, 0xA4, 0x97, 0xF0, 0xE4, 0xA3, -0xF0, 0xA3, 0xF0, 0x90, 0x04, 0x22, 0xE0, 0x54, 0xEF, 0xF0, 0x22, 0x12, 0x06, 0x89, 0x90, 0xA4, -0xA4, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x06, 0xA2, 0x90, 0xA4, 0xA5, 0xF0, 0x90, 0x00, 0x02, 0x12, -0x06, 0xA2, 0x90, 0xA4, 0xA6, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x06, 0xA2, 0x90, 0xA4, 0xA7, 0xF0, -0x90, 0x00, 0x04, 0x12, 0x06, 0xA2, 0x90, 0xA4, 0xA8, 0xF0, 0x22, 0x12, 0x06, 0x89, 0x90, 0xA4, -0xA9, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x06, 0xA2, 0x90, 0xA4, 0xAA, 0xF0, 0x90, 0x00, 0x02, 0x12, -0x06, 0xA2, 0x90, 0xA4, 0xAB, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x06, 0xA2, 0x90, 0xA4, 0xAC, 0xF0, -0x90, 0x00, 0x04, 0x12, 0x06, 0xA2, 0x90, 0xA4, 0xAD, 0xF0, 0x22, 0x12, 0x06, 0x89, 0x54, 0x01, -0xFF, 0x90, 0xA5, 0x6E, 0xE0, 0x54, 0xFE, 0x4F, 0xF0, 0x30, 0xE0, 0x19, 0x90, 0xA3, 0x9D, 0xE0, -0xFF, 0xB4, 0x01, 0x07, 0x90, 0xA5, 0x3D, 0x74, 0xDC, 0xF0, 0x22, 0xEF, 0xB4, 0x03, 0x06, 0x90, -0xA5, 0x3D, 0x74, 0xD4, 0xF0, 0x22, 0x90, 0xA5, 0x76, 0x12, 0x48, 0x5E, 0x12, 0x06, 0x89, 0xFF, -0x54, 0x7F, 0x90, 0xA5, 0x33, 0xF0, 0xEF, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0xA3, 0xF0, 0x90, -0x00, 0x01, 0x12, 0x06, 0xA2, 0xFF, 0x54, 0xF0, 0xC4, 0x54, 0x0F, 0xFE, 0x90, 0xA5, 0x31, 0xE0, -0x54, 0xF0, 0x4E, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x06, 0xA2, 0x54, 0x01, 0x25, 0xE0, 0xFE, 0x90, -0xA5, 0x2F, 0xE0, 0x54, 0xFD, 0x4E, 0xF0, 0xEF, 0x54, 0x0F, 0xC4, 0x54, 0xF0, 0xFF, 0x90, 0xA5, -0x31, 0xE0, 0x54, 0x0F, 0x4F, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x06, 0xA2, 0x90, 0xA5, 0x32, 0xF0, -0x90, 0x00, 0x06, 0x12, 0x06, 0xA2, 0x30, 0xE0, 0x5E, 0xC3, 0x13, 0x54, 0x07, 0xFF, 0xC3, 0x94, -0x04, 0x90, 0xA5, 0x45, 0x50, 0x04, 0xEF, 0xF0, 0x80, 0x2E, 0x74, 0x03, 0xF0, 0x90, 0xA5, 0x76, -0x12, 0x48, 0x55, 0xE9, 0x24, 0x06, 0xF9, 0xE4, 0x3A, 0xFA, 0x12, 0x06, 0x89, 0xFF, 0x74, 0x03, -0x24, 0xFD, 0xFE, 0xEF, 0xC4, 0x54, 0x0F, 0xFD, 0xEF, 0x54, 0x0F, 0xFF, 0xED, 0x2E, 0x54, 0x0F, -0xFE, 0xC4, 0x54, 0xF0, 0x4F, 0x12, 0x06, 0xCF, 0x90, 0xA5, 0x76, 0x12, 0x48, 0x55, 0x90, 0x00, -0x06, 0x12, 0x06, 0xA2, 0xC4, 0x54, 0x0F, 0xFF, 0xC3, 0x94, 0x04, 0x90, 0xA5, 0x3B, 0x50, 0x05, -0x74, 0x04, 0xF0, 0x80, 0x02, 0xEF, 0xF0, 0x90, 0xA5, 0x76, 0x12, 0x48, 0x55, 0x90, 0x00, 0x04, -0x12, 0x06, 0xA2, 0xFD, 0x7F, 0x02, 0x12, 0x5B, 0x02, 0x90, 0xA5, 0x76, 0x12, 0x48, 0x55, 0xB1, -0x26, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, 0xF0, 0x90, 0xA5, 0x33, 0xE0, 0x90, -0x01, 0xBA, 0xF0, 0x90, 0xA5, 0x35, 0xE0, 0x90, 0x01, 0xBB, 0xF0, 0x90, 0xA5, 0x31, 0xE0, 0x54, -0x0F, 0x90, 0x01, 0xBE, 0xF0, 0x22, 0x90, 0xA5, 0x79, 0x12, 0x48, 0x5E, 0xB1, 0x55, 0x90, 0xA5, -0x33, 0xE0, 0xFF, 0x12, 0x5E, 0x2F, 0x90, 0xA5, 0x33, 0xE0, 0x60, 0x18, 0x90, 0xA5, 0x79, 0x12, -0x48, 0x55, 0x90, 0x00, 0x01, 0x12, 0x06, 0xA2, 0x54, 0x0F, 0xFF, 0x90, 0x00, 0x02, 0x12, 0x06, -0xA2, 0xFD, 0xB1, 0x66, 0x22, 0x90, 0xA5, 0x2F, 0xE0, 0x54, 0xFB, 0xF0, 0xE4, 0x90, 0xA5, 0x3C, -0xF0, 0x90, 0xA5, 0x37, 0xF0, 0x22, 0xEF, 0x24, 0xFE, 0x60, 0x0B, 0x04, 0x70, 0x27, 0x90, 0xA5, -0x39, 0x74, 0x02, 0xF0, 0x80, 0x16, 0xED, 0x70, 0x0A, 0x90, 0xA5, 0x62, 0xE0, 0x90, 0xA5, 0x39, -0xF0, 0x80, 0x05, 0x90, 0xA5, 0x39, 0xED, 0xF0, 0x90, 0xA5, 0x39, 0xE0, 0xA3, 0xF0, 0x90, 0xA5, -0x30, 0xE0, 0x44, 0x08, 0xF0, 0x22, 0x90, 0x00, 0x02, 0x12, 0x06, 0xA2, 0xFF, 0x30, 0xE0, 0x26, -0x12, 0x06, 0x89, 0x90, 0xA5, 0x5F, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x06, 0xA2, 0x90, 0xA5, 0x60, -0xF0, 0xEF, 0x54, 0xFE, 0xFF, 0xA3, 0xE0, 0x54, 0x01, 0x4F, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x06, -0xA2, 0x90, 0xA5, 0x62, 0xF0, 0x22, 0x90, 0xA5, 0x5F, 0x74, 0x03, 0xF0, 0xA3, 0x74, 0x05, 0xF0, -0xA3, 0xE0, 0x54, 0x01, 0x44, 0x28, 0xF0, 0xA3, 0x74, 0x05, 0xF0, 0x22, 0x12, 0x06, 0x89, 0x90, -0xA5, 0x3D, 0xF0, 0x22, 0x12, 0x06, 0x89, 0x90, 0xA5, 0x65, 0xF0, 0x90, 0xA5, 0x65, 0xE0, 0x90, -0x01, 0xE7, 0xF0, 0x22, 0x12, 0x06, 0x89, 0xFF, 0x54, 0x01, 0xFE, 0x90, 0xA5, 0x66, 0xE0, 0x54, -0xFE, 0x4E, 0xFE, 0xF0, 0xEF, 0x54, 0x02, 0xFF, 0xEE, 0x54, 0xFD, 0x4F, 0xFF, 0xF0, 0x12, 0x06, -0x89, 0xFE, 0x54, 0x04, 0x25, 0xE0, 0xFD, 0xEF, 0x54, 0xF7, 0x4D, 0x90, 0xA5, 0x66, 0xF0, 0x90, -0x00, 0x01, 0x12, 0x06, 0xA2, 0xFF, 0x90, 0x05, 0x54, 0xE0, 0xC3, 0x9F, 0x90, 0xA5, 0x67, 0xF0, -0xEE, 0x20, 0xE0, 0x09, 0x12, 0x5D, 0xFC, 0xE4, 0xFD, 0xFF, 0x12, 0x5A, 0xBC, 0x90, 0xA5, 0x66, -0xE0, 0x13, 0x13, 0x13, 0x54, 0x01, 0xFF, 0x12, 0x9C, 0x47, 0x90, 0xA5, 0x66, 0xE0, 0xC3, 0x13, -0x30, 0xE0, 0x19, 0x90, 0xA5, 0x33, 0x74, 0x01, 0xF0, 0xE4, 0x90, 0xA5, 0x35, 0xF0, 0x90, 0xA5, -0x30, 0xE0, 0x44, 0x04, 0xF0, 0x90, 0x05, 0x58, 0x74, 0x05, 0xF0, 0x22, 0xE4, 0x90, 0xA5, 0x33, -0xF0, 0x90, 0xA5, 0x35, 0x74, 0x0C, 0xF0, 0x90, 0xA5, 0x2F, 0xE0, 0x54, 0xFE, 0xF0, 0xA3, 0xE0, -0x54, 0xFB, 0xF0, 0x22, 0x90, 0x01, 0xCC, 0xE0, 0x54, 0x0F, 0x90, 0xA7, 0x0C, 0xF0, 0x90, 0xA7, -0x0C, 0xE0, 0xFD, 0x70, 0x02, 0xE1, 0xD3, 0x90, 0xA3, 0xF4, 0xE0, 0xFF, 0x70, 0x06, 0xA3, 0xE0, -0x64, 0x09, 0x60, 0x0A, 0xEF, 0x14, 0xFF, 0x90, 0xA3, 0xF5, 0xE0, 0xB5, 0x07, 0x04, 0x7F, 0x01, -0x80, 0x02, 0x7F, 0x00, 0xEF, 0x60, 0x08, 0x90, 0x01, 0xC1, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0x90, -0xA7, 0x0A, 0xE0, 0xFF, 0x74, 0x01, 0x7E, 0x00, 0xA8, 0x07, 0x08, 0x80, 0x05, 0xC3, 0x33, 0xCE, -0x33, 0xCE, 0xD8, 0xF9, 0xFF, 0xEF, 0x5D, 0x70, 0x02, 0xE1, 0xB0, 0xE4, 0x90, 0xA7, 0x0D, 0xF0, -0x90, 0xA7, 0x0D, 0xE0, 0xF9, 0xC3, 0x94, 0x04, 0x50, 0x73, 0x90, 0xA7, 0x0A, 0xE0, 0x75, 0xF0, -0x04, 0xA4, 0xFF, 0xE9, 0xFD, 0x7C, 0x00, 0x2F, 0xFF, 0xEC, 0x35, 0xF0, 0xFE, 0x74, 0xD0, 0x2F, -0xF5, 0x82, 0x74, 0x01, 0x3E, 0xF5, 0x83, 0xE0, 0xFF, 0x90, 0xA3, 0xF5, 0xE0, 0x75, 0xF0, 0x08, -0x90, 0xA3, 0xA4, 0x12, 0x48, 0x49, 0xE5, 0x82, 0x29, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, -0xEF, 0xF0, 0x90, 0xA7, 0x0A, 0xE0, 0x75, 0xF0, 0x04, 0xA4, 0x2D, 0xFF, 0xEC, 0x35, 0xF0, 0xFE, -0x74, 0xF0, 0x2F, 0xF5, 0x82, 0x74, 0x01, 0x3E, 0xF5, 0x83, 0xE0, 0xFF, 0x90, 0xA3, 0xF5, 0xE0, -0x75, 0xF0, 0x08, 0x90, 0xA3, 0xA8, 0x12, 0x48, 0x49, 0xE5, 0x82, 0x29, 0xF5, 0x82, 0xE4, 0x35, -0x83, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0xA7, 0x0D, 0xE0, 0x04, 0xF0, 0x80, 0x83, 0x90, 0xA7, 0x0C, -0xE0, 0xFF, 0x90, 0xA7, 0x0A, 0xE0, 0xFE, 0x74, 0x01, 0xA8, 0x06, 0x08, 0x80, 0x02, 0xC3, 0x33, -0xD8, 0xFC, 0xF4, 0x5F, 0x90, 0xA7, 0x0C, 0xF0, 0x90, 0xA7, 0x0A, 0xE0, 0xFF, 0x74, 0x01, 0xA8, -0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0x90, 0x01, 0xCC, 0xF0, 0x90, 0xA7, 0x0A, 0xE0, -0x04, 0xF0, 0xE0, 0x54, 0x03, 0xF0, 0x90, 0xA3, 0xF5, 0xE0, 0x04, 0xF0, 0xE0, 0x7F, 0x00, 0xB4, -0x0A, 0x02, 0x7F, 0x01, 0xEF, 0x70, 0x02, 0xC1, 0x8E, 0xE4, 0x90, 0xA3, 0xF5, 0xF0, 0xC1, 0x8E, -0x90, 0x01, 0xC0, 0xE0, 0x44, 0x02, 0xF0, 0x90, 0xA7, 0x0A, 0xE0, 0x44, 0x80, 0x90, 0x00, 0x8A, -0xF0, 0x90, 0xA7, 0x0A, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD0, 0x12, 0x48, 0x49, 0xE0, 0x90, -0x01, 0xC3, 0xF0, 0x22, 0xE4, 0x90, 0xA4, 0x8C, 0xF0, 0xA3, 0xF0, 0x90, 0xA3, 0xF4, 0xF0, 0xA3, -0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0xA6, 0xF2, 0xEE, 0xF0, 0xA3, 0xEF, -0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0xA6, 0xF2, 0xE0, 0xFE, 0xA3, 0xE0, 0xF5, 0x82, 0x8E, -0x83, 0xE0, 0x60, 0x2D, 0xC3, 0x90, 0xA6, 0xF5, 0xE0, 0x94, 0xE8, 0x90, 0xA6, 0xF4, 0xE0, 0x94, -0x03, 0x40, 0x0B, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x80, 0xF0, 0x7F, 0x00, 0x80, 0x15, 0x90, 0xA6, -0xF4, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x08, 0xD6, 0x7F, 0x0A, 0x7E, 0x00, 0x12, 0x3E, 0x87, 0x80, -0xC5, 0x7F, 0x01, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xE4, 0xFC, 0xED, 0x2C, 0x24, 0x00, 0xF5, 0x82, -0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE4, 0xF0, 0x0C, 0xEC, 0xB4, 0x18, 0xEE, 0x74, 0x00, 0x2D, 0xF5, -0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xEF, 0xF0, 0xEE, 0x54, 0x3F, 0xFF, 0x74, 0x01, 0x2D, 0xF5, -0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xEF, 0xF0, 0x74, 0x02, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFB, -0xF5, 0x83, 0xE0, 0x54, 0xF0, 0xF0, 0x74, 0x03, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, -0xE0, 0x44, 0x80, 0xF0, 0x74, 0x0B, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x44, -0x10, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0xA6, 0xFA, 0x12, 0x48, 0x5E, -0x7F, 0x96, 0x7E, 0x02, 0x12, 0x97, 0xE2, 0xEF, 0x60, 0x58, 0x90, 0x01, 0x17, 0xE0, 0xFE, 0x90, -0x01, 0x16, 0xE0, 0x7C, 0x00, 0x24, 0x00, 0xFF, 0xEC, 0x3E, 0xFE, 0xEF, 0x24, 0x01, 0xFF, 0xE4, -0x3E, 0xFE, 0x90, 0xA6, 0xFD, 0xEF, 0xF0, 0xEE, 0xFF, 0x90, 0xFD, 0x11, 0xF0, 0x90, 0xA6, 0xFD, -0xE0, 0xFD, 0x90, 0x02, 0x94, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0xA6, 0xFA, 0x12, 0x48, 0x55, 0x90, -0x00, 0x0E, 0x12, 0x06, 0xA2, 0x24, 0x02, 0xFF, 0xE4, 0x33, 0xFE, 0x11, 0x38, 0x90, 0xA6, 0xFD, -0xE0, 0x24, 0x18, 0xFF, 0x90, 0xA6, 0xFA, 0x12, 0x48, 0x55, 0x31, 0x07, 0x90, 0x02, 0x96, 0x74, -0x01, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0xA6, 0xF6, 0xEF, 0xF0, 0xA3, 0x12, 0x48, 0x5E, -0x90, 0xA7, 0x0B, 0xE0, 0xFE, 0x04, 0xF0, 0x90, 0x00, 0x01, 0xEE, 0x12, 0x06, 0xE1, 0x74, 0x00, -0x2F, 0xF9, 0xE4, 0x34, 0xFB, 0xFA, 0x7B, 0x01, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90, 0xA6, -0xF7, 0x12, 0x48, 0x55, 0x8B, 0x40, 0x8A, 0x41, 0x89, 0x42, 0x75, 0x43, 0x02, 0xD0, 0x01, 0xD0, -0x02, 0xD0, 0x03, 0x12, 0x35, 0x85, 0x90, 0xA6, 0xF6, 0xE0, 0x24, 0x02, 0xF9, 0xE4, 0x34, 0xFB, -0xFA, 0x7B, 0x01, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0xA3, 0x12, 0x48, 0x55, 0xE9, 0x24, 0x02, -0xF9, 0xE4, 0x3A, 0x8B, 0x40, 0xF5, 0x41, 0x89, 0x42, 0x90, 0xA6, 0xF7, 0x12, 0x48, 0x55, 0x90, -0x00, 0x0E, 0x12, 0x06, 0xA2, 0xF5, 0x43, 0xD0, 0x01, 0xD0, 0x02, 0xD0, 0x03, 0x02, 0x35, 0x85, -0x8F, 0x57, 0x75, 0xF0, 0x10, 0xEF, 0x90, 0x81, 0x05, 0x12, 0x48, 0x49, 0xE0, 0x54, 0xFB, 0xF0, -0x22, 0x8F, 0x57, 0x75, 0xF0, 0x10, 0xEF, 0x90, 0x81, 0x05, 0x12, 0x48, 0x49, 0xE0, 0x44, 0x04, -0xF0, 0x22, 0x90, 0xA7, 0x01, 0x12, 0x48, 0x5E, 0xE4, 0xFF, 0x90, 0xA7, 0x01, 0x12, 0x48, 0x55, -0x8F, 0x82, 0x75, 0x83, 0x00, 0x12, 0x06, 0xA2, 0xFE, 0x74, 0xF0, 0x2F, 0xF5, 0x82, 0xE4, 0x34, -0x02, 0xF5, 0x83, 0xEE, 0xF0, 0x0F, 0xEF, 0xB4, 0x10, 0xE0, 0x22, 0x90, 0x01, 0x94, 0xE0, 0x44, -0x01, 0xF0, 0x90, 0x01, 0xC7, 0xE4, 0xF0, 0x22, 0x90, 0x01, 0x01, 0xE0, 0x44, 0x04, 0xF0, 0x90, -0x01, 0x9A, 0xE0, 0x54, 0xC0, 0xF0, 0x7F, 0x0A, 0x7E, 0x00, 0x12, 0x3E, 0x87, 0x90, 0x01, 0x99, -0xE0, 0x44, 0xC0, 0xF0, 0x90, 0x01, 0x9B, 0x74, 0x80, 0xF0, 0x22, 0x90, 0x01, 0x9A, 0xE0, 0x54, -0xC0, 0x44, 0x0B, 0xF0, 0x7F, 0x0A, 0x7E, 0x00, 0x12, 0x3E, 0x87, 0x90, 0x01, 0x98, 0xE0, 0x54, -0xC0, 0x7F, 0x00, 0xB4, 0x40, 0x02, 0x7F, 0x01, 0x22, 0xE4, 0x90, 0xA5, 0x6F, 0xF0, 0xA3, 0xF0, -0x31, 0xFB, 0xEF, 0x64, 0x01, 0x60, 0x45, 0xC3, 0x90, 0xA5, 0x70, 0xE0, 0x94, 0x88, 0x90, 0xA5, -0x6F, 0xE0, 0x94, 0x13, 0x40, 0x0F, 0x90, 0x01, 0xC1, 0xE0, 0x44, 0x10, 0xF0, 0x90, 0x01, 0xC7, -0x74, 0xFD, 0xF0, 0x80, 0x27, 0x90, 0xA5, 0x6F, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x08, 0xD6, 0x7F, -0x14, 0x7E, 0x00, 0x12, 0x3E, 0x87, 0xD3, 0x90, 0xA5, 0x70, 0xE0, 0x94, 0x32, 0x90, 0xA5, 0x6F, -0xE0, 0x94, 0x00, 0x40, 0xBB, 0x90, 0x01, 0xC6, 0xE0, 0x30, 0xE3, 0xB4, 0x90, 0x01, 0xC7, 0x74, -0xFE, 0xF0, 0x22, 0x7D, 0x02, 0x90, 0x01, 0xC4, 0x74, 0x73, 0xF0, 0x74, 0x9A, 0xA3, 0xF0, 0x90, -0xA5, 0x68, 0xE0, 0xFF, 0xED, 0xC3, 0x9F, 0x50, 0x18, 0xED, 0x25, 0xE0, 0x24, 0x81, 0xF8, 0xE6, -0x30, 0xE4, 0x0B, 0x90, 0x01, 0xB8, 0x74, 0x08, 0xF0, 0xA3, 0xF0, 0x7F, 0x00, 0x22, 0x0D, 0x80, -0xDE, 0x7F, 0x01, 0x22, 0xE4, 0x90, 0xA3, 0x98, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, -0xF0, 0x22, 0x90, 0x01, 0xE4, 0x74, 0x12, 0xF0, 0xA3, 0xE4, 0xF0, 0x22, 0x90, 0x01, 0x34, 0xE0, -0x55, 0x15, 0xF5, 0x19, 0xA3, 0xE0, 0x55, 0x16, 0xF5, 0x1A, 0xA3, 0xE0, 0x55, 0x17, 0xF5, 0x1B, -0xA3, 0xE0, 0x55, 0x18, 0xF5, 0x1C, 0x90, 0x01, 0x34, 0xE5, 0x19, 0xF0, 0xA3, 0xE5, 0x1A, 0xF0, -0xA3, 0xE5, 0x1B, 0xF0, 0xA3, 0xE5, 0x1C, 0xF0, 0x90, 0x01, 0x24, 0xE0, 0x55, 0x25, 0xF5, 0x26, -0xF0, 0x22, 0x90, 0xA4, 0xAF, 0xE0, 0x64, 0x01, 0x70, 0x26, 0x90, 0xA5, 0x33, 0xE0, 0x60, 0x20, -0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0xF0, 0x90, 0xA5, 0x2F, 0xE0, 0x54, -0xFB, 0xF0, 0x90, 0xA5, 0x37, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0x07, 0x70, 0x03, 0x12, 0x58, 0x95, -0x22, 0x90, 0xA4, 0xAF, 0xE0, 0xB4, 0x01, 0x14, 0x90, 0xA5, 0x33, 0xE0, 0x60, 0x0E, 0x90, 0xA5, -0x37, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0x07, 0x70, 0x03, 0x12, 0x58, 0x95, 0x22, 0x90, 0x01, 0x02, -0xE0, 0x54, 0x03, 0xFF, 0xBF, 0x03, 0x07, 0x90, 0x05, 0x21, 0xE0, 0x54, 0x7F, 0xF0, 0x22, 0x90, -0x01, 0x02, 0xE0, 0x54, 0x03, 0xFF, 0xBF, 0x03, 0x07, 0x90, 0x05, 0x21, 0xE0, 0x54, 0x7F, 0xF0, -0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x04, 0x1D, 0xE0, 0x60, 0x1A, 0x90, 0x05, -0x22, 0xE0, 0x54, 0x90, 0x60, 0x07, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x08, 0xF0, 0x90, 0x01, 0xC6, -0xE0, 0x30, 0xE1, 0xE4, 0x7F, 0x00, 0x80, 0x02, 0x7F, 0x01, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, -0x01, 0xC4, 0x74, 0x8F, 0xF0, 0x74, 0x9B, 0xA3, 0xF0, 0x7F, 0x90, 0x12, 0x4B, 0xC2, 0xEF, 0x20, -0xE0, 0xF7, 0x74, 0x8F, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x9B, 0xA3, 0xF0, 0x22, 0x75, 0xF0, -0x10, 0xEF, 0x90, 0x81, 0x03, 0x12, 0x48, 0x49, 0xE0, 0x44, 0x40, 0xF0, 0x22, 0x74, 0x1D, 0x2F, -0xF8, 0xE6, 0xFE, 0xED, 0xF4, 0x5E, 0xFE, 0xF6, 0x74, 0x38, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, -0xF5, 0x83, 0xEE, 0xF0, 0x22, 0x7F, 0x0C, 0x7E, 0x09, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, -0x90, 0xA6, 0xB0, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x12, 0x37, 0xAD, 0x90, 0xA6, 0xBA, 0x12, 0x08, -0x6D, 0x90, 0xA6, 0xB2, 0x12, 0x48, 0x11, 0x12, 0x08, 0x3A, 0x90, 0xA6, 0xBA, 0x12, 0x48, 0x2D, -0x12, 0x47, 0xE6, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0xA6, 0xB2, 0x12, 0x48, -0x11, 0x90, 0xA6, 0xB6, 0x12, 0x48, 0x2D, 0x12, 0x47, 0xE6, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, -0xD0, 0x00, 0x12, 0x47, 0xF3, 0x90, 0xA6, 0xBE, 0x12, 0x08, 0x6D, 0x90, 0xA6, 0xBE, 0x12, 0x48, -0x11, 0x90, 0xAA, 0xB9, 0x12, 0x08, 0x6D, 0x90, 0xA6, 0xB0, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12, -0x38, 0xA4, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xEF, 0x90, 0xA6, 0xB2, 0x70, 0x02, 0xA1, 0xE7, 0x12, -0x08, 0x79, 0x00, 0x00, 0x00, 0xFF, 0x90, 0xA6, 0xB6, 0x12, 0x08, 0x79, 0x00, 0x00, 0x00, 0x11, -0x7F, 0x04, 0x7E, 0x0C, 0x71, 0xD9, 0x90, 0xA6, 0xB2, 0x12, 0x08, 0x79, 0x00, 0x00, 0x00, 0x0F, -0x90, 0xA6, 0xB6, 0x12, 0x08, 0x79, 0x00, 0x00, 0x00, 0x01, 0x7F, 0x04, 0x7E, 0x0D, 0x71, 0xD9, -0x90, 0xA6, 0xB2, 0x12, 0x08, 0x79, 0x00, 0x70, 0x00, 0x00, 0x90, 0xA6, 0xB6, 0x12, 0x08, 0x79, -0x00, 0x10, 0x00, 0x00, 0x7F, 0x2C, 0x7E, 0x08, 0x71, 0xD9, 0x90, 0xA6, 0xB2, 0x12, 0x08, 0x79, -0x00, 0x00, 0x01, 0x00, 0x90, 0xA6, 0xB6, 0x12, 0x08, 0x79, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, -0x7E, 0x0A, 0x71, 0xD9, 0x90, 0xA6, 0xB2, 0x12, 0x08, 0x79, 0xFF, 0x00, 0x00, 0x00, 0x90, 0xA6, -0xB6, 0x12, 0x08, 0x79, 0x80, 0x00, 0x00, 0x00, 0x7F, 0x04, 0x7E, 0x0A, 0x71, 0xD9, 0x90, 0xA6, -0xB2, 0x12, 0x08, 0x79, 0x00, 0x00, 0x00, 0x0F, 0x90, 0xA6, 0xB6, 0x12, 0x08, 0x79, 0x00, 0x00, -0x00, 0x01, 0x7F, 0x04, 0x7E, 0x08, 0x71, 0xD9, 0x90, 0xA6, 0xB2, 0x12, 0x08, 0x79, 0x00, 0x00, -0x00, 0x0F, 0x90, 0xA6, 0xB6, 0x12, 0x08, 0x79, 0x00, 0x00, 0x00, 0x01, 0x71, 0xD5, 0x90, 0xAA, -0xB9, 0x12, 0x08, 0x79, 0x00, 0xC0, 0x96, 0x96, 0x7F, 0x6C, 0x7E, 0x0E, 0x12, 0x38, 0xA4, 0x90, -0xAA, 0xB9, 0x12, 0x08, 0x79, 0x00, 0x00, 0xD6, 0xD6, 0x7F, 0xE0, 0x7E, 0x0E, 0x12, 0x38, 0xA4, -0x90, 0xAA, 0xB9, 0x12, 0x08, 0x79, 0x00, 0x00, 0xD6, 0xD6, 0x7F, 0xDC, 0x7E, 0x0E, 0x12, 0x38, -0xA4, 0x90, 0xAA, 0xB9, 0x12, 0x08, 0x79, 0x04, 0xC0, 0x56, 0x56, 0x7F, 0x68, 0x7E, 0x0E, 0x12, -0x38, 0xA4, 0x90, 0xAA, 0xB9, 0x12, 0x08, 0x79, 0x04, 0xC0, 0x16, 0x16, 0x7F, 0xEC, 0x7E, 0x0E, -0x12, 0x38, 0xA4, 0x90, 0xAA, 0xB9, 0x12, 0x08, 0x79, 0x00, 0xC0, 0x96, 0x96, 0x7F, 0x70, 0x7E, -0x0E, 0x12, 0x38, 0xA4, 0x90, 0xAA, 0xB9, 0x12, 0x08, 0x79, 0x04, 0x00, 0x56, 0x56, 0x7F, 0x74, -0x7E, 0x0E, 0x12, 0x38, 0xA4, 0x90, 0xAA, 0xB9, 0x12, 0x08, 0x79, 0x04, 0x00, 0x56, 0x56, 0x7F, -0x7C, 0x7E, 0x0E, 0x12, 0x38, 0xA4, 0x90, 0xAA, 0xB9, 0x12, 0x08, 0x79, 0x00, 0xC0, 0x96, 0x96, -0x7F, 0x84, 0x7E, 0x0E, 0x12, 0x38, 0xA4, 0x90, 0xAA, 0xB9, 0x12, 0x08, 0x79, 0x04, 0x00, 0x56, -0x56, 0x7F, 0x88, 0x7E, 0x0E, 0x12, 0x38, 0xA4, 0x90, 0xAA, 0xB9, 0x12, 0x08, 0x79, 0x00, 0xC0, -0x96, 0x96, 0x7F, 0x8C, 0x7E, 0x0E, 0x12, 0x38, 0xA4, 0x90, 0xAA, 0xB9, 0x12, 0x08, 0x79, 0x00, -0xC0, 0x96, 0x96, 0x7F, 0xD0, 0x7E, 0x0E, 0x12, 0x38, 0xA4, 0x90, 0xAA, 0xB9, 0x12, 0x08, 0x79, -0x00, 0xC0, 0x96, 0x96, 0x7F, 0xD4, 0x7E, 0x0E, 0x12, 0x38, 0xA4, 0x90, 0xAA, 0xB9, 0x12, 0x08, -0x79, 0x00, 0xC0, 0x96, 0x96, 0xE1, 0x7D, 0x12, 0x08, 0x79, 0x00, 0x00, 0x00, 0xFF, 0x90, 0xA6, -0xB6, 0x12, 0x08, 0x79, 0x00, 0x00, 0x00, 0x33, 0x7F, 0x04, 0x7E, 0x0C, 0x71, 0xD9, 0x90, 0xA6, -0xB2, 0x12, 0x08, 0x79, 0x00, 0x00, 0x00, 0x0F, 0x90, 0xA6, 0xB6, 0x12, 0x08, 0x79, 0x00, 0x00, -0x00, 0x03, 0x7F, 0x04, 0x7E, 0x0D, 0x71, 0xD9, 0x90, 0xA6, 0xB2, 0x12, 0x08, 0x79, 0x00, 0x70, -0x00, 0x00, 0x90, 0xA6, 0xB6, 0x12, 0x08, 0x79, 0x00, 0x30, 0x00, 0x00, 0x7F, 0x2C, 0x7E, 0x08, -0x71, 0xD9, 0x90, 0xA6, 0xB2, 0x12, 0x08, 0x79, 0x00, 0x00, 0x80, 0x00, 0x90, 0xA6, 0xB6, 0x12, -0x08, 0x79, 0x00, 0x00, 0x80, 0x00, 0x7F, 0x00, 0x7E, 0x0A, 0x71, 0xD9, 0x90, 0xA6, 0xB2, 0x12, -0x08, 0x79, 0xFF, 0x00, 0x00, 0x00, 0x90, 0xA6, 0xB6, 0x12, 0x08, 0x79, 0x81, 0x00, 0x00, 0x00, -0x7F, 0x04, 0x7E, 0x0A, 0x71, 0xD9, 0x90, 0xA6, 0xB2, 0x12, 0x08, 0x79, 0x00, 0x00, 0x00, 0x0F, -0x90, 0xA6, 0xB6, 0x12, 0x08, 0x79, 0x00, 0x00, 0x00, 0x03, 0x7F, 0x04, 0x7E, 0x08, 0x71, 0xD9, -0x90, 0xA6, 0xB2, 0x12, 0x08, 0x79, 0x00, 0x00, 0x00, 0x0F, 0x90, 0xA6, 0xB6, 0x12, 0x08, 0x79, -0x00, 0x00, 0x00, 0x03, 0x71, 0xD5, 0x90, 0xAA, 0xB9, 0x12, 0x08, 0x79, 0x03, 0xC0, 0x96, 0x96, -0x7F, 0x6C, 0x7E, 0x0E, 0x12, 0x38, 0xA4, 0x90, 0xAA, 0xB9, 0x12, 0x08, 0x79, 0x00, 0x00, 0xD6, -0xD6, 0x7F, 0xE0, 0x7E, 0x0E, 0x12, 0x38, 0xA4, 0x90, 0xAA, 0xB9, 0x12, 0x08, 0x79, 0x00, 0x00, -0xD6, 0xD6, 0x7F, 0xDC, 0x7E, 0x0E, 0x12, 0x38, 0xA4, 0x90, 0xAA, 0xB9, 0x12, 0x08, 0x79, 0x0F, -0xC0, 0x56, 0x56, 0x7F, 0x68, 0x7E, 0x0E, 0x12, 0x38, 0xA4, 0x90, 0xAA, 0xB9, 0x12, 0x08, 0x79, -0x0F, 0xC0, 0x16, 0x16, 0x7F, 0xEC, 0x7E, 0x0E, 0x12, 0x38, 0xA4, 0x90, 0xAA, 0xB9, 0x12, 0x08, -0x79, 0x03, 0xC0, 0x96, 0x96, 0x7F, 0x70, 0x7E, 0x0E, 0x12, 0x38, 0xA4, 0x90, 0xAA, 0xB9, 0x12, -0x08, 0x79, 0x0C, 0x00, 0x56, 0x56, 0x7F, 0x74, 0x7E, 0x0E, 0x12, 0x38, 0xA4, 0x90, 0xAA, 0xB9, -0x12, 0x08, 0x79, 0x0C, 0x00, 0x56, 0x56, 0x7F, 0x7C, 0x7E, 0x0E, 0x12, 0x38, 0xA4, 0x90, 0xAA, -0xB9, 0x12, 0x08, 0x79, 0x03, 0xC0, 0x96, 0x96, 0x7F, 0x84, 0x7E, 0x0E, 0x12, 0x38, 0xA4, 0x90, -0xAA, 0xB9, 0x12, 0x08, 0x79, 0x0C, 0x00, 0x56, 0x56, 0x7F, 0x88, 0x7E, 0x0E, 0x12, 0x38, 0xA4, -0x90, 0xAA, 0xB9, 0x12, 0x08, 0x79, 0x03, 0xC0, 0x96, 0x96, 0x7F, 0x8C, 0x7E, 0x0E, 0x12, 0x38, -0xA4, 0x90, 0xAA, 0xB9, 0x12, 0x08, 0x79, 0x03, 0xC0, 0x96, 0x96, 0x7F, 0xD0, 0x7E, 0x0E, 0x12, -0x38, 0xA4, 0x90, 0xAA, 0xB9, 0x12, 0x08, 0x79, 0x03, 0xC0, 0x96, 0x96, 0x7F, 0xD4, 0x7E, 0x0E, -0x12, 0x38, 0xA4, 0x90, 0xAA, 0xB9, 0x12, 0x08, 0x79, 0x03, 0xC0, 0x96, 0x96, 0x7F, 0xD8, 0x7E, -0x0E, 0x02, 0x38, 0xA4, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0xA6, 0x9E, 0xEC, 0xF0, -0xA3, 0xED, 0xF0, 0x90, 0xA6, 0x9D, 0xEF, 0xF0, 0xA3, 0xA3, 0xE0, 0xFD, 0x12, 0x3E, 0x39, 0x90, -0xA6, 0xA8, 0x12, 0x08, 0x6D, 0x90, 0xA6, 0xA0, 0x12, 0x48, 0x11, 0x12, 0x08, 0x3A, 0x90, 0xA6, -0xA8, 0x12, 0x48, 0x2D, 0x12, 0x47, 0xE6, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, 0x90, -0xA6, 0xA0, 0x12, 0x48, 0x11, 0x90, 0xA6, 0xA4, 0x12, 0x48, 0x2D, 0x12, 0x47, 0xE6, 0xD0, 0x03, -0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0x12, 0x47, 0xF3, 0x90, 0xA6, 0xAC, 0x12, 0x08, 0x6D, 0x90, -0xA6, 0x9E, 0xA3, 0xE0, 0xFD, 0xC0, 0x05, 0x90, 0xA6, 0xAC, 0x12, 0x48, 0x11, 0x90, 0xAA, 0x96, -0x12, 0x08, 0x6D, 0x90, 0xA6, 0x9D, 0xE0, 0xFF, 0xD0, 0x05, 0x12, 0x3D, 0x39, 0xD0, 0xD0, 0x92, -0xAF, 0x22, 0x90, 0xA5, 0x69, 0xE0, 0x54, 0x7F, 0xF0, 0x54, 0xBF, 0xF0, 0x54, 0xDF, 0xF0, 0x54, -0xF0, 0xF0, 0xE4, 0x90, 0xA5, 0x6B, 0xF0, 0x22, 0x11, 0x29, 0x12, 0x97, 0xD4, 0x12, 0x6F, 0xD7, -0x12, 0x5C, 0xA3, 0x11, 0x41, 0x11, 0x2F, 0x80, 0xD9, 0xE4, 0x90, 0xA4, 0xAF, 0xF0, 0x22, 0xE4, -0x90, 0xA4, 0x90, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, -0x22, 0x90, 0xA5, 0x66, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0xFD, 0xF0, 0xE4, 0xA3, 0xF0, 0x90, 0xA5, -0x66, 0xE0, 0x54, 0xFB, 0xF0, 0x22, 0x90, 0xA3, 0xA0, 0xE0, 0xFF, 0x90, 0xA6, 0xEE, 0xE0, 0xFB, -0x7D, 0x01, 0x12, 0x66, 0xA2, 0x90, 0xA6, 0xEF, 0xEE, 0xF0, 0xFC, 0xA3, 0xEF, 0xF0, 0xFD, 0x90, -0xA6, 0xED, 0xE0, 0xFF, 0x12, 0x5F, 0x30, 0x90, 0xA6, 0xEF, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x90, -0x81, 0x00, 0xE0, 0x54, 0x0F, 0xFD, 0xAC, 0x07, 0x74, 0x0D, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, -0xF5, 0x83, 0xE0, 0x44, 0x01, 0xF0, 0x74, 0x0D, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, -0xE0, 0x54, 0xFB, 0xF0, 0xAC, 0x07, 0x74, 0x12, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, -0xE0, 0x44, 0xFA, 0xF0, 0x74, 0x11, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, -0x1F, 0xF0, 0xAC, 0x07, 0x74, 0x06, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, -0x0E, 0xF0, 0x90, 0x04, 0xA7, 0xE4, 0xF0, 0x90, 0x04, 0xA6, 0xF0, 0x90, 0x04, 0xA5, 0x74, 0xFF, -0xF0, 0x90, 0x04, 0xA4, 0x74, 0xFD, 0xF0, 0x74, 0x14, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, -0x83, 0xE0, 0x54, 0xC0, 0x4D, 0xFD, 0x74, 0x14, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, -0xED, 0xF0, 0x22, 0x90, 0x04, 0x1A, 0xE0, 0xF4, 0x60, 0x03, 0x7F, 0x00, 0x22, 0x90, 0x04, 0x1B, -0xE0, 0x54, 0x07, 0x64, 0x07, 0x7F, 0x01, 0x60, 0x02, 0x7F, 0x00, 0x22, 0x31, 0x03, 0xEF, 0x64, -0x01, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x01, 0xF0, 0x21, 0xB7, 0x90, 0xA5, 0x37, 0xE0, 0xFF, -0x54, 0x03, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x02, 0xF0, 0x80, 0x7B, 0x90, 0xA5, 0x35, 0xE0, -0xFE, 0xE4, 0xC3, 0x9E, 0x50, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x04, 0xF0, 0x80, 0x69, 0xEF, 0x30, -0xE2, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x08, 0xF0, 0x80, 0x5D, 0x90, 0xA5, 0x37, 0xE0, 0x30, 0xE4, -0x08, 0x90, 0x01, 0xB8, 0x74, 0x10, 0xF0, 0x80, 0x4E, 0x90, 0xA5, 0x30, 0xE0, 0x13, 0x13, 0x54, -0x3F, 0x20, 0xE0, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x20, 0xF0, 0x80, 0x3B, 0x90, 0xA5, 0x65, 0xE0, -0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x80, 0xF0, 0x80, 0x2D, 0x90, 0x06, 0x62, 0xE0, 0x30, 0xE1, -0x08, 0x90, 0x01, 0xB8, 0x74, 0x11, 0xF0, 0x80, 0x1E, 0x90, 0x06, 0x62, 0xE0, 0x30, 0xE0, 0x0F, -0xE0, 0x54, 0xFC, 0xFF, 0xBF, 0x80, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x12, 0xF0, 0x80, 0x08, 0x90, -0x01, 0xB8, 0xE4, 0xF0, 0x7F, 0x01, 0x22, 0x90, 0x01, 0xB9, 0x74, 0x04, 0xF0, 0x7F, 0x00, 0x22, -0x90, 0x02, 0x87, 0xE0, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x01, 0xF0, 0x80, 0x25, 0x90, 0x02, -0x96, 0xE0, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x10, 0xF0, 0x80, 0x17, 0x90, 0x02, 0x86, 0xE0, -0x20, 0xE1, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x04, 0xF0, 0x80, 0x08, 0x90, 0x01, 0xB8, 0xE4, 0xF0, -0x7F, 0x01, 0x22, 0x90, 0x01, 0xB9, 0x74, 0x08, 0xF0, 0x7F, 0x00, 0x22, 0x90, 0xA5, 0x36, 0xE0, -0xFF, 0x60, 0x03, 0xB4, 0x08, 0x0D, 0x31, 0xC0, 0xBF, 0x01, 0x08, 0x51, 0x14, 0x90, 0x01, 0xE5, -0xE0, 0x04, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x12, 0x4F, 0x34, 0x12, 0x4F, -0xD9, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x22, 0xE4, 0x90, 0xA7, 0x1A, 0xF0, 0xA3, 0xF0, 0x90, 0x02, -0x86, 0xE0, 0x20, 0xE1, 0x2C, 0xC3, 0x90, 0xA7, 0x1B, 0xE0, 0x94, 0xD0, 0x90, 0xA7, 0x1A, 0xE0, -0x94, 0x07, 0x40, 0x0A, 0x90, 0x01, 0xC1, 0xE0, 0x44, 0x04, 0xF0, 0x7F, 0x00, 0x22, 0x90, 0xA7, -0x1A, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x08, 0xD6, 0x7F, 0x0A, 0x7E, 0x00, 0x12, 0x3E, 0x87, 0x80, -0xCD, 0x7F, 0x01, 0x22, 0x7D, 0x07, 0xEF, 0x5D, 0xC3, 0x60, 0x14, 0x74, 0xFF, 0x9D, 0xFD, 0x74, -0xFF, 0x94, 0x00, 0x5E, 0xFE, 0xED, 0x5F, 0x24, 0x08, 0xFF, 0xE4, 0x3E, 0xFE, 0x80, 0x0D, 0x74, -0xFF, 0x9D, 0xFD, 0x74, 0xFF, 0x94, 0x00, 0x5E, 0xFE, 0xED, 0x5F, 0xFF, 0x22, 0x00, 0xD7, 0x22, -}; -u4Byte ArrayLength_MP_8192E_FW_AP_WoWLAN = 25264; - - -void -ODM_ReadFirmware_MP_8192E_FW_AP_WoWLAN( - IN PDM_ODM_T pDM_Odm, - OUT u1Byte *pFirmware, - OUT u4Byte *pFirmwareSize -) -{ -#if (DM_ODM_SUPPORT_TYPE & (ODM_CE)) - *((SIZE_PTR *)pFirmware) = (SIZE_PTR)Array_MP_8192E_FW_AP_WoWLAN; - *pFirmwareSize = ArrayLength_MP_8192E_FW_AP_WoWLAN; -#else - ODM_MoveMemory(pDM_Odm, pFirmware, Array_MP_8192E_FW_AP_WoWLAN, - ArrayLength_MP_8192E_FW_AP_WoWLAN); - *pFirmwareSize = ArrayLength_MP_8192E_FW_AP_WoWLAN; -#endif -} -#endif //CONFIG_AP_WOWLAN - -u1Byte Array_MP_8192E_FW_NIC[] = { -0xE1, 0x92, 0x10, 0x00, 0x12, 0x00, 0x00, 0x00, 0x11, 0x29, 0x19, 0x31, 0x5C, 0x7C, 0x00, 0x00, -0x9D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x02, 0x49, 0x0D, 0x02, 0x60, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x02, 0x60, 0x6F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x02, 0x70, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x02, 0x60, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x68, 0x54, 0x00, 0x00, -0x00, 0x00, 0x00, 0x02, 0x6F, 0xE8, 0x15, 0xF0, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x15, 0xF0, 0x0F, -0x00, 0x00, 0x00, 0x00, 0x05, 0xF0, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x05, 0xF0, 0x0F, 0x00, 0x00, -0x00, 0x00, 0x10, 0xF0, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x10, 0xF0, 0x0F, 0x00, 0x00, 0x00, 0x00, -0xF5, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xF0, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x10, 0xF0, 0x3F, 0x00, -0x00, 0x00, 0x00, 0x0A, 0x08, 0x03, 0x03, 0x00, 0x04, 0x09, 0x07, 0x03, 0x03, 0x00, 0x04, 0x08, -0x06, 0x03, 0x02, 0x00, 0x04, 0x08, 0x05, 0x03, 0x01, 0x00, 0x04, 0x0D, 0x0A, 0x07, 0x05, 0x00, -0x08, 0x0C, 0x0A, 0x07, 0x04, 0x00, 0x08, 0x0B, 0x0A, 0x06, 0x05, 0x00, 0x08, 0x0B, 0x0A, 0x05, -0x03, 0x00, 0x08, 0x0B, 0x0A, 0x03, 0x02, 0x00, 0x08, 0x14, 0x12, 0x0C, 0x04, 0x00, 0x10, 0x14, -0x12, 0x09, 0x04, 0x00, 0x10, 0x24, 0x22, 0x1C, 0x12, 0x00, 0x20, 0x24, 0x22, 0x18, 0x0C, 0x00, -0x20, 0x24, 0x22, 0x14, 0x06, 0x00, 0x20, 0x24, 0x22, 0x0F, 0x04, 0x00, 0x20, 0x24, 0x21, 0x0A, -0x04, 0x00, 0x20, 0x23, 0x21, 0x0C, 0x04, 0x00, 0x20, 0x23, 0x1F, 0x0A, 0x04, 0x00, 0x20, 0x22, -0x1F, 0x0F, 0x04, 0x00, 0x20, 0x21, 0x1F, 0x16, 0x0C, 0x00, 0x20, 0x31, 0x2F, 0x20, 0x14, 0x00, -0x30, 0x31, 0x2F, 0x18, 0x10, 0x00, 0x30, 0x31, 0x2C, 0x18, 0x0C, 0x00, 0x30, 0x31, 0x2A, 0x14, -0x0C, 0x00, 0x30, 0x31, 0x28, 0x14, 0x00, 0x00, 0x30, 0x31, 0x24, 0x14, 0x00, 0x00, 0x30, 0x31, -0x1E, 0x14, 0x00, 0x00, 0x30, 0x02, 0x02, 0x02, 0x05, 0x02, 0x04, 0x05, 0x07, 0x07, 0x07, 0x08, -0x0A, 0x01, 0x02, 0x04, 0x06, 0x07, 0x0A, 0x0B, 0x0D, 0x02, 0x03, 0x04, 0x07, 0x08, 0x0B, 0x0D, -0x0F, 0x05, 0x05, 0x07, 0x07, 0x08, 0x0B, 0x0D, 0x0F, 0x05, 0x05, 0x07, 0x07, 0x08, 0x0B, 0x0D, -0x0F, 0x01, 0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x02, 0x03, 0x04, 0x07, 0x08, -0x0B, 0x0C, 0x0D, 0x0E, 0x10, 0x05, 0x05, 0x07, 0x07, 0x08, 0x0B, 0x0D, 0x0F, 0x0F, 0x0F, 0x05, -0x05, 0x07, 0x07, 0x08, 0x0B, 0x0D, 0x0F, 0x0F, 0x0F, 0x04, 0x04, 0x04, 0x05, 0x07, 0x07, 0x09, -0x09, 0x0C, 0x0E, 0x10, 0x12, 0x04, 0x05, 0x06, 0x07, 0x0B, 0x0D, 0x11, 0x13, 0x04, 0x05, 0x06, -0x07, 0x0B, 0x0D, 0x11, 0x13, 0x09, 0x09, 0x09, 0x09, 0x0C, 0x0E, 0x11, 0x13, 0x09, 0x09, 0x09, -0x09, 0x0C, 0x0E, 0x11, 0x13, 0x04, 0x08, 0x09, 0x0A, 0x0C, 0x0E, 0x10, 0x12, 0x13, 0x14, 0x04, -0x08, 0x0A, 0x0C, 0x0E, 0x10, 0x11, 0x13, 0x14, 0x16, 0x09, 0x09, 0x09, 0x09, 0x0C, 0x0E, 0x11, -0x13, 0x13, 0x13, 0x09, 0x09, 0x09, 0x09, 0x0C, 0x0E, 0x11, 0x13, 0x13, 0x13, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x26, 0x2A, 0x00, 0x00, 0x00, 0x1F, 0x21, 0x25, 0x27, -0x28, 0x00, 0x00, 0x00, 0x00, 0x23, 0x26, 0x28, 0x2A, 0x00, 0x00, 0x00, 0x00, 0x23, 0x26, 0x28, -0x2A, 0x00, 0x00, 0x00, 0x00, 0x23, 0x26, 0x28, 0x2A, 0x00, 0x00, 0x00, 0x00, 0x20, 0x25, 0x27, -0x29, 0x29, 0x2A, 0x00, 0x00, 0x00, 0x00, 0x20, 0x25, 0x27, 0x29, 0x29, 0x2A, 0x00, 0x00, 0x00, -0x00, 0x23, 0x26, 0x28, 0x2A, 0x2A, 0x2A, 0x00, 0x00, 0x00, 0x1F, 0x23, 0x26, 0x28, 0x2A, 0x2A, -0x2A, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, -0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, -0x48, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, -0xD8, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, -0xA0, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x01, 0x90, 0x00, 0x00, 0x01, -0xE0, 0x00, 0x00, 0x00, 0xA0, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x01, -0x90, 0x00, 0x00, 0x02, 0x58, 0x00, 0x00, 0x03, 0x20, 0x00, 0x00, 0x06, 0x40, 0x00, 0x00, 0x07, -0xD0, 0x00, 0x00, 0x00, 0xC8, 0x00, 0x00, 0x01, 0x18, 0x00, 0x00, 0x01, 0xE0, 0x00, 0x00, 0x02, -0xD0, 0x00, 0x00, 0x03, 0xE8, 0x00, 0x00, 0x04, 0xB0, 0x00, 0x00, 0x06, 0x40, 0x00, 0x00, 0x07, -0xD0, 0x00, 0x00, 0x00, 0xC8, 0x00, 0x00, 0x01, 0x18, 0x00, 0x00, 0x01, 0xE0, 0x00, 0x00, 0x02, -0xD0, 0x00, 0x00, 0x03, 0xE8, 0x00, 0x00, 0x04, 0xB0, 0x00, 0x00, 0x06, 0x40, 0x00, 0x00, 0x07, -0xD0, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, -0xA0, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x01, 0x90, 0x00, 0x00, 0x01, -0xE0, 0x00, 0x00, 0x04, 0xB0, 0x00, 0x00, 0x09, 0x60, 0x00, 0x00, 0x00, 0xC8, 0x00, 0x00, 0x01, -0x18, 0x00, 0x00, 0x01, 0xE0, 0x00, 0x00, 0x02, 0xD0, 0x00, 0x00, 0x03, 0xE8, 0x00, 0x00, 0x07, -0xD0, 0x00, 0x00, 0x0B, 0xB8, 0x00, 0x00, 0x13, 0x88, 0x00, 0x00, 0x17, 0x70, 0x00, 0x00, 0x1F, -0x40, 0x00, 0x00, 0x00, 0xC8, 0x00, 0x00, 0x01, 0x18, 0x00, 0x00, 0x01, 0xE0, 0x00, 0x00, 0x02, -0xD0, 0x00, 0x00, 0x03, 0xE8, 0x00, 0x00, 0x04, 0xB0, 0x00, 0x00, 0x06, 0x40, 0x00, 0x00, 0x07, -0xD0, 0x00, 0x00, 0x07, 0xD0, 0x00, 0x00, 0x07, 0xD0, 0x00, 0x00, 0x00, 0xC8, 0x00, 0x00, 0x01, -0x18, 0x00, 0x00, 0x01, 0xE0, 0x00, 0x00, 0x02, 0xD0, 0x00, 0x00, 0x03, 0xE8, 0x00, 0x00, 0x04, -0xB0, 0x00, 0x00, 0x06, 0x40, 0x00, 0x00, 0x07, 0xD0, 0x00, 0x00, 0x07, 0xD0, 0x00, 0x00, 0x07, -0xD0, 0x00, 0x02, 0x00, 0x02, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x12, 0x00, 0x18, 0x00, -0x24, 0x00, 0x30, 0x00, 0x48, 0x00, 0x60, 0x00, 0x6C, 0x00, 0x1E, 0x00, 0x32, 0x00, 0x3C, 0x00, -0x50, 0x00, 0x78, 0x00, 0xA0, 0x00, 0xC8, 0x00, 0xF0, 0x00, 0x50, 0x00, 0x78, 0x00, 0xA0, 0x00, -0xC8, 0x01, 0x2C, 0x01, 0x90, 0x03, 0x84, 0x05, 0x14, 0x00, 0x64, 0x00, 0x8C, 0x00, 0xF0, 0x01, -0x68, 0x01, 0xF4, 0x02, 0x58, 0x03, 0x20, 0x03, 0xE8, 0x00, 0x64, 0x00, 0x8C, 0x00, 0xF0, 0x01, -0x68, 0x01, 0xF4, 0x02, 0x58, 0x03, 0x20, 0x03, 0xE8, 0x00, 0x1E, 0x00, 0x32, 0x00, 0x3C, 0x00, -0x50, 0x00, 0x78, 0x00, 0xA0, 0x00, 0xC8, 0x00, 0xF0, 0x02, 0x58, 0x04, 0xB0, 0x00, 0x64, 0x00, -0x8C, 0x00, 0xF0, 0x01, 0x68, 0x01, 0xF4, 0x03, 0xE8, 0x05, 0xDC, 0x09, 0xC4, 0x0B, 0xB8, 0x0F, -0xA0, 0x00, 0x64, 0x00, 0x8C, 0x00, 0xF0, 0x01, 0x68, 0x01, 0xF4, 0x02, 0x58, 0x03, 0x20, 0x03, -0xE8, 0x03, 0xE8, 0x03, 0xE8, 0x00, 0x64, 0x00, 0x8C, 0x00, 0xF0, 0x01, 0x68, 0x01, 0xF4, 0x02, -0x58, 0x03, 0x20, 0x03, 0xE8, 0x03, 0xE8, 0x03, 0xE8, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x10, -0x18, 0x20, 0x30, 0x40, 0x50, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x04, 0x04, 0x05, -0x05, 0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x05, 0x05, 0x02, 0x02, 0x03, 0x03, 0x05, 0x05, 0x06, -0x06, 0x05, 0x06, 0x06, 0x07, 0x07, 0x08, 0x09, 0x0A, 0x05, 0x06, 0x06, 0x07, 0x07, 0x08, 0x09, -0x0A, 0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x05, 0x05, 0x06, 0x07, 0x02, 0x02, 0x03, 0x03, 0x05, -0x05, 0x06, 0x06, 0x08, 0x09, 0x05, 0x06, 0x06, 0x07, 0x07, 0x08, 0x09, 0x0A, 0x0A, 0x0B, 0x05, -0x06, 0x06, 0x07, 0x07, 0x08, 0x09, 0x0A, 0x0A, 0x0B, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x03, -0x04, 0x05, 0x06, 0x07, 0x08, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x05, 0x06, 0x06, -0x07, 0x08, 0x0A, 0x0B, 0x0C, 0x05, 0x06, 0x06, 0x07, 0x08, 0x0A, 0x0B, 0x0C, 0x05, 0x06, 0x07, -0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x05, 0x06, 0x06, 0x07, 0x08, 0x09, 0x0B, 0x0C, 0x0C, 0x0C, 0x05, -0x06, 0x06, 0x07, 0x08, 0x09, 0x0B, 0x0C, 0x0C, 0x0C, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, -0x0C, 0x0C, 0x0C, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0C, 0x0C, 0x19, 0x06, 0x04, -0x02, 0x00, 0x18, 0x14, 0x0D, 0x15, 0x0E, 0x15, 0x0F, 0x16, 0x10, 0x17, 0x11, 0x18, 0x12, 0x18, -0x13, 0x18, 0x1C, 0x15, 0x0E, 0x16, 0x10, 0x17, 0x11, 0x18, 0x12, 0x19, 0x1C, 0x1A, 0x1C, 0x1B, -0x1C, 0x14, 0x0C, 0x14, 0x0D, 0x0E, 0x14, 0x15, 0x0F, 0x16, 0x10, 0x17, 0x11, 0x12, 0x17, 0x0C, -0x1C, 0x0E, 0x14, 0x15, 0x0F, 0x16, 0x10, 0x13, 0x17, 0x18, 0x13, 0x19, 0x18, 0x1A, 0x19, 0x00, -0xC2, 0xAF, 0x80, 0xFE, 0x32, 0x12, 0x45, 0x34, 0x85, 0xD0, 0x0B, 0x75, 0xD0, 0x08, 0xAA, 0xE0, -0xC2, 0x8C, 0xE5, 0x8A, 0x24, 0x67, 0xF5, 0x8A, 0xE5, 0x8C, 0x34, 0x79, 0xF5, 0x8C, 0xD2, 0x8C, -0xEC, 0x24, 0x87, 0xF8, 0xE6, 0xBC, 0x02, 0x02, 0x74, 0xFF, 0xC3, 0x95, 0x81, 0xB4, 0x40, 0x00, -0x40, 0xCE, 0x79, 0x03, 0x78, 0x80, 0x16, 0xE6, 0x08, 0x70, 0x0B, 0xC2, 0xAF, 0xE6, 0x30, 0xE1, -0x03, 0x44, 0x18, 0xF6, 0xD2, 0xAF, 0x08, 0xD9, 0xED, 0xEA, 0x8B, 0xD0, 0x22, 0xE5, 0x0C, 0xFF, -0x23, 0x24, 0x81, 0xF8, 0x0F, 0x08, 0x08, 0xBF, 0x03, 0x04, 0x7F, 0x00, 0x78, 0x81, 0xE6, 0x30, -0xE4, 0xF2, 0x00, 0xE5, 0x0C, 0xC3, 0x9F, 0x50, 0x20, 0x05, 0x0C, 0x74, 0x86, 0x25, 0x0C, 0xF8, -0xE6, 0xFD, 0xA6, 0x81, 0x08, 0xE6, 0xAE, 0x0C, 0xBE, 0x02, 0x02, 0x74, 0xFF, 0xCD, 0xF8, 0xE8, -0x6D, 0x60, 0xE0, 0x08, 0xE6, 0xC0, 0xE0, 0x80, 0xF6, 0xE5, 0x0C, 0xD3, 0x9F, 0x40, 0x27, 0xE5, -0x0C, 0x24, 0x87, 0xF8, 0xE6, 0xAE, 0x0C, 0xBE, 0x02, 0x02, 0x74, 0xFF, 0xFD, 0x18, 0xE6, 0xCD, -0xF8, 0xE5, 0x81, 0x6D, 0x60, 0x06, 0xD0, 0xE0, 0xF6, 0x18, 0x80, 0xF5, 0xE5, 0x0C, 0x24, 0x86, -0xC8, 0xF6, 0x15, 0x0C, 0x80, 0xD3, 0xE5, 0x0C, 0x23, 0x24, 0x81, 0xF8, 0x7F, 0x04, 0xC2, 0xAF, -0xE6, 0x30, 0xE0, 0x03, 0x10, 0xE2, 0x0C, 0x7F, 0x00, 0x30, 0xE1, 0x07, 0x30, 0xE3, 0x04, 0x7F, -0x08, 0x54, 0xF4, 0x54, 0x7C, 0xC6, 0xD2, 0xAF, 0x54, 0x80, 0x42, 0x07, 0x22, 0x78, 0x86, 0xA6, -0x81, 0x74, 0x02, 0x60, 0x06, 0xFF, 0x08, 0x76, 0xFF, 0xDF, 0xFB, 0x7F, 0x03, 0xE4, 0x78, 0x80, -0xF6, 0x08, 0xF6, 0x08, 0xDF, 0xFA, 0x78, 0x81, 0x76, 0x30, 0x90, 0x49, 0x29, 0x74, 0x01, 0x93, -0xC0, 0xE0, 0xE4, 0x93, 0xC0, 0xE0, 0x43, 0x89, 0x01, 0x75, 0x8A, 0x60, 0x75, 0x8C, 0x79, 0xD2, -0x8C, 0xD2, 0xAF, 0x22, 0x02, 0xEF, 0xD3, 0x94, 0x02, 0x40, 0x03, 0x7F, 0xFF, 0x22, 0x74, 0x81, -0x2F, 0x2F, 0xF8, 0xE6, 0x20, 0xE5, 0xF4, 0xC2, 0xAF, 0xE6, 0x44, 0x30, 0xF6, 0xD2, 0xAF, 0xAE, -0x0C, 0xEE, 0xC3, 0x9F, 0x50, 0x21, 0x0E, 0x74, 0x86, 0x2E, 0xF8, 0xE6, 0xF9, 0x08, 0xE6, 0x18, -0xBE, 0x02, 0x02, 0x74, 0xFF, 0xFD, 0xED, 0x69, 0x60, 0x09, 0x09, 0xE7, 0x19, 0x19, 0xF7, 0x09, -0x09, 0x80, 0xF3, 0x16, 0x16, 0x80, 0xDA, 0xEE, 0xD3, 0x9F, 0x40, 0x04, 0x05, 0x81, 0x05, 0x81, -0xEE, 0xD3, 0x9F, 0x40, 0x22, 0x74, 0x86, 0x2E, 0xF8, 0x08, 0xE6, 0xF9, 0xEE, 0xB5, 0x0C, 0x02, -0xA9, 0x81, 0x18, 0x06, 0x06, 0xE6, 0xFD, 0xED, 0x69, 0x60, 0x09, 0x19, 0x19, 0xE7, 0x09, 0x09, -0xF7, 0x19, 0x80, 0xF3, 0x1E, 0x80, 0xD9, 0xEF, 0x24, 0x86, 0xF8, 0xE6, 0x04, 0xF8, 0xEF, 0x2F, -0x04, 0x90, 0x49, 0x29, 0x93, 0xF6, 0x08, 0xEF, 0x2F, 0x93, 0xF6, 0x7F, 0x00, 0x22, 0xEF, 0xD3, -0x94, 0x02, 0x40, 0x03, 0x7F, 0xFF, 0x22, 0xEF, 0x23, 0x24, 0x81, 0xF8, 0xE6, 0x30, 0xE5, 0xF4, -0xC2, 0xAF, 0xE6, 0x54, 0x8C, 0xF6, 0xD2, 0xAF, 0xE5, 0x0C, 0xB5, 0x07, 0x0A, 0x74, 0x86, 0x2F, -0xF8, 0xE6, 0xF5, 0x81, 0x02, 0x45, 0x7D, 0x50, 0x2E, 0x74, 0x87, 0x2F, 0xF8, 0xE6, 0xBF, 0x02, -0x02, 0x74, 0xFF, 0xFD, 0x18, 0xE6, 0xF9, 0x74, 0x86, 0x2F, 0xF8, 0xFB, 0xE6, 0xFC, 0xE9, 0x6C, -0x60, 0x08, 0xA8, 0x05, 0xE7, 0xF6, 0x1D, 0x19, 0x80, 0xF4, 0xA8, 0x03, 0xA6, 0x05, 0x1F, 0xE5, -0x0C, 0xB5, 0x07, 0xE3, 0x7F, 0x00, 0x22, 0x74, 0x87, 0x2F, 0xF8, 0xE6, 0xFD, 0x18, 0x86, 0x01, -0x0F, 0x74, 0x86, 0x2F, 0xF8, 0xA6, 0x01, 0x08, 0x86, 0x04, 0xE5, 0x0C, 0xB5, 0x07, 0x02, 0xAC, -0x81, 0xED, 0x6C, 0x60, 0x08, 0x0D, 0x09, 0xA8, 0x05, 0xE6, 0xF7, 0x80, 0xF4, 0xE5, 0x0C, 0xB5, -0x07, 0xDE, 0x89, 0x81, 0x7F, 0x00, 0x22, 0xEF, 0xD3, 0x94, 0x02, 0x40, 0x03, 0x7F, 0xFF, 0x22, -0xEF, 0x23, 0x24, 0x81, 0xF8, 0xC2, 0xAF, 0xE6, 0x30, 0xE5, 0x05, 0x30, 0xE0, 0x02, 0xD2, 0xE4, -0xD2, 0xE2, 0xC6, 0xD2, 0xAF, 0x7F, 0x00, 0x30, 0xE2, 0x01, 0x0F, 0x02, 0x45, 0x7C, 0x8F, 0xF0, -0xE4, 0xFF, 0xFE, 0xE5, 0x0C, 0x23, 0x24, 0x80, 0xF8, 0xC2, 0xA9, 0x30, 0xF7, 0x0D, 0x7F, 0x08, -0xE6, 0x60, 0x0B, 0x2D, 0xF6, 0x60, 0x30, 0x50, 0x2E, 0x80, 0x07, 0x30, 0xF1, 0x06, 0xED, 0xF6, -0x60, 0x25, 0x7E, 0x02, 0x08, 0x30, 0xF0, 0x10, 0xC2, 0xAF, 0xE6, 0x10, 0xE7, 0x23, 0x0E, 0x30, -0xE2, 0x0C, 0xD2, 0xAF, 0x7F, 0x04, 0x80, 0x12, 0xC2, 0xAF, 0xE6, 0x10, 0xE7, 0x13, 0x54, 0xEC, -0x4E, 0xF6, 0xD2, 0xAF, 0x02, 0x45, 0x7D, 0x7F, 0x08, 0x08, 0xEF, 0x44, 0x83, 0xF4, 0xC2, 0xAF, -0x56, 0xC6, 0xD2, 0xAF, 0x54, 0x80, 0x4F, 0xFF, 0x22, 0xEF, 0x2B, 0xFF, 0xEE, 0x3A, 0xFE, 0xED, -0x39, 0xFD, 0xEC, 0x38, 0xFC, 0x22, 0xEF, 0x5B, 0xFF, 0xEE, 0x5A, 0xFE, 0xED, 0x59, 0xFD, 0xEC, -0x58, 0xFC, 0x22, 0xEF, 0x4B, 0xFF, 0xEE, 0x4A, 0xFE, 0xED, 0x49, 0xFD, 0xEC, 0x48, 0xFC, 0x22, -0xEB, 0x9F, 0xF5, 0xF0, 0xEA, 0x9E, 0x42, 0xF0, 0xE9, 0x9D, 0x42, 0xF0, 0xE8, 0x9C, 0x45, 0xF0, -0x22, 0xE0, 0xFC, 0xA3, 0xE0, 0xFD, 0xA3, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x22, 0xE4, 0x93, 0xFC, -0x74, 0x01, 0x93, 0xFD, 0x74, 0x02, 0x93, 0xFE, 0x74, 0x03, 0x93, 0xFF, 0x22, 0xE0, 0xF8, 0xA3, -0xE0, 0xF9, 0xA3, 0xE0, 0xFA, 0xA3, 0xE0, 0xFB, 0x22, 0xE4, 0x93, 0xF8, 0x74, 0x01, 0x93, 0xF9, -0x74, 0x02, 0x93, 0xFA, 0x74, 0x03, 0x93, 0xFB, 0x22, 0xA4, 0x25, 0x82, 0xF5, 0x82, 0xE5, 0xF0, -0x35, 0x83, 0xF5, 0x83, 0x22, 0xE0, 0xFB, 0xA3, 0xE0, 0xFA, 0xA3, 0xE0, 0xF9, 0x22, 0xEB, 0xF0, -0xA3, 0xEA, 0xF0, 0xA3, 0xE9, 0xF0, 0x22, 0xD0, 0x83, 0xD0, 0x82, 0xF8, 0xE4, 0x93, 0x70, 0x12, -0x74, 0x01, 0x93, 0x70, 0x0D, 0xA3, 0xA3, 0x93, 0xF8, 0x74, 0x01, 0x93, 0xF5, 0x82, 0x88, 0x83, -0xE4, 0x73, 0x74, 0x02, 0x93, 0x68, 0x60, 0xEF, 0xA3, 0xA3, 0xA3, 0x80, 0xDF, 0x02, 0x46, 0x0D, -0xE4, 0x93, 0xA3, 0xF8, 0xE4, 0x93, 0xA3, 0x40, 0x03, 0xF6, 0x80, 0x01, 0xF2, 0x08, 0xDF, 0xF4, -0x80, 0x29, 0xE4, 0x93, 0xA3, 0xF8, 0x54, 0x07, 0x24, 0x0C, 0xC8, 0xC3, 0x33, 0xC4, 0x54, 0x0F, -0x44, 0x20, 0xC8, 0x83, 0x40, 0x04, 0xF4, 0x56, 0x80, 0x01, 0x46, 0xF6, 0xDF, 0xE4, 0x80, 0x0B, -0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x90, 0x49, 0x10, 0xE4, 0x7E, 0x01, 0x93, 0x60, -0xBC, 0xA3, 0xFF, 0x54, 0x3F, 0x30, 0xE5, 0x09, 0x54, 0x1F, 0xFE, 0xE4, 0x93, 0xA3, 0x60, 0x01, -0x0E, 0xCF, 0x54, 0xC0, 0x25, 0xE0, 0x60, 0xA8, 0x40, 0xB8, 0xE4, 0x93, 0xA3, 0xFA, 0xE4, 0x93, -0xA3, 0xF8, 0xE4, 0x93, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCA, 0xC5, 0x83, 0xCA, 0xF0, 0xA3, 0xC8, -0xC5, 0x82, 0xC8, 0xCA, 0xC5, 0x83, 0xCA, 0xDF, 0xE9, 0xDE, 0xE7, 0x80, 0xBE, 0x02, 0x48, 0xC8, -0x00, 0x41, 0xA7, 0x7B, 0x00, 0x41, 0xA7, 0x7C, 0x00, 0x41, 0xA7, 0x7D, 0x00, 0x41, 0xA7, 0x84, -0x00, 0x41, 0xA7, 0x85, 0x00, 0x41, 0xA7, 0x86, 0x00, 0x4C, 0x47, 0x50, 0x29, 0x58, 0x1D, 0x31, -0x82, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0xE4, 0xFF, 0x90, 0xA7, 0x18, 0xF0, 0x90, 0x01, -0xC7, 0xE0, 0x64, 0xAD, 0x70, 0x37, 0xF0, 0x90, 0xA7, 0x25, 0x74, 0x0F, 0xF0, 0x90, 0xA7, 0x17, -0x74, 0x0A, 0xF0, 0xA3, 0xE0, 0x04, 0xF0, 0x90, 0xA7, 0x18, 0xE0, 0x2F, 0xFE, 0x74, 0x19, 0x2F, -0xF5, 0x82, 0xE4, 0x34, 0xA7, 0xF5, 0x83, 0xEE, 0xF0, 0x0F, 0xEF, 0xB4, 0x0F, 0xE9, 0x90, 0x01, -0x3F, 0x74, 0x04, 0xF0, 0x7B, 0x01, 0x7A, 0xA7, 0x79, 0x17, 0x12, 0xAD, 0xCD, 0xD0, 0xD0, 0x92, -0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x7F, 0x8F, 0x71, 0x31, 0xEF, 0x20, 0xE6, -0x02, 0x41, 0xFF, 0x90, 0x00, 0x8C, 0xE0, 0xF5, 0x6E, 0x7F, 0x8D, 0x71, 0x31, 0x90, 0x00, 0x8E, -0xE0, 0xF5, 0x6F, 0xEF, 0x24, 0xFC, 0x60, 0x12, 0x24, 0xEE, 0x70, 0x02, 0x41, 0xB0, 0x24, 0x15, -0x60, 0x02, 0x41, 0xF1, 0xAF, 0x6E, 0x91, 0xF2, 0x41, 0xF1, 0x74, 0x17, 0x25, 0x6E, 0xF5, 0x82, -0xE4, 0x34, 0x9C, 0xF5, 0x83, 0xE0, 0xFB, 0xE4, 0xFD, 0xFF, 0x71, 0x09, 0x75, 0xF0, 0x05, 0xE5, -0x6E, 0x90, 0x97, 0x9A, 0x11, 0x49, 0xE0, 0x13, 0x13, 0x54, 0x03, 0xFB, 0x0D, 0xE4, 0xFF, 0x71, -0x09, 0x75, 0xF0, 0x05, 0xE5, 0x6E, 0x90, 0x97, 0x9A, 0x11, 0x49, 0xE0, 0xC4, 0x13, 0x13, 0x13, -0x54, 0x01, 0xFB, 0x0D, 0xE4, 0xFF, 0x71, 0x09, 0x75, 0xF0, 0x05, 0xE5, 0x6E, 0x90, 0x97, 0x9A, -0x11, 0x49, 0xE0, 0xC4, 0x54, 0x03, 0xFB, 0x0D, 0xE4, 0xFF, 0x71, 0x09, 0x75, 0xF0, 0x05, 0xE5, -0x6E, 0x90, 0x97, 0x97, 0x11, 0x49, 0xE0, 0xFB, 0xE4, 0xFD, 0x0F, 0x71, 0x09, 0x75, 0xF0, 0x05, -0xE5, 0x6E, 0x90, 0x97, 0x98, 0x71, 0x04, 0x75, 0xF0, 0x05, 0xE5, 0x6E, 0x90, 0x97, 0x99, 0x11, -0x49, 0xE0, 0xC4, 0x13, 0x54, 0x01, 0xFB, 0x0D, 0x7F, 0x01, 0x71, 0x09, 0x75, 0xF0, 0x05, 0xE5, -0x6E, 0x90, 0x97, 0x99, 0x11, 0x49, 0xE0, 0x54, 0x1F, 0xFB, 0x0D, 0x71, 0x09, 0x75, 0xF0, 0x08, -0xE5, 0x6E, 0x90, 0x89, 0x00, 0x11, 0x49, 0xE0, 0xFB, 0xE4, 0xFD, 0x0F, 0x71, 0x09, 0x75, 0xF0, -0x08, 0xE5, 0x6E, 0x90, 0x89, 0x01, 0x71, 0x04, 0x75, 0xF0, 0x08, 0xE5, 0x6E, 0x90, 0x89, 0x02, -0x71, 0x04, 0x75, 0xF0, 0x08, 0xE5, 0x6E, 0x90, 0x89, 0x03, 0x71, 0x04, 0x75, 0xF0, 0x08, 0xE5, -0x6E, 0x90, 0x89, 0x04, 0x11, 0x49, 0xE0, 0xFB, 0xE4, 0xFD, 0x0F, 0x71, 0x09, 0x75, 0xF0, 0x08, -0xE5, 0x6E, 0x90, 0x89, 0x05, 0x71, 0x04, 0x75, 0xF0, 0x08, 0xE5, 0x6E, 0x90, 0x89, 0x06, 0x71, -0x04, 0x75, 0xF0, 0x08, 0xE5, 0x6E, 0x90, 0x89, 0x07, 0x11, 0x49, 0xE0, 0xFB, 0x0D, 0x80, 0x3F, -0x90, 0xA5, 0xD7, 0xE0, 0xFB, 0xE4, 0xFD, 0xFF, 0x71, 0x09, 0x90, 0xA5, 0xD8, 0xA3, 0xE0, 0xFB, -0x0D, 0x71, 0x09, 0x90, 0xA5, 0xDA, 0xE0, 0xFB, 0x0D, 0x71, 0x09, 0x90, 0xA5, 0xDB, 0xE0, 0x54, -0x03, 0xFB, 0x0D, 0x71, 0x09, 0x90, 0xA5, 0xDC, 0xA3, 0xE0, 0xFB, 0xE4, 0xFD, 0x0F, 0x71, 0x09, -0x90, 0xA5, 0xDC, 0xE0, 0xFB, 0x0D, 0x71, 0x09, 0x90, 0xA5, 0xDE, 0xE0, 0xFB, 0x1D, 0x0F, 0x71, -0x09, 0x7F, 0x8F, 0x71, 0x31, 0xEF, 0x30, 0xE0, 0x06, 0xE4, 0xFD, 0x7F, 0x8D, 0x71, 0xED, 0xD0, -0xD0, 0x92, 0xAF, 0x22, 0x11, 0x49, 0xE0, 0xFB, 0x0D, 0xEF, 0x70, 0x04, 0x74, 0xF0, 0x80, 0x16, -0xEF, 0xB4, 0x01, 0x04, 0x74, 0xF4, 0x80, 0x0E, 0xEF, 0xB4, 0x02, 0x04, 0x74, 0xF8, 0x80, 0x06, -0xEF, 0xB4, 0x03, 0x0C, 0x74, 0xFC, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0x02, 0xF5, 0x83, 0xEB, 0xF0, -0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x8F, 0x82, 0x75, 0x83, 0x00, 0xE0, 0x90, 0xA7, -0xA3, 0xF0, 0x7F, 0x10, 0x7E, 0x00, 0x12, 0x3E, 0x87, 0x90, 0xA7, 0xA3, 0xE0, 0xFF, 0xD0, 0xD0, -0x92, 0xAF, 0x22, 0x7F, 0xFF, 0x12, 0x53, 0x88, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x12, -0x5F, 0x40, 0x71, 0xE3, 0x71, 0xD7, 0x71, 0xD7, 0x90, 0x01, 0x00, 0x74, 0x3F, 0xF0, 0xA3, 0xE0, -0x54, 0xFD, 0xF0, 0x90, 0x05, 0x53, 0xE0, 0x44, 0x20, 0xF0, 0x90, 0xA5, 0x4C, 0xE0, 0xFF, 0x13, -0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x06, 0x90, 0x07, 0x78, 0x74, 0x01, 0xF0, 0xEF, 0xC3, 0x13, -0x30, 0xE0, 0x37, 0x90, 0xA5, 0x8D, 0xE0, 0x60, 0x08, 0x90, 0xA7, 0x9B, 0x74, 0x01, 0xF0, 0x80, -0x05, 0xE4, 0x90, 0xA7, 0x9B, 0xF0, 0x90, 0xA5, 0x4C, 0xE0, 0xC4, 0x13, 0x54, 0x07, 0x30, 0xE0, -0x07, 0xE4, 0x90, 0xA7, 0x9C, 0xF0, 0x80, 0x06, 0x90, 0xA7, 0x9C, 0x74, 0x02, 0xF0, 0x90, 0xA7, -0x9B, 0x12, 0x69, 0xED, 0x90, 0x07, 0x78, 0x74, 0x01, 0xF0, 0x90, 0xA5, 0x4B, 0xE0, 0x60, 0x02, -0xE4, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x7F, 0x02, 0x71, 0x31, 0xEF, 0x44, 0x01, 0xFD, 0x7F, -0x02, 0x71, 0xED, 0x7F, 0x02, 0x71, 0x31, 0xEF, 0x54, 0xFE, 0xFD, 0x7F, 0x02, 0xD3, 0x10, 0xAF, -0x01, 0xC3, 0xC0, 0xD0, 0x8F, 0x82, 0x75, 0x83, 0x00, 0xED, 0xF0, 0x7F, 0x10, 0x7E, 0x00, 0x12, -0x3E, 0x87, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x7F, 0x54, 0x71, 0x31, 0xE5, 0x0D, 0x5F, 0xF5, 0x11, -0x7F, 0x55, 0x71, 0x31, 0xE5, 0x0E, 0x5F, 0xF5, 0x12, 0x7F, 0x56, 0x71, 0x31, 0xE5, 0x0F, 0x5F, -0xF5, 0x13, 0x7F, 0x57, 0x71, 0x31, 0xE5, 0x10, 0x5F, 0xF5, 0x14, 0xAD, 0x11, 0x7F, 0x54, 0x71, -0xED, 0xAD, 0x12, 0x7F, 0x55, 0x71, 0xED, 0xAD, 0x13, 0x7F, 0x56, 0x71, 0xED, 0xAD, 0x14, 0x7F, -0x57, 0x71, 0xED, 0x53, 0x91, 0xEF, 0x22, 0x7F, 0x81, 0x71, 0x31, 0xEF, 0x54, 0xFE, 0xFD, 0x7F, -0x81, 0x71, 0xED, 0x7F, 0x80, 0x71, 0x31, 0xEF, 0x44, 0x80, 0xFD, 0x7F, 0x80, 0x71, 0xED, 0x12, -0xAF, 0xA6, 0x12, 0x3E, 0x48, 0x12, 0xAF, 0xB3, 0x12, 0xB0, 0x7F, 0x7F, 0x01, 0x12, 0x46, 0x45, -0x90, 0xA5, 0xAC, 0x74, 0x02, 0xF0, 0xFF, 0x12, 0x46, 0x45, 0x90, 0xA5, 0xAC, 0xE0, 0x04, 0xF0, -0x12, 0x50, 0x0E, 0x12, 0x72, 0x35, 0x7F, 0x80, 0x71, 0x31, 0xEF, 0x44, 0x40, 0xFD, 0x7F, 0x80, -0x71, 0xED, 0x75, 0x28, 0xFF, 0xF1, 0xEE, 0x12, 0xAF, 0xF4, 0x7F, 0x81, 0x71, 0x31, 0xEF, 0x44, -0x04, 0xFD, 0x7F, 0x81, 0x71, 0xED, 0x12, 0xB0, 0x8D, 0xE4, 0xFF, 0x02, 0x46, 0xCE, 0x90, 0xA5, -0x25, 0xE0, 0xFD, 0x7F, 0x93, 0x71, 0xED, 0x90, 0xA5, 0x1C, 0xE0, 0x60, 0x12, 0x90, 0x01, 0x2F, -0xE0, 0x30, 0xE7, 0x05, 0x74, 0x10, 0xF0, 0x80, 0x06, 0x90, 0x01, 0x2F, 0x74, 0x90, 0xF0, 0x7F, -0x08, 0x71, 0x31, 0xEF, 0x44, 0x10, 0xFD, 0x7F, 0x08, 0x71, 0xED, 0x7F, 0x01, 0xF1, 0x83, 0x7F, -0x90, 0x71, 0x31, 0xEF, 0x44, 0x01, 0xFD, 0x7F, 0x90, 0x71, 0xED, 0x7F, 0x14, 0x7E, 0x00, 0x02, -0x3E, 0x87, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0xA7, 0x9F, 0xEF, 0xF0, 0x7F, 0x8F, -0x71, 0x31, 0xEF, 0x30, 0xE6, 0x48, 0x7F, 0x8D, 0x71, 0x31, 0xEF, 0x64, 0x01, 0x70, 0x3F, 0x90, -0xA7, 0xA0, 0xF0, 0x90, 0xA7, 0xA0, 0xE0, 0xFD, 0x90, 0xA7, 0x9F, 0xE0, 0x75, 0xF0, 0x10, 0x90, -0x81, 0x00, 0x11, 0x49, 0xE5, 0x82, 0x2D, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE0, 0xFB, -0xE4, 0xFF, 0x71, 0x09, 0x90, 0xA7, 0xA0, 0xE0, 0x04, 0xF0, 0xE0, 0xC3, 0x94, 0x10, 0x40, 0xD3, -0x7F, 0x8F, 0x71, 0x31, 0xEF, 0x30, 0xE0, 0x06, 0xE4, 0xFD, 0x7F, 0x8D, 0x71, 0xED, 0xD0, 0xD0, -0x92, 0xAF, 0x22, 0x90, 0xFD, 0x68, 0xE0, 0xFF, 0x90, 0xFD, 0x60, 0xE0, 0x90, 0xA6, 0xA2, 0xF0, -0xEF, 0x20, 0xE0, 0x02, 0xC1, 0xD6, 0x90, 0xA7, 0x7D, 0xE0, 0x70, 0x18, 0x7F, 0x2E, 0x71, 0x31, -0x90, 0xA5, 0x89, 0xEF, 0xF0, 0x7F, 0x2D, 0x71, 0x31, 0x90, 0xA5, 0x8A, 0xEF, 0xF0, 0x90, 0xA7, -0x7D, 0x74, 0x01, 0xF0, 0x90, 0xA6, 0xA2, 0xE0, 0x64, 0x15, 0x70, 0x6C, 0x90, 0xFD, 0x62, 0xE0, -0xFF, 0x30, 0xE6, 0x1C, 0xF4, 0x54, 0x3F, 0x04, 0xFE, 0x90, 0xA5, 0x89, 0xE0, 0x13, 0x13, 0x54, -0x3F, 0xC3, 0x9E, 0x90, 0xA6, 0xA1, 0xF0, 0xD3, 0x94, 0x3F, 0x40, 0x1D, 0xE4, 0xF0, 0x80, 0x19, -0x90, 0xA5, 0x89, 0xE0, 0x13, 0x13, 0x54, 0x3F, 0xFE, 0xEF, 0x54, 0x3F, 0x2E, 0x90, 0xA6, 0xA1, -0xF0, 0xD3, 0x94, 0x3F, 0x40, 0x03, 0x74, 0x3F, 0xF0, 0x90, 0xA6, 0xA1, 0xE0, 0xFF, 0x54, 0x30, -0xC4, 0x54, 0x0F, 0xFE, 0xEF, 0x25, 0xE0, 0x25, 0xE0, 0x4E, 0x90, 0xA6, 0x9F, 0xF0, 0xE0, 0xFD, -0x7F, 0x2E, 0x71, 0xED, 0x90, 0xA6, 0xA1, 0xE0, 0xC4, 0x54, 0xF0, 0xFF, 0x90, 0xA5, 0x8A, 0xE0, -0x54, 0x0F, 0x4F, 0xFD, 0x7F, 0x2D, 0x71, 0xED, 0x90, 0xA6, 0xA2, 0xE0, 0xB4, 0x21, 0x0C, 0x90, -0xFD, 0x62, 0xE0, 0xFF, 0x12, 0x91, 0x91, 0x7F, 0x04, 0xD1, 0xDC, 0x90, 0xA6, 0xA2, 0xE0, 0xB4, -0x23, 0x04, 0x7F, 0x01, 0xD1, 0xD7, 0x90, 0xA6, 0xA2, 0xE0, 0xB4, 0x27, 0x04, 0x7F, 0x02, 0xD1, -0xD7, 0x90, 0xA6, 0xA2, 0xE0, 0xB4, 0x30, 0x0C, 0xE4, 0xFB, 0xFD, 0x7F, 0x01, 0x12, 0x93, 0xD4, -0x7F, 0x04, 0xD1, 0xDC, 0x90, 0xA6, 0xA2, 0xE0, 0x64, 0x34, 0x70, 0x38, 0x90, 0xFD, 0x62, 0xE0, -0x30, 0xE0, 0x27, 0x90, 0xA6, 0x9F, 0x74, 0x01, 0xF0, 0xFB, 0x7A, 0xA6, 0x79, 0x9F, 0xFD, 0x7F, -0x34, 0x12, 0x58, 0xA1, 0x90, 0xA6, 0x9F, 0x74, 0x03, 0xF0, 0xE0, 0xFF, 0x12, 0x9F, 0x74, 0x90, -0x04, 0x9D, 0xE4, 0xF0, 0xE0, 0x44, 0x01, 0xF0, 0x80, 0x0A, 0x12, 0x69, 0xCE, 0x90, 0x04, 0x9D, -0xE0, 0x54, 0xFE, 0xF0, 0x90, 0xA6, 0xA2, 0xE0, 0xFD, 0xB4, 0x35, 0x07, 0x90, 0xA5, 0x55, 0xE0, -0x44, 0x01, 0xF0, 0xED, 0xB4, 0x36, 0x23, 0x90, 0xFD, 0x61, 0xE0, 0x90, 0xA6, 0x9F, 0xF0, 0x90, -0xFD, 0x62, 0xE0, 0x90, 0xA6, 0xA0, 0xF0, 0x90, 0xA6, 0xA2, 0xE0, 0xFF, 0x90, 0xA6, 0x9F, 0xE0, -0xFD, 0x7B, 0x01, 0x7A, 0xA6, 0x79, 0xA0, 0x12, 0x58, 0xA1, 0x90, 0xA6, 0xA2, 0xE0, 0xB4, 0x37, -0x03, 0x12, 0xA0, 0x0C, 0x90, 0xA6, 0xA2, 0xE0, 0xB4, 0x40, 0x14, 0x90, 0xFD, 0x62, 0xE0, 0x30, -0xE0, 0x08, 0x90, 0xA5, 0x71, 0x74, 0x01, 0xF0, 0x80, 0x05, 0xE4, 0x90, 0xA5, 0x71, 0xF0, 0x90, -0xFD, 0x68, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0x12, 0x91, 0xAB, 0x7F, 0x04, 0x8F, 0x72, 0x7F, 0x02, -0x12, 0x47, 0x57, 0x90, 0xA3, 0x98, 0xE0, 0x45, 0x72, 0xF0, 0x22, 0xE4, 0xF5, 0x0D, 0xF5, 0x0E, -0xF5, 0x0F, 0x75, 0x10, 0x80, 0xAD, 0x0D, 0x7F, 0x50, 0x71, 0xED, 0xAD, 0x0E, 0x7F, 0x51, 0x71, -0xED, 0xAD, 0x0F, 0x7F, 0x52, 0x71, 0xED, 0xAD, 0x10, 0x7F, 0x53, 0x61, 0xED, 0x90, 0x01, 0x30, -0xE4, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0x38, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, -0xA3, 0xF0, 0xFD, 0x7F, 0x50, 0x71, 0xED, 0xE4, 0xFD, 0x7F, 0x51, 0x71, 0xED, 0xE4, 0xFD, 0x7F, -0x52, 0x71, 0xED, 0xE4, 0xFD, 0x7F, 0x53, 0x61, 0xED, 0x90, 0x01, 0x34, 0x74, 0xFF, 0xF0, 0xA3, -0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0x3C, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xFD, -0x7F, 0x54, 0x71, 0xED, 0x7D, 0xFF, 0x7F, 0x55, 0x71, 0xED, 0x7D, 0xFF, 0x7F, 0x56, 0x71, 0xED, -0x7D, 0xFF, 0x7F, 0x57, 0x61, 0xED, 0xF1, 0x0D, 0xF1, 0x39, 0x12, 0xAF, 0x5F, 0x12, 0xAF, 0x7E, -0xC1, 0xEB, 0x12, 0xB4, 0xBC, 0x7F, 0x08, 0x71, 0x31, 0xEF, 0x54, 0xEF, 0xFD, 0x7F, 0x08, 0x71, -0xED, 0xE4, 0xFF, 0x90, 0xA7, 0x8D, 0xEF, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0x09, -0xE0, 0x7F, 0x00, 0x30, 0xE7, 0x02, 0x7F, 0x01, 0x90, 0xA7, 0x8D, 0xE0, 0x6F, 0x60, 0x3E, 0xC3, -0x90, 0xA7, 0x8F, 0xE0, 0x94, 0x88, 0x90, 0xA7, 0x8E, 0xE0, 0x94, 0x13, 0x40, 0x08, 0x90, 0x01, -0xC0, 0xE0, 0x44, 0x10, 0xF0, 0x22, 0x90, 0xA7, 0x8E, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x08, 0xD6, -0x7F, 0x14, 0x7E, 0x00, 0x12, 0x3E, 0x87, 0xD3, 0x90, 0xA7, 0x8F, 0xE0, 0x94, 0x32, 0x90, 0xA7, -0x8E, 0xE0, 0x94, 0x00, 0x40, 0xB7, 0x90, 0x01, 0xC6, 0xE0, 0x30, 0xE0, 0xB0, 0x22, 0x7D, 0x20, -0x71, 0x53, 0x90, 0xA5, 0x15, 0x74, 0x02, 0xF0, 0x22, 0x12, 0xB6, 0xEA, 0x80, 0xF0, 0x75, 0xE8, -0x07, 0x75, 0xA8, 0x85, 0x22, 0x7F, 0xF4, 0x71, 0x31, 0xEF, 0x20, 0xE5, 0x0E, 0x7F, 0xF4, 0x12, -0x4B, 0x31, 0xEF, 0x7F, 0x01, 0x20, 0xE4, 0x05, 0x7F, 0x02, 0x22, 0x7F, 0x03, 0x22, 0x12, 0x4F, -0xF5, 0x90, 0xA3, 0x9D, 0xEF, 0xF0, 0x12, 0x4F, 0x66, 0x90, 0x01, 0x64, 0x74, 0x01, 0xF0, 0x90, -0x04, 0x23, 0xE0, 0x44, 0x80, 0xF0, 0x02, 0x37, 0xF8, 0xE4, 0x90, 0xA6, 0x64, 0xF0, 0x90, 0xA6, -0x64, 0xE0, 0x64, 0x01, 0xF0, 0x24, 0x29, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x50, 0xA3, 0xF0, 0x12, -0x3E, 0x7B, 0xBF, 0x01, 0x03, 0x12, 0x31, 0xF7, 0x90, 0xA5, 0x1B, 0xE0, 0x60, 0x0E, 0x90, 0xA5, -0x1E, 0xE0, 0xFF, 0x90, 0xA5, 0x1D, 0xE0, 0x6F, 0x60, 0x02, 0x11, 0x71, 0xC2, 0xAF, 0x12, 0xB0, -0x4E, 0xBF, 0x01, 0x03, 0x12, 0xB7, 0x96, 0xD2, 0xAF, 0x12, 0x49, 0x2F, 0x12, 0x45, 0x7D, 0x80, -0xBD, 0x90, 0xA5, 0x12, 0xE0, 0x90, 0xA5, 0x1D, 0x30, 0xE0, 0x05, 0xE0, 0xFF, 0x02, 0xB7, 0xD0, -0xE0, 0xFF, 0x7D, 0x01, 0x80, 0x04, 0x7D, 0x01, 0x7F, 0x04, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, -0xD0, 0x90, 0xA7, 0xAB, 0xED, 0xF0, 0x90, 0xA5, 0x17, 0xE0, 0xFE, 0xC4, 0x13, 0x13, 0x54, 0x03, -0x30, 0xE0, 0x02, 0x21, 0xE6, 0xEE, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x02, 0x21, -0xE6, 0x90, 0xA5, 0x1E, 0xE0, 0xFE, 0x6F, 0x70, 0x02, 0x21, 0xE6, 0xEF, 0x70, 0x02, 0x21, 0x4C, -0x24, 0xFE, 0x70, 0x02, 0x21, 0x86, 0x24, 0xFE, 0x60, 0x4A, 0x24, 0xFC, 0x70, 0x02, 0x21, 0xC1, -0x24, 0xFC, 0x60, 0x02, 0x21, 0xD6, 0xEE, 0xB4, 0x0E, 0x02, 0x51, 0x75, 0x90, 0xA5, 0x1E, 0xE0, -0x70, 0x04, 0x7F, 0x01, 0x51, 0xA5, 0x90, 0xA5, 0x1E, 0xE0, 0xB4, 0x06, 0x02, 0x51, 0x4B, 0x90, -0xA5, 0x1E, 0xE0, 0xB4, 0x04, 0x0F, 0x90, 0xA7, 0xAB, 0xE0, 0xFF, 0x60, 0x05, 0x12, 0xBB, 0x46, -0x80, 0x03, 0x12, 0x77, 0xAA, 0x90, 0xA5, 0x1E, 0xE0, 0x64, 0x08, 0x60, 0x02, 0x21, 0xD6, 0x12, -0xBC, 0x46, 0x21, 0xD6, 0x90, 0xA5, 0x1E, 0xE0, 0x70, 0x04, 0x7F, 0x01, 0x51, 0xA5, 0x90, 0xA5, -0x1E, 0xE0, 0xB4, 0x06, 0x02, 0x51, 0x4B, 0x90, 0xA5, 0x1E, 0xE0, 0xB4, 0x0E, 0x07, 0x31, 0xEB, -0xBF, 0x01, 0x02, 0x51, 0x75, 0x90, 0xA5, 0x1E, 0xE0, 0x64, 0x0C, 0x60, 0x02, 0x21, 0xD6, 0x31, -0xEB, 0xEF, 0x64, 0x01, 0x60, 0x02, 0x21, 0xD6, 0x71, 0x3C, 0x21, 0xD6, 0x90, 0xA5, 0x1E, 0xE0, -0xB4, 0x0E, 0x07, 0x31, 0xEB, 0xBF, 0x01, 0x02, 0x51, 0x75, 0x90, 0xA5, 0x1E, 0xE0, 0xB4, 0x06, -0x02, 0x51, 0x4B, 0x90, 0xA5, 0x1E, 0xE0, 0xB4, 0x0C, 0x07, 0x31, 0xEB, 0xBF, 0x01, 0x02, 0x71, -0x3C, 0x90, 0xA5, 0x1E, 0xE0, 0x64, 0x04, 0x70, 0x5D, 0x12, 0xBA, 0x3B, 0xEF, 0x64, 0x01, 0x70, -0x55, 0x12, 0xBB, 0x92, 0x80, 0x50, 0x90, 0xA5, 0x1E, 0xE0, 0xB4, 0x0E, 0x07, 0x31, 0xEB, 0xBF, -0x01, 0x02, 0x51, 0x75, 0x90, 0xA5, 0x1E, 0xE0, 0xB4, 0x06, 0x02, 0x51, 0x4B, 0x90, 0xA5, 0x1E, -0xE0, 0xB4, 0x0C, 0x07, 0x31, 0xEB, 0xBF, 0x01, 0x02, 0x71, 0x3C, 0x90, 0xA5, 0x1E, 0xE0, 0x70, -0x04, 0x7F, 0x01, 0x51, 0xA5, 0x90, 0xA5, 0x1E, 0xE0, 0xB4, 0x04, 0x1A, 0x12, 0xBB, 0xB3, 0x80, -0x15, 0x90, 0xA5, 0x1E, 0xE0, 0xB4, 0x0C, 0x0E, 0x90, 0xA5, 0x18, 0xE0, 0xFF, 0x13, 0x13, 0x54, -0x3F, 0x30, 0xE0, 0x02, 0xF1, 0xE4, 0x90, 0xA5, 0x1E, 0xE0, 0x90, 0x01, 0xBA, 0xF0, 0x90, 0xA5, -0x1D, 0xE0, 0x90, 0x01, 0xBB, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0xA5, 0x4E, 0xE0, 0x30, -0xE0, 0x13, 0x90, 0xA5, 0x54, 0xE0, 0xC4, 0x13, 0x54, 0x07, 0x30, 0xE0, 0x18, 0x90, 0x01, 0xB8, -0x74, 0x10, 0xF0, 0x80, 0x3D, 0x12, 0x77, 0xBE, 0xEF, 0x64, 0x01, 0x60, 0x08, 0x90, 0x01, 0xB8, -0x74, 0x01, 0xF0, 0x80, 0x2D, 0x90, 0xA5, 0x17, 0xE0, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, -0x08, 0x90, 0x01, 0xB8, 0x74, 0x02, 0xF0, 0x80, 0x19, 0x90, 0xA5, 0x1D, 0xE0, 0xD3, 0x94, 0x04, -0x40, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x08, 0xF0, 0x80, 0x08, 0x90, 0x01, 0xB8, 0xE4, 0xF0, 0x7F, -0x01, 0x22, 0x90, 0x01, 0xB9, 0x74, 0x02, 0xF0, 0x7F, 0x00, 0x22, 0x90, 0xA5, 0x18, 0xE0, 0x90, -0x06, 0x04, 0x20, 0xE0, 0x0C, 0xE0, 0x44, 0x40, 0xF0, 0x7D, 0x04, 0x7F, 0x01, 0x51, 0xCD, 0x80, -0x0F, 0x51, 0xC5, 0x90, 0x05, 0x27, 0xE0, 0x54, 0x7F, 0xF0, 0x90, 0xA5, 0x16, 0x74, 0x0C, 0xF0, -0xE4, 0xFD, 0xFF, 0x61, 0x88, 0x90, 0xA5, 0x18, 0xE0, 0xC3, 0x13, 0x20, 0xE0, 0x04, 0x51, 0xC9, -0x80, 0x1E, 0x90, 0x06, 0x04, 0xE0, 0x44, 0x40, 0xF0, 0xE0, 0x44, 0x80, 0xF0, 0x7D, 0x04, 0x7F, -0x01, 0x51, 0xCD, 0x90, 0x05, 0x27, 0xE0, 0x44, 0x80, 0xF0, 0x90, 0xA5, 0x16, 0x74, 0x04, 0xF0, -0xE4, 0xFD, 0xFF, 0x61, 0x88, 0x90, 0xA7, 0xAA, 0xEF, 0xF0, 0x12, 0x6E, 0x7A, 0x90, 0xA7, 0xAA, -0xE0, 0x60, 0x05, 0xE4, 0xFD, 0xFF, 0x71, 0x88, 0x7D, 0x04, 0x7F, 0x01, 0x51, 0xCD, 0x90, 0xA5, -0x16, 0x74, 0x04, 0xF0, 0x22, 0xE0, 0x54, 0x7F, 0xF0, 0x7D, 0x0C, 0x7F, 0x01, 0xD3, 0x10, 0xAF, -0x01, 0xC3, 0xC0, 0xD0, 0x90, 0xA7, 0xA9, 0xEF, 0xF0, 0x14, 0x60, 0x15, 0x14, 0x60, 0x19, 0x24, -0x02, 0x70, 0x1A, 0xED, 0x54, 0x01, 0xFF, 0x90, 0xA5, 0x17, 0xE0, 0x54, 0xFE, 0x4F, 0xF0, 0x80, -0x0C, 0x90, 0xA5, 0x1E, 0xED, 0xF0, 0x80, 0x05, 0x90, 0xA5, 0x1D, 0xED, 0xF0, 0x7F, 0x8F, 0x12, -0x4B, 0x31, 0xEF, 0x30, 0xE4, 0x31, 0x90, 0xA7, 0xA9, 0xE0, 0x14, 0x60, 0x07, 0x14, 0x60, 0x1D, -0x24, 0x02, 0x70, 0x23, 0x90, 0xA5, 0x17, 0xE0, 0x54, 0x01, 0xC4, 0x33, 0x33, 0x33, 0x54, 0x80, -0xFF, 0x90, 0xA5, 0x1E, 0xE0, 0x54, 0x7F, 0x4F, 0xFD, 0x7F, 0x88, 0x80, 0x07, 0x90, 0xA5, 0x1D, -0xE0, 0xFD, 0x7F, 0x89, 0x12, 0x4B, 0xED, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0xA4, 0x91, 0xE0, -0x64, 0x01, 0x70, 0x31, 0x90, 0xA5, 0x18, 0xE0, 0x54, 0xFD, 0xF0, 0x7D, 0x2C, 0x7F, 0x6F, 0x71, -0x88, 0x71, 0x93, 0xBF, 0x01, 0x14, 0x90, 0xA5, 0x17, 0xE0, 0x44, 0x80, 0xF0, 0x7D, 0x0E, 0x7F, -0x01, 0x51, 0xCD, 0x90, 0xA5, 0x16, 0x74, 0x0E, 0xF0, 0x22, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, -0x90, 0x01, 0xB8, 0x04, 0xF0, 0x22, 0x90, 0xA5, 0xBC, 0x12, 0x48, 0x49, 0xE0, 0xFF, 0x7E, 0x00, -0xE4, 0xFD, 0x12, 0x5B, 0xA0, 0xE4, 0xFD, 0xFF, 0x90, 0x05, 0x22, 0xEF, 0xF0, 0x90, 0xA3, 0x9C, -0xED, 0xF0, 0x22, 0x90, 0xA5, 0x55, 0xE0, 0x44, 0x02, 0xF0, 0x7D, 0x08, 0x7F, 0x01, 0xD3, 0x10, -0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0xA7, 0x4A, 0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0x90, 0xA3, 0x9A, -0xE0, 0x04, 0xF0, 0x90, 0x04, 0x1D, 0xE0, 0x60, 0x45, 0x90, 0x05, 0x22, 0xE0, 0x90, 0xA7, 0x4E, -0xF0, 0x7D, 0x26, 0x12, 0x5F, 0x3B, 0xEF, 0x64, 0x01, 0x70, 0x0C, 0x12, 0x5C, 0x06, 0x90, 0xA5, -0xAD, 0xE0, 0x20, 0xE0, 0x1B, 0x80, 0x16, 0x90, 0xA5, 0x52, 0xE0, 0xC4, 0x13, 0x13, 0x54, 0x03, -0x30, 0xE0, 0x0D, 0x12, 0x5C, 0x06, 0x90, 0xA5, 0xAD, 0xE0, 0x20, 0xE0, 0x03, 0x12, 0xB7, 0xF1, -0x90, 0xA7, 0x4E, 0xE0, 0xFF, 0x7D, 0x27, 0x71, 0x88, 0x12, 0xB8, 0x7D, 0x80, 0x10, 0x12, 0xB8, -0x7D, 0x12, 0x5C, 0x06, 0x90, 0xA5, 0xAD, 0xE0, 0x20, 0xE0, 0x03, 0x12, 0xB7, 0xF1, 0x90, 0xA5, -0x4E, 0xE0, 0x30, 0xE0, 0x17, 0x90, 0xA5, 0x52, 0xE0, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, -0x0B, 0x90, 0x05, 0x22, 0xE0, 0x54, 0x6F, 0xFF, 0x7D, 0x28, 0x71, 0x88, 0x90, 0x04, 0x1F, 0x74, -0x20, 0xF0, 0x7F, 0x01, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0xA6, 0x93, 0xEF, 0xF0, 0x90, 0xA6, -0x95, 0x74, 0x02, 0xF0, 0x7F, 0x01, 0x12, 0x97, 0xB4, 0x90, 0xA5, 0x52, 0xE0, 0xFF, 0x13, 0x13, -0x54, 0x3F, 0x30, 0xE0, 0x21, 0x90, 0xA6, 0x93, 0xE0, 0xB4, 0x02, 0x04, 0x7D, 0x07, 0x80, 0x09, -0x90, 0xA6, 0x93, 0xE0, 0xB4, 0x05, 0x06, 0x7D, 0x0D, 0x7F, 0xFF, 0x71, 0x88, 0x12, 0x5F, 0x40, -0xBF, 0x01, 0x03, 0x12, 0x4B, 0x58, 0x90, 0xA5, 0x52, 0xE0, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, -0x90, 0x07, 0x78, 0x30, 0xE0, 0x05, 0x74, 0x03, 0xF0, 0x80, 0x03, 0x74, 0x01, 0xF0, 0x90, 0xA6, -0x93, 0xE0, 0xB4, 0x02, 0x0C, 0x90, 0xA5, 0x4F, 0xE0, 0x24, 0x03, 0xFF, 0x90, 0xA5, 0x5E, 0xF1, -0xCE, 0x90, 0xA5, 0x4E, 0xE0, 0xC3, 0x13, 0x30, 0xE0, 0x07, 0xE4, 0x90, 0xA6, 0x94, 0xF0, 0x80, -0x06, 0x90, 0xA6, 0x94, 0x74, 0x01, 0xF0, 0x90, 0xA5, 0x51, 0xE0, 0xC4, 0x13, 0x54, 0x07, 0x20, -0xE0, 0x13, 0x90, 0xA5, 0x8D, 0xE0, 0x60, 0x08, 0x90, 0xA6, 0x95, 0x74, 0x01, 0xF0, 0x80, 0x05, -0xE4, 0x90, 0xA6, 0x95, 0xF0, 0x90, 0xA6, 0x95, 0xE0, 0xFF, 0x90, 0xA6, 0x94, 0xE0, 0xFD, 0x12, -0x69, 0xF2, 0xE4, 0x90, 0xA5, 0x60, 0xF0, 0x90, 0xA6, 0x93, 0xE0, 0xFF, 0xB4, 0x02, 0x08, 0x90, -0xA5, 0x61, 0xE0, 0x04, 0xF0, 0x80, 0x09, 0xEF, 0xB4, 0x05, 0x05, 0xE4, 0x90, 0xA5, 0x61, 0xF0, -0x90, 0xA5, 0x4E, 0xE0, 0xC4, 0x13, 0x54, 0x07, 0x30, 0xE0, 0x17, 0x90, 0xA6, 0x93, 0xE0, 0xB4, -0x02, 0x04, 0x7D, 0x08, 0x80, 0x64, 0x90, 0xA6, 0x93, 0xE0, 0x64, 0x05, 0x70, 0x60, 0x7D, 0x0E, -0x80, 0x58, 0x90, 0xA5, 0x4E, 0xE0, 0xC4, 0x54, 0x0F, 0x30, 0xE0, 0x2B, 0x90, 0xA5, 0x52, 0xE0, -0xC4, 0x13, 0x54, 0x07, 0x20, 0xE0, 0x09, 0x90, 0xA5, 0x1D, 0xE0, 0xFF, 0xE4, 0xFD, 0x11, 0x8A, -0x90, 0xA6, 0x93, 0xE0, 0xB4, 0x02, 0x04, 0x7D, 0x09, 0x80, 0x2F, 0x90, 0xA6, 0x93, 0xE0, 0x64, -0x05, 0x70, 0x2B, 0x7D, 0x0F, 0x80, 0x23, 0x90, 0xA5, 0x1B, 0xE0, 0x60, 0x21, 0x90, 0xA5, 0x1D, -0xE0, 0xFF, 0xE4, 0xFD, 0x11, 0x8A, 0x90, 0xA6, 0x93, 0xE0, 0xB4, 0x02, 0x04, 0x7D, 0x0A, 0x80, -0x09, 0x90, 0xA6, 0x93, 0xE0, 0xB4, 0x05, 0x06, 0x7D, 0x10, 0x7F, 0x6F, 0x71, 0x88, 0x90, 0xA5, -0x51, 0xE0, 0x30, 0xE0, 0x05, 0xE4, 0xFD, 0xFF, 0x71, 0x88, 0x90, 0xA5, 0x51, 0xE0, 0xC4, 0x13, -0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x04, 0xE4, 0xFF, 0xF1, 0xF6, 0x90, 0xA5, 0x52, 0xE0, 0xC3, -0x13, 0x90, 0x06, 0xCD, 0xE0, 0x54, 0xEF, 0xF0, 0x90, 0x06, 0xCF, 0xE0, 0x54, 0xEF, 0xF0, 0x22, -0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0xA7, 0x4F, 0xEF, 0xF0, 0xA3, 0x74, 0x02, 0xF0, -0xE4, 0xFF, 0x12, 0x97, 0xB4, 0x90, 0xA5, 0x52, 0xE0, 0xFF, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, -0x03, 0x12, 0x6E, 0x7A, 0x90, 0xA5, 0x52, 0xE0, 0xFF, 0x30, 0xE0, 0x08, 0x90, 0x07, 0x78, 0x74, -0x01, 0xF0, 0x80, 0x42, 0x90, 0xA5, 0x4E, 0xE0, 0xFE, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, -0x08, 0x90, 0x07, 0x78, 0x74, 0x0D, 0xF0, 0x80, 0x2D, 0x90, 0xA5, 0x51, 0xE0, 0xFE, 0xC4, 0x54, -0x0F, 0x30, 0xE0, 0x0D, 0xEE, 0x13, 0x13, 0x54, 0x3F, 0x90, 0x07, 0x78, 0x30, 0xE0, 0x0F, 0x80, -0x12, 0x90, 0xA5, 0x51, 0xE0, 0xFE, 0xC3, 0x13, 0x90, 0x07, 0x78, 0x30, 0xE0, 0x05, 0x74, 0x03, -0xF0, 0x80, 0x03, 0x74, 0x09, 0xF0, 0x90, 0xA7, 0x4F, 0xE0, 0x64, 0x03, 0x60, 0x02, 0xC1, 0xB5, -0xEF, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, 0x6F, 0x90, 0xA5, 0x58, 0xE0, 0xFF, 0x90, 0xA5, -0x63, 0xE0, 0xFE, 0xD3, 0x9F, 0x40, 0x42, 0xEE, 0x75, 0xF0, 0x03, 0xA4, 0xFF, 0x90, 0xA5, 0x5A, -0xE0, 0xFE, 0xC3, 0xEF, 0x9E, 0xFF, 0x24, 0x03, 0xFD, 0xE4, 0x33, 0xFC, 0x90, 0xA5, 0x50, 0xE0, -0xFE, 0xD3, 0x9D, 0xEC, 0x64, 0x80, 0xF8, 0x74, 0x80, 0x98, 0x40, 0x08, 0xEE, 0x9F, 0x90, 0xA7, -0x52, 0xF0, 0x80, 0x06, 0x90, 0xA7, 0x52, 0x74, 0x03, 0xF0, 0x90, 0xA7, 0x52, 0xE0, 0xFF, 0xF1, -0xD2, 0x90, 0xA5, 0x61, 0xE0, 0x04, 0xF0, 0x80, 0x18, 0x90, 0xA5, 0x5B, 0xE0, 0xFF, 0xF1, 0xD2, -0x90, 0xA5, 0x56, 0x74, 0x04, 0xF0, 0xE4, 0x90, 0xA5, 0x61, 0xF0, 0x90, 0x06, 0x92, 0x74, 0x04, -0xF0, 0xE4, 0x90, 0xA5, 0x63, 0xF0, 0x80, 0x0D, 0x90, 0xA5, 0x50, 0xE0, 0xFF, 0xF1, 0xD2, 0x90, -0xA5, 0x61, 0xE0, 0x04, 0xF0, 0x90, 0xA5, 0x4E, 0xE0, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, -0xE0, 0x07, 0xE4, 0x90, 0xA7, 0x51, 0xF0, 0x80, 0x06, 0x90, 0xA7, 0x51, 0x74, 0x01, 0xF0, 0x90, -0xA5, 0x51, 0xE0, 0xC4, 0x13, 0x54, 0x07, 0x20, 0xE0, 0x13, 0x90, 0xA5, 0x8D, 0xE0, 0x60, 0x07, -0xE4, 0x90, 0xA7, 0x50, 0xF0, 0x80, 0x06, 0x90, 0xA7, 0x50, 0x74, 0x01, 0xF0, 0x90, 0xA7, 0x50, -0x12, 0x69, 0xED, 0x90, 0xA5, 0x60, 0x74, 0x01, 0xF0, 0x90, 0xA5, 0x4E, 0xE0, 0xC4, 0x13, 0x54, -0x07, 0x30, 0xE0, 0x0C, 0x90, 0xA7, 0x4F, 0xE0, 0x70, 0x3F, 0xFD, 0xFF, 0x71, 0x88, 0x80, 0x39, -0x90, 0xA5, 0x4E, 0xE0, 0xC4, 0x54, 0x0F, 0x30, 0xE0, 0x1C, 0x90, 0xA5, 0x54, 0xE0, 0x44, 0x20, -0xF0, 0x90, 0xA5, 0x4D, 0xE0, 0x60, 0x04, 0x7D, 0x01, 0x80, 0x1A, 0xE4, 0xFD, 0xFF, 0x71, 0x88, -0x7D, 0x01, 0x7F, 0x0C, 0x80, 0x11, 0x90, 0xA7, 0x4F, 0xE0, 0xB4, 0x03, 0x0C, 0x90, 0xA5, 0x1B, -0xE0, 0x60, 0x06, 0xE4, 0xFD, 0x7F, 0x04, 0x11, 0x8A, 0x90, 0xA5, 0x4D, 0xE0, 0x60, 0x18, 0x90, -0xA7, 0x4F, 0xE0, 0x70, 0x04, 0x7D, 0x04, 0x80, 0x0A, 0x90, 0xA7, 0x4F, 0xE0, 0x64, 0x03, 0x70, -0x33, 0x7D, 0x0B, 0x7F, 0x6F, 0x80, 0x2B, 0x90, 0xA7, 0x4F, 0xE0, 0x70, 0x04, 0xFD, 0xFF, 0x80, -0x21, 0x90, 0xA7, 0x4F, 0xE0, 0xB4, 0x03, 0x1C, 0x90, 0xA5, 0x4E, 0xE0, 0xFF, 0xC4, 0x13, 0x54, -0x07, 0x20, 0xE0, 0x0B, 0xEF, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x03, 0x12, 0x9E, 0x40, 0xE4, -0xFD, 0xFF, 0x71, 0x88, 0x90, 0xA5, 0x51, 0xE0, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, -0x04, 0x7F, 0x01, 0xF1, 0xF6, 0x90, 0xA5, 0x52, 0xE0, 0xC3, 0x13, 0x90, 0x06, 0xCD, 0x30, 0xE0, -0x0D, 0xE0, 0x44, 0x10, 0xF0, 0x90, 0x06, 0xCF, 0xE0, 0x44, 0x10, 0xF0, 0x80, 0x0B, 0xE0, 0x54, -0xEF, 0xF0, 0x90, 0x06, 0xCF, 0xE0, 0x54, 0xEF, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xE0, 0xC3, -0x9F, 0xFF, 0xE4, 0x90, 0xA7, 0x42, 0xF0, 0xA3, 0xEF, 0xF0, 0xE4, 0xFB, 0xFD, 0x7F, 0x6C, 0x7E, -0x01, 0x02, 0x5A, 0x81, 0x7D, 0x2F, 0x12, 0x4B, 0x53, 0x7D, 0x08, 0x7F, 0x01, 0x51, 0xCD, 0x90, -0xA5, 0x16, 0x74, 0x08, 0xF0, 0x22, 0x90, 0xA5, 0x7E, 0xE0, 0xFE, 0xC3, 0x13, 0x30, 0xE0, 0x1C, -0xEF, 0xB4, 0x01, 0x05, 0x90, 0xA5, 0x85, 0x80, 0x03, 0x90, 0xA5, 0x81, 0x12, 0x48, 0x11, 0x90, -0xAA, 0xB9, 0x12, 0x08, 0x6D, 0x7F, 0x80, 0x7E, 0x08, 0x12, 0x38, 0xA4, 0x22, 0xE4, 0xFB, 0xFA, -0xFD, 0x7F, 0x01, 0x12, 0x47, 0x7E, 0xEF, 0x60, 0xF4, 0x90, 0xA3, 0x98, 0xE0, 0x60, 0xEE, 0xC2, -0xAF, 0x30, 0xE0, 0x0B, 0x54, 0xFE, 0xF0, 0xE4, 0xFF, 0x12, 0x65, 0x09, 0x12, 0x7F, 0x44, 0xD2, -0xAF, 0xC2, 0xAF, 0x90, 0xA3, 0x98, 0xE0, 0xFF, 0x30, 0xE1, 0x06, 0x54, 0xFD, 0xF0, 0x12, 0x8E, -0x45, 0xD2, 0xAF, 0xC2, 0xAF, 0x90, 0xA3, 0x98, 0xE0, 0xFF, 0x30, 0xE2, 0x05, 0x54, 0xFB, 0xF0, -0x31, 0xA6, 0xD2, 0xAF, 0xC2, 0xAF, 0x90, 0xA3, 0x98, 0xE0, 0xFF, 0x30, 0xE6, 0x05, 0x54, 0xBF, -0xF0, 0x11, 0x77, 0xD2, 0xAF, 0x80, 0xB2, 0xE4, 0x7B, 0x01, 0x7A, 0xA5, 0x79, 0x97, 0x11, 0x9D, -0xEF, 0xB4, 0x02, 0x18, 0x90, 0xA7, 0x7B, 0xE0, 0x64, 0x04, 0x60, 0x0B, 0x7F, 0x40, 0xF1, 0xF2, -0x90, 0xA7, 0x7B, 0xE0, 0x04, 0xF0, 0x22, 0xE4, 0x90, 0xA7, 0x7B, 0xF0, 0x22, 0x7D, 0x03, 0x7F, -0x11, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0xA7, 0x53, 0xEF, 0xF0, 0xA3, 0x12, 0x48, -0x5E, 0xAE, 0x05, 0x90, 0xA5, 0x72, 0xE0, 0x70, 0x64, 0x90, 0xA5, 0x74, 0xE0, 0xFD, 0x13, 0x13, -0x13, 0x54, 0x1F, 0xFC, 0xED, 0xC3, 0x13, 0xFD, 0x90, 0xA5, 0x74, 0xE0, 0xC4, 0x13, 0x54, 0x07, -0xF9, 0x90, 0xA5, 0x74, 0xE0, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x90, 0xA5, 0x75, 0xE0, 0xC3, -0x13, 0xEC, 0x20, 0xE0, 0x15, 0xED, 0x20, 0xE0, 0x11, 0xE9, 0x20, 0xE0, 0x0D, 0x90, 0xA5, 0x74, -0xE0, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x04, 0x7F, 0x02, 0x80, 0x21, 0x90, 0xFD, -0x58, 0xE0, 0x20, 0xE0, 0x04, 0x31, 0x24, 0x80, 0x10, 0x90, 0x01, 0x01, 0xE0, 0x54, 0xEF, 0xF0, -0x31, 0x24, 0x90, 0x01, 0x01, 0xE0, 0x44, 0x10, 0xF0, 0x7F, 0x01, 0x80, 0x02, 0x7F, 0x04, 0xD0, -0xD0, 0x92, 0xAF, 0x22, 0x90, 0xA7, 0x53, 0xE0, 0xFF, 0xAD, 0x06, 0xA3, 0x12, 0x48, 0x55, 0x90, -0xA7, 0x7E, 0x12, 0x48, 0x5E, 0xE4, 0xFE, 0x90, 0xFD, 0x50, 0xEF, 0xF0, 0x64, 0x30, 0x60, 0x3B, -0xA3, 0xED, 0xF0, 0xEE, 0xC3, 0x9D, 0x50, 0x1E, 0x90, 0xA7, 0x7E, 0x12, 0x48, 0x55, 0x8E, 0x82, -0x75, 0x83, 0x00, 0x12, 0x06, 0xA2, 0xFF, 0x74, 0x52, 0x2E, 0xF5, 0x82, 0xE4, 0x34, 0xFD, 0xF5, -0x83, 0xEF, 0xF0, 0x0E, 0x80, 0xDD, 0xEE, 0xC3, 0x94, 0x06, 0x50, 0x33, 0x74, 0x52, 0x2E, 0xF5, -0x82, 0xE4, 0x34, 0xFD, 0xF5, 0x83, 0xE4, 0xF0, 0x0E, 0x80, 0xEB, 0xEE, 0xC3, 0x94, 0x07, 0x50, -0x1E, 0x90, 0xA7, 0x7E, 0x12, 0x48, 0x55, 0x8E, 0x82, 0x75, 0x83, 0x00, 0x12, 0x06, 0xA2, 0xFF, -0x74, 0x51, 0x2E, 0xF5, 0x82, 0xE4, 0x34, 0xFD, 0xF5, 0x83, 0xEF, 0xF0, 0x0E, 0x80, 0xDC, 0x90, -0xFD, 0x58, 0x74, 0x01, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0xE4, 0xFF, 0x90, -0xA4, 0x8D, 0xE0, 0xFE, 0x90, 0xA4, 0x8C, 0xE0, 0xFD, 0xB5, 0x06, 0x04, 0x7E, 0x01, 0x80, 0x02, -0x7E, 0x00, 0xEE, 0x64, 0x01, 0x60, 0x2D, 0xED, 0x75, 0xF0, 0x0F, 0xA4, 0x24, 0xF6, 0xF9, 0x74, -0xA3, 0x35, 0xF0, 0xFA, 0x7B, 0x01, 0x12, 0xAD, 0xCD, 0x7F, 0x01, 0xEF, 0x60, 0x16, 0x90, 0xA4, -0x8C, 0xE0, 0x04, 0xF0, 0xE0, 0xB4, 0x0A, 0x02, 0x80, 0x02, 0x7F, 0x00, 0xEF, 0x60, 0x05, 0xE4, -0x90, 0xA4, 0x8C, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0xA7, 0x57, 0x12, 0x48, 0x5E, 0x90, -0xA5, 0x74, 0xE0, 0x44, 0x10, 0xF0, 0x7D, 0x01, 0x7F, 0x1B, 0x11, 0xA1, 0x90, 0xA7, 0x5A, 0xEF, -0xF0, 0xBF, 0x01, 0x1C, 0x90, 0xA5, 0x74, 0xE0, 0x54, 0xEF, 0xF0, 0x44, 0x20, 0xF0, 0xE4, 0x90, -0xA7, 0x42, 0xF0, 0xA3, 0x74, 0x0A, 0xF0, 0xE4, 0xFB, 0xFD, 0x7F, 0x68, 0x7E, 0x01, 0x80, 0x51, -0x90, 0xA7, 0x5A, 0xE0, 0xFF, 0xB4, 0x02, 0x0E, 0x90, 0xA7, 0x57, 0x12, 0x48, 0x55, 0x12, 0x06, -0x89, 0x90, 0xA5, 0x77, 0xF0, 0x22, 0xEF, 0xB4, 0x04, 0x07, 0x90, 0xA5, 0x74, 0xE0, 0x54, 0xEF, -0xF0, 0x22, 0x90, 0xA5, 0xAD, 0xE0, 0xC3, 0x13, 0x54, 0x07, 0xFF, 0x75, 0xF0, 0x0D, 0x90, 0xA5, -0xBA, 0x12, 0x48, 0x49, 0xE0, 0xFE, 0x75, 0xF0, 0x0D, 0xEF, 0x90, 0xA5, 0xB9, 0x12, 0x48, 0x49, -0xE0, 0x90, 0xA7, 0x43, 0xF0, 0x90, 0xA7, 0x42, 0xEE, 0xF0, 0xE4, 0xFB, 0xFD, 0x7F, 0x54, 0x7E, -0x01, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0xA7, 0x3E, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, -0x90, 0xA7, 0x42, 0xE0, 0xF5, 0x3B, 0xA3, 0xE0, 0xF5, 0x3C, 0x12, 0x36, 0x9D, 0x90, 0xA7, 0x3E, -0xE0, 0xFE, 0xA3, 0xE0, 0xF5, 0x82, 0x8E, 0x83, 0xA3, 0xA3, 0xA3, 0x74, 0x05, 0xF0, 0xD0, 0xD0, -0x92, 0xAF, 0x22, 0x90, 0xA7, 0x81, 0x12, 0x48, 0x5E, 0x90, 0xA5, 0x74, 0xE0, 0x44, 0x04, 0xF0, -0x7D, 0x01, 0x7F, 0x23, 0x11, 0xA1, 0x8F, 0x70, 0xE5, 0x70, 0xB4, 0x01, 0x1C, 0x90, 0xA5, 0x74, -0xE0, 0x54, 0xFB, 0xF0, 0x44, 0x08, 0xF0, 0xE4, 0x90, 0xA7, 0x42, 0xF0, 0xA3, 0x74, 0x0A, 0xF0, -0xE4, 0xFB, 0xFD, 0x7F, 0x68, 0x7E, 0x01, 0x80, 0x98, 0xE5, 0x70, 0xB4, 0x02, 0x0E, 0x90, 0xA7, -0x81, 0x12, 0x48, 0x55, 0x12, 0x06, 0x89, 0x90, 0xA5, 0x76, 0xF0, 0x22, 0xE5, 0x70, 0xB4, 0x04, -0x10, 0x90, 0xA5, 0x74, 0xE0, 0x54, 0xFB, 0xF0, 0xE4, 0xFF, 0x12, 0x91, 0xAB, 0x7F, 0x04, 0xF1, -0xF2, 0x22, 0x90, 0xA5, 0xAD, 0xE0, 0x30, 0xE0, 0x7A, 0x90, 0xA5, 0xAF, 0xE0, 0x70, 0x3C, 0x7D, -0x16, 0x7F, 0x6F, 0x12, 0x53, 0x88, 0xF1, 0x40, 0x90, 0xA5, 0xAD, 0xE0, 0xC3, 0x13, 0x54, 0x07, -0x75, 0xF0, 0x0D, 0x71, 0x94, 0x90, 0xA5, 0xAD, 0xE0, 0xC3, 0x13, 0x54, 0x07, 0x75, 0xF0, 0x0D, -0x90, 0xA5, 0xB8, 0x12, 0x48, 0x49, 0xE0, 0x44, 0x01, 0xF0, 0xE4, 0x90, 0xA7, 0x42, 0xF0, 0xA3, -0x74, 0x03, 0x51, 0x79, 0x90, 0xA5, 0xAF, 0x74, 0x01, 0xF0, 0x22, 0x90, 0xA5, 0xAF, 0xE0, 0x64, -0x01, 0x70, 0x2E, 0x90, 0xA5, 0xAD, 0xE0, 0xC3, 0x13, 0x54, 0x07, 0xFF, 0x75, 0xF0, 0x0D, 0x90, -0xA5, 0xB8, 0x12, 0x48, 0x49, 0xE0, 0x30, 0xE0, 0x18, 0x75, 0xF0, 0x0D, 0xEF, 0x71, 0x94, 0xE4, -0x90, 0xA7, 0x42, 0xF0, 0xA3, 0x74, 0x03, 0xF0, 0xE4, 0xFB, 0xFD, 0x7F, 0x54, 0x7E, 0x01, 0x41, -0x81, 0xB1, 0xB6, 0x22, 0x90, 0xA5, 0xBC, 0x12, 0x48, 0x49, 0xE0, 0xFF, 0x7E, 0x00, 0x7D, 0x01, -0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0xA7, 0x44, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xA3, -0xED, 0xF0, 0x90, 0x04, 0x1D, 0xE0, 0x60, 0x2E, 0x90, 0x05, 0x22, 0xE0, 0x90, 0xA7, 0x49, 0xF0, -0x7D, 0x14, 0xF1, 0x3B, 0xBF, 0x01, 0x13, 0x91, 0xA3, 0x90, 0xA7, 0x47, 0xEE, 0xF0, 0xFC, 0xA3, -0xEF, 0xF0, 0xFD, 0x90, 0xA7, 0x46, 0xE0, 0xFF, 0x91, 0x23, 0x90, 0xA7, 0x49, 0xE0, 0xFF, 0x7D, -0x15, 0x12, 0x53, 0x88, 0x80, 0x13, 0x91, 0xA3, 0x90, 0xA7, 0x47, 0xEE, 0xF0, 0xFC, 0xA3, 0xEF, -0xF0, 0xFD, 0x90, 0xA7, 0x46, 0xE0, 0xFF, 0x91, 0x23, 0x90, 0x04, 0x1F, 0x74, 0x20, 0xF0, 0x7F, -0x01, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0xA3, 0xA0, 0xE0, 0xFF, 0x90, 0xA7, 0x4B, 0xE0, 0xFB, -0x7D, 0x01, 0x91, 0xAD, 0x90, 0xA7, 0x4C, 0xEE, 0xF0, 0xFC, 0xA3, 0xEF, 0xF0, 0xFD, 0x90, 0xA7, -0x4A, 0xE0, 0xFF, 0x74, 0x09, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0x3F, -0xF0, 0xEF, 0x60, 0x52, 0x74, 0x29, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, -0x10, 0xF0, 0x74, 0x09, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x80, 0xF0, -0x90, 0xA5, 0x52, 0xE0, 0xC4, 0x13, 0x54, 0x07, 0x30, 0xE0, 0x47, 0x90, 0xA5, 0x65, 0xE0, 0xFF, -0xC3, 0x94, 0x20, 0x50, 0x13, 0xEF, 0x25, 0xE0, 0x25, 0xE0, 0xFF, 0x74, 0x2B, 0x2D, 0xF5, 0x82, -0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xEF, 0xF0, 0x22, 0x74, 0x2B, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, -0xF5, 0x83, 0x74, 0x7F, 0xF0, 0x22, 0x74, 0x29, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, -0xE0, 0x54, 0xEF, 0xF0, 0x74, 0x09, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, -0x40, 0xF0, 0x22, 0x90, 0xA7, 0x44, 0xA3, 0xE0, 0xFF, 0x7B, 0x08, 0x7D, 0x01, 0xD3, 0x10, 0xAF, -0x01, 0xC3, 0xC0, 0xD0, 0x90, 0xA7, 0x8B, 0xED, 0xF0, 0xA3, 0xEB, 0xF0, 0x90, 0xA7, 0x8A, 0xEF, -0xF0, 0xE4, 0xFD, 0xFC, 0xF1, 0xEA, 0x7C, 0x00, 0xAD, 0x07, 0x90, 0xA7, 0x8A, 0xE0, 0x90, 0x04, -0x25, 0xF0, 0x90, 0xA7, 0x8B, 0xE0, 0x60, 0x0E, 0x74, 0x21, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, -0xF5, 0x83, 0xE0, 0x44, 0x80, 0xF0, 0xAF, 0x05, 0x74, 0x20, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, -0xF5, 0x83, 0xE0, 0x54, 0xC0, 0xF0, 0x74, 0x21, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, -0xE0, 0x54, 0xC0, 0xF0, 0xAF, 0x05, 0x74, 0x12, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, -0xE0, 0x54, 0x01, 0xFE, 0x90, 0xA7, 0x8C, 0xE0, 0x25, 0xE0, 0x25, 0xE0, 0xFB, 0xEE, 0x44, 0x02, -0x4B, 0xFE, 0x74, 0x12, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xEE, 0xF0, 0x74, 0x11, -0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0x74, 0xFF, 0xF0, 0x74, 0x29, 0x2F, 0xF5, 0x82, -0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xF7, 0xF0, 0xAE, 0x04, 0xAF, 0x05, 0xD0, 0xD0, 0x92, -0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0xA7, 0x77, 0xEF, 0xF0, 0x90, 0x04, -0x1D, 0xE0, 0x60, 0x31, 0x90, 0x05, 0x22, 0xE0, 0x90, 0xA7, 0x7A, 0xF0, 0x7D, 0x29, 0xF1, 0x3B, -0xBF, 0x01, 0x16, 0x90, 0xA3, 0xA1, 0x91, 0xA7, 0x90, 0xA7, 0x78, 0xEE, 0xF0, 0xFC, 0xA3, 0xEF, -0xF0, 0xFD, 0x90, 0xA7, 0x77, 0xE0, 0xFF, 0x91, 0x23, 0x90, 0xA7, 0x7A, 0xE0, 0xFF, 0x7D, 0x2A, -0x12, 0x53, 0x88, 0x80, 0x16, 0x90, 0xA3, 0xA1, 0x91, 0xA7, 0x90, 0xA7, 0x78, 0xEE, 0xF0, 0xFC, -0xA3, 0xEF, 0xF0, 0xFD, 0x90, 0xA7, 0x77, 0xE0, 0xFF, 0x91, 0x23, 0x90, 0x04, 0x1F, 0x74, 0x20, -0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0xA5, 0xAD, 0xE0, 0xFF, 0xC3, 0x13, 0xFE, 0xEF, 0x54, -0xF1, 0xFF, 0xEE, 0x04, 0x54, 0x07, 0x25, 0xE0, 0x4F, 0xF0, 0xA3, 0xE0, 0xFF, 0x90, 0xA5, 0xAD, -0xE0, 0xFE, 0xC3, 0x13, 0x54, 0x07, 0xB5, 0x07, 0x04, 0xEE, 0x54, 0xF1, 0xF0, 0x51, 0x52, 0xE4, -0x90, 0xA5, 0xAF, 0xF0, 0xF1, 0x40, 0x90, 0xA5, 0xAD, 0xE0, 0xFE, 0xC3, 0x13, 0x54, 0x07, 0xFD, -0x75, 0xF0, 0x0D, 0x90, 0xA5, 0xB0, 0x12, 0x48, 0x49, 0xE0, 0xFA, 0x75, 0xF0, 0x0D, 0xED, 0x90, -0xA5, 0xB1, 0x12, 0x48, 0x49, 0xE0, 0xFC, 0x54, 0x03, 0xFD, 0xEC, 0x13, 0x13, 0x54, 0x07, 0xFB, -0xEE, 0xC4, 0x54, 0x0F, 0x90, 0xA7, 0x72, 0xF0, 0xAF, 0x02, 0x12, 0xA5, 0xE1, 0x90, 0xA5, 0xAD, -0xE0, 0xC3, 0x13, 0x54, 0x07, 0x75, 0xF0, 0x0D, 0x12, 0xA3, 0xE7, 0x90, 0xA5, 0xAD, 0xE0, 0xC3, -0x13, 0x54, 0x07, 0xFF, 0x75, 0xF0, 0x0D, 0x90, 0xA5, 0xBB, 0x12, 0x48, 0x49, 0xE0, 0x04, 0xF0, -0x75, 0xF0, 0x0D, 0xEF, 0x12, 0x53, 0x76, 0x90, 0xA5, 0xAD, 0xE0, 0xC3, 0x13, 0x54, 0x07, 0xFD, -0xE4, 0xFF, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0xA7, 0x73, 0xEF, 0xF0, 0xA3, 0xED, -0xF0, 0xE4, 0xA3, 0xF0, 0x90, 0xA7, 0x75, 0xE0, 0xFF, 0xC3, 0x94, 0x02, 0x40, 0x02, 0xE1, 0x36, -0x90, 0xA7, 0x74, 0xE0, 0xFE, 0x75, 0xF0, 0x0D, 0x90, 0xA5, 0xB2, 0x12, 0x48, 0x49, 0x75, 0xF0, -0x03, 0xEF, 0x12, 0x48, 0x49, 0xE0, 0xFC, 0xA3, 0xE0, 0xF5, 0x82, 0x8C, 0x83, 0xE0, 0x90, 0xA7, -0x76, 0xF0, 0x90, 0xA7, 0x73, 0xE0, 0x60, 0x31, 0x90, 0xA7, 0x76, 0xE0, 0xFF, 0x75, 0xF0, 0x0D, -0xEE, 0x90, 0xA5, 0xB4, 0x12, 0x48, 0x49, 0xC0, 0x83, 0xC0, 0x82, 0x90, 0xA7, 0x75, 0xE0, 0xD0, -0x82, 0xD0, 0x83, 0x75, 0xF0, 0x03, 0x12, 0x48, 0x49, 0xE0, 0xFE, 0x74, 0x01, 0xA8, 0x06, 0x08, -0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0x4F, 0x80, 0x33, 0x90, 0xA7, 0x76, 0xE0, 0xFF, 0x90, 0xA7, -0x74, 0xE0, 0x75, 0xF0, 0x0D, 0x90, 0xA5, 0xB4, 0x12, 0x48, 0x49, 0xC0, 0x83, 0xC0, 0x82, 0x90, -0xA7, 0x75, 0xE0, 0xD0, 0x82, 0xD0, 0x83, 0x75, 0xF0, 0x03, 0x12, 0x48, 0x49, 0xE0, 0xFE, 0x74, -0x01, 0xA8, 0x06, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0x5F, 0x90, 0xA7, 0x76, 0xF0, -0x90, 0xA7, 0x76, 0xE0, 0xFF, 0x90, 0xA7, 0x74, 0xE0, 0x75, 0xF0, 0x0D, 0x90, 0xA5, 0xB2, 0x12, -0x48, 0x49, 0xC0, 0x83, 0xC0, 0x82, 0x90, 0xA7, 0x75, 0xE0, 0xD0, 0x82, 0xD0, 0x83, 0x75, 0xF0, -0x03, 0x12, 0x48, 0x49, 0xE0, 0xFC, 0xA3, 0xE0, 0xF5, 0x82, 0x8C, 0x83, 0xEF, 0xF0, 0x90, 0xA7, -0x75, 0xE0, 0x04, 0xF0, 0xC1, 0x64, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x7F, 0xFF, 0x12, 0x53, 0x88, -0xE4, 0x90, 0xA7, 0x9D, 0xF0, 0xA3, 0xF0, 0x90, 0x05, 0xF8, 0xE0, 0x70, 0x0F, 0xA3, 0xE0, 0x70, -0x0B, 0xA3, 0xE0, 0x70, 0x07, 0xA3, 0xE0, 0x70, 0x03, 0x7F, 0x01, 0x22, 0x90, 0xA5, 0x52, 0xE0, -0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, 0x15, 0xD3, 0x90, 0xA7, 0x9E, 0xE0, 0x94, 0x03, 0x90, -0xA7, 0x9D, 0xE0, 0x94, 0x00, 0x40, 0x02, 0x80, 0x13, 0x7F, 0x01, 0x80, 0x1B, 0xD3, 0x90, 0xA7, -0x9E, 0xE0, 0x94, 0xE8, 0x90, 0xA7, 0x9D, 0xE0, 0x94, 0x03, 0x40, 0x0A, 0x90, 0x01, 0xC0, 0xE0, -0x44, 0x20, 0xF0, 0x7F, 0x00, 0x22, 0x7F, 0x32, 0x7E, 0x00, 0x12, 0x3E, 0x87, 0x90, 0xA7, 0x9D, -0xE4, 0x75, 0xF0, 0x01, 0x12, 0x08, 0xD6, 0x80, 0x9E, 0x90, 0xA6, 0x94, 0xEF, 0xF0, 0xA3, 0xED, -0xF0, 0xA3, 0xEB, 0xF0, 0x90, 0x04, 0x1D, 0xE0, 0x60, 0x20, 0x90, 0x05, 0x22, 0xE0, 0x90, 0xA6, -0x99, 0xF0, 0x7D, 0x01, 0xF1, 0x3B, 0xEF, 0x64, 0x01, 0x70, 0x03, 0x12, 0x96, 0x28, 0x90, 0xA6, -0x99, 0xE0, 0xFF, 0x7D, 0x02, 0x12, 0x53, 0x88, 0x80, 0x03, 0x12, 0x96, 0x28, 0x90, 0x04, 0x1F, -0x74, 0x20, 0xF0, 0x22, 0x7D, 0x01, 0x7F, 0x17, 0x01, 0xA1, 0x90, 0xFD, 0x10, 0xEF, 0xF0, 0x7F, -0x00, 0x22, 0x90, 0xA7, 0xA4, 0xEF, 0xF0, 0x7F, 0x02, 0x12, 0x47, 0x57, 0x90, 0xA3, 0x98, 0xE0, -0xFF, 0x90, 0xA7, 0xA4, 0xE0, 0xFE, 0xEF, 0x4E, 0x90, 0xA3, 0x98, 0xF0, 0x22, 0x32, 0xC0, 0xE0, -0xC0, 0xF0, 0xC0, 0x83, 0xC0, 0x82, 0xC0, 0xD0, 0x75, 0xD0, 0x00, 0xC0, 0x00, 0xC0, 0x01, 0xC0, -0x02, 0xC0, 0x03, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, 0x12, 0x4C, 0x07, 0xE5, 0x14, -0x30, 0xE7, 0x02, 0x11, 0x50, 0xD0, 0x07, 0xD0, 0x06, 0xD0, 0x05, 0xD0, 0x04, 0xD0, 0x03, 0xD0, -0x02, 0xD0, 0x01, 0xD0, 0x00, 0xD0, 0xD0, 0xD0, 0x82, 0xD0, 0x83, 0xD0, 0xF0, 0xD0, 0xE0, 0x32, -0x7F, 0x01, 0x7E, 0x00, 0x12, 0x3E, 0x0C, 0x7F, 0xF2, 0x12, 0x4B, 0x31, 0xEF, 0x20, 0xE6, 0x0E, -0x7F, 0x05, 0x12, 0x4B, 0x31, 0xEF, 0x44, 0x80, 0xFD, 0x7F, 0x05, 0x12, 0x4B, 0xED, 0x22, 0xC0, -0xE0, 0xC0, 0xF0, 0xC0, 0x83, 0xC0, 0x82, 0xC0, 0xD0, 0x75, 0xD0, 0x00, 0xC0, 0x00, 0xC0, 0x01, -0xC0, 0x02, 0xC0, 0x03, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, 0x12, 0xB0, 0x97, 0xE5, -0x19, 0x30, 0xE1, 0x02, 0x91, 0x82, 0xE5, 0x19, 0x30, 0xE4, 0x02, 0xD1, 0x61, 0xE5, 0x19, 0x30, -0xE5, 0x03, 0x12, 0xB0, 0xFD, 0xE5, 0x19, 0x30, 0xE6, 0x02, 0xF1, 0xCE, 0xE5, 0x1B, 0x30, 0xE0, -0x02, 0xD1, 0x69, 0xE5, 0x1B, 0x30, 0xE1, 0x03, 0x12, 0x76, 0x0B, 0xE5, 0x1B, 0x30, 0xE2, 0x03, -0x12, 0x75, 0x24, 0xE5, 0x1B, 0x30, 0xE3, 0x03, 0x12, 0xB1, 0x39, 0xE5, 0x1B, 0x30, 0xE4, 0x03, -0x12, 0xB1, 0x62, 0xE5, 0x1B, 0x30, 0xE5, 0x02, 0xD1, 0xA3, 0xE5, 0x1B, 0x30, 0xE6, 0x03, 0x12, -0xB1, 0x91, 0xE5, 0x1C, 0x30, 0xE1, 0x02, 0xD1, 0xFE, 0xE5, 0x1C, 0x30, 0xE4, 0x02, 0xB1, 0x07, -0xE5, 0x1C, 0x30, 0xE5, 0x02, 0x31, 0x19, 0xE5, 0x1C, 0x30, 0xE6, 0x02, 0x91, 0x22, 0xD0, 0x07, -0xD0, 0x06, 0xD0, 0x05, 0xD0, 0x04, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0xD0, 0xD0, -0xD0, 0x82, 0xD0, 0x83, 0xD0, 0xF0, 0xD0, 0xE0, 0x32, 0xE4, 0xF5, 0x64, 0x74, 0x81, 0x25, 0x64, -0xF5, 0x82, 0xE4, 0x34, 0x94, 0xF5, 0x83, 0xE0, 0xFF, 0x54, 0x03, 0xF5, 0x65, 0xEF, 0x54, 0x04, -0x13, 0x13, 0x54, 0x3F, 0xF5, 0x66, 0x74, 0x91, 0x25, 0x64, 0xF5, 0x82, 0xE4, 0x34, 0xA4, 0xF5, -0x83, 0xE0, 0x70, 0x02, 0x41, 0x93, 0xE5, 0x64, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x90, 0xA6, 0x83, -0xF0, 0xE5, 0x64, 0x54, 0x07, 0xA3, 0xF0, 0x90, 0xA6, 0x83, 0xE0, 0x24, 0x01, 0xF5, 0x82, 0xE4, -0x34, 0x95, 0xF5, 0x83, 0xE0, 0x90, 0xA6, 0x85, 0xF0, 0xFD, 0x90, 0xA6, 0x84, 0xE0, 0xFF, 0x74, -0x01, 0x7E, 0x00, 0xA8, 0x07, 0x08, 0x80, 0x05, 0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8, 0xF9, 0xFF, -0xEF, 0x5D, 0x70, 0x02, 0x41, 0x93, 0x75, 0xF0, 0x10, 0xE5, 0x64, 0x90, 0x81, 0x01, 0x12, 0x48, -0x49, 0xE0, 0x20, 0xE7, 0x02, 0x80, 0x13, 0x75, 0xF0, 0x10, 0xE5, 0x64, 0x90, 0x81, 0x02, 0x12, -0x48, 0x49, 0xE0, 0x90, 0xA6, 0x86, 0xF0, 0x20, 0xE7, 0x09, 0x90, 0x01, 0xC1, 0xE0, 0x44, 0x20, -0xF0, 0x41, 0x93, 0x90, 0xA6, 0x86, 0xE0, 0x30, 0xE6, 0x38, 0x74, 0x81, 0x25, 0x64, 0xF5, 0x82, -0xE4, 0x34, 0x94, 0xF5, 0x83, 0xE0, 0x54, 0xF8, 0xF0, 0x75, 0xF0, 0x10, 0xE5, 0x64, 0x90, 0x81, -0x00, 0x12, 0x48, 0x49, 0xE0, 0xFD, 0x75, 0xF0, 0x05, 0xE5, 0x64, 0x90, 0x97, 0x9A, 0x12, 0x48, -0x49, 0xE0, 0x13, 0x13, 0x54, 0x03, 0x90, 0xA7, 0x3B, 0xF0, 0xE4, 0xFB, 0xAF, 0x64, 0x51, 0xA3, -0x41, 0x93, 0xE5, 0x65, 0x60, 0x45, 0x15, 0x65, 0x74, 0x81, 0x25, 0x64, 0xF5, 0x82, 0xE4, 0x34, -0x94, 0xF5, 0x83, 0xE0, 0x54, 0xFC, 0x45, 0x65, 0xFF, 0x74, 0x81, 0x25, 0x64, 0xF5, 0x82, 0xE4, -0x34, 0x94, 0xF5, 0x83, 0xEF, 0xF0, 0x75, 0xF0, 0x05, 0xE5, 0x64, 0x90, 0x97, 0x9A, 0x12, 0x48, -0x49, 0xE0, 0x13, 0x13, 0x54, 0x03, 0x90, 0xA7, 0x3B, 0xF0, 0x74, 0x18, 0x25, 0x64, 0xF5, 0x82, -0xE4, 0x34, 0xA3, 0xF5, 0x83, 0xE0, 0xFD, 0x7B, 0x01, 0x80, 0x4F, 0xE5, 0x66, 0x64, 0x01, 0x70, -0x4D, 0xF5, 0x66, 0x74, 0x81, 0x25, 0x64, 0xF5, 0x82, 0xE4, 0x34, 0x94, 0xF5, 0x83, 0xE0, 0x54, -0xFB, 0xFF, 0xE5, 0x66, 0x25, 0xE0, 0x25, 0xE0, 0x4F, 0xFF, 0x74, 0x81, 0x25, 0x64, 0xF5, 0x82, -0xE4, 0x34, 0x94, 0xF5, 0x83, 0xEF, 0xF0, 0x75, 0xF0, 0x05, 0xE5, 0x64, 0x90, 0x97, 0x9A, 0x12, -0x48, 0x49, 0xE0, 0x13, 0x13, 0x54, 0x03, 0x90, 0xA7, 0x3B, 0xF0, 0x74, 0x18, 0x25, 0x64, 0xF5, -0x82, 0xE4, 0x34, 0x9E, 0xF5, 0x83, 0xE0, 0xFD, 0xE4, 0xFB, 0xAF, 0x64, 0x80, 0x15, 0xAF, 0x64, -0x12, 0x7C, 0x1B, 0x05, 0x64, 0xE5, 0x64, 0xC3, 0x94, 0x80, 0x50, 0x02, 0x21, 0x1C, 0x22, 0xAD, -0x61, 0xAF, 0x60, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0xA7, 0x38, 0xEF, 0xF0, 0xA3, -0xED, 0xF0, 0xF9, 0x90, 0xA7, 0x38, 0xE0, 0xFE, 0x13, 0x13, 0x13, 0x54, 0x1F, 0xFD, 0xEE, 0x54, -0x07, 0xFE, 0x75, 0xF0, 0x10, 0xEF, 0x90, 0x81, 0x01, 0x12, 0x48, 0x49, 0xE0, 0x90, 0xA7, 0x3D, -0xF0, 0xE9, 0x54, 0x7F, 0x90, 0xA7, 0x3C, 0xF0, 0xEB, 0x70, 0x2B, 0x74, 0x01, 0x2D, 0xF5, 0x82, -0xE4, 0x34, 0x95, 0xF5, 0x83, 0xC0, 0x83, 0xC0, 0x82, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x06, 0x08, -0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0x5F, 0xD0, 0x82, 0xD0, 0x83, 0xF0, 0x90, 0xA7, 0x3D, -0xE0, 0x54, 0x7F, 0xF0, 0x80, 0x69, 0x90, 0xA7, 0x3C, 0xE0, 0xFF, 0xC3, 0x94, 0x19, 0x40, 0x0E, -0xEF, 0xD3, 0x94, 0x1B, 0x50, 0x08, 0x90, 0x04, 0xCF, 0x74, 0x02, 0xF0, 0x80, 0x05, 0x90, 0x04, -0xCF, 0xE4, 0xF0, 0x74, 0x01, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0x95, 0xF5, 0x83, 0xC0, 0x83, 0xC0, -0x82, 0xE0, 0xFF, 0x74, 0x01, 0xA8, 0x06, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0x4F, 0xD0, -0x82, 0xD0, 0x83, 0xF0, 0x90, 0xA7, 0x38, 0xE0, 0x75, 0xF0, 0x10, 0x90, 0x81, 0x01, 0x12, 0x48, -0x49, 0xE0, 0x54, 0x07, 0xFF, 0x90, 0xA7, 0x3D, 0xF0, 0x90, 0xA7, 0x3C, 0xE0, 0x90, 0x44, 0x45, -0x93, 0xFE, 0x33, 0x33, 0x33, 0x54, 0xF8, 0x4F, 0x90, 0xA7, 0x3D, 0xF0, 0x44, 0x80, 0xF0, 0x90, -0xA7, 0x38, 0xE0, 0xFB, 0x70, 0x0C, 0xA3, 0xE0, 0x90, 0xA6, 0xB5, 0xF0, 0xE4, 0xFD, 0xFF, 0x12, -0x77, 0xD7, 0x90, 0xA7, 0x3C, 0xE0, 0xFB, 0x25, 0xE0, 0x24, 0x91, 0xF5, 0x82, 0xE4, 0x34, 0x43, -0xF5, 0x83, 0xE4, 0x93, 0xFE, 0x74, 0x01, 0x93, 0xFF, 0xE4, 0xFC, 0xFD, 0x75, 0xF0, 0x04, 0xEB, -0x90, 0x42, 0x41, 0x12, 0x48, 0x49, 0x12, 0x48, 0x39, 0x12, 0x47, 0xD9, 0x78, 0x01, 0x12, 0x08, -0x47, 0x90, 0xA7, 0x38, 0xE0, 0xFD, 0x25, 0xE0, 0x24, 0x16, 0xF5, 0x82, 0xE4, 0x34, 0x96, 0xF5, -0x83, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0xA7, 0x39, 0xE0, 0xFF, 0x75, 0xF0, 0x10, 0xED, 0x90, -0x81, 0x00, 0x12, 0x48, 0x49, 0xEF, 0xF0, 0xED, 0x70, 0x05, 0x90, 0x01, 0xC8, 0xEF, 0xF0, 0x90, -0xA7, 0x3D, 0xE0, 0xFF, 0x90, 0xA7, 0x38, 0xE0, 0xFE, 0x75, 0xF0, 0x10, 0x90, 0x81, 0x01, 0x12, -0x48, 0x49, 0xEF, 0xF0, 0x75, 0xF0, 0x10, 0xEE, 0x90, 0x81, 0x05, 0x12, 0x48, 0x49, 0xE0, 0x54, -0xFC, 0xFF, 0x90, 0xA7, 0x3B, 0xE0, 0x4F, 0xFE, 0x90, 0xA7, 0x38, 0xE0, 0xFF, 0x75, 0xF0, 0x10, -0x90, 0x81, 0x05, 0x12, 0x48, 0x49, 0xEE, 0xF0, 0x7D, 0x01, 0x12, 0x85, 0x6D, 0xD0, 0xD0, 0x92, -0xAF, 0x22, 0x90, 0x07, 0x1F, 0xE0, 0x54, 0x7F, 0xF0, 0x90, 0x07, 0x1C, 0xE0, 0x54, 0x01, 0xFF, -0x60, 0x2F, 0x90, 0xA5, 0xDE, 0xE0, 0x60, 0x29, 0x90, 0xA5, 0xDB, 0xE0, 0x54, 0x03, 0x14, 0x60, -0x10, 0x14, 0x60, 0x16, 0x24, 0x02, 0x70, 0x19, 0x90, 0x04, 0x2D, 0xE0, 0x44, 0x02, 0xF0, 0x80, -0x10, 0x90, 0x04, 0x2D, 0xE0, 0x44, 0x06, 0xF0, 0x80, 0x07, 0x90, 0x04, 0x2D, 0xE0, 0x44, 0x0E, -0xF0, 0xE4, 0x90, 0xA5, 0xDE, 0xF0, 0x90, 0xA6, 0x85, 0xEF, 0xF0, 0x90, 0xA6, 0x83, 0x74, 0x02, -0xF0, 0x90, 0xA6, 0x91, 0x14, 0xF0, 0xFB, 0x7A, 0xA6, 0x79, 0x83, 0xF1, 0xEA, 0x7F, 0x04, 0x02, -0x5F, 0xF2, 0xE4, 0xFF, 0x90, 0xA6, 0x83, 0xEF, 0xF0, 0x90, 0x04, 0x7E, 0xE0, 0xF5, 0x65, 0xA3, -0xE0, 0xF5, 0x66, 0x65, 0x65, 0x60, 0x6F, 0x90, 0xA6, 0x84, 0x74, 0x03, 0xF0, 0x90, 0xA6, 0x92, -0x74, 0x08, 0xF0, 0xE5, 0x66, 0x04, 0x54, 0x0F, 0xF5, 0x67, 0xE4, 0xF5, 0x64, 0xE5, 0x67, 0x75, -0xF0, 0x08, 0xA4, 0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34, 0x80, 0xF5, 0x83, 0xE5, 0x82, 0x25, 0x64, -0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE0, 0xFF, 0x74, 0x86, 0x25, 0x64, 0xF5, 0x82, 0xE4, -0x34, 0xA6, 0xF5, 0x83, 0xEF, 0xF0, 0x05, 0x64, 0xE5, 0x64, 0xB4, 0x08, 0xD0, 0x7B, 0x01, 0x7A, -0xA6, 0x79, 0x84, 0xF1, 0xEA, 0xE5, 0x66, 0x04, 0x54, 0x0F, 0xF5, 0x66, 0xB4, 0x0F, 0x03, 0xE4, -0xF5, 0x66, 0x90, 0x04, 0x7F, 0xE5, 0x66, 0xF0, 0x90, 0xA6, 0x83, 0xE0, 0x7F, 0x04, 0x70, 0x03, -0x02, 0x4E, 0xDC, 0x12, 0x5F, 0xF2, 0x22, 0xE4, 0xFF, 0x90, 0xA5, 0xE0, 0xEF, 0xF0, 0xE4, 0xA3, -0xF0, 0x90, 0xA5, 0xE1, 0xE0, 0xFF, 0xC3, 0x94, 0x80, 0x50, 0x47, 0x74, 0xE2, 0x2F, 0xF5, 0x82, -0xE4, 0x34, 0xA5, 0xF5, 0x83, 0xE4, 0xF0, 0x75, 0xF0, 0x10, 0xEF, 0x90, 0x81, 0x03, 0x12, 0x48, -0x49, 0xE0, 0x90, 0xA5, 0xE1, 0x30, 0xE7, 0x0E, 0xE0, 0x24, 0x81, 0xF5, 0x82, 0xE4, 0x34, 0x93, -0xF5, 0x83, 0xE4, 0xF0, 0x80, 0x14, 0xE0, 0xFF, 0xF1, 0xDB, 0x90, 0xA5, 0xE1, 0xE0, 0x24, 0xE2, -0xF5, 0x82, 0xE4, 0x34, 0xA5, 0xF5, 0x83, 0x74, 0x01, 0xF0, 0x90, 0xA5, 0xE1, 0xE0, 0x04, 0xF0, -0x80, 0xAF, 0x7F, 0x0C, 0x7E, 0x00, 0x12, 0x3E, 0x87, 0xE4, 0x90, 0xA5, 0xE1, 0xF0, 0x90, 0xA5, -0xE1, 0xE0, 0xFF, 0xC3, 0x94, 0x80, 0x40, 0x02, 0xC1, 0x60, 0x74, 0xE2, 0x2F, 0xF5, 0x82, 0xE4, -0x34, 0xA5, 0xF5, 0x83, 0xE0, 0x70, 0x02, 0xC1, 0x58, 0x90, 0xA5, 0xE1, 0xE0, 0xFF, 0x75, 0xF0, -0x10, 0x90, 0x81, 0x06, 0x12, 0x48, 0x49, 0xE0, 0xFD, 0x75, 0xF0, 0x10, 0xEF, 0x90, 0x81, 0x07, -0x12, 0x48, 0x49, 0xE0, 0xFE, 0xED, 0xFF, 0x90, 0xA5, 0xE1, 0xE0, 0xFC, 0x25, 0xE0, 0x24, 0x01, -0xF5, 0x82, 0xE4, 0x34, 0x92, 0xF5, 0x83, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x75, 0xF0, 0x10, 0xEC, -0x90, 0x81, 0x0A, 0x12, 0x48, 0x49, 0xE0, 0xFD, 0x75, 0xF0, 0x10, 0xEC, 0x90, 0x81, 0x0B, 0x12, -0x48, 0x49, 0xE0, 0xFE, 0xED, 0xFF, 0x90, 0xA5, 0xE1, 0xE0, 0x75, 0xF0, 0x0A, 0x90, 0x8D, 0x01, -0x12, 0x48, 0x49, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x7F, 0x01, 0x90, 0xA5, 0xE1, 0xE0, 0xFE, 0x75, -0xF0, 0x10, 0x90, 0x81, 0x0B, 0x12, 0x48, 0x49, 0xE5, 0x82, 0x2F, 0xF5, 0x82, 0xE4, 0x35, 0x83, -0xF5, 0x83, 0xE0, 0xFD, 0x75, 0xF0, 0x0A, 0xEE, 0x90, 0x8D, 0x01, 0x12, 0x48, 0x49, 0x75, 0xF0, -0x02, 0xEF, 0x12, 0x48, 0x49, 0xE4, 0xF0, 0xA3, 0xED, 0xF0, 0x0F, 0xEF, 0xB4, 0x05, 0xCB, 0x90, -0xA5, 0xE1, 0xE0, 0xFF, 0x75, 0xF0, 0x10, 0x90, 0x81, 0x09, 0x12, 0x48, 0x49, 0xE0, 0xFE, 0x74, -0x97, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x9A, 0xF5, 0x83, 0xEE, 0xF0, 0x90, 0xA5, 0xE1, 0xE0, 0xFF, -0x90, 0xA5, 0xE0, 0xE0, 0xFD, 0x12, 0x85, 0x6D, 0x90, 0xA5, 0xE1, 0xE0, 0x24, 0x81, 0xF5, 0x82, -0xE4, 0x34, 0x93, 0xF5, 0x83, 0x74, 0x01, 0xF0, 0x90, 0xA5, 0xE1, 0xE0, 0x04, 0xF0, 0xA1, 0x6E, -0x22, 0x12, 0xAC, 0x27, 0x7F, 0x02, 0x02, 0x4E, 0xDC, 0x90, 0xA5, 0x12, 0xE0, 0x30, 0xE0, 0x10, -0xA3, 0x74, 0x01, 0xF0, 0x90, 0xA5, 0x12, 0xE0, 0xFF, 0xC3, 0x13, 0x30, 0xE0, 0x02, 0xF1, 0x3A, -0x12, 0x97, 0x10, 0x90, 0xA5, 0x4E, 0xE0, 0x30, 0xE0, 0x05, 0xE4, 0xFF, 0x12, 0x55, 0xB0, 0x22, -0xF1, 0x6B, 0x90, 0xA5, 0x21, 0xE0, 0x14, 0x90, 0x05, 0x73, 0xF0, 0x7D, 0x02, 0x7F, 0x02, 0xD1, -0xC9, 0x80, 0xE0, 0x90, 0xA4, 0x91, 0xE0, 0xB4, 0x01, 0x15, 0x90, 0xA5, 0x1B, 0xE0, 0x60, 0x0F, -0x90, 0xA5, 0x19, 0xE0, 0x54, 0x0F, 0x64, 0x02, 0x60, 0x03, 0x02, 0x9E, 0x40, 0xD1, 0xDE, 0x22, -0x90, 0x01, 0x34, 0x74, 0x40, 0xF0, 0xFD, 0xE4, 0xFF, 0x74, 0x15, 0x2F, 0xF8, 0xE6, 0x4D, 0xFE, -0xF6, 0x74, 0x30, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0x12, 0xB8, -0xE8, 0x90, 0xA5, 0x1E, 0xE0, 0x64, 0x0C, 0x60, 0x14, 0xE4, 0xFD, 0x7F, 0x0C, 0x12, 0x50, 0x8A, -0xE4, 0xFD, 0xFF, 0x12, 0x53, 0x88, 0x7D, 0x08, 0xE4, 0xFF, 0x12, 0x53, 0x9E, 0x22, 0x90, 0xA5, -0x1B, 0xE0, 0x70, 0x07, 0x90, 0xA5, 0x12, 0xE0, 0x30, 0xE0, 0x11, 0x90, 0xA5, 0x12, 0xE0, 0x30, -0xE0, 0x07, 0xF1, 0x5F, 0xBF, 0x01, 0x05, 0x80, 0x04, 0x12, 0x77, 0x76, 0x22, 0x90, 0xA5, 0x1B, -0xE0, 0x64, 0x02, 0x60, 0x14, 0x90, 0xA5, 0x19, 0xE0, 0x54, 0x0F, 0x60, 0x0C, 0x12, 0x77, 0xBE, -0xEF, 0x70, 0x06, 0xFD, 0x7F, 0x0C, 0x12, 0x50, 0x8A, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, -0xD0, 0x90, 0xA5, 0x11, 0xE0, 0xB4, 0x01, 0x04, 0x7F, 0x04, 0x80, 0x0B, 0xF1, 0x5F, 0xBF, 0x01, -0x04, 0x7F, 0x01, 0x80, 0x02, 0x7F, 0x02, 0x12, 0xB5, 0xCB, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, -0x05, 0x43, 0xE0, 0x7F, 0x00, 0x30, 0xE7, 0x02, 0x7F, 0x01, 0x22, 0xE4, 0x90, 0xA6, 0x93, 0xF0, -0x90, 0xA5, 0x1B, 0xE0, 0x60, 0x57, 0x90, 0xA4, 0x91, 0xE0, 0x64, 0x01, 0x70, 0x4F, 0x90, 0xA6, -0x93, 0x04, 0xF0, 0xE4, 0x90, 0xA5, 0x22, 0xF0, 0x90, 0xA5, 0x12, 0xE0, 0x30, 0xE0, 0x15, 0x90, -0xA5, 0x16, 0xE0, 0xB4, 0x02, 0x05, 0xE4, 0x90, 0xA6, 0x93, 0xF0, 0xF1, 0x5F, 0xEF, 0x70, 0x04, -0x90, 0xA6, 0x93, 0xF0, 0x90, 0xA6, 0x93, 0xE0, 0x60, 0x23, 0x90, 0xA5, 0x1F, 0xE0, 0x44, 0x10, -0xF0, 0xE4, 0x90, 0xA7, 0x42, 0xF0, 0x90, 0xA5, 0x23, 0xE0, 0x90, 0xA7, 0x43, 0x12, 0x5A, 0x79, -0x90, 0xA5, 0x1E, 0xE0, 0x20, 0xE2, 0x03, 0x12, 0x50, 0x86, 0x12, 0x96, 0xD6, 0x22, 0x90, 0xA5, -0x12, 0xE0, 0x30, 0xE0, 0x05, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0x22, 0x75, 0xF0, 0x10, 0xEF, 0x90, -0x81, 0x03, 0x12, 0x48, 0x49, 0xE0, 0x44, 0x40, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, -0xD0, 0x90, 0xA4, 0x8C, 0xE0, 0xFF, 0x70, 0x06, 0xA3, 0xE0, 0x64, 0x09, 0x60, 0x0A, 0xEF, 0x14, -0xFF, 0x90, 0xA4, 0x8D, 0xE0, 0xB5, 0x07, 0x04, 0x7F, 0x01, 0x80, 0x02, 0x7F, 0x00, 0xEF, 0x60, -0x09, 0x90, 0x01, 0xC1, 0xE0, 0x44, 0x02, 0xF0, 0x80, 0x35, 0xC0, 0x01, 0x90, 0xA4, 0x8D, 0xE0, -0x75, 0xF0, 0x0F, 0xA4, 0x24, 0xF6, 0xF9, 0x74, 0xA3, 0x35, 0xF0, 0xA8, 0x01, 0xFC, 0x7D, 0x01, -0xD0, 0x01, 0x7E, 0x00, 0x7F, 0x0F, 0x12, 0x06, 0x63, 0x90, 0xA4, 0x8D, 0xE0, 0x04, 0xF0, 0xE0, -0x7F, 0x00, 0xB4, 0x0A, 0x02, 0x7F, 0x01, 0xEF, 0x60, 0x05, 0xE4, 0x90, 0xA4, 0x8D, 0xF0, 0xD0, -0xD0, 0x92, 0xAF, 0x22, 0xC0, 0xE0, 0xC0, 0xF0, 0xC0, 0x83, 0xC0, 0x82, 0xC0, 0xD0, 0x75, 0xD0, -0x00, 0xC0, 0x00, 0xC0, 0x01, 0xC0, 0x02, 0xC0, 0x03, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, -0x07, 0x12, 0xB0, 0xCD, 0xE5, 0x21, 0x30, 0xE1, 0x02, 0x31, 0x4B, 0xE5, 0x21, 0x30, 0xE2, 0x02, -0x31, 0x85, 0xE5, 0x21, 0x30, 0xE3, 0x02, 0x31, 0x09, 0xE5, 0x21, 0x30, 0xE5, 0x02, 0x31, 0x38, -0xE5, 0x22, 0x30, 0xE0, 0x03, 0x12, 0xB1, 0xAD, 0xE5, 0x22, 0x30, 0xE3, 0x03, 0x12, 0x92, 0x34, -0xE5, 0x23, 0x30, 0xE1, 0x03, 0x12, 0xB2, 0xFF, 0xE5, 0x23, 0x30, 0xE0, 0x03, 0x12, 0xB2, 0x90, -0xE5, 0x23, 0x30, 0xE2, 0x09, 0xD1, 0xFB, 0x90, 0x07, 0x8F, 0xE0, 0x44, 0x10, 0xF0, 0xE5, 0x23, -0x30, 0xE3, 0x02, 0xF1, 0xCF, 0xE5, 0x24, 0x30, 0xE1, 0x05, 0x7F, 0x04, 0x12, 0x4E, 0xDC, 0xE5, -0x24, 0x30, 0xE4, 0x03, 0x12, 0x66, 0x90, 0xE5, 0x24, 0x30, 0xE5, 0x03, 0x12, 0xB3, 0x96, 0xE5, -0x24, 0x30, 0xE6, 0x03, 0x12, 0xB3, 0xDE, 0xE5, 0x24, 0x30, 0xE7, 0x02, 0x31, 0x57, 0xD0, 0x07, -0xD0, 0x06, 0xD0, 0x05, 0xD0, 0x04, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0xD0, 0xD0, -0xD0, 0x82, 0xD0, 0x83, 0xD0, 0xF0, 0xD0, 0xE0, 0x32, 0x12, 0xB4, 0xDB, 0xD3, 0x90, 0xA5, 0xD9, -0xE0, 0x94, 0x00, 0x90, 0xA5, 0xD8, 0xE0, 0x94, 0x00, 0x40, 0x17, 0xE0, 0xFC, 0xA3, 0xE0, 0xFD, -0xEC, 0x90, 0xA7, 0x42, 0xF0, 0xA3, 0xED, 0xF0, 0xE4, 0xFB, 0xFD, 0x7F, 0x5C, 0x7E, 0x01, 0x02, -0x5A, 0x81, 0x90, 0x01, 0x5F, 0xE4, 0xF0, 0x22, 0x90, 0xA5, 0xAD, 0xE0, 0x30, 0xE0, 0x0B, 0x12, -0xA6, 0xE6, 0xE4, 0x90, 0xA5, 0xAF, 0xF0, 0x12, 0x5A, 0x52, 0x22, 0x90, 0xA5, 0x1B, 0xE0, 0x60, -0x03, 0x12, 0xBB, 0xFC, 0x02, 0x5B, 0x12, 0x90, 0xA5, 0x69, 0xE0, 0x30, 0xE0, 0x04, 0x31, 0x6F, -0x80, 0x03, 0x12, 0x9A, 0x7D, 0x90, 0xA5, 0x9A, 0xE0, 0x30, 0xE0, 0x02, 0xF1, 0x2D, 0x22, 0x7D, -0x12, 0x7F, 0xFF, 0x12, 0x53, 0x88, 0x90, 0x07, 0x78, 0x74, 0x01, 0xF0, 0x90, 0xA5, 0x8D, 0xE0, -0xFF, 0xE4, 0xFD, 0x80, 0x6D, 0x90, 0xA5, 0x1B, 0xE0, 0x60, 0x14, 0x90, 0x06, 0x92, 0xE0, 0x30, -0xE1, 0x03, 0x02, 0xB8, 0xE8, 0x90, 0xA5, 0x17, 0xE0, 0x54, 0xF7, 0xF0, 0x12, 0x50, 0x71, 0x22, -0x31, 0x6F, 0x90, 0xA5, 0x69, 0xE0, 0xFF, 0xC4, 0x13, 0x54, 0x07, 0xFE, 0xEF, 0xC3, 0x13, 0x54, -0x0F, 0xC3, 0x9E, 0x40, 0x02, 0x80, 0x17, 0x90, 0xA5, 0x69, 0xE0, 0xFF, 0xC3, 0x13, 0x54, 0x0F, -0xFE, 0xEF, 0x54, 0xE1, 0xFF, 0xEE, 0x04, 0x54, 0x0F, 0x25, 0xE0, 0x4F, 0xF0, 0x22, 0x90, 0xA5, -0x69, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0xE1, 0xF0, 0x90, 0xA5, 0x6E, 0xE0, 0x90, 0x07, 0x78, 0xF0, -0x90, 0xA5, 0x6F, 0x31, 0xED, 0xD1, 0x7A, 0xE4, 0xFD, 0xFF, 0x02, 0x53, 0x88, 0xE0, 0xFF, 0xA3, -0xE0, 0xFD, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x8F, 0x6C, 0x8D, 0x6D, 0xE5, 0x6C, 0x64, -0x02, 0x60, 0x41, 0x7F, 0x2C, 0x7E, 0x09, 0x12, 0x37, 0xAD, 0xE4, 0xFF, 0xEC, 0x90, 0xA7, 0x30, -0x12, 0x08, 0x6D, 0xE5, 0x6C, 0x90, 0xA7, 0x30, 0xB4, 0x01, 0x08, 0x12, 0x48, 0x11, 0xEF, 0x44, -0x04, 0x80, 0x06, 0x12, 0x48, 0x11, 0xEF, 0x44, 0x20, 0xFF, 0xEC, 0x90, 0xA7, 0x30, 0x12, 0x08, -0x6D, 0x90, 0xA7, 0x30, 0x12, 0x48, 0x11, 0x90, 0xAA, 0xB9, 0x12, 0x08, 0x6D, 0x7F, 0x2C, 0x7E, -0x09, 0x12, 0x38, 0xA4, 0xE5, 0x6D, 0x64, 0x02, 0x70, 0x02, 0x41, 0xE3, 0x7F, 0x30, 0x7E, 0x09, -0x12, 0x37, 0xAD, 0xE4, 0xFF, 0xFE, 0xFD, 0xEC, 0x90, 0xA7, 0x30, 0x12, 0x08, 0x6D, 0xE5, 0x6D, -0x70, 0x17, 0x90, 0xA7, 0x30, 0x12, 0x48, 0x11, 0xEE, 0x44, 0x07, 0xFE, 0xED, 0x44, 0x70, 0xFD, -0xEC, 0x90, 0xA7, 0x30, 0x12, 0x08, 0x6D, 0x80, 0x57, 0x90, 0xA7, 0x30, 0x12, 0x48, 0x11, 0xEE, -0x44, 0x06, 0xFE, 0xED, 0x44, 0x60, 0xFD, 0xEC, 0x90, 0xA7, 0x30, 0x12, 0x08, 0x6D, 0x7F, 0x2C, -0x7E, 0x09, 0x12, 0x37, 0xAD, 0xE4, 0xFF, 0xEC, 0x90, 0xA7, 0x34, 0x12, 0x08, 0x6D, 0x90, 0xA5, -0x8D, 0xE0, 0x90, 0xA7, 0x34, 0x60, 0x08, 0x12, 0x48, 0x11, 0xEF, 0x44, 0x20, 0x80, 0x06, 0x12, -0x48, 0x11, 0xEF, 0x44, 0x04, 0xFF, 0xEC, 0x90, 0xA7, 0x34, 0x12, 0x08, 0x6D, 0x90, 0xA7, 0x34, -0x12, 0x48, 0x11, 0x90, 0xAA, 0xB9, 0x12, 0x08, 0x6D, 0x7F, 0x2C, 0x7E, 0x09, 0x12, 0x38, 0xA4, -0x90, 0xA7, 0x30, 0x12, 0x48, 0x11, 0x90, 0xAA, 0xB9, 0x12, 0x08, 0x6D, 0x7F, 0x30, 0x7E, 0x09, -0x12, 0x38, 0xA4, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, -0xA6, 0x69, 0x12, 0x48, 0x5E, 0x12, 0x06, 0x89, 0xFF, 0x54, 0x01, 0xFE, 0x90, 0xA5, 0x4E, 0xE0, -0x54, 0xFE, 0x4E, 0xFE, 0xF0, 0xEF, 0x54, 0x02, 0xFF, 0xEE, 0x54, 0xFD, 0x4F, 0xFF, 0xF0, 0x12, -0x06, 0x89, 0xFE, 0x54, 0x04, 0xFD, 0xEF, 0x54, 0xFB, 0x4D, 0xFF, 0x90, 0xA5, 0x4E, 0xF0, 0xEE, -0x54, 0x10, 0xFE, 0xEF, 0x54, 0xEF, 0x4E, 0xFF, 0xF0, 0x12, 0x06, 0x89, 0xFE, 0x54, 0x20, 0xFD, -0xEF, 0x54, 0xDF, 0x4D, 0xFF, 0x90, 0xA5, 0x4E, 0xF0, 0xEE, 0x54, 0x40, 0xFE, 0xEF, 0x54, 0xBF, -0x4E, 0xFF, 0xF0, 0x12, 0x06, 0x89, 0x54, 0x80, 0xFE, 0xEF, 0x54, 0x7F, 0x4E, 0x90, 0xA5, 0x4E, -0xF0, 0x90, 0x00, 0x03, 0x12, 0x06, 0xA2, 0xFF, 0x54, 0x01, 0xFE, 0x90, 0xA5, 0x51, 0xE0, 0x54, -0xFE, 0x4E, 0xFE, 0xF0, 0xEF, 0x54, 0x02, 0xFF, 0xEE, 0x54, 0xFD, 0x4F, 0xFF, 0xF0, 0x90, 0x00, -0x03, 0x12, 0x06, 0xA2, 0xFE, 0x54, 0x04, 0xFD, 0xEF, 0x54, 0xFB, 0x4D, 0xFF, 0x90, 0xA5, 0x51, -0xF0, 0xEE, 0x54, 0x10, 0xFE, 0xEF, 0x54, 0xEF, 0x4E, 0xFF, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x06, -0xA2, 0xFE, 0x54, 0x20, 0xFD, 0xEF, 0x54, 0xDF, 0x4D, 0xFF, 0x90, 0xA5, 0x51, 0xF0, 0xEE, 0x54, -0x40, 0xFE, 0xEF, 0x54, 0xBF, 0x4E, 0xFF, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x06, 0xA2, 0x54, 0x80, -0xFE, 0xEF, 0x54, 0x7F, 0x4E, 0x90, 0xA5, 0x51, 0xF0, 0x90, 0x00, 0x04, 0x12, 0x06, 0xA2, 0xFF, -0x54, 0x20, 0xFE, 0x90, 0xA5, 0x52, 0xE0, 0x54, 0xDF, 0x4E, 0xFE, 0xF0, 0xEF, 0x54, 0x40, 0xFF, -0xEE, 0x54, 0xBF, 0x4F, 0xFF, 0xF0, 0x90, 0x00, 0x04, 0x12, 0x06, 0xA2, 0xFE, 0x54, 0x80, 0xFD, -0xEF, 0x54, 0x7F, 0x4D, 0xFF, 0x90, 0xA5, 0x52, 0xF0, 0xEE, 0x54, 0x01, 0xFE, 0xEF, 0x54, 0xFE, -0x4E, 0xFF, 0xF0, 0x90, 0x00, 0x04, 0x12, 0x06, 0xA2, 0xFE, 0x54, 0x04, 0xFD, 0xEF, 0x54, 0xFB, -0x4D, 0xFF, 0x90, 0xA5, 0x52, 0xF0, 0xEE, 0x54, 0x02, 0xFE, 0xEF, 0x54, 0xFD, 0x4E, 0xFF, 0xF0, -0x90, 0x00, 0x04, 0x12, 0x06, 0xA2, 0xFE, 0x54, 0x10, 0xFD, 0xEF, 0x54, 0xEF, 0x4D, 0xFF, 0x90, -0xA5, 0x52, 0xF0, 0xEE, 0x54, 0x08, 0xFE, 0xEF, 0x54, 0xF7, 0x4E, 0xF0, 0xE0, 0xFF, 0x13, 0x13, -0x54, 0x3F, 0x20, 0xE0, 0x08, 0xD1, 0x7A, 0xE4, 0xFD, 0xFF, 0x12, 0x53, 0x88, 0x90, 0xA5, 0x52, -0xE0, 0xC3, 0x13, 0x20, 0xE0, 0x0E, 0x90, 0x06, 0xCD, 0xE0, 0x54, 0xEF, 0xF0, 0x90, 0x06, 0xCF, -0xE0, 0x54, 0xEF, 0xF0, 0x90, 0xA6, 0x69, 0x12, 0x48, 0x55, 0x12, 0x06, 0x89, 0x20, 0xE0, 0x02, -0xA1, 0xC7, 0x90, 0x05, 0x54, 0xE0, 0x90, 0xA5, 0x5F, 0xF0, 0xE0, 0xC3, 0x13, 0x90, 0xA5, 0x5E, -0xF0, 0x90, 0xA5, 0x51, 0xE0, 0xC4, 0x54, 0x0F, 0x30, 0xE0, 0x16, 0x90, 0x00, 0x01, 0x12, 0x06, -0xA2, 0x90, 0xA5, 0x4F, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x06, 0xA2, 0x90, 0xA5, 0x50, 0xF0, 0x80, -0x48, 0x90, 0x00, 0x01, 0x12, 0x06, 0xA2, 0xFF, 0xC3, 0x94, 0x2A, 0x50, 0x12, 0xEF, 0xC3, 0x94, -0x03, 0x90, 0xA5, 0x4F, 0x50, 0x05, 0x74, 0x03, 0xF0, 0x80, 0x0A, 0xEF, 0xF0, 0x80, 0x06, 0x90, -0xA5, 0x4F, 0x74, 0x2A, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x06, 0xA2, 0xFF, 0xC3, 0x94, 0x2A, 0x50, -0x12, 0xEF, 0xC3, 0x94, 0x03, 0x90, 0xA5, 0x50, 0x50, 0x05, 0x74, 0x03, 0xF0, 0x80, 0x0A, 0xEF, -0xF0, 0x80, 0x06, 0x90, 0xA5, 0x50, 0x74, 0x2A, 0xF0, 0x90, 0xA5, 0x52, 0xE0, 0xC4, 0x13, 0x13, -0x54, 0x03, 0x30, 0xE0, 0x3D, 0x90, 0xA5, 0x4F, 0xE0, 0x75, 0xF0, 0x03, 0x84, 0x90, 0xA5, 0x57, -0xF0, 0xE0, 0xC3, 0x13, 0xA3, 0xF0, 0x90, 0xA5, 0x50, 0xE0, 0x75, 0xF0, 0x03, 0x84, 0x90, 0xA5, -0x59, 0xF0, 0x90, 0xA5, 0x4F, 0xE0, 0xC3, 0x13, 0x90, 0xA5, 0x5A, 0xF0, 0x90, 0xA5, 0x50, 0xE0, -0xC3, 0x13, 0x90, 0xA5, 0x5B, 0xF0, 0x90, 0x01, 0x3E, 0x74, 0x08, 0xF0, 0xFD, 0x7F, 0x02, 0x12, -0x77, 0x59, 0xE4, 0x90, 0xA5, 0x8B, 0xF0, 0x90, 0xA6, 0x69, 0x12, 0x48, 0x55, 0x90, 0x00, 0x03, -0x12, 0x06, 0xA2, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x20, 0xE0, 0x27, 0x12, 0x06, 0x89, 0x13, 0x13, -0x13, 0x54, 0x1F, 0x30, 0xE0, 0x08, 0x90, 0xA5, 0x8D, 0xE0, 0x60, 0x08, 0x80, 0x0B, 0x90, 0xA5, -0x8D, 0xE0, 0x60, 0x05, 0x75, 0x51, 0x01, 0x80, 0x03, 0xE4, 0xF5, 0x51, 0x7D, 0x02, 0xAF, 0x51, -0x31, 0xF2, 0x90, 0xA5, 0x4E, 0xE0, 0xC4, 0x54, 0x0F, 0x30, 0xE0, 0x1C, 0x90, 0xA5, 0x52, 0xE0, -0xC4, 0x13, 0x54, 0x07, 0x30, 0xE0, 0x07, 0x7D, 0x04, 0x7F, 0x02, 0x12, 0x52, 0xCD, 0x90, 0x05, -0x00, 0x74, 0x1C, 0xF0, 0xA3, 0x74, 0x11, 0xF0, 0x90, 0x05, 0x58, 0x74, 0x02, 0xF0, 0x90, 0xA5, -0x56, 0xE0, 0xFF, 0xB4, 0x01, 0x08, 0x90, 0xA5, 0x61, 0x74, 0x01, 0xF0, 0x80, 0x22, 0xEF, 0xB4, -0x04, 0x08, 0x90, 0xA5, 0x61, 0x74, 0x04, 0xF0, 0x80, 0x16, 0xEF, 0xB4, 0x06, 0x08, 0x90, 0xA5, -0x61, 0x74, 0x02, 0xF0, 0x80, 0x0A, 0xEF, 0xB4, 0x07, 0x06, 0x90, 0xA5, 0x61, 0x74, 0x05, 0xF0, -0xE4, 0x90, 0xA5, 0x56, 0xF0, 0x80, 0x6D, 0x90, 0xA6, 0x69, 0x12, 0x48, 0x55, 0x90, 0x00, 0x03, -0x12, 0x06, 0xA2, 0xFF, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, 0x05, 0x75, 0x52, 0x02, 0x80, -0x14, 0x12, 0x06, 0x89, 0xFF, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x05, 0x75, 0x52, 0x01, -0x80, 0x03, 0xE4, 0xF5, 0x52, 0x12, 0x9D, 0x6B, 0x7D, 0x20, 0x7F, 0x40, 0x12, 0x4B, 0xED, 0x90, -0xA6, 0x69, 0x12, 0x48, 0x55, 0x90, 0x00, 0x03, 0x12, 0x06, 0xA2, 0x13, 0x13, 0x13, 0x54, 0x1F, -0x90, 0x07, 0x78, 0x30, 0xE0, 0x05, 0x74, 0x03, 0xF0, 0x80, 0x03, 0x74, 0x01, 0xF0, 0xAD, 0x52, -0x7F, 0x02, 0x31, 0xF2, 0xE4, 0xFD, 0xFF, 0x12, 0x53, 0x88, 0x90, 0x05, 0x00, 0x74, 0x1C, 0xF0, -0xA3, 0x74, 0x43, 0xF0, 0x90, 0xA5, 0x54, 0xE0, 0x54, 0xDF, 0xF0, 0xE4, 0x90, 0xA5, 0x60, 0xF0, -0x90, 0xA5, 0x51, 0xE0, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x09, 0x90, 0xA5, 0x7E, -0xE0, 0x44, 0x02, 0xF0, 0x80, 0x0C, 0x7F, 0x01, 0x12, 0x57, 0xF6, 0x90, 0xA5, 0x7E, 0xE0, 0x54, -0xFD, 0xF0, 0x7F, 0x03, 0x12, 0x97, 0xB4, 0x90, 0xA5, 0x4E, 0xE0, 0x20, 0xE0, 0x07, 0x90, 0xA5, -0x52, 0xE0, 0x54, 0xBF, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, -0xD0, 0x90, 0x01, 0x01, 0xE0, 0x44, 0x02, 0xF0, 0x90, 0x01, 0x00, 0x74, 0xFF, 0xF0, 0x90, 0x06, -0xB7, 0x74, 0x09, 0xF0, 0x90, 0x06, 0xB4, 0x74, 0x86, 0xF0, 0x90, 0xA5, 0x4C, 0xE0, 0xFF, 0x13, -0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x06, 0x90, 0x07, 0x78, 0x74, 0x03, 0xF0, 0x90, 0xA5, 0x69, -0xE0, 0x20, 0xE0, 0x34, 0xEF, 0xC3, 0x13, 0x30, 0xE0, 0x2E, 0x90, 0xA5, 0x8D, 0xE0, 0x60, 0x07, -0xE4, 0x90, 0xA7, 0x99, 0xF0, 0x80, 0x06, 0x90, 0xA7, 0x99, 0x74, 0x01, 0xF0, 0x90, 0xA5, 0x4C, -0xE0, 0xC4, 0x13, 0x54, 0x07, 0x90, 0xA7, 0x9A, 0x30, 0xE0, 0x05, 0x74, 0x01, 0xF0, 0x80, 0x03, -0x74, 0x02, 0xF0, 0x90, 0xA7, 0x99, 0x31, 0xED, 0x7F, 0x02, 0x12, 0x4B, 0x31, 0xEF, 0x44, 0x01, -0xFD, 0x7F, 0x02, 0x12, 0x4B, 0xED, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, -0xC0, 0xD0, 0x90, 0xA5, 0x9A, 0xE0, 0x30, 0xE0, 0x1F, 0x90, 0xA5, 0x9F, 0xE0, 0xB4, 0x01, 0x0C, -0xA3, 0xE0, 0xB4, 0x01, 0x13, 0x74, 0x02, 0xF0, 0xF1, 0xA8, 0x80, 0x0C, 0x90, 0xA5, 0x9F, 0xE0, -0xB4, 0x02, 0x05, 0x74, 0x03, 0xF0, 0xF1, 0x2D, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, -0x01, 0xC3, 0xC0, 0xD0, 0x90, 0xA5, 0xA1, 0xE0, 0xB4, 0x01, 0x02, 0x80, 0x4C, 0x90, 0xA5, 0xA1, -0xE0, 0xB4, 0x02, 0x12, 0xF1, 0xA8, 0x7F, 0x01, 0x12, 0x97, 0xB4, 0x12, 0xA0, 0x37, 0x90, 0xA5, -0xA1, 0x74, 0x03, 0xF0, 0x80, 0x4D, 0x90, 0xA5, 0xA1, 0xE0, 0x64, 0x03, 0x70, 0x24, 0x90, 0xA5, -0xA4, 0xF1, 0xAB, 0xE4, 0xFF, 0x12, 0x97, 0xB4, 0x12, 0xA0, 0x37, 0x90, 0xA5, 0x9A, 0xE0, 0xC3, -0x13, 0x54, 0x03, 0xFF, 0xE4, 0xFB, 0xFD, 0x12, 0x9C, 0x9B, 0x90, 0xA5, 0xA1, 0x74, 0x04, 0xF0, -0x80, 0x21, 0x90, 0xA5, 0xA1, 0xE0, 0xB4, 0x04, 0x1A, 0x90, 0xA5, 0x9A, 0xE0, 0xC3, 0x13, 0x54, -0x03, 0xFF, 0x7B, 0x01, 0x7D, 0x01, 0x12, 0x9C, 0x9B, 0x90, 0xA5, 0xA1, 0x74, 0x02, 0xF0, 0x90, -0xA5, 0x9F, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0xA5, 0xA6, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, -0xAD, 0x07, 0xEE, 0xFF, 0x90, 0x01, 0x6F, 0xE4, 0xF0, 0x8F, 0x35, 0xAF, 0x05, 0x8F, 0x36, 0xFB, -0xFD, 0x7F, 0x6C, 0x7E, 0x01, 0x12, 0x3C, 0xE1, 0x90, 0x01, 0x6F, 0x74, 0x05, 0xF0, 0x22, 0x22, -0xD1, 0x7A, 0x90, 0xA5, 0x15, 0x74, 0x03, 0xF0, 0x22, 0xD1, 0x7A, 0xE4, 0xFD, 0xFF, 0x12, 0x53, -0x88, 0x90, 0xA5, 0x15, 0x74, 0x01, 0xF0, 0x22, 0xC0, 0xE0, 0xC0, 0xF0, 0xC0, 0x83, 0xC0, 0x82, -0xC0, 0xD0, 0x75, 0xD0, 0x00, 0xC0, 0x00, 0xC0, 0x01, 0xC0, 0x02, 0xC0, 0x03, 0xC0, 0x04, 0xC0, -0x05, 0xC0, 0x06, 0xC0, 0x07, 0x12, 0x4D, 0x53, 0x53, 0x91, 0xBF, 0xD0, 0x07, 0xD0, 0x06, 0xD0, -0x05, 0xD0, 0x04, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0xD0, 0xD0, 0xD0, 0x82, 0xD0, -0x83, 0xD0, 0xF0, 0xD0, 0xE0, 0x32, 0x32, 0xE4, 0xFF, 0xE4, 0xFE, 0x74, 0x97, 0x2F, 0xF5, 0x82, -0xE4, 0x34, 0x9B, 0xF5, 0x83, 0xE0, 0x54, 0xFE, 0xF0, 0x75, 0xF0, 0x10, 0xEF, 0x90, 0x81, 0x00, -0xBE, 0x03, 0x12, 0x12, 0x48, 0x49, 0xE5, 0x82, 0x2E, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, -0x74, 0x80, 0xF0, 0x80, 0x0F, 0x12, 0x48, 0x49, 0xE5, 0x82, 0x2E, 0xF5, 0x82, 0xE4, 0x35, 0x83, -0xF5, 0x83, 0xE4, 0xF0, 0x75, 0xF0, 0x08, 0xEF, 0x90, 0x89, 0x00, 0x12, 0x48, 0x49, 0xE5, 0x82, -0x2E, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE4, 0xF0, 0x0E, 0xBE, 0x10, 0xAD, 0x0F, 0xBF, -0x80, 0xA7, 0xE4, 0x90, 0xAD, 0xE3, 0xF0, 0x90, 0x95, 0x92, 0x12, 0x08, 0x79, 0x00, 0x00, 0x00, -0x00, 0xE4, 0xFF, 0xE4, 0xFE, 0x75, 0xF0, 0x0A, 0xEF, 0x90, 0x8D, 0x01, 0x12, 0x48, 0x49, 0x75, -0xF0, 0x02, 0xEE, 0x12, 0x48, 0x49, 0xE4, 0xF0, 0xA3, 0xF0, 0x0E, 0xBE, 0x05, 0xE7, 0x74, 0x98, -0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xA2, 0xF5, 0x83, 0xE4, 0xF0, 0x74, 0x18, 0x2F, 0xF5, 0x82, 0xE4, -0x34, 0xA3, 0xF5, 0x83, 0xE4, 0xF0, 0x74, 0x18, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x9D, 0xF5, 0x83, -0xE4, 0xF0, 0x74, 0x18, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x9E, 0xF5, 0x83, 0xE4, 0xF0, 0x74, 0x81, -0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x94, 0xF5, 0x83, 0xE4, 0xF0, 0x74, 0x98, 0x2F, 0xF5, 0x82, 0xE4, -0x34, 0x9C, 0xF5, 0x83, 0xE4, 0xF0, 0x74, 0x97, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x9B, 0xF5, 0x83, -0xE0, 0x54, 0x9D, 0xF0, 0x90, 0x95, 0x11, 0x74, 0x01, 0xF0, 0x74, 0x98, 0x2F, 0xF5, 0x82, 0xE4, -0x34, 0xA1, 0xF5, 0x83, 0xE4, 0xF0, 0x74, 0x17, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x9A, 0xF5, 0x83, -0xE4, 0xF0, 0x74, 0x96, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x95, 0xF5, 0x83, 0x74, 0xFF, 0xF0, 0xEF, -0x25, 0xE0, 0x24, 0x01, 0xF5, 0x82, 0xE4, 0x34, 0x92, 0xF5, 0x83, 0xE4, 0xF0, 0xA3, 0xF0, 0x74, -0x97, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x9A, 0xF5, 0x83, 0xE4, 0xF0, 0xEF, 0x25, 0xE0, 0x24, 0x98, -0xF5, 0x82, 0xE4, 0x34, 0x9E, 0xF5, 0x83, 0xE4, 0xF0, 0xA3, 0xF0, 0xEF, 0x25, 0xE0, 0x24, 0x98, -0xF5, 0x82, 0xE4, 0x34, 0x9F, 0xF5, 0x83, 0xE4, 0xF0, 0xA3, 0xF0, 0x75, 0xF0, 0x05, 0xEF, 0x90, -0x97, 0x97, 0x12, 0x48, 0x49, 0x74, 0x1B, 0xF0, 0x75, 0xF0, 0x05, 0xEF, 0x90, 0x97, 0x98, 0x12, -0x48, 0x49, 0xE4, 0xF0, 0x75, 0xF0, 0x05, 0xEF, 0x90, 0x97, 0x99, 0x12, 0x48, 0x49, 0xE0, 0x54, -0xE0, 0xF0, 0x75, 0xF0, 0x05, 0xEF, 0x90, 0x97, 0x9A, 0x12, 0x48, 0x49, 0xE0, 0x54, 0xF3, 0xF0, -0x75, 0xF0, 0x05, 0xEF, 0x90, 0x97, 0x9A, 0x12, 0x48, 0x49, 0xE0, 0x54, 0xFC, 0xF0, 0x75, 0xF0, -0x05, 0xEF, 0x90, 0x97, 0x99, 0x12, 0x48, 0x49, 0xE0, 0x44, 0x20, 0xF0, 0x75, 0xF0, 0x05, 0xEF, -0x90, 0x97, 0x9A, 0x12, 0x48, 0x49, 0xE0, 0x54, 0xCF, 0xF0, 0x75, 0xF0, 0x05, 0xEF, 0x90, 0x97, -0x9A, 0x12, 0x48, 0x49, 0xE0, 0x44, 0x40, 0xF0, 0x75, 0xF0, 0x05, 0xEF, 0x90, 0x97, 0x9A, 0x12, -0x48, 0x49, 0xE0, 0x54, 0x7F, 0xF0, 0x75, 0xF0, 0x05, 0xEF, 0x90, 0x97, 0x9B, 0x12, 0x48, 0x49, -0xE0, 0x54, 0xFE, 0xF0, 0x75, 0xF0, 0x05, 0xEF, 0x90, 0x97, 0x98, 0x12, 0x48, 0x49, 0xE0, 0xFE, -0x75, 0xF0, 0x10, 0xEF, 0x90, 0x81, 0x00, 0x12, 0x48, 0x49, 0xEE, 0xF0, 0x0F, 0xEF, 0x64, 0x80, -0x60, 0x02, 0x01, 0x93, 0x90, 0x04, 0x49, 0x74, 0xF0, 0xF0, 0xA3, 0xE4, 0xF0, 0xA3, 0x74, 0xFF, -0xF0, 0x90, 0x04, 0x33, 0x74, 0x02, 0xF0, 0xA3, 0x74, 0x04, 0xF0, 0xA3, 0x04, 0xF0, 0xA3, 0x04, -0xF0, 0xA3, 0x04, 0xF0, 0x22, 0x51, 0xE7, 0x51, 0xED, 0x11, 0x27, 0x51, 0xFB, 0x12, 0xB9, 0x28, -0x12, 0xA7, 0x02, 0x51, 0x61, 0x90, 0xA5, 0xD7, 0x74, 0xFF, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, -0xA3, 0xF0, 0xA3, 0xE0, 0x54, 0xFC, 0x44, 0x02, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, -0x22, 0x90, 0xA5, 0x7E, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0xFB, 0xF0, 0x54, 0xFD, 0xF0, 0x54, 0xF7, -0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0x7F, 0x80, 0x7E, 0x08, 0x12, 0x37, 0xAD, 0x90, 0xA5, 0x85, -0x12, 0x08, 0x6D, 0x90, 0xA5, 0x85, 0x12, 0x48, 0x11, 0x90, 0xA5, 0x81, 0x12, 0x08, 0x6D, 0xE4, -0x90, 0xA5, 0x8B, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0x04, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, -0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0xFD, 0x68, 0xE0, 0x44, 0x02, 0xF0, 0x90, 0x07, 0x78, -0x74, 0x01, 0xF0, 0x12, 0x9D, 0x11, 0x12, 0x9D, 0x6B, 0x90, 0xA5, 0x67, 0x74, 0x01, 0xF0, 0xE4, -0xA3, 0xF0, 0x90, 0xA5, 0x71, 0xF0, 0xA3, 0xF0, 0xFD, 0x7F, 0x01, 0x12, 0x69, 0xF2, 0xE4, 0x90, -0xA5, 0x8E, 0xF0, 0x90, 0xA5, 0x94, 0xE0, 0x54, 0xFE, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, -0xA5, 0x9A, 0xE0, 0x54, 0xFE, 0xF0, 0x22, 0xE4, 0x90, 0xA4, 0x91, 0xF0, 0x22, 0xE4, 0x90, 0xA4, -0x8C, 0xF0, 0xA3, 0xF0, 0x90, 0xA3, 0xF4, 0xF0, 0xA3, 0xF0, 0x22, 0x90, 0xA5, 0x12, 0xE0, 0x54, -0xFE, 0xF0, 0x54, 0xFD, 0xF0, 0x54, 0xFB, 0xF0, 0x54, 0xF7, 0xF0, 0x54, 0xEF, 0xF0, 0x54, 0xDF, -0xF0, 0x54, 0xBF, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0x74, 0x0C, 0xF0, 0x22, -0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x8B, 0x51, 0x8A, 0x52, 0x89, 0x53, 0x90, 0x05, 0x27, -0xE0, 0xF5, 0x54, 0x12, 0x06, 0x89, 0xFF, 0x54, 0x01, 0xFE, 0x90, 0xA5, 0x12, 0xE0, 0x54, 0xFE, -0x4E, 0xFE, 0xF0, 0xEF, 0x54, 0x02, 0xFF, 0xEE, 0x54, 0xFD, 0x4F, 0xFF, 0xF0, 0x12, 0x06, 0x89, -0xFE, 0x54, 0x04, 0xFD, 0xEF, 0x54, 0xFB, 0x4D, 0xFF, 0x90, 0xA5, 0x12, 0xF0, 0xEE, 0x54, 0x08, -0xFE, 0xEF, 0x54, 0xF7, 0x4E, 0xFF, 0xF0, 0x12, 0x06, 0x89, 0xFE, 0x54, 0x10, 0xFD, 0xEF, 0x54, -0xEF, 0x4D, 0xFF, 0x90, 0xA5, 0x12, 0xF0, 0xEE, 0x54, 0x20, 0xFE, 0xEF, 0x54, 0xDF, 0x4E, 0xFF, -0xF0, 0x12, 0x06, 0x89, 0xFE, 0x54, 0x40, 0xFD, 0xEF, 0x54, 0xBF, 0x4D, 0x90, 0xA5, 0x12, 0xF0, -0xEE, 0xC3, 0x13, 0x20, 0xE0, 0x02, 0x81, 0x3C, 0xE0, 0x20, 0xE0, 0x02, 0x81, 0x23, 0x75, 0x54, -0x21, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x08, 0x12, 0x66, 0xC0, 0x43, 0x54, 0x08, 0x80, 0x0C, -0xE4, 0x90, 0xA5, 0x13, 0xF0, 0xA3, 0xF0, 0x7D, 0x40, 0xFF, 0xB1, 0x0C, 0x90, 0xA5, 0x12, 0xE0, -0xFF, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x03, 0x43, 0x54, 0x12, 0xEF, 0xC4, 0x54, 0x0F, -0x30, 0xE0, 0x03, 0x43, 0x54, 0x14, 0x90, 0xA5, 0x12, 0xE0, 0xC4, 0x13, 0x54, 0x07, 0x30, 0xE0, -0x03, 0x43, 0x54, 0x80, 0x90, 0xA5, 0x12, 0xE0, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x20, 0xE0, 0x03, -0x43, 0x54, 0x40, 0x90, 0x05, 0x27, 0xE5, 0x54, 0xF0, 0x90, 0xA5, 0x15, 0xE0, 0x70, 0x05, 0x7F, -0x01, 0x12, 0xB5, 0xCB, 0x90, 0xA5, 0x12, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, -0x04, 0x7F, 0x04, 0x80, 0x22, 0x12, 0x67, 0x5F, 0xEF, 0x60, 0x04, 0x7F, 0x01, 0x80, 0x18, 0x7F, -0x02, 0x80, 0x14, 0x75, 0x54, 0x01, 0x90, 0x05, 0x27, 0xE5, 0x54, 0xF0, 0x90, 0xA5, 0x15, 0xE0, -0x64, 0x04, 0x60, 0x02, 0x81, 0xFD, 0xFF, 0x12, 0xB5, 0xCB, 0x81, 0xFD, 0x90, 0xA5, 0x12, 0xE0, -0xFF, 0x20, 0xE0, 0x02, 0x81, 0xCB, 0x43, 0x54, 0x31, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x08, -0x12, 0x66, 0xC0, 0x43, 0x54, 0x08, 0x80, 0x06, 0x7D, 0x40, 0xE4, 0xFF, 0xB1, 0x0C, 0x90, 0xA5, -0x12, 0xE0, 0xFF, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x03, 0x43, 0x54, 0x02, 0xEF, 0xC4, -0x54, 0x0F, 0x30, 0xE0, 0x03, 0x43, 0x54, 0x04, 0x90, 0x05, 0x27, 0xE5, 0x54, 0xF0, 0x90, 0xA5, -0x12, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, 0x0E, 0x90, 0xA5, 0x16, 0xE0, 0x64, -0x02, 0x60, 0x6A, 0xE4, 0xFD, 0x7F, 0x02, 0x80, 0x23, 0x90, 0x05, 0x27, 0xE0, 0x44, 0x40, 0xF0, -0x90, 0xA5, 0x16, 0xE0, 0xB4, 0x02, 0x1A, 0x12, 0xBB, 0xCF, 0x12, 0x67, 0x5F, 0xBF, 0x01, 0x09, -0x90, 0xA5, 0x1D, 0xE0, 0xFF, 0x7D, 0x01, 0x80, 0x03, 0xE4, 0xFD, 0xFF, 0x12, 0x50, 0x8A, 0x80, -0x3C, 0x90, 0xA5, 0x1E, 0xE0, 0x90, 0xA5, 0x16, 0xF0, 0x80, 0x32, 0x75, 0x54, 0x01, 0x90, 0x05, -0x27, 0xE5, 0x54, 0xF0, 0x90, 0xA5, 0x16, 0xE0, 0xB4, 0x02, 0x06, 0x7D, 0x01, 0x7F, 0x04, 0x80, -0x0B, 0x90, 0xA5, 0x16, 0xE0, 0xB4, 0x08, 0x07, 0x7D, 0x01, 0x7F, 0x0C, 0x12, 0x50, 0x8A, 0xF1, -0x6E, 0x90, 0xA5, 0x1D, 0xE0, 0xFF, 0x7D, 0x01, 0x12, 0x50, 0x8A, 0x51, 0xFB, 0xD0, 0xD0, 0x92, -0xAF, 0x22, 0x7D, 0x02, 0x7F, 0x02, 0xB1, 0x0C, 0x7D, 0x01, 0x7F, 0x02, 0x74, 0x15, 0x2F, 0xF8, -0xE6, 0xFE, 0xED, 0xF4, 0x5E, 0xFE, 0xF6, 0x74, 0x30, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, -0x83, 0xEE, 0xF0, 0x22, 0x90, 0xA5, 0x12, 0xE0, 0xFF, 0x30, 0xE0, 0x08, 0x90, 0xA5, 0x16, 0xE0, -0x64, 0x02, 0x60, 0x3A, 0x90, 0xA5, 0x1B, 0xE0, 0x70, 0x04, 0xEF, 0x30, 0xE0, 0x0A, 0x90, 0xA5, -0x1E, 0xE0, 0x64, 0x02, 0x60, 0x28, 0xD1, 0x95, 0x90, 0xA5, 0x18, 0xE0, 0x13, 0x13, 0x13, 0x54, -0x1F, 0x30, 0xE0, 0x14, 0x90, 0xA5, 0x21, 0xE0, 0xFF, 0xA3, 0xE0, 0x6F, 0x70, 0x0A, 0xF1, 0x4A, -0xB1, 0x02, 0x90, 0xA5, 0x22, 0xE0, 0x14, 0xF0, 0x90, 0x01, 0xE6, 0xE0, 0x04, 0xF0, 0x22, 0xEF, -0x70, 0x4E, 0x7D, 0x78, 0x7F, 0x02, 0xB1, 0x0C, 0x7D, 0x02, 0x7F, 0x03, 0xB1, 0x0C, 0x7D, 0xC8, -0x7F, 0x02, 0x12, 0xA6, 0xEA, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0xF0, -0x90, 0xA4, 0x91, 0xE0, 0x70, 0x14, 0x12, 0x6E, 0x7A, 0xF1, 0xAA, 0x90, 0xA5, 0x17, 0xE0, 0x54, -0xF7, 0xF0, 0x54, 0xBF, 0xF0, 0x54, 0x7F, 0xF0, 0x80, 0x07, 0x7D, 0x01, 0x7F, 0x0C, 0x12, 0x50, -0x8A, 0x90, 0xA5, 0x17, 0xE0, 0x54, 0xF7, 0xF0, 0x90, 0x06, 0x0A, 0xE0, 0x54, 0xF8, 0xF0, 0x22, -0x90, 0x01, 0x36, 0x74, 0x78, 0xF0, 0xA3, 0x74, 0x02, 0xF0, 0x7D, 0x78, 0xFF, 0x12, 0x66, 0xC9, -0x7D, 0x02, 0x7F, 0x03, 0x12, 0x66, 0xC9, 0x90, 0x06, 0x0A, 0xE0, 0x44, 0x07, 0xF0, 0x90, 0xA5, -0x26, 0xA3, 0xE0, 0x90, 0x05, 0x58, 0xF0, 0x90, 0xA4, 0x91, 0xE0, 0xB4, 0x01, 0x15, 0x90, 0xA5, -0x18, 0xE0, 0x54, 0xFB, 0xF0, 0x90, 0xA5, 0x1E, 0xE0, 0x20, 0xE2, 0x0E, 0x7D, 0x01, 0x7F, 0x04, -0x02, 0x50, 0x8A, 0x90, 0xA5, 0x18, 0xE0, 0x44, 0x04, 0xF0, 0x22, 0x90, 0xA5, 0x69, 0xE0, 0x30, -0xE0, 0x05, 0x12, 0x69, 0xA0, 0x80, 0x03, 0x12, 0x9D, 0xC8, 0x90, 0xA5, 0x52, 0xE0, 0xC4, 0x13, -0x13, 0x54, 0x03, 0x30, 0xE0, 0x13, 0x90, 0xA5, 0x96, 0xE0, 0x04, 0xF0, 0xE0, 0xB4, 0x14, 0x09, -0x90, 0x04, 0x9C, 0xE4, 0xF0, 0x90, 0xA5, 0x96, 0xF0, 0x90, 0xA5, 0x12, 0xE0, 0x30, 0xE0, 0x06, -0x90, 0xA5, 0x14, 0x74, 0x01, 0xF0, 0x90, 0xA5, 0x1B, 0xE0, 0x60, 0x44, 0x90, 0xA5, 0x18, 0xE0, -0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x12, 0x90, 0x01, 0x3B, 0xE0, 0x30, 0xE4, 0x0B, 0xB1, -0x02, 0x90, 0xA5, 0x21, 0xE0, 0x14, 0x90, 0x05, 0x73, 0xF0, 0x90, 0xA7, 0x97, 0xE4, 0x75, 0xF0, -0x01, 0x12, 0x08, 0xD6, 0xC3, 0x90, 0xA7, 0x98, 0xE0, 0x94, 0x80, 0x90, 0xA7, 0x97, 0xE0, 0x64, -0x80, 0x94, 0x80, 0x40, 0x0B, 0x90, 0x01, 0x98, 0xE0, 0x54, 0xFE, 0xF0, 0xE0, 0x44, 0x01, 0xF0, -0x7F, 0x01, 0x02, 0x4E, 0xDC, 0x90, 0xA4, 0x91, 0xE0, 0x64, 0x01, 0x60, 0x02, 0xE1, 0x39, 0x90, -0xA5, 0x1B, 0xE0, 0x70, 0x02, 0xE1, 0x39, 0x90, 0xA5, 0x19, 0xE0, 0xC4, 0x54, 0x0F, 0x64, 0x01, -0x70, 0x26, 0x90, 0x06, 0xAB, 0xE0, 0x90, 0xA5, 0x22, 0xF0, 0x90, 0x06, 0xAA, 0xE0, 0x04, 0x90, -0xA5, 0x21, 0xF0, 0xA3, 0xE0, 0xFF, 0x70, 0x08, 0x90, 0xA5, 0x21, 0xE0, 0xFE, 0xFF, 0x80, 0x03, -0xEF, 0x04, 0xFF, 0x90, 0xA5, 0x22, 0xEF, 0xF0, 0x90, 0xA5, 0x18, 0xE0, 0x44, 0x04, 0xF0, 0xE4, -0x90, 0xA5, 0x24, 0xF0, 0x90, 0xA5, 0x26, 0xA3, 0xE0, 0x90, 0x05, 0x58, 0xF0, 0x90, 0x01, 0x57, -0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0xF0, 0x90, 0xA5, 0x1F, 0xE0, 0x54, 0xFD, 0xF0, 0x54, -0xEF, 0xF0, 0x90, 0xA5, 0x19, 0xE0, 0xFF, 0xC4, 0x54, 0x0F, 0x24, 0xFD, 0x50, 0x02, 0x80, 0x0F, -0x90, 0xA5, 0x12, 0xE0, 0x30, 0xE0, 0x05, 0x12, 0x9E, 0xDB, 0x80, 0x03, 0x12, 0x9E, 0x6B, 0x90, -0xA5, 0x18, 0xE0, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x0E, 0x90, 0xA5, 0x21, 0xE0, 0xFF, -0xA3, 0xE0, 0xB5, 0x07, 0x04, 0xF1, 0x4A, 0xB1, 0x08, 0x90, 0xA5, 0x12, 0xE0, 0xC3, 0x13, 0x20, -0xE0, 0x07, 0x90, 0xA5, 0x18, 0xE0, 0x44, 0x04, 0xF0, 0x22, 0xEF, 0x14, 0x90, 0x05, 0x73, 0xF0, -0x90, 0x01, 0x3F, 0x74, 0x10, 0xF0, 0xFD, 0x7F, 0x03, 0x74, 0x1D, 0x2F, 0xF8, 0xE6, 0x4D, 0xFE, -0xF6, 0x74, 0x38, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0xF1, 0xBE, -0xEF, 0x70, 0x02, 0xF1, 0x76, 0x22, 0x90, 0xA5, 0x4E, 0xE0, 0x20, 0xE0, 0x2C, 0x90, 0xA5, 0x1B, -0xE0, 0x64, 0x01, 0x70, 0x24, 0x12, 0x96, 0xD6, 0x90, 0xA5, 0x19, 0xE0, 0x54, 0x0F, 0x60, 0x10, -0xE4, 0xFD, 0x7F, 0x0C, 0x12, 0x50, 0x8A, 0xE4, 0xFD, 0xFF, 0x12, 0x53, 0x88, 0x02, 0xB8, 0xE8, -0x90, 0xA5, 0x1E, 0xE0, 0x70, 0x03, 0x12, 0x50, 0x86, 0x22, 0x90, 0x06, 0x04, 0xE0, 0x54, 0x7F, -0xF0, 0xE4, 0xFD, 0xFF, 0x12, 0x53, 0x88, 0x7D, 0x0C, 0x7F, 0x01, 0x02, 0x52, 0xCD, 0x90, 0x04, -0x1A, 0xE0, 0xF4, 0x60, 0x03, 0x7F, 0x00, 0x22, 0x90, 0x04, 0x1B, 0xE0, 0x54, 0x07, 0x64, 0x07, -0x7F, 0x01, 0x60, 0x02, 0x7F, 0x00, 0x22, 0x90, 0xA6, 0xB4, 0xEB, 0xF0, 0x70, 0x64, 0x90, 0xA6, -0xB4, 0xE0, 0xFE, 0x24, 0x17, 0xF5, 0x82, 0xE4, 0x34, 0x9B, 0xF5, 0x83, 0xE0, 0xFC, 0x90, 0xA6, -0xB5, 0xE0, 0xFB, 0xEC, 0x6B, 0x60, 0x4B, 0x90, 0xA6, 0xB8, 0xEB, 0xF0, 0xA3, 0xEE, 0xF0, 0xAE, -0x05, 0xEE, 0x25, 0xE0, 0x4F, 0xFF, 0x90, 0x95, 0x11, 0xE0, 0xFE, 0x25, 0xE0, 0x25, 0xE0, 0x4F, -0x90, 0xA6, 0xBA, 0xF0, 0x90, 0xA6, 0xB6, 0x74, 0x0C, 0xF0, 0x90, 0xA6, 0xC4, 0x74, 0x04, 0xF0, -0x7B, 0x01, 0x7A, 0xA6, 0x79, 0xB6, 0x12, 0x67, 0xEA, 0x7F, 0x04, 0x12, 0x5F, 0xF2, 0x90, 0xA6, -0xB5, 0xE0, 0xFF, 0x90, 0xA6, 0xB4, 0xE0, 0x24, 0x17, 0xF5, 0x82, 0xE4, 0x34, 0x9B, 0xF5, 0x83, -0xEF, 0xF0, 0x22, 0x8F, 0x60, 0x75, 0xF0, 0x05, 0xEF, 0x90, 0x97, 0x9B, 0x12, 0x48, 0x49, 0xE0, -0x54, 0x01, 0xFB, 0x75, 0xF0, 0x10, 0xE5, 0x60, 0x90, 0x81, 0x00, 0x12, 0x48, 0x49, 0xE0, 0xF5, -0x61, 0x54, 0x7F, 0xFA, 0x75, 0xF0, 0x05, 0xE5, 0x60, 0x90, 0x97, 0x97, 0x12, 0x48, 0x49, 0xE0, -0xF9, 0x90, 0xA6, 0x71, 0xF0, 0x75, 0xF0, 0x04, 0xEA, 0x90, 0x42, 0x41, 0x12, 0x48, 0x49, 0x12, -0x48, 0x1D, 0xE5, 0x60, 0x25, 0xE0, 0x24, 0x16, 0xF5, 0x82, 0xE4, 0x34, 0x96, 0xF5, 0x83, 0xEE, -0xF0, 0xA3, 0xEF, 0xF0, 0x75, 0xF0, 0x05, 0xE5, 0x60, 0x90, 0x97, 0x9A, 0x12, 0x48, 0x49, 0xE0, -0x13, 0x13, 0x54, 0x03, 0xF5, 0x63, 0xEA, 0xC3, 0x99, 0x40, 0x02, 0x21, 0x49, 0x74, 0x18, 0x25, -0x60, 0xF5, 0x82, 0xE4, 0x34, 0xA2, 0xF5, 0x83, 0xEA, 0xF0, 0x74, 0x18, 0x25, 0x60, 0xF5, 0x82, -0xE4, 0x34, 0xA2, 0xF5, 0x83, 0xE0, 0xF5, 0x62, 0xC3, 0x94, 0x0C, 0x40, 0x23, 0xE5, 0x62, 0x94, -0x1B, 0x50, 0x1D, 0xBB, 0x01, 0x1A, 0xE5, 0x62, 0x24, 0xF4, 0xFD, 0xAF, 0x60, 0x51, 0x69, 0xAD, -0x62, 0xAF, 0x60, 0x31, 0xC7, 0xAA, 0x07, 0xEA, 0x65, 0x62, 0x60, 0x04, 0x8A, 0x61, 0x21, 0xB9, -0xEA, 0x04, 0xFD, 0x90, 0xA6, 0x71, 0xE0, 0xFF, 0xED, 0xD3, 0x9F, 0x40, 0x02, 0x21, 0xB9, 0xED, -0x13, 0x13, 0x13, 0x54, 0x1F, 0xFF, 0x75, 0xF0, 0x08, 0xE5, 0x60, 0x90, 0x89, 0x00, 0x12, 0x48, -0x49, 0xE5, 0x82, 0x2F, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE0, 0xF5, 0x82, 0x75, 0x83, -0x00, 0xED, 0x54, 0x07, 0xFF, 0x74, 0x01, 0x7E, 0x00, 0xA8, 0x07, 0x08, 0x80, 0x05, 0xC3, 0x33, -0xCE, 0x33, 0xCE, 0xD8, 0xF9, 0xFF, 0xEE, 0x55, 0x83, 0xFE, 0xEF, 0x55, 0x82, 0x4E, 0x60, 0x06, -0xAA, 0x05, 0x8A, 0x61, 0x80, 0x73, 0x0D, 0x80, 0xAA, 0x90, 0xA6, 0x71, 0xE0, 0x6A, 0x70, 0x50, -0x74, 0x18, 0x25, 0x60, 0xF5, 0x82, 0xE4, 0x34, 0xA2, 0xF5, 0x83, 0xE5, 0x61, 0xF0, 0x75, 0xF0, -0x05, 0xE5, 0x60, 0x90, 0x97, 0x99, 0x12, 0x48, 0x49, 0xE0, 0xFF, 0xC4, 0x13, 0x54, 0x07, 0x30, -0xE0, 0x0C, 0xE5, 0x61, 0x20, 0xE7, 0x07, 0xEA, 0x44, 0x80, 0xF5, 0x61, 0x80, 0x3B, 0x75, 0xF0, -0x04, 0xEA, 0x90, 0x42, 0x41, 0x12, 0x48, 0x49, 0x12, 0x48, 0x1D, 0xE5, 0x60, 0x25, 0xE0, 0x24, -0x16, 0xF5, 0x82, 0xE4, 0x34, 0x96, 0xF5, 0x83, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xAF, 0x61, 0x22, -0x90, 0xA6, 0x71, 0xE0, 0xFF, 0x74, 0x18, 0x25, 0x60, 0xF5, 0x82, 0xE4, 0x34, 0xA2, 0xF5, 0x83, -0xEF, 0xF0, 0xAA, 0x07, 0xEF, 0x54, 0x80, 0xF5, 0x61, 0x90, 0xA7, 0x3B, 0xE5, 0x63, 0xF0, 0x7B, -0x01, 0x12, 0x62, 0x9F, 0xAF, 0x61, 0x22, 0x74, 0x81, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x94, 0xF5, -0x83, 0xE0, 0x54, 0xFC, 0xF0, 0x74, 0x98, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xA2, 0xF5, 0x83, 0xE0, -0xFE, 0x60, 0x37, 0x74, 0x18, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xA3, 0xF5, 0x83, 0xE0, 0x60, 0x2A, -0xEE, 0x7A, 0x00, 0xFB, 0x90, 0xA6, 0x72, 0xEA, 0xF0, 0xA3, 0xEB, 0xF0, 0x74, 0x81, 0x2F, 0xF5, -0x82, 0xE4, 0x34, 0x94, 0xF5, 0x83, 0xE0, 0x54, 0xFC, 0x44, 0x02, 0xFE, 0x74, 0x81, 0x2F, 0xF5, -0x82, 0xE4, 0x34, 0x94, 0xF5, 0x83, 0xEE, 0xF0, 0x80, 0x48, 0x74, 0x98, 0x2F, 0xF5, 0x82, 0xE4, -0x34, 0xA2, 0xF5, 0x83, 0xE0, 0x70, 0x0F, 0x74, 0x18, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xA3, 0xF5, -0x83, 0xE0, 0x60, 0x02, 0x80, 0x1C, 0x74, 0x98, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xA2, 0xF5, 0x83, -0xE0, 0xFE, 0x60, 0x1B, 0x74, 0x18, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xA3, 0xF5, 0x83, 0xE0, 0x70, -0x0E, 0xEE, 0x7A, 0x00, 0xFB, 0x90, 0xA6, 0x72, 0xEA, 0xF0, 0xA3, 0xEB, 0xF0, 0x80, 0x03, 0xAF, -0x05, 0x22, 0x90, 0xA6, 0x72, 0xA3, 0xE0, 0xFF, 0x22, 0xAC, 0x07, 0x74, 0x97, 0x2C, 0xF5, 0x82, -0xE4, 0x34, 0x9B, 0xF5, 0x83, 0xE0, 0xFF, 0x54, 0x02, 0xC3, 0x13, 0xFE, 0xEF, 0x54, 0x40, 0xC4, -0x13, 0x13, 0x54, 0x03, 0x64, 0x01, 0x70, 0x4D, 0xED, 0xC3, 0x94, 0x00, 0x40, 0x06, 0xED, 0xD3, -0x94, 0x03, 0x40, 0x0C, 0xED, 0xC3, 0x94, 0x08, 0x40, 0x2F, 0xED, 0xD3, 0x94, 0x0A, 0x50, 0x29, -0xED, 0x25, 0xE0, 0x24, 0xF4, 0xF5, 0x82, 0xE4, 0x34, 0x44, 0xF5, 0x83, 0xE4, 0x93, 0xFF, 0x74, -0x98, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xA2, 0xF5, 0x83, 0xEF, 0xF0, 0x74, 0x18, 0x2C, 0xF5, 0x82, -0xE4, 0x34, 0xA3, 0xF5, 0x83, 0xE4, 0xF0, 0x61, 0x74, 0xED, 0x64, 0x05, 0x60, 0x22, 0xED, 0x64, -0x0B, 0x70, 0x44, 0x80, 0x1B, 0xEE, 0x64, 0x01, 0x70, 0x64, 0xED, 0xC3, 0x94, 0x00, 0x40, 0x06, -0xED, 0xD3, 0x94, 0x03, 0x40, 0x0A, 0xED, 0x64, 0x08, 0x60, 0x05, 0xED, 0x64, 0x09, 0x70, 0x27, -0xED, 0x25, 0xE0, 0x24, 0xF4, 0xF5, 0x82, 0xE4, 0x34, 0x44, 0xF5, 0x83, 0xE4, 0x93, 0xFF, 0x74, -0x98, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xA2, 0xF5, 0x83, 0xEF, 0xF0, 0xED, 0x25, 0xE0, 0x24, 0xF3, -0xF5, 0x82, 0xE4, 0x34, 0x44, 0x80, 0x4C, 0xED, 0x25, 0xE0, 0x24, 0xF3, 0xF5, 0x82, 0xE4, 0x34, -0x44, 0xF5, 0x83, 0xE4, 0x93, 0xFF, 0x74, 0x98, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xA2, 0xF5, 0x83, -0xEF, 0xF0, 0xED, 0x25, 0xE0, 0x24, 0xF4, 0xF5, 0x82, 0xE4, 0x34, 0x44, 0x80, 0x25, 0xED, 0x25, -0xE0, 0x24, 0xF3, 0xF5, 0x82, 0xE4, 0x34, 0x44, 0xF5, 0x83, 0xE4, 0x93, 0xFF, 0x74, 0x98, 0x2C, -0xF5, 0x82, 0xE4, 0x34, 0xA2, 0xF5, 0x83, 0xEF, 0xF0, 0xED, 0x25, 0xE0, 0x24, 0xF4, 0xF5, 0x82, -0xE4, 0x34, 0x44, 0xF5, 0x83, 0xE4, 0x93, 0xFF, 0x74, 0x18, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xA3, -0xF5, 0x83, 0xEF, 0xF0, 0x74, 0x98, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xA2, 0xF5, 0x83, 0xE0, 0xF9, -0x74, 0x18, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xA3, 0xF5, 0x83, 0xE0, 0xFD, 0xE9, 0x13, 0x13, 0x13, -0x54, 0x1F, 0xFF, 0x75, 0xF0, 0x08, 0xEC, 0x90, 0x89, 0x00, 0x12, 0x48, 0x49, 0xE5, 0x82, 0x2F, -0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE0, 0xFB, 0x7A, 0x00, 0xE9, 0x54, 0x07, 0xFF, 0x74, -0x01, 0x7E, 0x00, 0xA8, 0x07, 0x08, 0x80, 0x05, 0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8, 0xF9, 0xFF, -0xEE, 0x5A, 0xFE, 0xEF, 0x5B, 0x4E, 0x70, 0x0A, 0x74, 0x98, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xA2, -0x80, 0x44, 0xED, 0x13, 0x13, 0x13, 0x54, 0x1F, 0xFF, 0x75, 0xF0, 0x08, 0xEC, 0x90, 0x89, 0x00, -0x12, 0x48, 0x49, 0xE5, 0x82, 0x2F, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE0, 0xFB, 0x7A, -0x00, 0xED, 0x54, 0x07, 0xFF, 0x74, 0x01, 0x7E, 0x00, 0xA8, 0x07, 0x08, 0x80, 0x05, 0xC3, 0x33, -0xCE, 0x33, 0xCE, 0xD8, 0xF9, 0xFF, 0xEE, 0x5A, 0xFE, 0xEF, 0x5B, 0x4E, 0x70, 0x0C, 0x74, 0x18, -0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xA3, 0xF5, 0x83, 0xE4, 0xF0, 0x22, 0x74, 0x81, 0x2F, 0xF5, 0x82, -0xE4, 0x34, 0x94, 0xF5, 0x83, 0xE0, 0x54, 0xF0, 0xC4, 0x54, 0x0F, 0xFE, 0x75, 0xF0, 0x10, 0xEF, -0x90, 0x81, 0x05, 0x12, 0x48, 0x49, 0xE0, 0x54, 0x03, 0xFD, 0x75, 0xF0, 0x05, 0xEF, 0x90, 0x97, -0x97, 0x12, 0x48, 0x49, 0xE0, 0xFC, 0x74, 0x18, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xA2, 0xF5, 0x83, -0xE0, 0x54, 0x7F, 0xF5, 0x67, 0xD3, 0x94, 0x1B, 0x50, 0x61, 0xE5, 0x67, 0xC3, 0x94, 0x0C, 0x40, -0x5A, 0x0E, 0xEE, 0x94, 0x04, 0x40, 0x34, 0xE4, 0xFE, 0x74, 0x17, 0x2F, 0xF5, 0x82, 0xE4, 0x34, -0x9C, 0xF5, 0x83, 0xE0, 0xFB, 0x74, 0x12, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x95, 0xF5, 0x83, 0xEB, -0xF0, 0x74, 0x17, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x9C, 0xF5, 0x83, 0xE0, 0x24, 0x3C, 0xFB, 0x74, -0x98, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x9C, 0xF5, 0x83, 0xEB, 0xF0, 0x74, 0x81, 0x2F, 0xF5, 0x82, -0xE4, 0x34, 0x94, 0xF5, 0x83, 0xE0, 0x54, 0x0F, 0xFB, 0xEE, 0xC4, 0x54, 0xF0, 0x4B, 0xFE, 0x74, -0x81, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x94, 0xF5, 0x83, 0xEE, 0xF0, 0xE5, 0x67, 0xD3, 0x9C, 0x40, -0x02, 0x8C, 0x67, 0x90, 0xA7, 0x3B, 0xED, 0xF0, 0xE4, 0xFB, 0xAD, 0x67, 0x12, 0x62, 0xA3, 0xAF, -0x67, 0x22, 0x8F, 0x60, 0x74, 0x98, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x9C, 0xF5, 0x83, 0xE4, 0xF0, -0x75, 0xF0, 0x05, 0xEF, 0x90, 0x97, 0x9B, 0x12, 0x48, 0x49, 0xE0, 0x54, 0x01, 0xFF, 0x75, 0xF0, -0x10, 0xE5, 0x60, 0x90, 0x81, 0x00, 0x12, 0x48, 0x49, 0xE0, 0xF5, 0x61, 0x54, 0x7F, 0x90, 0xA6, -0x73, 0xF0, 0x75, 0xF0, 0x05, 0xE5, 0x60, 0x90, 0x97, 0x98, 0x12, 0x48, 0x49, 0xE0, 0x90, 0xA6, -0x76, 0xF0, 0x75, 0xF0, 0x05, 0xE5, 0x60, 0x90, 0x97, 0x97, 0x12, 0x48, 0x49, 0xE0, 0xF9, 0x90, -0xA6, 0x77, 0xF0, 0x75, 0xF0, 0x10, 0xE5, 0x60, 0x90, 0x81, 0x05, 0x12, 0x48, 0x49, 0xE0, 0x54, -0x03, 0xF5, 0x62, 0x90, 0xA6, 0x73, 0xE0, 0xFE, 0x25, 0xE0, 0x24, 0x91, 0xF5, 0x82, 0xE4, 0x34, -0x43, 0xF5, 0x83, 0xE4, 0x93, 0xFA, 0x74, 0x01, 0x93, 0xFB, 0xE5, 0x60, 0x25, 0xE0, 0x24, 0x16, -0xF5, 0x82, 0xE4, 0x34, 0x96, 0xF5, 0x83, 0xEA, 0xF0, 0xA3, 0xEB, 0xF0, 0x74, 0x18, 0x25, 0x60, -0xF5, 0x82, 0xE4, 0x34, 0xA2, 0xF5, 0x83, 0xEE, 0xF0, 0x74, 0x18, 0x25, 0x60, 0xF5, 0x82, 0xE4, -0x34, 0xA2, 0xF5, 0x83, 0xE0, 0xF5, 0x63, 0x90, 0xA6, 0x73, 0xE0, 0xD3, 0x99, 0x40, 0x0A, 0x90, -0xA6, 0x77, 0xE0, 0x90, 0xA6, 0x73, 0xF0, 0xF5, 0x61, 0xED, 0x70, 0x02, 0xC1, 0xA2, 0x90, 0xA6, -0x74, 0xED, 0xF0, 0xE5, 0x61, 0x30, 0xE7, 0x0A, 0x90, 0xA6, 0x73, 0xE0, 0xF5, 0x61, 0xA3, 0xE0, -0x14, 0xF0, 0x90, 0xA6, 0x74, 0xE0, 0xFE, 0x70, 0x02, 0xC1, 0xA2, 0x90, 0xA6, 0x76, 0xE0, 0xFD, -0x90, 0xA6, 0x73, 0xE0, 0xD3, 0x9D, 0x50, 0x02, 0xC1, 0x9C, 0xE4, 0x90, 0xA6, 0x72, 0xF0, 0xE5, -0x63, 0xD3, 0x94, 0x1B, 0x50, 0x5A, 0xE5, 0x63, 0x94, 0x0C, 0x40, 0x54, 0xEF, 0x64, 0x01, 0x70, -0x4F, 0xE5, 0x63, 0x24, 0xF4, 0xC3, 0x9E, 0x90, 0xA6, 0x75, 0xF0, 0xFD, 0xAF, 0x60, 0x12, 0x89, -0x4C, 0xAB, 0x62, 0xAD, 0x63, 0xAF, 0x60, 0xD1, 0xB0, 0x8F, 0x61, 0x74, 0x81, 0x25, 0x60, 0xF5, -0x82, 0xE4, 0x34, 0x94, 0xF5, 0x83, 0xE0, 0x54, 0x04, 0xFF, 0xBF, 0x0C, 0x0A, 0x90, 0xA7, 0x3B, -0xE5, 0x62, 0xF0, 0x7B, 0x01, 0xC1, 0xAA, 0x74, 0x81, 0x25, 0x60, 0xF5, 0x82, 0xE4, 0x34, 0x94, -0xF5, 0x83, 0xE0, 0x30, 0xE2, 0x0A, 0x90, 0xA7, 0x3B, 0xE5, 0x62, 0xF0, 0xE4, 0xFB, 0xC1, 0xAA, -0x90, 0xA6, 0x73, 0xE0, 0x14, 0x90, 0xA6, 0x71, 0xF0, 0x90, 0xA6, 0x76, 0xE0, 0xFF, 0x90, 0xA6, -0x71, 0xE0, 0xFD, 0xC3, 0x9F, 0x40, 0x6B, 0xE0, 0xFF, 0x13, 0x13, 0x13, 0x54, 0x1F, 0xFE, 0x75, -0xF0, 0x08, 0xE5, 0x60, 0x90, 0x89, 0x00, 0x12, 0x48, 0x49, 0xE5, 0x82, 0x2E, 0xF5, 0x82, 0xE4, -0x35, 0x83, 0xF5, 0x83, 0xE0, 0xFB, 0x7A, 0x00, 0xEF, 0x54, 0x07, 0xFF, 0x74, 0x01, 0x7E, 0x00, -0xA8, 0x07, 0x08, 0x80, 0x05, 0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8, 0xF9, 0xFF, 0xEE, 0x5A, 0xFE, -0xEF, 0x5B, 0x4E, 0x60, 0x1F, 0x8D, 0x61, 0x90, 0xA6, 0x72, 0xE0, 0x04, 0xF0, 0x90, 0xA6, 0x74, -0xE0, 0xFF, 0x90, 0xA6, 0x72, 0xE0, 0x6F, 0x60, 0x19, 0x90, 0xA6, 0x76, 0xE0, 0xFF, 0xE5, 0x61, -0xD3, 0x9F, 0x40, 0x0E, 0x90, 0xA6, 0x71, 0xE0, 0x14, 0xF0, 0x80, 0x8D, 0x90, 0xA6, 0x76, 0xE0, -0xF5, 0x61, 0x90, 0xA7, 0x3B, 0xE5, 0x62, 0xF0, 0xE4, 0xFB, 0x12, 0x62, 0x9F, 0xAF, 0x61, 0x22, -0x90, 0xA6, 0x78, 0xEB, 0xF0, 0x74, 0x81, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x94, 0xF5, 0x83, 0xE0, -0x54, 0xFB, 0xF0, 0x74, 0x18, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x9D, 0xF5, 0x83, 0xE0, 0xFB, 0x60, -0x2F, 0x74, 0x18, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x9E, 0xF5, 0x83, 0xE0, 0x60, 0x22, 0xAE, 0x03, -0xAC, 0x06, 0x74, 0x81, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x94, 0xF5, 0x83, 0xE0, 0x54, 0xFB, 0x44, -0x04, 0xFD, 0x74, 0x81, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x94, 0xF5, 0x83, 0xED, 0xF0, 0x80, 0x41, -0x74, 0x18, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x9D, 0xF5, 0x83, 0xE0, 0x70, 0x10, 0x74, 0x18, 0x2F, -0xF5, 0x82, 0xE4, 0x34, 0x9E, 0xF5, 0x83, 0xE0, 0x60, 0x03, 0xFC, 0x80, 0x24, 0x74, 0x18, 0x2F, -0xF5, 0x82, 0xE4, 0x34, 0x9D, 0xF5, 0x83, 0xE0, 0xFB, 0x60, 0x13, 0x74, 0x18, 0x2F, 0xF5, 0x82, -0xE4, 0x34, 0x9E, 0xF5, 0x83, 0xE0, 0x70, 0x06, 0xAE, 0x03, 0xAC, 0x06, 0x80, 0x03, 0xAF, 0x05, -0x22, 0xAF, 0x04, 0x22, 0xE4, 0xF5, 0x51, 0x74, 0x91, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0xA4, -0xF5, 0x83, 0xE0, 0x70, 0x03, 0x02, 0x85, 0x60, 0x75, 0xF0, 0x05, 0xE5, 0x51, 0x90, 0x97, 0x9A, -0x12, 0x48, 0x49, 0xE0, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x03, 0x02, 0x85, 0x60, -0x74, 0x81, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x94, 0xF5, 0x83, 0xE0, 0x54, 0xF8, 0xF0, 0x75, -0xF0, 0x05, 0xE5, 0x51, 0x90, 0x97, 0x99, 0x12, 0x48, 0x49, 0xE0, 0x54, 0x1F, 0x90, 0xA6, 0x6F, -0xF0, 0x75, 0xF0, 0x05, 0xE5, 0x51, 0x90, 0x97, 0x9A, 0x12, 0x48, 0x49, 0xE0, 0x13, 0x13, 0x54, -0x03, 0x90, 0xA6, 0x70, 0xF0, 0xE5, 0x51, 0x25, 0xE0, 0x24, 0x01, 0xF5, 0x82, 0xE4, 0x34, 0x92, -0xF5, 0x83, 0xE0, 0xFE, 0xA3, 0xE0, 0xD3, 0x94, 0x00, 0xEE, 0x94, 0x00, 0x50, 0x03, 0x02, 0x85, -0x60, 0xE5, 0x51, 0x75, 0xF0, 0x0A, 0xA4, 0x24, 0x01, 0xF9, 0x74, 0x8D, 0x35, 0xF0, 0xFA, 0x7B, -0x01, 0x8B, 0x56, 0xF5, 0x57, 0x89, 0x58, 0xE5, 0x51, 0x25, 0xE0, 0x24, 0x01, 0xF5, 0x82, 0xE4, -0x34, 0x92, 0xF5, 0x83, 0xE0, 0xF5, 0x5B, 0xA3, 0xE0, 0xF5, 0x5C, 0x74, 0x97, 0x25, 0x51, 0xF5, -0x82, 0xE4, 0x34, 0x9A, 0xF5, 0x83, 0xE0, 0xFF, 0x90, 0xA6, 0x66, 0xE4, 0xF0, 0xA3, 0xEF, 0xF0, -0x90, 0x00, 0x02, 0x12, 0x07, 0xAB, 0xFF, 0xAE, 0xF0, 0x12, 0x07, 0x80, 0x2F, 0xFF, 0xE5, 0xF0, -0x3E, 0xFE, 0x90, 0x00, 0x04, 0x12, 0x07, 0xAB, 0x2F, 0xFF, 0xEE, 0x35, 0xF0, 0xFE, 0x90, 0x00, -0x06, 0x12, 0x07, 0xAB, 0x2F, 0xFF, 0xEE, 0x35, 0xF0, 0xFE, 0x90, 0x00, 0x08, 0x12, 0x07, 0xAB, -0x2F, 0xFF, 0xEE, 0x35, 0xF0, 0xFE, 0x90, 0xA6, 0x68, 0xF0, 0xA3, 0xEF, 0xF0, 0x12, 0x07, 0x80, -0xFD, 0xC3, 0xEF, 0x9D, 0xFF, 0xEE, 0x95, 0xF0, 0x90, 0xA6, 0x6A, 0xF0, 0xA3, 0xEF, 0xF0, 0xE5, -0x51, 0xD3, 0x94, 0x01, 0x50, 0x4C, 0xAB, 0x56, 0x90, 0x00, 0x08, 0x12, 0x07, 0xAB, 0xFD, 0xE5, -0x5B, 0xC3, 0x13, 0xFE, 0xE5, 0x5C, 0x13, 0xFF, 0xC3, 0xED, 0x9F, 0xE5, 0xF0, 0x9E, 0x50, 0x08, -0x90, 0x95, 0x11, 0x74, 0x01, 0xF0, 0x80, 0x2A, 0x90, 0x00, 0x08, 0x12, 0x07, 0xAB, 0xFB, 0xAA, -0xF0, 0xE5, 0x5C, 0xAE, 0x5B, 0x78, 0x03, 0xCE, 0xC3, 0x13, 0xCE, 0x13, 0xD8, 0xF9, 0xFF, 0x7C, -0x00, 0x7D, 0x05, 0x12, 0x07, 0x03, 0xD3, 0xEB, 0x9F, 0xEA, 0x9E, 0x40, 0x05, 0xE4, 0x90, 0x95, -0x11, 0xF0, 0x75, 0xF0, 0x10, 0xE5, 0x51, 0x90, 0x81, 0x00, 0x12, 0x48, 0x49, 0xE0, 0x90, 0xA6, -0x65, 0xF0, 0x54, 0x7F, 0xF5, 0x52, 0x75, 0xF0, 0x05, 0xE5, 0x51, 0x90, 0x97, 0x97, 0x12, 0x48, -0x49, 0xE0, 0x90, 0xA6, 0x6C, 0xF0, 0x74, 0x98, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0xA0, 0xF5, -0x83, 0xE0, 0xC3, 0x94, 0x05, 0x40, 0x02, 0x81, 0x64, 0x90, 0xA6, 0x6C, 0xE0, 0xFF, 0xE5, 0x52, -0x9F, 0x40, 0x0D, 0x8F, 0x52, 0x90, 0xA6, 0x65, 0xE0, 0x54, 0x80, 0xFE, 0xF0, 0xEF, 0x4E, 0xF0, -0xE5, 0x52, 0x90, 0x41, 0xED, 0x93, 0xFF, 0x74, 0x17, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x9C, -0xF5, 0x83, 0xE0, 0xC3, 0x9F, 0xE5, 0x52, 0x40, 0x05, 0x90, 0x41, 0x45, 0x80, 0x03, 0x90, 0x41, -0x99, 0x93, 0xF5, 0x5D, 0x90, 0xA5, 0x8F, 0xE0, 0x60, 0x7D, 0xE5, 0x52, 0x64, 0x13, 0x60, 0x05, -0xE5, 0x52, 0xB4, 0x0B, 0x05, 0x90, 0xA5, 0x91, 0x80, 0x23, 0xE5, 0x52, 0x64, 0x12, 0x60, 0x05, -0xE5, 0x52, 0xB4, 0x0A, 0x05, 0x90, 0xA5, 0x92, 0x80, 0x13, 0xE5, 0x52, 0x64, 0x11, 0x60, 0x05, -0xE5, 0x52, 0xB4, 0x09, 0x05, 0x90, 0xA5, 0x93, 0x80, 0x03, 0x90, 0xA5, 0x90, 0xE0, 0xF5, 0x5E, -0xE5, 0x5E, 0xC3, 0x94, 0x80, 0x50, 0x28, 0xE5, 0x5E, 0x94, 0x1B, 0x40, 0x02, 0x80, 0x13, 0xE5, -0x5D, 0x25, 0x5E, 0xFF, 0xE4, 0x33, 0xFE, 0xD3, 0xEF, 0x94, 0x1B, 0xEE, 0x64, 0x80, 0x94, 0x80, -0x40, 0x05, 0x75, 0x5D, 0x1B, 0x80, 0x20, 0xE5, 0x5E, 0x25, 0x5D, 0xF5, 0x5D, 0x80, 0x18, 0xC3, -0xE4, 0x95, 0x5E, 0xF5, 0x5E, 0xE5, 0x5D, 0xD3, 0x95, 0x5E, 0x40, 0x08, 0xE5, 0x5D, 0x95, 0x5E, -0xF5, 0x5D, 0x80, 0x03, 0xE4, 0xF5, 0x5D, 0xE5, 0x5D, 0x75, 0xF0, 0x06, 0xA4, 0x24, 0xA3, 0xF9, -0x74, 0x40, 0x35, 0xF0, 0x75, 0x53, 0xFF, 0xF5, 0x54, 0x89, 0x55, 0x90, 0xA6, 0x65, 0xE0, 0x90, -0x44, 0x99, 0x93, 0xFF, 0xD3, 0x90, 0xA6, 0x67, 0xE0, 0x9F, 0x90, 0xA6, 0x66, 0xE0, 0x94, 0x00, -0x40, 0x02, 0x81, 0x5D, 0x90, 0x04, 0xA9, 0xE5, 0x5C, 0xF0, 0xC3, 0x94, 0x0A, 0xE5, 0x5B, 0x94, -0x00, 0x50, 0x66, 0x90, 0x04, 0xA8, 0xE0, 0x04, 0xF0, 0xAB, 0x56, 0xAA, 0x57, 0xA9, 0x58, 0x90, -0x00, 0x06, 0x12, 0x07, 0xAB, 0xFF, 0xAE, 0xF0, 0x90, 0x00, 0x08, 0x12, 0x07, 0xAB, 0x2F, 0xFD, -0xE5, 0xF0, 0x3E, 0xFC, 0xE5, 0x5B, 0xC3, 0x13, 0xFE, 0xE5, 0x5C, 0x13, 0xFF, 0xD3, 0xED, 0x9F, -0xEC, 0x9E, 0x40, 0x04, 0x7D, 0x02, 0x81, 0x5F, 0xE5, 0x5C, 0xAE, 0x5B, 0x78, 0x02, 0xCE, 0xC3, -0x13, 0xCE, 0x13, 0xD8, 0xF9, 0xFD, 0xAC, 0x06, 0xE5, 0x5B, 0xC3, 0x13, 0xFE, 0xE5, 0x5C, 0x13, -0x2D, 0xFF, 0xEE, 0x3C, 0xFE, 0xAB, 0x56, 0xAA, 0x57, 0xA9, 0x58, 0x12, 0x07, 0x80, 0xD3, 0x9F, -0xE5, 0xF0, 0x9E, 0x50, 0x02, 0x81, 0x64, 0x81, 0x3D, 0x74, 0x17, 0x25, 0x51, 0xF5, 0x82, 0xE4, -0x34, 0x9A, 0xF5, 0x83, 0xE0, 0x70, 0x3D, 0xAB, 0x56, 0xAA, 0x57, 0xA9, 0x58, 0x90, 0x00, 0x08, -0x12, 0x07, 0xAB, 0xFB, 0xAA, 0xF0, 0xAE, 0x5B, 0xAF, 0x5C, 0x7C, 0x00, 0x7D, 0x03, 0x12, 0x07, -0x03, 0xEF, 0x78, 0x02, 0xCE, 0xC3, 0x13, 0xCE, 0x13, 0xD8, 0xF9, 0xFF, 0xD3, 0xEB, 0x9F, 0xEA, -0x9E, 0x40, 0x1F, 0x90, 0x04, 0xA0, 0xE0, 0x04, 0xF0, 0x90, 0xA6, 0x6F, 0xE0, 0xFD, 0xAF, 0x51, -0xB1, 0xFA, 0x81, 0x64, 0x74, 0x17, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x9A, 0xF5, 0x83, 0xE0, -0x14, 0xF0, 0xE5, 0x51, 0x25, 0xE0, 0x24, 0x16, 0xF5, 0x82, 0xE4, 0x34, 0x96, 0xF5, 0x83, 0xE0, -0xF5, 0x59, 0xA3, 0xE0, 0xF5, 0x5A, 0xD3, 0xE5, 0x5C, 0x94, 0xE8, 0xE5, 0x5B, 0x94, 0x03, 0x40, -0x08, 0x90, 0xA6, 0x6E, 0x74, 0x05, 0xF0, 0x80, 0x18, 0xD3, 0xE5, 0x5C, 0x94, 0x19, 0xE5, 0x5B, -0x94, 0x00, 0x40, 0x08, 0x90, 0xA6, 0x6E, 0x74, 0x02, 0xF0, 0x80, 0x05, 0xE4, 0x90, 0xA6, 0x6E, -0xF0, 0xE4, 0xF5, 0x5F, 0xAB, 0x56, 0xAA, 0x57, 0xA9, 0x58, 0x75, 0xF0, 0x02, 0xE5, 0x5F, 0xA4, -0xF5, 0x82, 0x85, 0xF0, 0x83, 0x12, 0x07, 0xAB, 0xFF, 0xAE, 0xF0, 0x90, 0xA6, 0x6E, 0xE0, 0xFD, -0xEF, 0xA8, 0x05, 0x08, 0x80, 0x05, 0xCE, 0xC3, 0x13, 0xCE, 0x13, 0xD8, 0xF9, 0xFF, 0xAB, 0x53, -0xAA, 0x54, 0xA9, 0x55, 0x85, 0x5F, 0x82, 0x75, 0x83, 0x00, 0x12, 0x06, 0xA2, 0xFD, 0x7C, 0x00, -0x12, 0x07, 0x03, 0xEF, 0x25, 0x5A, 0xF5, 0x5A, 0xEE, 0x35, 0x59, 0xF5, 0x59, 0x05, 0x5F, 0xE5, -0x5F, 0xB4, 0x05, 0xB0, 0xAB, 0x53, 0xAA, 0x54, 0xA9, 0x55, 0x90, 0x00, 0x05, 0x12, 0x06, 0xA2, -0xFD, 0x7C, 0x00, 0x90, 0xA6, 0x6E, 0xE0, 0xFF, 0xE5, 0x5C, 0xAE, 0x5B, 0xA8, 0x07, 0x08, 0x80, -0x05, 0xCE, 0xC3, 0x13, 0xCE, 0x13, 0xD8, 0xF9, 0xFF, 0x12, 0x07, 0x03, 0xD3, 0xE5, 0x5A, 0x9F, -0xE5, 0x59, 0x9E, 0x40, 0x0C, 0xE5, 0x5A, 0x9F, 0xF5, 0x5A, 0xE5, 0x59, 0x9E, 0xF5, 0x59, 0x80, -0x05, 0xE4, 0xF5, 0x59, 0xF5, 0x5A, 0xE5, 0x51, 0x25, 0xE0, 0x24, 0x16, 0xF5, 0x82, 0xE4, 0x34, -0x96, 0xF5, 0x83, 0xE5, 0x59, 0xF0, 0xA3, 0xE5, 0x5A, 0xF0, 0xAE, 0x59, 0xFF, 0xE4, 0xFC, 0xFD, -0x75, 0xF0, 0x04, 0xE5, 0x52, 0x90, 0x42, 0x41, 0x12, 0x48, 0x49, 0x12, 0x48, 0x39, 0xC3, 0x12, -0x48, 0x00, 0x40, 0x02, 0x81, 0x44, 0x74, 0x12, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x95, 0xF5, -0x83, 0xE0, 0xFF, 0x74, 0x17, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x9C, 0xF5, 0x83, 0xE0, 0xFE, -0xD3, 0x9F, 0x40, 0x03, 0xEE, 0x80, 0x1A, 0x74, 0x17, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x9C, -0xF5, 0x83, 0xE0, 0xFF, 0x74, 0x12, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x95, 0xF5, 0x83, 0xE0, -0xC3, 0x9F, 0x90, 0xA6, 0x6D, 0xF0, 0x90, 0xA6, 0x6D, 0xE0, 0xD3, 0x94, 0x04, 0x40, 0x04, 0x74, -0x98, 0x80, 0x21, 0x74, 0x98, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x9C, 0xF5, 0x83, 0xE0, 0xD3, -0x94, 0x01, 0x74, 0x98, 0x40, 0x0E, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x9C, 0xF5, 0x83, 0xE0, -0x14, 0xF0, 0x80, 0x0B, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x9C, 0xF5, 0x83, 0xE4, 0xF0, 0x75, -0xF0, 0x04, 0xE5, 0x52, 0x90, 0x42, 0x41, 0x12, 0x48, 0x49, 0x12, 0x48, 0x1D, 0xE5, 0x51, 0x25, -0xE0, 0x24, 0x16, 0xF5, 0x82, 0xE4, 0x34, 0x96, 0xF5, 0x83, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x74, -0x98, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x9C, 0xF5, 0x83, 0xE0, 0x70, 0x27, 0xAF, 0x51, 0x12, -0x78, 0x43, 0x80, 0x20, 0xE5, 0x52, 0x25, 0xE0, 0x24, 0x91, 0xF5, 0x82, 0xE4, 0x34, 0x43, 0xF5, -0x83, 0xD3, 0x74, 0x01, 0x93, 0x95, 0x5A, 0xE4, 0x93, 0x95, 0x59, 0x40, 0x07, 0x7D, 0x01, 0xAF, -0x51, 0x12, 0x7C, 0xD2, 0x74, 0x81, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x93, 0xF5, 0x83, 0xE0, -0x64, 0x01, 0x60, 0x02, 0xA1, 0x5A, 0x90, 0xA6, 0x66, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xC3, 0x74, -0xFF, 0x9F, 0xFD, 0x74, 0xFF, 0x9E, 0xFC, 0xE5, 0x51, 0x25, 0xE0, 0x24, 0x98, 0xF5, 0x82, 0xE4, -0x34, 0x9E, 0xF5, 0x83, 0xE0, 0xFA, 0xA3, 0xE0, 0xD3, 0x9D, 0xEA, 0x9C, 0xE5, 0x51, 0x50, 0x13, -0x25, 0xE0, 0x24, 0x98, 0xF5, 0x82, 0xE4, 0x34, 0x9E, 0xF5, 0x83, 0xEE, 0x8F, 0xF0, 0x12, 0x08, -0xD6, 0x80, 0x10, 0x25, 0xE0, 0x24, 0x98, 0xF5, 0x82, 0xE4, 0x34, 0x9E, 0xF5, 0x83, 0x74, 0xFF, -0xF0, 0xA3, 0xF0, 0x90, 0xA6, 0x68, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xC3, 0x74, 0xFF, 0x9F, 0xFD, -0x74, 0xFF, 0x9E, 0xFC, 0xE5, 0x51, 0x25, 0xE0, 0x24, 0x98, 0xF5, 0x82, 0xE4, 0x34, 0x9F, 0xF5, -0x83, 0xE0, 0xFA, 0xA3, 0xE0, 0xD3, 0x9D, 0xEA, 0x9C, 0xE5, 0x51, 0x50, 0x13, 0x25, 0xE0, 0x24, -0x98, 0xF5, 0x82, 0xE4, 0x34, 0x9F, 0xF5, 0x83, 0xEE, 0x8F, 0xF0, 0x12, 0x08, 0xD6, 0x80, 0x10, -0x25, 0xE0, 0x24, 0x98, 0xF5, 0x82, 0xE4, 0x34, 0x9F, 0xF5, 0x83, 0x74, 0xFF, 0xF0, 0xA3, 0xF0, -0x90, 0xA6, 0x6A, 0xE0, 0xFE, 0xA3, 0xE0, 0xFB, 0xC3, 0x74, 0xFF, 0x9B, 0xFF, 0x74, 0xFF, 0x9E, -0xFE, 0x74, 0xFF, 0x94, 0x00, 0xFD, 0x74, 0xFF, 0x94, 0x00, 0xFC, 0x90, 0x95, 0x92, 0x12, 0x48, -0x2D, 0xD3, 0x12, 0x48, 0x00, 0x90, 0x95, 0x92, 0x50, 0x19, 0x12, 0x48, 0x2D, 0x90, 0xA6, 0x6A, -0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0x12, 0x47, 0xD9, 0x90, 0x95, 0x92, 0x12, 0x08, -0x6D, 0x80, 0x07, 0x12, 0x08, 0x79, 0xFF, 0xFF, 0xFF, 0xFF, 0xE4, 0xFD, 0xAF, 0x51, 0xB1, 0x6D, -0x05, 0x51, 0xE5, 0x51, 0xC3, 0x94, 0x80, 0x50, 0x03, 0x02, 0x7F, 0x47, 0x22, 0xD3, 0x10, 0xAF, -0x01, 0xC3, 0xC0, 0xD0, 0xED, 0x60, 0x62, 0x75, 0xF0, 0x0A, 0xEF, 0x90, 0x8D, 0x01, 0x12, 0x48, -0x49, 0xE4, 0xF0, 0xA3, 0xF0, 0x75, 0xF0, 0x0A, 0xEF, 0x90, 0x8D, 0x03, 0x12, 0x48, 0x49, 0xE4, -0xF0, 0xA3, 0xF0, 0x75, 0xF0, 0x0A, 0xEF, 0x90, 0x8D, 0x05, 0x12, 0x48, 0x49, 0xE4, 0xF0, 0xA3, -0xF0, 0x75, 0xF0, 0x0A, 0xEF, 0x90, 0x8D, 0x07, 0x12, 0x48, 0x49, 0xE4, 0xF0, 0xA3, 0xF0, 0x75, -0xF0, 0x0A, 0xEF, 0x90, 0x8D, 0x09, 0x12, 0x48, 0x49, 0xE4, 0xF0, 0xA3, 0xF0, 0xEF, 0x25, 0xE0, -0x24, 0x01, 0xF5, 0x82, 0xE4, 0x34, 0x92, 0xF5, 0x83, 0xE4, 0xF0, 0xA3, 0xF0, 0x74, 0x97, 0x2F, -0xF5, 0x82, 0xE4, 0x34, 0x9A, 0xF5, 0x83, 0xE4, 0xF0, 0x75, 0xF0, 0x10, 0xEF, 0x90, 0x81, 0x03, -0x12, 0x48, 0x49, 0xE0, 0x54, 0xBF, 0x44, 0x80, 0xFE, 0x75, 0xF0, 0x10, 0xEF, 0x90, 0x81, 0x03, -0x12, 0x48, 0x49, 0xEE, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x8F, 0x60, 0x75, 0xF0, 0x05, 0xEF, -0x90, 0x97, 0x9A, 0x12, 0x48, 0x49, 0xE0, 0x13, 0x13, 0x54, 0x03, 0xFF, 0x74, 0x17, 0x25, 0x60, -0xF5, 0x82, 0xE4, 0x34, 0x9C, 0xF5, 0x83, 0xE0, 0xFE, 0xD3, 0x94, 0x32, 0x40, 0x2C, 0x75, 0xF0, -0x05, 0xE5, 0x60, 0x90, 0x97, 0x97, 0x12, 0x48, 0x49, 0xE0, 0xF5, 0x62, 0x75, 0xF0, 0x05, 0xE5, -0x60, 0x90, 0x97, 0x99, 0x12, 0x48, 0x49, 0xE0, 0xFC, 0xC4, 0x13, 0x54, 0x07, 0x20, 0xE0, 0x02, -0xC1, 0xC5, 0xE5, 0x62, 0x44, 0x80, 0xF5, 0x61, 0x80, 0x7B, 0xEE, 0xD3, 0x94, 0x1E, 0x40, 0x2F, -0xED, 0x12, 0x48, 0x67, 0x86, 0x70, 0x00, 0x86, 0x75, 0x01, 0x86, 0x70, 0x02, 0x86, 0x75, 0x03, -0x86, 0x70, 0x04, 0x86, 0x75, 0x05, 0x86, 0x7A, 0x06, 0x86, 0x7A, 0x07, 0x00, 0x00, 0x86, 0xC5, -0x75, 0x62, 0x17, 0x80, 0x4D, 0x75, 0x62, 0x10, 0x80, 0x48, 0x75, 0x62, 0x08, 0x80, 0x43, 0x74, -0x17, 0x25, 0x60, 0xF5, 0x82, 0xE4, 0x34, 0x9C, 0xF5, 0x83, 0xE0, 0xD3, 0x94, 0x0A, 0x40, 0x2F, -0xED, 0x12, 0x48, 0x67, 0x86, 0xB0, 0x00, 0x86, 0xB5, 0x01, 0x86, 0xB0, 0x02, 0x86, 0xB5, 0x03, -0x86, 0xB0, 0x04, 0x86, 0xB5, 0x05, 0x86, 0xBA, 0x06, 0x86, 0xBA, 0x07, 0x00, 0x00, 0x86, 0xC5, -0x75, 0x62, 0x14, 0x80, 0x0D, 0x75, 0x62, 0x0C, 0x80, 0x08, 0x75, 0x62, 0x04, 0x80, 0x03, 0xE4, -0xF5, 0x62, 0x85, 0x62, 0x61, 0x90, 0x04, 0xA5, 0xE5, 0x61, 0xF0, 0x90, 0xA7, 0x3B, 0xEF, 0xF0, -0xE4, 0xFB, 0x12, 0x62, 0x9F, 0x74, 0x96, 0x25, 0x60, 0xF5, 0x82, 0xE4, 0x34, 0x95, 0xF5, 0x83, -0xE0, 0xB5, 0x61, 0x10, 0x74, 0x98, 0x25, 0x60, 0xF5, 0x82, 0xE4, 0x34, 0xA1, 0xF5, 0x83, 0xE0, -0x04, 0xF0, 0x80, 0x1B, 0x74, 0x96, 0x25, 0x60, 0xF5, 0x82, 0xE4, 0x34, 0x95, 0xF5, 0x83, 0xE5, -0x61, 0xF0, 0x74, 0x98, 0x25, 0x60, 0xF5, 0x82, 0xE4, 0x34, 0xA1, 0xF5, 0x83, 0xE4, 0xF0, 0x74, -0x98, 0x25, 0x60, 0xF5, 0x82, 0xE4, 0x34, 0xA1, 0xF5, 0x83, 0xE0, 0xB4, 0x02, 0x1B, 0x74, 0x17, -0x25, 0x60, 0xF5, 0x82, 0xE4, 0x34, 0x9A, 0xF5, 0x83, 0x74, 0x0A, 0xF0, 0x74, 0x98, 0x25, 0x60, -0xF5, 0x82, 0xE4, 0x34, 0xA1, 0xF5, 0x83, 0xE4, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, -0xD0, 0x90, 0xA7, 0x93, 0xEF, 0xF0, 0x75, 0xF0, 0x05, 0x90, 0x97, 0x99, 0x12, 0x48, 0x49, 0xE0, -0x54, 0x1F, 0xFF, 0x24, 0xF7, 0x50, 0x02, 0x80, 0x5B, 0xE4, 0xF5, 0x68, 0x90, 0xA7, 0x93, 0xE0, -0xFD, 0x75, 0xF0, 0x08, 0x90, 0x89, 0x00, 0x12, 0x48, 0x49, 0xE5, 0x82, 0x25, 0x68, 0xF5, 0x82, -0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE0, 0xFE, 0xEF, 0x75, 0xF0, 0x07, 0xA4, 0x24, 0x56, 0xF5, 0x82, -0xE4, 0x34, 0x40, 0xF5, 0x83, 0xE5, 0x82, 0x25, 0x68, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, -0xE4, 0x93, 0xFC, 0xEE, 0x5C, 0xFE, 0x75, 0xF0, 0x08, 0xED, 0x90, 0x89, 0x00, 0x12, 0x48, 0x49, -0xE5, 0x82, 0x25, 0x68, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xEE, 0xF0, 0x05, 0x68, 0xE5, -0x68, 0xB4, 0x08, 0xA8, 0xE4, 0xFD, 0x75, 0x69, 0x06, 0xE5, 0x69, 0xB4, 0x06, 0x1D, 0xFF, 0x90, -0xA7, 0x93, 0xE0, 0x75, 0xF0, 0x08, 0x90, 0x89, 0x00, 0x12, 0x48, 0x49, 0xE5, 0x82, 0x2F, 0xF5, -0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE0, 0x54, 0x0F, 0x80, 0x19, 0x90, 0xA7, 0x93, 0xE0, 0x75, -0xF0, 0x08, 0x90, 0x89, 0x00, 0x12, 0x48, 0x49, 0xE5, 0x82, 0x25, 0x69, 0xF5, 0x82, 0xE4, 0x35, -0x83, 0xF5, 0x83, 0xE0, 0x90, 0xA7, 0x94, 0xF0, 0x90, 0xA7, 0x94, 0xE0, 0x60, 0x31, 0x75, 0x68, -0x07, 0x74, 0x01, 0x7E, 0x00, 0xA8, 0x68, 0x08, 0x80, 0x05, 0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8, -0xF9, 0xFF, 0x90, 0xA7, 0x94, 0xE0, 0xFB, 0xEF, 0x5B, 0x60, 0x0B, 0xE5, 0x69, 0x75, 0xF0, 0x08, -0xA4, 0x25, 0x68, 0xFD, 0x80, 0x19, 0x15, 0x68, 0xE5, 0x68, 0xC3, 0x94, 0x00, 0x50, 0xD2, 0xE5, -0x69, 0x60, 0x0C, 0x15, 0x69, 0xE5, 0x69, 0xC3, 0x94, 0x00, 0x40, 0x03, 0x02, 0x87, 0xB9, 0xE4, -0xFC, 0xF5, 0x69, 0xE5, 0x69, 0xB4, 0x06, 0x1D, 0xFF, 0x90, 0xA7, 0x93, 0xE0, 0x75, 0xF0, 0x08, -0x90, 0x89, 0x00, 0x12, 0x48, 0x49, 0xE5, 0x82, 0x2F, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, -0xE0, 0x54, 0x0F, 0x80, 0x19, 0x90, 0xA7, 0x93, 0xE0, 0x75, 0xF0, 0x08, 0x90, 0x89, 0x00, 0x12, -0x48, 0x49, 0xE5, 0x82, 0x25, 0x69, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE0, 0x90, 0xA7, -0x94, 0xF0, 0x90, 0xA7, 0x94, 0xE0, 0x60, 0x2F, 0xE4, 0xF5, 0x68, 0x74, 0x01, 0x7E, 0x00, 0xA8, -0x68, 0x08, 0x80, 0x05, 0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8, 0xF9, 0xFF, 0x90, 0xA7, 0x94, 0xE0, -0xFB, 0xEF, 0x5B, 0x60, 0x0B, 0xE5, 0x69, 0x75, 0xF0, 0x08, 0xA4, 0x25, 0x68, 0xFC, 0x80, 0x0F, -0x05, 0x68, 0xE5, 0x68, 0xB4, 0x08, 0xD4, 0x05, 0x69, 0xE5, 0x69, 0x64, 0x07, 0x70, 0x84, 0x90, -0xA7, 0x93, 0xE0, 0xFF, 0x75, 0xF0, 0x05, 0x90, 0x97, 0x97, 0x12, 0x48, 0x49, 0xED, 0xF0, 0x75, -0xF0, 0x05, 0xEF, 0x90, 0x97, 0x98, 0x12, 0x48, 0x49, 0xEC, 0xF0, 0x75, 0xF0, 0x10, 0xEF, 0x90, -0x81, 0x00, 0x12, 0x48, 0x49, 0xE0, 0xFF, 0x54, 0x7F, 0xF5, 0x6A, 0xEF, 0x54, 0x80, 0xF5, 0x6B, -0xE5, 0x6A, 0xD3, 0x9D, 0x40, 0x07, 0xE5, 0x6B, 0x4D, 0xF5, 0x6A, 0x80, 0x0B, 0xE5, 0x6A, 0xC3, -0x9C, 0x50, 0x05, 0xE5, 0x6B, 0x4C, 0xF5, 0x6A, 0x90, 0xA7, 0x93, 0xE0, 0xFF, 0x24, 0x18, 0xF5, -0x82, 0xE4, 0x34, 0xA1, 0xF5, 0x83, 0xE5, 0x6A, 0xF0, 0x75, 0xF0, 0x05, 0xEF, 0x90, 0x97, 0x9A, -0x12, 0x48, 0x49, 0xE0, 0x13, 0x13, 0x54, 0x03, 0x90, 0xA7, 0x3B, 0xF0, 0x90, 0xA7, 0x93, 0xE0, -0xFF, 0xE4, 0xFB, 0xAD, 0x6A, 0x12, 0x62, 0xA3, 0x90, 0xA7, 0x93, 0xE0, 0x75, 0xF0, 0x10, 0x90, -0x81, 0x03, 0x12, 0x48, 0x49, 0xE4, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xAC, 0x07, 0x74, 0x97, -0x2C, 0xF5, 0x82, 0xE4, 0x34, 0x9B, 0xF5, 0x83, 0xE0, 0xFF, 0x54, 0x02, 0xC3, 0x13, 0xFE, 0xEF, -0x54, 0x40, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x64, 0x01, 0x70, 0x5F, 0xED, 0x60, 0x17, 0x64, 0x01, -0x60, 0x13, 0xED, 0x64, 0x03, 0x60, 0x0E, 0xED, 0x64, 0x04, 0x60, 0x09, 0xED, 0x64, 0x09, 0x60, -0x04, 0xED, 0xB4, 0x0A, 0x0C, 0xED, 0x25, 0xE0, 0x24, 0x12, 0xF5, 0x82, 0xE4, 0x34, 0x45, 0x80, -0x18, 0xED, 0x64, 0x02, 0x60, 0x09, 0xED, 0x64, 0x07, 0x60, 0x04, 0xED, 0xB4, 0x08, 0x29, 0xED, -0x25, 0xE0, 0x24, 0x11, 0xF5, 0x82, 0xE4, 0x34, 0x45, 0xF5, 0x83, 0xE4, 0x93, 0xFF, 0x74, 0x18, -0x2C, 0xF5, 0x82, 0xE4, 0x34, 0x9D, 0xF5, 0x83, 0xEF, 0xF0, 0x74, 0x18, 0x2C, 0xF5, 0x82, 0xE4, -0x34, 0x9E, 0xF5, 0x83, 0xE4, 0xF0, 0x41, 0x6E, 0x80, 0x47, 0xEE, 0x64, 0x01, 0x70, 0x69, 0xED, -0x60, 0x18, 0x64, 0x01, 0x60, 0x14, 0xED, 0x64, 0x03, 0x60, 0x0F, 0xED, 0x64, 0x04, 0x60, 0x0A, -0xED, 0x64, 0x09, 0x60, 0x05, 0xED, 0x64, 0x0A, 0x70, 0x27, 0xED, 0x25, 0xE0, 0x24, 0x12, 0xF5, -0x82, 0xE4, 0x34, 0x45, 0xF5, 0x83, 0xE4, 0x93, 0xFF, 0x74, 0x18, 0x2C, 0xF5, 0x82, 0xE4, 0x34, -0x9D, 0xF5, 0x83, 0xEF, 0xF0, 0xED, 0x25, 0xE0, 0x24, 0x11, 0xF5, 0x82, 0xE4, 0x34, 0x45, 0x80, -0x4C, 0xED, 0x25, 0xE0, 0x24, 0x11, 0xF5, 0x82, 0xE4, 0x34, 0x45, 0xF5, 0x83, 0xE4, 0x93, 0xFF, -0x74, 0x18, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0x9D, 0xF5, 0x83, 0xEF, 0xF0, 0xED, 0x25, 0xE0, 0x24, -0x12, 0xF5, 0x82, 0xE4, 0x34, 0x45, 0x80, 0x25, 0xED, 0x25, 0xE0, 0x24, 0x11, 0xF5, 0x82, 0xE4, -0x34, 0x45, 0xF5, 0x83, 0xE4, 0x93, 0xFF, 0x74, 0x18, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0x9D, 0xF5, -0x83, 0xEF, 0xF0, 0xED, 0x25, 0xE0, 0x24, 0x12, 0xF5, 0x82, 0xE4, 0x34, 0x45, 0xF5, 0x83, 0xE4, -0x93, 0xFF, 0x74, 0x18, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0x9E, 0xF5, 0x83, 0xEF, 0xF0, 0x74, 0x18, -0x2C, 0xF5, 0x82, 0xE4, 0x34, 0x9D, 0xF5, 0x83, 0xE0, 0xF9, 0x74, 0x18, 0x2C, 0xF5, 0x82, 0xE4, -0x34, 0x9E, 0xF5, 0x83, 0xE0, 0xFD, 0xE9, 0x13, 0x13, 0x13, 0x54, 0x1F, 0xFF, 0x75, 0xF0, 0x08, -0xEC, 0x90, 0x89, 0x00, 0x12, 0x48, 0x49, 0xE5, 0x82, 0x2F, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, -0x83, 0xE0, 0xFB, 0x7A, 0x00, 0xE9, 0x54, 0x07, 0xFF, 0x74, 0x01, 0x7E, 0x00, 0xA8, 0x07, 0x08, -0x80, 0x05, 0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8, 0xF9, 0xFF, 0xEE, 0x5A, 0xFE, 0xEF, 0x5B, 0x4E, -0x70, 0x0A, 0x74, 0x18, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0x9D, 0x80, 0x44, 0xED, 0x13, 0x13, 0x13, -0x54, 0x1F, 0xFF, 0x75, 0xF0, 0x08, 0xEC, 0x90, 0x89, 0x00, 0x12, 0x48, 0x49, 0xE5, 0x82, 0x2F, -0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xE0, 0xFB, 0x7A, 0x00, 0xED, 0x54, 0x07, 0xFF, 0x74, -0x01, 0x7E, 0x00, 0xA8, 0x07, 0x08, 0x80, 0x05, 0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8, 0xF9, 0xFF, -0xEE, 0x5A, 0xFE, 0xEF, 0x5B, 0x4E, 0x70, 0x0C, 0x74, 0x18, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0x9E, -0xF5, 0x83, 0xE4, 0xF0, 0x22, 0x12, 0x06, 0x89, 0x54, 0x7F, 0xFF, 0x90, 0x00, 0x01, 0x12, 0x06, -0xA2, 0xFE, 0x54, 0x1F, 0xFD, 0xEE, 0x54, 0x80, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x90, 0xA6, -0x69, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x06, 0xA2, 0xFE, 0x54, 0x03, 0x90, 0xA6, 0x6A, 0xF0, 0xEE, -0x54, 0x30, 0xC4, 0x54, 0x0F, 0x90, 0xA6, 0x6C, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x06, 0xA2, 0xFE, -0x54, 0x40, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x90, 0xA6, 0x6B, 0xF0, 0xEE, 0x54, 0x80, 0xC4, 0x13, -0x13, 0x13, 0x54, 0x01, 0xFE, 0x90, 0x00, 0x02, 0x12, 0x06, 0xA2, 0x54, 0x08, 0xFC, 0x13, 0x13, -0x13, 0x54, 0x1F, 0x90, 0xA6, 0x6D, 0xF0, 0xEE, 0x54, 0x01, 0xC4, 0x33, 0x33, 0x33, 0x54, 0x80, -0xFE, 0x75, 0xF0, 0x05, 0xEF, 0x90, 0x97, 0x9A, 0x12, 0x48, 0x49, 0xE0, 0x54, 0x7F, 0x4E, 0xF0, -0x90, 0xA6, 0x6B, 0xE0, 0x54, 0x01, 0xC4, 0x33, 0x33, 0x54, 0xC0, 0xFE, 0x75, 0xF0, 0x05, 0xEF, -0x90, 0x97, 0x9A, 0x12, 0x48, 0x49, 0xE0, 0x54, 0xBF, 0x4E, 0xF0, 0x90, 0xA6, 0x6D, 0xE0, 0x60, -0x02, 0x81, 0x7A, 0xED, 0x60, 0x08, 0x64, 0x02, 0x60, 0x04, 0xED, 0xB4, 0x04, 0x10, 0x75, 0xF0, -0x05, 0xEF, 0x90, 0x97, 0x9B, 0x12, 0x48, 0x49, 0xE0, 0x44, 0x01, 0xF0, 0x80, 0x0E, 0x75, 0xF0, -0x05, 0xEF, 0x90, 0x97, 0x9B, 0x12, 0x48, 0x49, 0xE0, 0x54, 0xFE, 0xF0, 0xED, 0x54, 0x1F, 0xFE, -0x75, 0xF0, 0x05, 0xEF, 0x90, 0x97, 0x99, 0x12, 0x48, 0x49, 0xE0, 0x54, 0xE0, 0x4E, 0xF0, 0x90, -0xA6, 0x6A, 0xE0, 0x54, 0x03, 0xFE, 0x75, 0xF0, 0x05, 0xEF, 0x90, 0x97, 0x9A, 0x12, 0x48, 0x49, -0xE0, 0x54, 0xFC, 0x4E, 0xF0, 0xEE, 0x25, 0xE0, 0x25, 0xE0, 0xFE, 0x75, 0xF0, 0x05, 0xEF, 0x90, -0x97, 0x9A, 0x12, 0x48, 0x49, 0xE0, 0x54, 0xF3, 0x4E, 0xF0, 0x90, 0xA6, 0x69, 0xE0, 0x54, 0x01, -0xC4, 0x33, 0x54, 0xE0, 0xFE, 0x75, 0xF0, 0x05, 0xEF, 0x90, 0x97, 0x99, 0x12, 0x48, 0x49, 0xE0, -0x54, 0xDF, 0x4E, 0xF0, 0x90, 0xA6, 0x6C, 0xE0, 0x54, 0x03, 0xC4, 0x54, 0xF0, 0xFE, 0x75, 0xF0, -0x05, 0xEF, 0x90, 0x97, 0x9A, 0x12, 0x48, 0x49, 0xE0, 0x54, 0xCF, 0x4E, 0xF0, 0xE4, 0xFE, 0xEE, -0xF5, 0x82, 0x75, 0x83, 0x00, 0xA3, 0xA3, 0xA3, 0x12, 0x06, 0xA2, 0xFD, 0x75, 0xF0, 0x08, 0xEF, -0x90, 0x89, 0x00, 0x12, 0x48, 0x49, 0xE5, 0x82, 0x2E, 0xF5, 0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, -0xED, 0xF0, 0x0E, 0xEE, 0xB4, 0x04, 0xD8, 0x12, 0x87, 0x3A, 0x22, 0x90, 0xA6, 0x66, 0x12, 0x48, -0x5E, 0x90, 0xA6, 0x65, 0xEF, 0xF0, 0x12, 0x48, 0x67, 0x8C, 0xE1, 0x00, 0x8C, 0xEA, 0x01, 0x8C, -0xF2, 0x02, 0x8C, 0xFA, 0x10, 0x8D, 0x03, 0x11, 0x8D, 0x0C, 0x12, 0x8D, 0x14, 0x14, 0x8D, 0x1D, -0x20, 0x8D, 0x26, 0x21, 0x8D, 0x2F, 0x23, 0x8D, 0x38, 0x24, 0x8D, 0x41, 0x25, 0x8D, 0x4A, 0x40, -0x8D, 0x63, 0x41, 0x8D, 0x52, 0x42, 0x8D, 0x5A, 0x44, 0x8D, 0x6C, 0x60, 0x8D, 0x75, 0x61, 0x8D, -0x7E, 0x62, 0x8D, 0x87, 0x63, 0x8D, 0x90, 0x64, 0x8D, 0x99, 0x65, 0x8D, 0xA2, 0x66, 0x8D, 0xAB, -0x67, 0x8D, 0xB4, 0x68, 0x8D, 0xBD, 0x69, 0x8D, 0xC6, 0x6B, 0x8D, 0xCF, 0x6C, 0x00, 0x00, 0x8D, -0xD8, 0x90, 0xA6, 0x66, 0x12, 0x48, 0x55, 0x02, 0xA0, 0xF3, 0x90, 0xA6, 0x66, 0x12, 0x48, 0x55, -0xC1, 0xA9, 0x90, 0xA6, 0x66, 0x12, 0x48, 0x55, 0xA1, 0xFB, 0x90, 0xA6, 0x66, 0x12, 0x48, 0x55, -0x02, 0xA1, 0x3F, 0x90, 0xA6, 0x66, 0x12, 0x48, 0x55, 0x02, 0xA1, 0x67, 0x90, 0xA6, 0x66, 0x12, -0x48, 0x55, 0xA1, 0xE8, 0x90, 0xA6, 0x66, 0x12, 0x48, 0x55, 0x02, 0xA7, 0x90, 0x90, 0xA6, 0x66, -0x12, 0x48, 0x55, 0x02, 0xA7, 0xBB, 0x90, 0xA6, 0x66, 0x12, 0x48, 0x55, 0x02, 0xA9, 0xCC, 0x90, -0xA6, 0x66, 0x12, 0x48, 0x55, 0x02, 0xAA, 0x12, 0x90, 0xA6, 0x66, 0x12, 0x48, 0x55, 0x02, 0x73, -0x20, 0x90, 0xA6, 0x66, 0x12, 0x48, 0x55, 0x02, 0xAA, 0x1A, 0x90, 0xA6, 0x66, 0x12, 0x48, 0x55, -0x61, 0x15, 0x90, 0xA6, 0x66, 0x12, 0x48, 0x55, 0xE1, 0xEA, 0x90, 0xA6, 0x66, 0x12, 0x48, 0x55, -0x02, 0x90, 0xFB, 0x90, 0xA6, 0x66, 0x12, 0x48, 0x55, 0x02, 0xB5, 0x7A, 0x90, 0xA6, 0x66, 0x12, -0x48, 0x55, 0x02, 0x6A, 0xE8, 0x90, 0xA6, 0x66, 0x12, 0x48, 0x55, 0x02, 0x5A, 0xB3, 0x90, 0xA6, -0x66, 0x12, 0x48, 0x55, 0x02, 0x5F, 0xE4, 0x90, 0xA6, 0x66, 0x12, 0x48, 0x55, 0x02, 0x59, 0xF9, -0x90, 0xA6, 0x66, 0x12, 0x48, 0x55, 0x02, 0xAA, 0x61, 0x90, 0xA6, 0x66, 0x12, 0x48, 0x55, 0x02, -0xAA, 0xC3, 0x90, 0xA6, 0x66, 0x12, 0x48, 0x55, 0x02, 0x94, 0x9C, 0x90, 0xA6, 0x66, 0x12, 0x48, -0x55, 0x02, 0x93, 0x1A, 0x90, 0xA6, 0x66, 0x12, 0x48, 0x55, 0x02, 0x94, 0x33, 0x90, 0xA6, 0x66, -0x12, 0x48, 0x55, 0x02, 0x95, 0x55, 0x90, 0xA6, 0x66, 0x12, 0x48, 0x55, 0x02, 0xAA, 0xD9, 0x90, -0xA6, 0x66, 0x12, 0x48, 0x55, 0x02, 0xAB, 0xFD, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x01, 0xF0, 0x90, -0xA6, 0x65, 0xE0, 0x90, 0x01, 0xC2, 0xF0, 0x22, 0x12, 0x06, 0x89, 0xFF, 0x90, 0xA4, 0x90, 0xF0, -0xBF, 0x01, 0x07, 0xF1, 0x26, 0xE4, 0x90, 0xA4, 0x90, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, -0xC0, 0xD0, 0x8B, 0x51, 0x8A, 0x52, 0x89, 0x53, 0x12, 0x06, 0x89, 0xFF, 0x90, 0xA5, 0x11, 0xF0, -0xBF, 0x01, 0x0C, 0x90, 0x00, 0x01, 0x12, 0x06, 0xA2, 0x64, 0x01, 0x60, 0x23, 0x80, 0x1E, 0xAB, -0x51, 0xAA, 0x52, 0xA9, 0x53, 0x90, 0x00, 0x01, 0x12, 0x06, 0xA2, 0x64, 0x01, 0x60, 0x11, 0x90, -0xA5, 0x12, 0xE0, 0x20, 0xE0, 0x07, 0xE4, 0xFF, 0x12, 0xB5, 0xCB, 0x80, 0x03, 0x12, 0x67, 0x3A, -0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0xA3, 0xF5, 0xE0, -0xFF, 0x90, 0xA3, 0xF4, 0xE0, 0xB5, 0x07, 0x04, 0x7F, 0x01, 0x80, 0x02, 0x7F, 0x00, 0xEF, 0x70, -0x43, 0x90, 0xA3, 0xF4, 0xE0, 0xFE, 0x75, 0xF0, 0x08, 0x90, 0xA3, 0xA4, 0x12, 0x48, 0x49, 0xE0, -0xFD, 0xEE, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0xA5, 0xF9, 0x74, 0xA3, 0x35, 0xF0, 0xFA, 0x7B, 0x01, -0xAF, 0x05, 0x91, 0x7B, 0x90, 0xA3, 0xF4, 0xE0, 0x04, 0xF0, 0xE0, 0x7F, 0x00, 0xB4, 0x0A, 0x02, -0x7F, 0x01, 0xEF, 0x60, 0x05, 0xE4, 0x90, 0xA3, 0xF4, 0xF0, 0x12, 0xAC, 0x27, 0x90, 0xA3, 0x98, -0xE0, 0x44, 0x02, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x8B, 0x51, 0x8A, 0x52, 0x89, 0x53, 0x90, -0x00, 0x01, 0x12, 0x06, 0xA2, 0xFF, 0xF5, 0x55, 0x12, 0x06, 0x89, 0xFE, 0xC3, 0x13, 0x30, 0xE0, -0x0A, 0x90, 0x00, 0x02, 0x12, 0x06, 0xA2, 0xF5, 0x56, 0x80, 0x02, 0x8F, 0x56, 0x85, 0x55, 0x54, -0xE5, 0x54, 0xD3, 0x95, 0x56, 0x50, 0x35, 0xAB, 0x51, 0xAA, 0x52, 0xA9, 0x53, 0x12, 0x06, 0x89, -0x54, 0x01, 0xFF, 0x74, 0x91, 0x25, 0x54, 0xF5, 0x82, 0xE4, 0x34, 0xA4, 0xF5, 0x83, 0xEF, 0xF0, -0x74, 0x91, 0x25, 0x54, 0xF5, 0x82, 0xE4, 0x34, 0xA4, 0xF5, 0x83, 0xE0, 0xAF, 0x54, 0x70, 0x05, -0x12, 0xAF, 0x25, 0x80, 0x03, 0x12, 0xAF, 0x14, 0x05, 0x54, 0x80, 0xC4, 0x90, 0xA4, 0x91, 0xE0, -0x70, 0x13, 0x12, 0x6E, 0x7A, 0x12, 0x77, 0xAA, 0x90, 0xA5, 0x17, 0xE0, 0x54, 0xF7, 0xF0, 0x54, -0xBF, 0xF0, 0x54, 0x7F, 0xF0, 0x22, 0x7B, 0x01, 0x7A, 0xA6, 0x79, 0x69, 0x7F, 0xF5, 0x7E, 0x01, -0x12, 0x34, 0xBC, 0xBF, 0x01, 0x06, 0x90, 0xA6, 0x69, 0xE0, 0xA3, 0xF0, 0x7B, 0x01, 0x7A, 0xA6, -0x79, 0x69, 0x7F, 0xF6, 0x7E, 0x01, 0x12, 0x34, 0xBC, 0xBF, 0x01, 0x08, 0x90, 0xA6, 0x69, 0xE0, -0x90, 0xA6, 0x6B, 0xF0, 0x7B, 0x01, 0x7A, 0xA6, 0x79, 0x69, 0x7F, 0xF4, 0x7E, 0x01, 0x12, 0x34, -0xBC, 0xBF, 0x01, 0x08, 0x90, 0xA6, 0x69, 0xE0, 0x90, 0xA6, 0x6C, 0xF0, 0x7B, 0x01, 0x7A, 0xA6, -0x79, 0x69, 0x7F, 0xF3, 0x7E, 0x01, 0x12, 0x34, 0xBC, 0xBF, 0x01, 0x08, 0x90, 0xA6, 0x69, 0xE0, -0x90, 0xA6, 0x6D, 0xF0, 0x7B, 0x01, 0x7A, 0xA6, 0x79, 0x69, 0x7F, 0xF2, 0x7E, 0x01, 0x12, 0x34, -0xBC, 0xBF, 0x01, 0x08, 0x90, 0xA6, 0x69, 0xE0, 0x90, 0xA6, 0x6E, 0xF0, 0x90, 0xA6, 0x6A, 0xE0, -0xFF, 0xA3, 0xE0, 0xFD, 0xA3, 0xE0, 0xFB, 0xA3, 0xE0, 0x90, 0xA6, 0x72, 0xF0, 0x90, 0xA6, 0x6E, -0xE0, 0x90, 0xA6, 0x73, 0xF0, 0x90, 0xA6, 0x74, 0x74, 0x12, 0xF0, 0x90, 0xA6, 0x82, 0x74, 0x05, -0xF0, 0x90, 0xA6, 0x76, 0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0xA3, 0xEB, 0xF0, 0x90, 0xA6, 0x72, 0xE0, -0x90, 0xA6, 0x79, 0xF0, 0x90, 0xA6, 0x73, 0xE0, 0x90, 0xA6, 0x7A, 0xF0, 0x7B, 0x01, 0x7A, 0xA6, -0x79, 0x74, 0x12, 0x67, 0xEA, 0x7F, 0x04, 0x02, 0x5F, 0xF2, 0x90, 0xA6, 0x69, 0x12, 0x48, 0x5E, -0x12, 0x06, 0x89, 0xF5, 0x51, 0x24, 0x97, 0xF5, 0x82, 0xE4, 0x34, 0x9B, 0xF5, 0x83, 0xE0, 0x54, -0x9C, 0xF0, 0x74, 0x97, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x9B, 0xF5, 0x83, 0xC0, 0x83, 0xC0, -0x82, 0xE0, 0xFF, 0x90, 0xA6, 0x69, 0x12, 0x48, 0x55, 0x90, 0x00, 0x03, 0x12, 0x06, 0xA2, 0x54, -0x01, 0xFE, 0xEF, 0x4E, 0xD0, 0x82, 0xD0, 0x83, 0xF0, 0x74, 0x97, 0x25, 0x51, 0xF5, 0x82, 0xE4, -0x34, 0x9B, 0xF5, 0x83, 0xC0, 0x83, 0xC0, 0x82, 0xE0, 0xFF, 0x90, 0xA6, 0x69, 0x12, 0x48, 0x55, -0x90, 0x00, 0x03, 0x12, 0x06, 0xA2, 0x54, 0x02, 0xFE, 0xEF, 0x4E, 0xD0, 0x82, 0xD0, 0x83, 0xF0, -0x74, 0x97, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x9B, 0xF5, 0x83, 0xC0, 0x83, 0xC0, 0x82, 0xE0, -0xFF, 0x90, 0xA6, 0x69, 0x12, 0x48, 0x55, 0x90, 0x00, 0x03, 0x12, 0x06, 0xA2, 0x54, 0x20, 0xFE, -0xEF, 0x4E, 0xD0, 0x82, 0xD0, 0x83, 0xF0, 0x74, 0x97, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x9B, -0xF5, 0x83, 0xC0, 0x83, 0xC0, 0x82, 0xE0, 0xFF, 0x90, 0xA6, 0x69, 0x12, 0x48, 0x55, 0x90, 0x00, -0x03, 0x12, 0x06, 0xA2, 0x54, 0x40, 0xFE, 0xEF, 0x4E, 0xD0, 0x82, 0xD0, 0x83, 0xF0, 0x74, 0x97, -0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x9B, 0xF5, 0x83, 0xE0, 0xFF, 0x54, 0x20, 0xC4, 0x13, 0x54, -0x07, 0xFE, 0x75, 0xF0, 0x05, 0xE5, 0x51, 0x90, 0x97, 0x99, 0x12, 0x48, 0x49, 0xE0, 0x54, 0x1F, -0xFD, 0x90, 0x04, 0xA4, 0xEF, 0xF0, 0xE5, 0x51, 0xC3, 0x94, 0x80, 0x50, 0x16, 0x90, 0x00, 0x02, -0x12, 0x06, 0xA2, 0xFF, 0x74, 0x17, 0x25, 0x51, 0xF5, 0x82, 0xE4, 0x34, 0x9C, 0xF5, 0x83, 0xEF, -0xF0, 0x80, 0x0F, 0xE5, 0x51, 0xB4, 0x80, 0x0A, 0x90, 0x00, 0x02, 0x12, 0x06, 0xA2, 0x90, 0x97, -0x16, 0xF0, 0xEE, 0x60, 0x05, 0xAF, 0x51, 0x12, 0x85, 0xFA, 0x22, 0x90, 0xA6, 0x69, 0x12, 0x48, -0x5E, 0xE4, 0x90, 0xA6, 0x6E, 0xF0, 0xFD, 0x90, 0xA6, 0x69, 0x12, 0x48, 0x55, 0x8D, 0x82, 0x75, -0x83, 0x00, 0x12, 0x06, 0xA2, 0xF4, 0x60, 0x4D, 0x90, 0xA6, 0x6E, 0xE0, 0xFF, 0x90, 0xA6, 0x69, -0x12, 0x48, 0x55, 0x8D, 0x82, 0x75, 0x83, 0x00, 0x12, 0x06, 0xA2, 0xFE, 0x75, 0xF0, 0x10, 0x90, -0x81, 0x01, 0x12, 0x48, 0x49, 0xE0, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0xFC, 0xA8, 0x05, 0x08, -0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0x4F, 0x90, 0xA6, 0x6E, 0xF0, 0x75, 0xF0, 0x10, 0xEE, 0x90, -0x81, 0x00, 0x12, 0x48, 0x49, 0xE0, 0xFF, 0x74, 0x6F, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xA6, 0xF5, -0x83, 0xEF, 0xF0, 0x80, 0x0D, 0x74, 0x6F, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xA6, 0xF5, 0x83, 0x74, -0xFF, 0xF0, 0x0D, 0xED, 0xB4, 0x07, 0x90, 0x90, 0xA6, 0x6C, 0x74, 0x05, 0xF0, 0x90, 0xA6, 0x7A, -0x74, 0x08, 0xF0, 0x7B, 0x01, 0x7A, 0xA6, 0x79, 0x6C, 0x12, 0x67, 0xEA, 0x7F, 0x04, 0x02, 0x5F, -0xF2, 0x90, 0xA6, 0xA3, 0x74, 0x08, 0xF0, 0x90, 0xA6, 0xB1, 0x74, 0x01, 0xF0, 0x90, 0xA6, 0xA5, -0xEF, 0xF0, 0x7B, 0x01, 0x7A, 0xA6, 0x79, 0xA3, 0x02, 0x67, 0xEA, 0x90, 0xA6, 0xEA, 0x74, 0x09, -0xF0, 0x90, 0xA6, 0xF8, 0x74, 0x07, 0xF0, 0x90, 0xA6, 0xEC, 0xEF, 0xF0, 0x70, 0x31, 0x90, 0xA5, -0x67, 0xE0, 0x60, 0x1A, 0xA3, 0xE0, 0x60, 0x02, 0x80, 0x0C, 0x90, 0x07, 0x70, 0xE0, 0x70, 0x06, -0x90, 0x07, 0x74, 0xE0, 0x60, 0x08, 0x90, 0xA6, 0xED, 0x74, 0x01, 0xF0, 0x80, 0x05, 0xE4, 0x90, -0xA6, 0xED, 0xF0, 0xE4, 0x90, 0xA6, 0xEE, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0x80, 0x39, 0x90, -0xFD, 0x62, 0xE0, 0x90, 0xA6, 0xED, 0xF0, 0x90, 0xFD, 0x63, 0xE0, 0x90, 0xA6, 0xEE, 0xF0, 0x90, -0xFD, 0x64, 0xE0, 0x90, 0xA6, 0xEF, 0xF0, 0x90, 0xFD, 0x65, 0xE0, 0x90, 0xA6, 0xF0, 0xF0, 0x90, -0xFD, 0x66, 0xE0, 0x90, 0xA6, 0xF1, 0xF0, 0x90, 0xFD, 0x67, 0xE0, 0x90, 0xA6, 0xF2, 0xF0, 0x90, -0xA6, 0xED, 0xE0, 0x54, 0x01, 0x90, 0xA5, 0x67, 0xF0, 0xA3, 0xF0, 0x7B, 0x01, 0x7A, 0xA6, 0x79, -0xEA, 0x02, 0x67, 0xEA, 0x90, 0xA5, 0x74, 0xE0, 0xFF, 0xC3, 0x13, 0x30, 0xE0, 0x04, 0xEF, 0x54, -0xFD, 0xF0, 0x90, 0xA5, 0x74, 0xE0, 0xFF, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x10, 0xEF, -0x54, 0xF7, 0xF0, 0x90, 0xFD, 0x58, 0xE0, 0x30, 0xE0, 0x05, 0xE4, 0xFF, 0x12, 0x4E, 0xD7, 0x90, -0xA5, 0x74, 0xE0, 0xFF, 0xC4, 0x13, 0x54, 0x07, 0x30, 0xE0, 0x04, 0xEF, 0x54, 0xDF, 0xF0, 0x90, -0xA5, 0x74, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x2B, 0xEF, 0x54, 0x7F, -0xF0, 0x90, 0xFD, 0x58, 0xE0, 0x20, 0xE0, 0x08, 0x90, 0xA6, 0x93, 0x74, 0x01, 0xF0, 0x80, 0x05, -0xE4, 0x90, 0xA6, 0x93, 0xF0, 0x90, 0xA6, 0x93, 0xE0, 0xFD, 0x90, 0xA5, 0x79, 0xE0, 0xFB, 0xE4, -0xFF, 0x71, 0xD4, 0x7F, 0x04, 0x12, 0x4E, 0xDC, 0x90, 0xA5, 0x75, 0xE0, 0xFF, 0xC3, 0x13, 0x30, -0xE0, 0x04, 0xEF, 0x54, 0xFD, 0xF0, 0x90, 0xFD, 0x58, 0xE0, 0x20, 0xE0, 0x5C, 0x90, 0xA5, 0x74, -0xE0, 0x30, 0xE0, 0x08, 0x7B, 0x01, 0x7A, 0xA5, 0x79, 0x97, 0x81, 0x9C, 0x90, 0xA5, 0x74, 0xE0, -0xFF, 0xC4, 0x54, 0x0F, 0x30, 0xE0, 0x09, 0x7B, 0x01, 0x7A, 0xA5, 0x79, 0x77, 0x02, 0x59, 0xF9, -0x90, 0xA5, 0x74, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, 0x08, 0x7B, 0x01, 0x7A, -0xA5, 0x79, 0x79, 0x80, 0x25, 0x90, 0xA5, 0x74, 0xE0, 0xFF, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, -0x09, 0x7B, 0x01, 0x7A, 0xA5, 0x79, 0x76, 0x02, 0x5A, 0xB3, 0x90, 0xA5, 0x75, 0xE0, 0x30, 0xE0, -0x08, 0x7B, 0x01, 0x7A, 0xA5, 0x79, 0x78, 0x91, 0x33, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, -0xD0, 0x90, 0xA7, 0x26, 0x12, 0x48, 0x5E, 0x12, 0x06, 0x89, 0x90, 0xA7, 0x29, 0xF0, 0x90, 0x00, -0x01, 0x12, 0x06, 0xA2, 0x90, 0xA7, 0x2A, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x06, 0xA2, 0x90, 0xA7, -0x2B, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x06, 0xA2, 0x90, 0xA7, 0x2C, 0xF0, 0x90, 0x00, 0x04, 0x12, -0x06, 0xA2, 0x90, 0xA7, 0x2D, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0xA5, 0x74, 0xE0, 0x44, -0x40, 0xF0, 0x7B, 0x01, 0x7A, 0xA7, 0x79, 0x29, 0x7D, 0x07, 0x7F, 0x30, 0x12, 0x58, 0xA1, 0x8F, -0x71, 0xE5, 0x71, 0xB4, 0x01, 0x1F, 0x90, 0xA5, 0x74, 0xE0, 0x54, 0xBF, 0xF0, 0x44, 0x80, 0xF0, -0xE4, 0x90, 0xA7, 0x42, 0xF0, 0xA3, 0x74, 0x0A, 0xF0, 0xE4, 0xFB, 0xFD, 0x7F, 0x68, 0x7E, 0x01, -0x12, 0x5A, 0x81, 0x80, 0x3A, 0xE5, 0x71, 0xB4, 0x02, 0x1A, 0x90, 0xA7, 0x26, 0x12, 0x48, 0x55, -0x8B, 0x40, 0x8A, 0x41, 0x89, 0x42, 0x75, 0x43, 0x05, 0x7B, 0x01, 0x7A, 0xA5, 0x79, 0x79, 0x12, -0x35, 0x85, 0x80, 0x1B, 0xE5, 0x71, 0xB4, 0x04, 0x16, 0x90, 0xA5, 0x74, 0xE0, 0x54, 0xBF, 0xF0, -0x90, 0xA7, 0x29, 0xE0, 0xFB, 0xE4, 0xFD, 0xFF, 0x71, 0xD4, 0x7F, 0x04, 0x12, 0x5F, 0xF2, 0xD0, -0xD0, 0x92, 0xAF, 0x22, 0x90, 0xA6, 0xF9, 0x74, 0x0B, 0xF0, 0x90, 0xA7, 0x07, 0x74, 0x07, 0xF0, -0x90, 0xA6, 0xFB, 0xEF, 0xF0, 0x60, 0x32, 0x90, 0xFD, 0x63, 0xE0, 0x90, 0xA6, 0xFC, 0xF0, 0x90, -0xFD, 0x61, 0xE0, 0x90, 0xA6, 0xFD, 0xF0, 0x90, 0xFD, 0x64, 0xE0, 0x90, 0xA6, 0xFE, 0xF0, 0x90, -0xFD, 0x65, 0xE0, 0x90, 0xA6, 0xFF, 0xF0, 0x90, 0xFD, 0x66, 0xE0, 0x90, 0xA7, 0x00, 0xF0, 0x90, -0xFD, 0x67, 0xE0, 0x90, 0xA7, 0x01, 0xF0, 0x80, 0x11, 0x90, 0xA6, 0xFC, 0xED, 0xF0, 0xA3, 0xEB, -0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x7B, 0x01, 0x7A, 0xA6, 0x79, 0xF9, -0x02, 0x67, 0xEA, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0xA7, 0x5F, 0x12, 0x48, 0x5E, -0x90, 0xA5, 0x75, 0xE0, 0x44, 0x01, 0xF0, 0x7D, 0x01, 0x7F, 0x28, 0x12, 0x58, 0xA1, 0x90, 0xA7, -0x62, 0xEF, 0xF0, 0xBF, 0x01, 0x1F, 0x90, 0xA5, 0x75, 0xE0, 0x54, 0xFE, 0xF0, 0x44, 0x02, 0xF0, -0xE4, 0x90, 0xA7, 0x42, 0xF0, 0xA3, 0x74, 0x0A, 0xF0, 0xE4, 0xFB, 0xFD, 0x7F, 0x68, 0x7E, 0x01, -0x12, 0x5A, 0x81, 0x80, 0x22, 0x90, 0xA7, 0x62, 0xE0, 0xFF, 0xB4, 0x02, 0x0F, 0x90, 0xA7, 0x5F, -0x12, 0x48, 0x55, 0x12, 0x06, 0x89, 0x90, 0xA5, 0x78, 0xF0, 0x80, 0x0B, 0xEF, 0xB4, 0x04, 0x07, -0x90, 0xA5, 0x75, 0xE0, 0x54, 0xFE, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0xA7, 0x5B, 0x12, -0x48, 0x5E, 0x90, 0xA7, 0x5B, 0x12, 0x48, 0x55, 0x12, 0x06, 0x89, 0x90, 0xA5, 0x97, 0xF0, 0x90, -0x00, 0x01, 0x12, 0x06, 0xA2, 0x90, 0xA5, 0x98, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x06, 0xA2, 0x90, -0xA5, 0x99, 0xF0, 0x90, 0xA5, 0x74, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0xA7, 0x5B, 0x12, 0x48, 0x55, -0x12, 0x58, 0x9D, 0x90, 0xA7, 0x5E, 0xEF, 0xF0, 0xBF, 0x01, 0x1D, 0x90, 0xA5, 0x74, 0xE0, 0x54, -0xFE, 0xF0, 0x44, 0x02, 0xF0, 0xE4, 0x90, 0xA7, 0x42, 0xF0, 0xA3, 0x74, 0x0A, 0xF0, 0xE4, 0xFB, -0xFD, 0x7F, 0x68, 0x7E, 0x01, 0x02, 0x5A, 0x81, 0x90, 0xA7, 0x5E, 0xE0, 0xB4, 0x04, 0x07, 0x90, -0xA5, 0x74, 0xE0, 0x54, 0xFE, 0xF0, 0x22, 0x90, 0xA6, 0x69, 0x74, 0x0A, 0xF0, 0x90, 0xA6, 0x77, -0x74, 0x06, 0xF0, 0x12, 0x06, 0x89, 0x90, 0xA6, 0x6B, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x06, 0xA2, -0x90, 0xA6, 0x6C, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x06, 0xA2, 0x90, 0xA6, 0x6D, 0xF0, 0x90, 0x00, -0x03, 0x12, 0x06, 0xA2, 0x90, 0xA6, 0x6E, 0xF0, 0x90, 0x00, 0x04, 0x12, 0x06, 0xA2, 0x90, 0xA6, -0x6F, 0xF0, 0x90, 0x00, 0x05, 0x12, 0x06, 0xA2, 0x90, 0xA6, 0x70, 0xF0, 0x7B, 0x01, 0x7A, 0xA6, -0x79, 0x69, 0x02, 0x67, 0xEA, 0x12, 0x06, 0x89, 0xF5, 0x51, 0x90, 0x00, 0x01, 0x12, 0x06, 0xA2, -0xF5, 0x54, 0x90, 0x00, 0x02, 0x12, 0x06, 0xA2, 0xF5, 0x55, 0x90, 0x00, 0x03, 0x12, 0x06, 0xA2, -0xF5, 0x56, 0x90, 0x00, 0x04, 0x12, 0x06, 0xA2, 0xF5, 0x57, 0x90, 0x00, 0x05, 0x12, 0x06, 0xA2, -0xF5, 0x58, 0x90, 0x00, 0x06, 0x12, 0x06, 0xA2, 0xF5, 0x59, 0xE5, 0x51, 0x12, 0x48, 0x67, 0x95, -0xA8, 0x00, 0x95, 0xB0, 0x01, 0x95, 0xB8, 0x02, 0x95, 0xC0, 0x03, 0x95, 0xC8, 0x04, 0x95, 0xD0, -0x05, 0x95, 0xD8, 0x06, 0x00, 0x00, 0x95, 0xEF, 0x75, 0x52, 0x02, 0x75, 0x53, 0x29, 0x80, 0x45, -0x75, 0x52, 0x06, 0x75, 0x53, 0x2A, 0x80, 0x3D, 0x75, 0x52, 0x01, 0x75, 0x53, 0x31, 0x80, 0x35, -0x75, 0x52, 0x01, 0x75, 0x53, 0x32, 0x80, 0x2D, 0x75, 0x52, 0x06, 0x75, 0x53, 0x33, 0x80, 0x25, -0x7B, 0x00, 0x7A, 0x00, 0x79, 0x54, 0xA1, 0x07, 0x90, 0xA5, 0x8F, 0xE5, 0x54, 0xF0, 0xA3, 0xE5, -0x55, 0xF0, 0xA3, 0xE5, 0x56, 0xF0, 0xA3, 0xE5, 0x57, 0xF0, 0xA3, 0xE5, 0x58, 0xF0, 0x22, 0x75, -0x52, 0x01, 0x75, 0x53, 0xFF, 0x7B, 0x00, 0x7A, 0x00, 0x79, 0x54, 0xAD, 0x52, 0xAF, 0x53, 0x02, -0x58, 0xA1, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0xA7, 0x08, 0x74, 0x15, 0xF0, 0x90, -0xA7, 0x16, 0x74, 0x01, 0xF0, 0x90, 0xA7, 0x0A, 0xEF, 0xF0, 0x7B, 0x01, 0x7A, 0xA7, 0x79, 0x08, -0x12, 0x67, 0xEA, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0xA3, 0xA2, 0xE0, 0xFF, 0x7B, 0x08, 0x7D, -0x01, 0x12, 0x5C, 0xAD, 0x90, 0xA6, 0x97, 0xEE, 0xF0, 0xFC, 0xA3, 0xEF, 0xF0, 0xFD, 0x90, 0xA6, -0x94, 0xE0, 0xFF, 0xA3, 0xE0, 0xFB, 0xA3, 0xE0, 0x90, 0xA6, 0x9E, 0xF0, 0x90, 0xA6, 0x9B, 0xEC, -0xF0, 0xA3, 0xED, 0xF0, 0xA3, 0xEB, 0xF0, 0x90, 0xA6, 0x9B, 0xE0, 0xFC, 0xA3, 0xE0, 0xFD, 0x12, -0x5C, 0x23, 0x90, 0xA6, 0x9B, 0xA3, 0xE0, 0xFF, 0xFD, 0x24, 0x0D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, -0xF5, 0x83, 0xE0, 0x44, 0x80, 0xF0, 0x74, 0x0D, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, -0xE0, 0x54, 0xEF, 0xF0, 0x74, 0x12, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, -0x02, 0xF0, 0x74, 0x12, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0x03, 0xF0, -0x90, 0xA6, 0x9D, 0xE0, 0xFF, 0x90, 0xA6, 0x9B, 0xA3, 0xE0, 0xFE, 0x24, 0x2A, 0xF5, 0x82, 0xE4, -0x34, 0xFC, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0xA6, 0x9E, 0xE0, 0xFF, 0x74, 0x2B, 0x2E, 0xF5, 0x82, -0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xEF, 0xF0, 0x74, 0x2C, 0x2E, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, -0x83, 0xE0, 0x24, 0x02, 0xF0, 0x22, 0x90, 0xA5, 0x4C, 0xE0, 0xFF, 0xC3, 0x13, 0x30, 0xE0, 0x2F, -0xEF, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x20, 0xE0, 0x26, 0x90, 0xA5, 0x51, 0xE0, 0xC4, 0x54, 0x0F, -0x30, 0xE0, 0x07, 0x90, 0x07, 0x78, 0x74, 0x03, 0xF0, 0x22, 0x90, 0xA5, 0x4C, 0xE0, 0x13, 0x13, -0x54, 0x3F, 0x90, 0x07, 0x78, 0x30, 0xE0, 0x04, 0x74, 0x0D, 0xF0, 0x22, 0x74, 0x09, 0xF0, 0x22, -0xE4, 0xF5, 0x64, 0x90, 0xA5, 0x1B, 0xE0, 0x70, 0x02, 0xE1, 0xB3, 0x90, 0xA4, 0x91, 0xE0, 0x64, -0x01, 0x60, 0x02, 0xE1, 0xB3, 0x90, 0xA5, 0x19, 0xE0, 0xFF, 0xC4, 0x54, 0x0F, 0x60, 0x22, 0x24, -0xFE, 0x60, 0x03, 0x04, 0x70, 0x1E, 0x90, 0xA5, 0x22, 0xE0, 0x14, 0xF0, 0xE0, 0xFF, 0x60, 0x06, -0x90, 0xA5, 0x24, 0xE0, 0x60, 0x0E, 0xEF, 0x70, 0x08, 0x90, 0xA5, 0x21, 0xE0, 0xA3, 0xF0, 0x80, -0x00, 0x75, 0x64, 0x01, 0x90, 0xA5, 0x12, 0xE0, 0x30, 0xE0, 0x12, 0x90, 0xA5, 0x16, 0xE0, 0xB4, -0x02, 0x03, 0xE4, 0xF5, 0x64, 0x12, 0x67, 0x5F, 0xEF, 0x70, 0x02, 0xF5, 0x64, 0xE5, 0x64, 0x60, -0x42, 0x90, 0xA5, 0x1F, 0xE0, 0x44, 0x10, 0xF0, 0x90, 0xA5, 0x24, 0xE0, 0x60, 0x03, 0xB4, 0x01, -0x0B, 0xE4, 0x90, 0xA7, 0x42, 0xF0, 0x90, 0xA5, 0x24, 0xE0, 0x80, 0x0F, 0xE4, 0x90, 0xA7, 0x42, -0xF0, 0x90, 0xA5, 0x24, 0xE0, 0x75, 0xF0, 0x03, 0xA4, 0x24, 0xFE, 0xFF, 0x90, 0xA5, 0x23, 0xE0, -0x2F, 0x90, 0xA7, 0x43, 0x12, 0x5A, 0x79, 0x90, 0xA5, 0x1E, 0xE0, 0x20, 0xE2, 0x03, 0x12, 0x50, -0x86, 0xD1, 0xD6, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0xEF, 0xB4, 0x03, 0x13, 0x90, -0xA5, 0x51, 0xE0, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x90, 0x06, 0xCC, 0x30, 0xE0, 0x35, 0xE4, 0xF0, -0x80, 0x34, 0x90, 0xA5, 0x52, 0xE0, 0xC4, 0x54, 0x0F, 0x30, 0xE0, 0x0C, 0xEF, 0x90, 0x06, 0xCC, -0x70, 0x03, 0xF0, 0x80, 0x03, 0x74, 0x03, 0xF0, 0x90, 0xA5, 0x9A, 0xE0, 0x30, 0xE0, 0x17, 0xC4, -0x54, 0x0F, 0x30, 0xE0, 0x0B, 0xEF, 0x90, 0x06, 0xCC, 0x70, 0x03, 0xF0, 0x80, 0x08, 0x80, 0x03, -0x90, 0x06, 0xCC, 0x74, 0x03, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0xA5, 0x52, 0xE0, 0xC4, -0x13, 0x13, 0x54, 0x03, 0x20, 0xE0, 0x02, 0x41, 0x7C, 0x90, 0xA5, 0x56, 0xE0, 0x64, 0x01, 0x70, -0x38, 0x90, 0x06, 0x92, 0xE0, 0x20, 0xE2, 0x06, 0x90, 0x04, 0xE3, 0xE0, 0x60, 0x20, 0x90, 0x06, -0x92, 0x74, 0x04, 0xF0, 0x90, 0xA5, 0x63, 0xE0, 0x04, 0xF0, 0x90, 0xA5, 0x5A, 0xE0, 0x75, 0xF0, -0x03, 0x84, 0xFF, 0x90, 0xA5, 0x63, 0xE0, 0xB5, 0x07, 0x02, 0x80, 0x02, 0x41, 0x61, 0xE4, 0x90, -0xA5, 0x56, 0xF0, 0x90, 0xA5, 0x61, 0x04, 0xF0, 0x22, 0x90, 0xA5, 0x56, 0xE0, 0x64, 0x04, 0x70, -0x35, 0x90, 0x06, 0x92, 0xE0, 0x20, 0xE2, 0x06, 0x90, 0x04, 0xE3, 0xE0, 0x60, 0x1C, 0x90, 0x06, -0x92, 0x74, 0x04, 0xF0, 0x90, 0xA5, 0x63, 0xE0, 0x04, 0xF0, 0x90, 0xA5, 0x59, 0xE0, 0xFF, 0x90, -0xA5, 0x63, 0xE0, 0xB5, 0x07, 0x02, 0x80, 0x02, 0x41, 0x61, 0xE4, 0x90, 0xA5, 0x56, 0xF0, 0x90, -0xA5, 0x61, 0x74, 0x04, 0xF0, 0x22, 0x90, 0xA5, 0x56, 0xE0, 0x64, 0x06, 0x60, 0x02, 0x21, 0xC2, -0x90, 0xA5, 0x64, 0xE0, 0xFF, 0x90, 0xA5, 0x63, 0xE0, 0x2F, 0xFF, 0xE4, 0x33, 0xFE, 0x7C, 0x00, -0x7D, 0x03, 0x12, 0x07, 0x03, 0x90, 0xA5, 0x5A, 0xE0, 0x2F, 0xFF, 0xEC, 0x3E, 0xFE, 0xC3, 0xEF, -0x94, 0x41, 0xEE, 0x64, 0x80, 0x94, 0x80, 0x50, 0x08, 0x90, 0xA5, 0x64, 0xE0, 0x94, 0x03, 0x40, -0x11, 0x90, 0xA5, 0x51, 0xE0, 0xC4, 0x54, 0x0F, 0x90, 0xA5, 0x61, 0x20, 0xE0, 0x02, 0x21, 0x64, -0x41, 0x0A, 0x90, 0xA5, 0x55, 0xE0, 0xFF, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x7A, 0xEF, 0x54, -0xFB, 0xF0, 0xE4, 0xA3, 0xF0, 0x90, 0xA5, 0x51, 0xE0, 0xC4, 0x54, 0x0F, 0x30, 0xE0, 0x0E, 0x90, -0xA5, 0x73, 0xE0, 0x30, 0xE0, 0x02, 0x21, 0xF0, 0x90, 0xA5, 0x61, 0x41, 0x0A, 0x90, 0xA5, 0x64, -0xE0, 0xFF, 0x90, 0xA5, 0x63, 0xE0, 0x2F, 0xFF, 0xE4, 0x33, 0xFE, 0x7C, 0x00, 0x7D, 0x03, 0x12, -0x07, 0x03, 0x90, 0xA5, 0x5A, 0xE0, 0x2F, 0xFF, 0xEC, 0x3E, 0xFE, 0xC3, 0xEF, 0x94, 0x41, 0xEE, -0x64, 0x80, 0x94, 0x80, 0x40, 0x0E, 0x90, 0xA5, 0x73, 0xE0, 0x30, 0xE0, 0x02, 0x21, 0xF0, 0x90, -0xA5, 0x61, 0x41, 0x0A, 0x90, 0xA5, 0x73, 0xE0, 0x30, 0xE0, 0x16, 0x90, 0xA5, 0x56, 0x74, 0x09, -0xF0, 0x90, 0x06, 0x92, 0x74, 0x04, 0xF0, 0xE4, 0x90, 0xA5, 0x63, 0xF0, 0x90, 0xA7, 0x7C, 0x41, -0x16, 0x90, 0xA5, 0x61, 0x74, 0x02, 0xF0, 0x22, 0x12, 0x53, 0x93, 0x90, 0xA5, 0x64, 0xE0, 0x04, -0xF0, 0x7F, 0x03, 0x12, 0x57, 0xD2, 0x90, 0xA5, 0x64, 0xE0, 0xFF, 0x90, 0xA5, 0x63, 0xE0, 0x2F, -0xFF, 0xE4, 0x33, 0xFE, 0x7C, 0x00, 0x7D, 0x03, 0x12, 0x07, 0x03, 0x90, 0xA5, 0x5A, 0xE0, 0x2F, -0xFF, 0xEC, 0x3E, 0xFE, 0xC3, 0xEF, 0x94, 0x41, 0xEE, 0x64, 0x80, 0x94, 0x80, 0x50, 0x0A, 0x90, -0xA5, 0x64, 0xE0, 0x94, 0x03, 0x50, 0x02, 0x41, 0x7C, 0x90, 0x07, 0x78, 0x74, 0x03, 0xF0, 0x90, -0x05, 0x22, 0xE0, 0x44, 0x10, 0xFF, 0x7D, 0x03, 0x12, 0x53, 0x88, 0x90, 0x04, 0x9C, 0xE0, 0x04, -0xF0, 0x22, 0x90, 0xA5, 0x56, 0xE0, 0x64, 0x07, 0x70, 0x4F, 0x90, 0xA5, 0x64, 0xE0, 0xB4, 0x04, -0x05, 0x90, 0xA5, 0x61, 0x80, 0x34, 0x90, 0xA5, 0x55, 0xE0, 0xFF, 0x13, 0x13, 0x54, 0x3F, 0x30, -0xE0, 0x2C, 0xEF, 0x54, 0xFB, 0xF0, 0xE4, 0xA3, 0xF0, 0x90, 0xA5, 0x73, 0xE0, 0x30, 0xE0, 0x17, -0x90, 0xA5, 0x56, 0x74, 0x09, 0xF0, 0x90, 0x06, 0x92, 0x74, 0x04, 0xF0, 0xE4, 0x90, 0xA5, 0x63, -0xF0, 0x90, 0xA7, 0x7C, 0x04, 0x80, 0x0F, 0x90, 0xA5, 0x61, 0x74, 0x05, 0xF0, 0x22, 0x12, 0x53, -0x93, 0x90, 0xA5, 0x64, 0xE0, 0x04, 0xF0, 0x80, 0x48, 0x90, 0xA5, 0x56, 0xE0, 0x64, 0x09, 0x70, -0x5B, 0x90, 0xA5, 0x55, 0xE0, 0x30, 0xE0, 0x0E, 0x90, 0xA5, 0x61, 0x74, 0x05, 0xF0, 0x90, 0xA5, -0x55, 0xE0, 0x54, 0xFE, 0xF0, 0x22, 0x90, 0x06, 0x92, 0xE0, 0x30, 0xE2, 0x29, 0x74, 0x04, 0xF0, -0x90, 0xA5, 0x63, 0xE0, 0x04, 0xF0, 0xE0, 0xB4, 0x02, 0x17, 0x90, 0xA7, 0x7C, 0xE0, 0x90, 0xA5, -0x61, 0x60, 0x05, 0x74, 0x05, 0xF0, 0x80, 0x03, 0x74, 0x02, 0xF0, 0xE4, 0x90, 0xA5, 0x56, 0xF0, -0x22, 0x7F, 0x03, 0x02, 0x57, 0xD2, 0x90, 0xA7, 0x7C, 0xE0, 0x90, 0xA5, 0x61, 0x60, 0x05, 0x74, -0x05, 0xF0, 0x80, 0x03, 0x74, 0x02, 0xF0, 0xE4, 0x90, 0xA5, 0x56, 0xF0, 0x22, 0x90, 0xA5, 0x4E, -0xE0, 0x30, 0xE0, 0x36, 0x11, 0x0B, 0x90, 0xA5, 0x61, 0xE0, 0xFF, 0xB4, 0x01, 0x02, 0x80, 0x1D, -0x90, 0xA5, 0x61, 0xE0, 0xFF, 0xB4, 0x02, 0x02, 0x80, 0x1D, 0x90, 0xA5, 0x61, 0xE0, 0xFF, 0xB4, -0x03, 0x03, 0x02, 0x55, 0xB0, 0x90, 0xA5, 0x61, 0xE0, 0xFF, 0xB4, 0x04, 0x02, 0x80, 0x0C, 0x90, -0xA5, 0x61, 0xE0, 0xFF, 0xB4, 0x05, 0x03, 0x12, 0x54, 0x39, 0x22, 0x90, 0xA6, 0x93, 0xEF, 0xF0, -0x7F, 0x03, 0x12, 0x57, 0xD2, 0x90, 0xA5, 0x51, 0xE0, 0xC4, 0x54, 0x0F, 0x90, 0xA5, 0x61, 0x30, -0xE0, 0x05, 0x74, 0x05, 0xF0, 0x80, 0x03, 0xE0, 0x04, 0xF0, 0x90, 0xA5, 0x52, 0xE0, 0xFF, 0xC4, -0x13, 0x54, 0x07, 0x20, 0xE0, 0x09, 0xEF, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x3C, 0x90, -0xA5, 0x51, 0xE0, 0xC4, 0x54, 0x0F, 0x30, 0xE0, 0x0A, 0x90, 0xA5, 0x4F, 0xE0, 0xFF, 0x90, 0xA5, -0x5F, 0x80, 0x21, 0x90, 0xA6, 0x93, 0xE0, 0xFC, 0xB4, 0x01, 0x0D, 0x90, 0xA5, 0x4F, 0xE0, 0xFE, -0x90, 0xA5, 0x5E, 0xE0, 0xC3, 0x9E, 0x80, 0x0F, 0xEC, 0xB4, 0x04, 0x0F, 0x90, 0xA5, 0x50, 0xE0, -0xFF, 0x90, 0xA5, 0x5E, 0xE0, 0xC3, 0x9F, 0x90, 0xA5, 0x65, 0xF0, 0x90, 0xA5, 0x4E, 0xE0, 0xC4, -0x13, 0x54, 0x07, 0x30, 0xE0, 0x2C, 0x90, 0xA5, 0x52, 0xE0, 0xC4, 0x13, 0x54, 0x07, 0x20, 0xE0, -0x02, 0x61, 0xD9, 0x90, 0xA5, 0x65, 0xE0, 0xFF, 0xC3, 0x94, 0x20, 0x50, 0x0A, 0xEF, 0x25, 0xE0, -0x25, 0xE0, 0xFB, 0xE4, 0xFD, 0x80, 0x05, 0x7B, 0x7F, 0x7D, 0xFF, 0xE4, 0xFF, 0x12, 0x5F, 0xA9, -0x80, 0x77, 0x90, 0xA5, 0x4E, 0xE0, 0xC4, 0x54, 0x0F, 0x30, 0xE0, 0x54, 0x90, 0xA5, 0x54, 0xE0, -0x54, 0xDF, 0xF0, 0xE4, 0xFD, 0x7F, 0x04, 0x12, 0x50, 0x8A, 0x90, 0xA5, 0x52, 0xE0, 0xC4, 0x13, -0x13, 0x54, 0x03, 0x30, 0xE0, 0x3A, 0x90, 0xA5, 0x55, 0xE0, 0x44, 0x02, 0xF0, 0x54, 0xFB, 0xF0, -0xE4, 0x90, 0xA5, 0x64, 0xF0, 0x90, 0xA5, 0x61, 0xF0, 0x90, 0xA6, 0x93, 0xE0, 0xFF, 0xB4, 0x01, -0x08, 0x90, 0xA5, 0x56, 0x74, 0x06, 0xF0, 0x80, 0x0A, 0xEF, 0xB4, 0x04, 0x06, 0x90, 0xA5, 0x56, -0x74, 0x07, 0xF0, 0x90, 0xA5, 0x4D, 0xE0, 0x60, 0x07, 0x90, 0xA5, 0x55, 0xE0, 0x44, 0x04, 0xF0, -0x90, 0xA6, 0x93, 0xE0, 0xB4, 0x01, 0x04, 0x7D, 0x06, 0x80, 0x09, 0x90, 0xA6, 0x93, 0xE0, 0xB4, -0x04, 0x07, 0x7D, 0x0C, 0x7F, 0x6F, 0x12, 0x53, 0x88, 0x90, 0xA5, 0x52, 0xE0, 0x13, 0x13, 0x13, -0x54, 0x1F, 0x30, 0xE0, 0x1A, 0x90, 0xA5, 0x65, 0xE0, 0xFF, 0xC3, 0x94, 0x20, 0x50, 0x0A, 0xEF, -0x7F, 0x00, 0x25, 0xE0, 0x25, 0xE0, 0xFE, 0x80, 0x04, 0x7F, 0xFF, 0x7E, 0x7F, 0x91, 0x0D, 0x90, -0xA5, 0x51, 0xE0, 0x30, 0xE0, 0x06, 0xE4, 0xFD, 0xFF, 0x12, 0x53, 0x88, 0x22, 0xD3, 0x10, 0xAF, -0x01, 0xC3, 0xC0, 0xD0, 0x90, 0xA6, 0x96, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x04, 0x1D, 0xE0, -0x60, 0x1E, 0x90, 0x05, 0x22, 0xE0, 0x90, 0xA6, 0x9A, 0xF0, 0x7D, 0x36, 0x12, 0x5F, 0x3B, 0xBF, -0x01, 0x02, 0x91, 0x59, 0x90, 0xA6, 0x9A, 0xE0, 0xFF, 0x7D, 0x37, 0x12, 0x53, 0x88, 0x80, 0x02, -0x91, 0x59, 0x90, 0x05, 0x22, 0xE0, 0x54, 0x6F, 0xFF, 0x7D, 0x38, 0x12, 0x53, 0x88, 0x90, 0x04, -0x1F, 0x74, 0x20, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0xA3, 0xA3, 0xE0, 0xFF, 0xE4, 0xFB, -0x7D, 0x01, 0x12, 0x5C, 0xAD, 0x90, 0xA6, 0x98, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0xA6, 0x96, -0xE0, 0xFC, 0xA3, 0xE0, 0xFD, 0xAB, 0x07, 0x90, 0xA6, 0x9B, 0xED, 0xF0, 0xEC, 0xF9, 0xE0, 0xFF, -0xAE, 0x03, 0x74, 0x2A, 0x2E, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xEF, 0xF0, 0x74, 0x2B, -0x2E, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE9, 0xF0, 0x22, 0x90, 0xA6, 0x93, 0xEF, 0xF0, -0xA3, 0xED, 0xF0, 0xA3, 0xEB, 0xF0, 0x90, 0xA5, 0x9A, 0xE0, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x20, -0xE0, 0x0E, 0x90, 0xA6, 0x94, 0xE0, 0xB4, 0x01, 0x07, 0x7D, 0x36, 0x7F, 0x6F, 0x12, 0x53, 0x88, -0x90, 0xA6, 0x93, 0xE0, 0x70, 0x0C, 0x90, 0xA6, 0x95, 0xE0, 0xFF, 0x7D, 0x05, 0x12, 0x53, 0x9E, -0x80, 0x27, 0x90, 0xA6, 0x93, 0xE0, 0xB4, 0x01, 0x0A, 0x90, 0xA6, 0x95, 0xE0, 0xFF, 0x12, 0x5D, -0x52, 0x80, 0x16, 0x90, 0xA6, 0x93, 0xE0, 0xB4, 0x02, 0x0F, 0xA3, 0xE0, 0xB4, 0x01, 0x0A, 0x90, -0xA5, 0xA8, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x91, 0x0D, 0x90, 0xA5, 0x9A, 0xE0, 0x13, 0x13, 0x13, -0x54, 0x1F, 0x20, 0xE0, 0x0B, 0x90, 0xA6, 0x94, 0xE0, 0x70, 0x05, 0xFD, 0xFF, 0x12, 0x53, 0x88, -0x22, 0x90, 0xA5, 0x4E, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0xFD, 0xF0, 0x54, 0xFB, 0xF0, 0x54, 0xEF, -0xF0, 0x54, 0xDF, 0xF0, 0x54, 0xBF, 0xF0, 0x54, 0x7F, 0xF0, 0xA3, 0x74, 0x0B, 0xF0, 0xA3, 0x74, -0x08, 0xF0, 0xA3, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0xFD, 0xF0, 0x54, 0xFB, 0xF0, 0x54, 0xEF, 0xF0, -0x54, 0xDF, 0xF0, 0x54, 0xBF, 0xF0, 0x54, 0x7F, 0xF0, 0xA3, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0xFD, -0xF0, 0x54, 0xFB, 0xF0, 0x54, 0xF7, 0xF0, 0x54, 0xEF, 0xF0, 0x54, 0xDF, 0xF0, 0x54, 0xBF, 0xF0, -0x54, 0x7F, 0xF0, 0x90, 0xA5, 0x73, 0xE0, 0x54, 0xFE, 0xF0, 0x22, 0x90, 0xA5, 0x54, 0xE0, 0x54, -0xDF, 0xF0, 0xE4, 0x90, 0xA5, 0x53, 0xF0, 0x90, 0xA5, 0x55, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0xFD, -0xF0, 0x54, 0xFB, 0xF0, 0xE4, 0x90, 0xA5, 0x5C, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, -0xF0, 0xA3, 0xF0, 0xA3, 0x74, 0x02, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0xA5, 0x69, 0xE0, -0x54, 0xFE, 0xF0, 0x54, 0xE1, 0xF0, 0xE4, 0x90, 0xA5, 0x66, 0xF0, 0x90, 0xA5, 0x74, 0xE0, 0x54, -0xFE, 0xF0, 0x54, 0xFD, 0xF0, 0x54, 0xFB, 0xF0, 0x54, 0xF7, 0xF0, 0x54, 0xBF, 0xF0, 0x54, 0x7F, -0xF0, 0x54, 0xEF, 0xF0, 0x54, 0xDF, 0xF0, 0x22, 0xE4, 0x90, 0xA6, 0x83, 0xF0, 0x90, 0xA5, 0x4E, -0xE0, 0x30, 0xE0, 0x6B, 0x90, 0xA5, 0x52, 0xE0, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, 0x1F, -0x90, 0xA5, 0x5A, 0xE0, 0xFF, 0x12, 0x57, 0xD2, 0x90, 0x06, 0x92, 0x74, 0x04, 0xF0, 0x90, 0xA5, -0x56, 0x74, 0x01, 0xF0, 0xE4, 0x90, 0xA5, 0x63, 0xF0, 0x90, 0xA5, 0x61, 0xF0, 0x80, 0x11, 0x90, -0xA6, 0x83, 0xE0, 0xFF, 0x90, 0xA5, 0x4F, 0x12, 0x57, 0xCE, 0x90, 0xA5, 0x61, 0x74, 0x01, 0xF0, -0x90, 0xA5, 0x60, 0x74, 0x01, 0xF0, 0x90, 0xA5, 0x4D, 0xE0, 0x60, 0x07, 0x7D, 0x05, 0x7F, 0x6F, -0x02, 0x53, 0x88, 0xE4, 0xFD, 0xFF, 0x12, 0x53, 0x88, 0x90, 0xA5, 0x4E, 0xE0, 0xFF, 0xC4, 0x13, -0x54, 0x07, 0x20, 0xE0, 0x0A, 0xEF, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x02, 0xD1, 0x40, 0x22, -0x90, 0xA5, 0x4C, 0xE0, 0xC4, 0x54, 0x0F, 0x20, 0xE0, 0x20, 0x90, 0x04, 0x1D, 0xE0, 0x70, 0x1A, -0x90, 0xA3, 0x9F, 0xE0, 0xFF, 0x7B, 0x18, 0xE4, 0xFD, 0x12, 0x5C, 0xAD, 0x90, 0xA7, 0xA1, 0xEE, -0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x04, 0x1F, 0x74, 0x20, 0xF0, 0x22, 0xE4, 0xF5, 0x64, 0x90, 0x06, -0xA9, 0xE0, 0xF5, 0x64, 0x54, 0xC0, 0x70, 0x0D, 0x90, 0xA5, 0x1F, 0xE0, 0x54, 0xFE, 0xF0, 0x54, -0xFD, 0xF0, 0x02, 0x50, 0x71, 0xE5, 0x64, 0x30, 0xE6, 0x22, 0x90, 0xA5, 0x1B, 0xE0, 0x64, 0x01, -0x70, 0x21, 0x90, 0xA5, 0x1F, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0xA5, 0x19, 0xE0, 0x54, 0x0F, 0x64, -0x02, 0x60, 0x04, 0xD1, 0x40, 0x80, 0x0C, 0x12, 0x66, 0xDE, 0x80, 0x07, 0x90, 0xA5, 0x1F, 0xE0, -0x54, 0xFE, 0xF0, 0xE5, 0x64, 0x90, 0xA5, 0x1F, 0x30, 0xE7, 0x1B, 0xE0, 0x44, 0x02, 0xF0, 0xE4, -0x90, 0xA7, 0x42, 0xF0, 0x90, 0xA5, 0x48, 0xE0, 0x90, 0xA7, 0x43, 0x12, 0x5A, 0x79, 0x90, 0xA5, -0x17, 0xE0, 0x44, 0x04, 0xF0, 0x22, 0xE0, 0x54, 0xFD, 0xF0, 0x22, 0x90, 0x06, 0xA9, 0xE0, 0x90, -0xA6, 0x83, 0xF0, 0xE0, 0xFD, 0x54, 0xC0, 0x70, 0x09, 0x90, 0xA5, 0x1F, 0xE0, 0x54, 0xFE, 0xF0, -0x80, 0x7E, 0xED, 0x30, 0xE6, 0x4D, 0x90, 0xA5, 0x1B, 0xE0, 0x64, 0x02, 0x70, 0x2B, 0x90, 0xA5, -0x17, 0xE0, 0xFF, 0xC3, 0x13, 0x20, 0xE0, 0x09, 0x90, 0xA5, 0x1F, 0xE0, 0x44, 0x01, 0xF0, 0x80, -0x29, 0x90, 0xA5, 0x19, 0xE0, 0x54, 0x0F, 0x64, 0x01, 0x70, 0x2F, 0x90, 0xA5, 0x1F, 0xE0, 0x44, -0x04, 0xF0, 0x7F, 0x01, 0x12, 0x5D, 0x52, 0x80, 0x21, 0x90, 0xA5, 0x1F, 0xE0, 0x44, 0x01, 0xF0, -0x90, 0xA5, 0x19, 0xE0, 0x54, 0x0F, 0x64, 0x02, 0x60, 0x04, 0xD1, 0x40, 0x80, 0x0C, 0x12, 0x66, -0xDE, 0x80, 0x07, 0x90, 0xA5, 0x1F, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0xA6, 0x83, 0xE0, 0x90, 0xA5, -0x1F, 0x30, 0xE7, 0x1B, 0xE0, 0x44, 0x02, 0xF0, 0xE4, 0x90, 0xA7, 0x42, 0xF0, 0x90, 0xA5, 0x48, -0xE0, 0x90, 0xA7, 0x43, 0x12, 0x5A, 0x79, 0x90, 0xA5, 0x17, 0xE0, 0x44, 0x04, 0xF0, 0x22, 0xE0, -0x54, 0xFD, 0xF0, 0x22, 0x90, 0xA6, 0xA4, 0xEF, 0xF0, 0x7F, 0x2C, 0x7E, 0x09, 0x12, 0x37, 0xAD, -0xEF, 0x54, 0x04, 0xFF, 0xE4, 0xFD, 0xFC, 0xEF, 0x60, 0x08, 0x90, 0xA5, 0x6F, 0x74, 0x01, 0xF0, -0x80, 0x05, 0xE4, 0x90, 0xA5, 0x6F, 0xF0, 0x7F, 0x30, 0x7E, 0x09, 0x12, 0x37, 0xAD, 0xEE, 0x54, -0x01, 0xFE, 0xED, 0x54, 0x10, 0xFD, 0xE4, 0xFC, 0xED, 0x4E, 0x60, 0x07, 0xE4, 0x90, 0xA5, 0x70, -0xF0, 0x80, 0x06, 0x90, 0xA5, 0x70, 0x74, 0x01, 0xF0, 0x90, 0xA5, 0x69, 0xE0, 0x44, 0x01, 0xF0, -0x7D, 0x11, 0x12, 0x4B, 0x53, 0x90, 0x07, 0x78, 0xE0, 0x90, 0xA5, 0x6E, 0xF0, 0x90, 0xA5, 0x8D, -0xE0, 0xFF, 0xE4, 0xFD, 0x12, 0x69, 0xF2, 0x90, 0xA6, 0xA4, 0xE0, 0xFD, 0x70, 0x02, 0x80, 0x24, -0xED, 0xB4, 0x01, 0x0A, 0x90, 0xA5, 0x69, 0xE0, 0x54, 0x1F, 0x44, 0x20, 0xF0, 0x22, 0x90, 0xA6, -0xA4, 0xE0, 0xFD, 0xB4, 0x02, 0x0A, 0x90, 0xA5, 0x69, 0xE0, 0x54, 0x1F, 0x44, 0x60, 0xF0, 0x22, -0xED, 0xB4, 0x03, 0x07, 0x90, 0xA5, 0x69, 0xE0, 0x54, 0x1F, 0xF0, 0x22, 0x90, 0xA5, 0x51, 0xE0, -0xC4, 0x13, 0x13, 0x54, 0x03, 0x20, 0xE0, 0x1E, 0x90, 0xFD, 0x62, 0xE0, 0x30, 0xE0, 0x17, 0xE0, -0x90, 0xA6, 0xA3, 0x30, 0xE1, 0x05, 0x74, 0x01, 0xF0, 0x80, 0x03, 0x74, 0x02, 0xF0, 0x90, 0xA6, -0xA3, 0xE0, 0xFF, 0x12, 0x9F, 0x74, 0x22, 0xEF, 0x70, 0x1C, 0x90, 0xA5, 0x9B, 0xE0, 0x54, 0x03, -0xFE, 0x70, 0x02, 0x80, 0x1B, 0xBE, 0x01, 0x02, 0x80, 0x20, 0xBE, 0x02, 0x02, 0x80, 0x26, 0xEE, -0x64, 0x03, 0x70, 0x32, 0x80, 0x2A, 0x90, 0xA5, 0x9B, 0xE0, 0xC4, 0x54, 0x03, 0xFE, 0x70, 0x07, -0x90, 0x07, 0x78, 0x04, 0xF0, 0x80, 0x1F, 0xBE, 0x01, 0x08, 0x90, 0x07, 0x78, 0x74, 0x03, 0xF0, -0x80, 0x14, 0xBE, 0x02, 0x08, 0x90, 0x07, 0x78, 0x74, 0x09, 0xF0, 0x80, 0x09, 0xBE, 0x03, 0x06, -0x90, 0x07, 0x78, 0x74, 0x0D, 0xF0, 0x90, 0xA5, 0x9A, 0xE0, 0xFE, 0xC4, 0x13, 0x54, 0x07, 0x30, -0xE0, 0x45, 0xEF, 0x70, 0x1F, 0xA3, 0xE0, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x07, 0xE4, 0x90, -0xA6, 0x93, 0xF0, 0x80, 0x06, 0x90, 0xA6, 0x93, 0x74, 0x01, 0xF0, 0x90, 0xA6, 0x93, 0xE0, 0xFD, -0xE4, 0xFF, 0x80, 0x20, 0x90, 0xA5, 0x9B, 0xE0, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, 0x07, -0xE4, 0x90, 0xA6, 0x93, 0xF0, 0x80, 0x06, 0x90, 0xA6, 0x93, 0x74, 0x01, 0xF0, 0x90, 0xA6, 0x93, -0xE0, 0xFD, 0x7F, 0x01, 0x12, 0x69, 0xF2, 0x22, 0x90, 0xA7, 0xA5, 0xEF, 0xF0, 0x7F, 0x02, 0x12, -0x47, 0x57, 0x90, 0xA3, 0x99, 0xE0, 0xFF, 0x90, 0xA7, 0xA5, 0xE0, 0xFE, 0xEF, 0x4E, 0x90, 0xA3, -0x99, 0xF0, 0x22, 0x90, 0x02, 0x09, 0xE0, 0xF5, 0x51, 0x12, 0x06, 0x89, 0x25, 0x51, 0x90, 0xA3, -0x9E, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x06, 0xA2, 0x25, 0x51, 0x90, 0xA3, 0x9F, 0xF0, 0x90, 0x00, -0x02, 0x12, 0x06, 0xA2, 0x25, 0x51, 0x90, 0xA3, 0xA0, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x06, 0xA2, -0x25, 0x51, 0x90, 0xA3, 0xA1, 0xF0, 0x90, 0x00, 0x04, 0x12, 0x06, 0xA2, 0x25, 0x51, 0x90, 0xA3, -0xA2, 0xF0, 0x90, 0x00, 0x05, 0x12, 0x06, 0xA2, 0x25, 0x51, 0x90, 0xA3, 0xA3, 0xF0, 0x22, 0x90, -0x04, 0x24, 0xE0, 0xF5, 0x51, 0x12, 0x06, 0x89, 0x25, 0x51, 0x90, 0xA5, 0xBC, 0xF0, 0x90, 0x00, -0x01, 0x12, 0x06, 0xA2, 0x25, 0x51, 0x90, 0xA5, 0xC9, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x06, 0xA2, -0x25, 0x51, 0x90, 0xA5, 0xD6, 0xF0, 0x22, 0x8B, 0x51, 0x8A, 0x52, 0x89, 0x53, 0x12, 0x06, 0x89, -0xC4, 0x54, 0x0F, 0xFF, 0xBF, 0x0F, 0x19, 0x90, 0xA5, 0xAD, 0xE0, 0x54, 0xFE, 0xF0, 0xD1, 0xE6, -0xAB, 0x51, 0xAA, 0x52, 0xA9, 0x53, 0x12, 0x06, 0x89, 0x54, 0x0F, 0xFF, 0x71, 0x97, 0xE1, 0x02, -0xAB, 0x51, 0xAA, 0x52, 0xA9, 0x53, 0x90, 0x00, 0x01, 0x12, 0x06, 0xA2, 0xFF, 0x12, 0x06, 0x89, -0xFE, 0x54, 0x0F, 0xFD, 0x75, 0xF0, 0x0D, 0x90, 0xA5, 0xB0, 0x12, 0x48, 0x49, 0xEF, 0xF0, 0x90, -0x00, 0x02, 0x12, 0x06, 0xA2, 0x54, 0x03, 0xFF, 0x75, 0xF0, 0x0D, 0xED, 0x90, 0xA5, 0xB1, 0x12, -0x48, 0x49, 0xE0, 0x54, 0xFC, 0x4F, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x06, 0xA2, 0x54, 0x1C, 0xFF, -0xEE, 0x54, 0x0F, 0xFE, 0x75, 0xF0, 0x0D, 0x90, 0xA5, 0xB1, 0x12, 0x48, 0x49, 0xE0, 0x54, 0xE3, -0x4F, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x06, 0xA2, 0x54, 0xE0, 0xFF, 0x75, 0xF0, 0x0D, 0xEE, 0x90, -0xA5, 0xB1, 0x12, 0x48, 0x49, 0xE0, 0x54, 0x1F, 0x4F, 0xF0, 0x90, 0x00, 0x04, 0x12, 0x06, 0xA2, -0xFF, 0x12, 0x06, 0x89, 0x54, 0x0F, 0xFD, 0xE4, 0xFB, 0x51, 0x8D, 0xAB, 0x51, 0xAA, 0x52, 0xA9, -0x53, 0x90, 0x00, 0x05, 0x12, 0x06, 0xA2, 0xFF, 0x12, 0x06, 0x89, 0x54, 0x0F, 0xFD, 0x7B, 0x01, -0x51, 0x8D, 0xAB, 0x51, 0xAA, 0x52, 0xA9, 0x53, 0x90, 0x00, 0x03, 0x12, 0x06, 0xA2, 0x33, 0x33, -0x33, 0x54, 0xF8, 0xFF, 0x12, 0x06, 0x89, 0xFE, 0x54, 0x0F, 0xFD, 0x75, 0xF0, 0x0D, 0x90, 0xA5, -0xB9, 0x12, 0x48, 0x49, 0xEF, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x06, 0xA2, 0xC4, 0x13, 0x54, 0x07, -0xFF, 0x75, 0xF0, 0x0D, 0xED, 0x90, 0xA5, 0xBA, 0x12, 0x48, 0x49, 0xEF, 0xF0, 0xEE, 0xC4, 0x54, -0x0F, 0xFF, 0x14, 0x6D, 0x70, 0x26, 0x90, 0xA5, 0xAE, 0xEF, 0xF0, 0x90, 0x00, 0x06, 0x12, 0x06, -0xA2, 0x54, 0x0F, 0xC4, 0x54, 0xF0, 0xFF, 0x90, 0xA5, 0xAD, 0xE0, 0x54, 0x0F, 0x4F, 0xF0, 0x54, -0xF1, 0xF0, 0x44, 0x01, 0xF0, 0x7D, 0x20, 0xE4, 0xFF, 0x12, 0x77, 0x59, 0x22, 0x8F, 0x54, 0x8D, -0x55, 0xAE, 0x03, 0x74, 0x1F, 0xC3, 0x95, 0x54, 0x40, 0x14, 0x90, 0xA6, 0x6D, 0xEE, 0xF0, 0xAB, -0x55, 0xE4, 0xFD, 0x71, 0x20, 0x90, 0xA6, 0x69, 0xEF, 0xF0, 0x24, 0xD4, 0x80, 0x55, 0x74, 0x3F, -0xC3, 0x95, 0x54, 0x40, 0x16, 0x90, 0xA6, 0x6D, 0xEE, 0xF0, 0xAB, 0x55, 0x7D, 0x20, 0xAF, 0x54, -0x71, 0x20, 0x90, 0xA6, 0x69, 0xEF, 0xF0, 0x24, 0x88, 0x80, 0x38, 0x74, 0x5F, 0xC3, 0x95, 0x54, -0x40, 0x16, 0x90, 0xA6, 0x6D, 0xEE, 0xF0, 0xAB, 0x55, 0x7D, 0x40, 0xAF, 0x54, 0x71, 0x20, 0x90, -0xA6, 0x69, 0xEF, 0xF0, 0x24, 0xD0, 0x80, 0x1B, 0x74, 0x7F, 0xC3, 0x95, 0x54, 0x40, 0x30, 0x90, -0xA6, 0x6D, 0xEE, 0xF0, 0xAB, 0x55, 0x7D, 0x60, 0xAF, 0x54, 0x71, 0x20, 0x90, 0xA6, 0x69, 0xEF, -0xF0, 0x24, 0x84, 0xFD, 0xE4, 0x34, 0x04, 0xFC, 0x75, 0xF0, 0x0D, 0xE5, 0x55, 0x90, 0xA5, 0xB2, -0x12, 0x48, 0x49, 0x75, 0xF0, 0x03, 0xEE, 0x12, 0x48, 0x49, 0xEC, 0xF0, 0xA3, 0xED, 0xF0, 0x22, -0xC3, 0xEF, 0x9D, 0xF5, 0x56, 0xC3, 0x94, 0x08, 0x50, 0x24, 0xE4, 0xF5, 0x57, 0x75, 0xF0, 0x0D, -0xEB, 0x90, 0xA5, 0xB4, 0x12, 0x48, 0x49, 0xC0, 0x83, 0xC0, 0x82, 0x90, 0xA6, 0x6D, 0xE0, 0xD0, -0x82, 0xD0, 0x83, 0x75, 0xF0, 0x03, 0x12, 0x48, 0x49, 0xE5, 0x56, 0xF0, 0x80, 0x46, 0xE5, 0x56, -0xC3, 0x94, 0x10, 0x50, 0x09, 0x75, 0x57, 0x01, 0xE5, 0x56, 0x24, 0xF8, 0x80, 0x17, 0xE5, 0x56, -0xC3, 0x94, 0x18, 0x50, 0x09, 0x75, 0x57, 0x02, 0xE5, 0x56, 0x24, 0xF0, 0x80, 0x07, 0x75, 0x57, -0x03, 0xE5, 0x56, 0x24, 0xE8, 0xFF, 0x75, 0xF0, 0x0D, 0xEB, 0x90, 0xA5, 0xB4, 0x12, 0x48, 0x49, -0xC0, 0x83, 0xC0, 0x82, 0x90, 0xA6, 0x6D, 0xE0, 0xD0, 0x82, 0xD0, 0x83, 0x75, 0xF0, 0x03, 0x12, -0x48, 0x49, 0xEF, 0xF0, 0xAF, 0x57, 0x22, 0x8F, 0x54, 0x7D, 0x17, 0x12, 0x5F, 0x3B, 0x75, 0xF0, -0x0D, 0xE5, 0x54, 0x90, 0xA5, 0xB0, 0x12, 0x48, 0x49, 0xE0, 0xFC, 0x75, 0xF0, 0x0D, 0xE5, 0x54, -0x90, 0xA5, 0xB1, 0x12, 0x48, 0x49, 0xE0, 0xFE, 0x54, 0x03, 0xFD, 0xEE, 0x13, 0x13, 0x54, 0x07, -0xFB, 0x90, 0xA5, 0xAD, 0xE0, 0xFE, 0xC4, 0x54, 0x0F, 0x90, 0xA7, 0x72, 0xF0, 0xAF, 0x04, 0xB1, -0xE1, 0x75, 0xF0, 0x0D, 0xE5, 0x54, 0x71, 0xE7, 0x75, 0xF0, 0x0D, 0xE5, 0x54, 0x12, 0x53, 0x76, -0xAD, 0x54, 0xE4, 0xFF, 0x02, 0x5E, 0x52, 0x90, 0xA5, 0xB1, 0x12, 0x48, 0x49, 0xE0, 0xFE, 0x54, -0x03, 0xFF, 0xEE, 0x13, 0x13, 0x54, 0x07, 0xFD, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, -0xA7, 0xA6, 0xED, 0xF0, 0xEF, 0x14, 0x60, 0x02, 0xA1, 0x03, 0x90, 0x06, 0x03, 0xE0, 0x54, 0xFB, -0xF0, 0x90, 0xA7, 0xA6, 0xE0, 0xC4, 0x33, 0x54, 0xE0, 0xFF, 0x90, 0x04, 0x42, 0xE0, 0x54, 0x9F, -0x4F, 0xFF, 0xF0, 0x90, 0xA6, 0xDA, 0x12, 0x08, 0x79, 0x00, 0x00, 0x00, 0x01, 0x90, 0xA6, 0xDE, -0x12, 0x08, 0x79, 0x00, 0x00, 0x00, 0x01, 0x7F, 0x00, 0x7E, 0x08, 0xB1, 0x73, 0x90, 0xA6, 0xDA, -0x12, 0x08, 0x79, 0x00, 0x00, 0x00, 0x01, 0x90, 0xA6, 0xDE, 0x12, 0x08, 0x79, 0x00, 0x00, 0x00, -0x01, 0x7F, 0x00, 0x7E, 0x09, 0xB1, 0x73, 0x90, 0xA6, 0xDA, 0x12, 0x08, 0x79, 0x00, 0x00, 0x00, -0x10, 0x90, 0xA7, 0xA6, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0xEF, 0x54, 0x03, 0xFF, 0xE4, 0x78, -0x01, 0x12, 0x08, 0x47, 0x78, 0x04, 0x12, 0x08, 0x5A, 0x90, 0xA6, 0xDE, 0x12, 0x08, 0x6D, 0x7F, -0x00, 0x7E, 0x0A, 0xB1, 0x73, 0x90, 0xA6, 0xDA, 0x12, 0x08, 0x79, 0x00, 0x00, 0x0C, 0x00, 0x90, -0xA7, 0xA6, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0xEF, 0x54, 0x03, 0xFF, 0xE4, 0x78, 0x0A, 0x12, -0x08, 0x5A, 0x90, 0xA6, 0xDE, 0x12, 0x08, 0x6D, 0x7F, 0x00, 0x7E, 0x0D, 0xB1, 0x73, 0x90, 0xA6, -0xDA, 0x12, 0x08, 0x79, 0x0C, 0x00, 0x00, 0x00, 0x90, 0xA7, 0xA6, 0xE0, 0xFF, 0xE4, 0xFC, 0xFD, -0xFE, 0xEF, 0x54, 0x03, 0xFF, 0xE4, 0x78, 0x1A, 0x12, 0x08, 0x5A, 0x90, 0xA6, 0xDE, 0x12, 0x08, -0x6D, 0x7F, 0x18, 0x7E, 0x08, 0xB1, 0x73, 0x90, 0xA6, 0xDA, 0x12, 0x08, 0x79, 0x00, 0x00, 0x0C, -0x00, 0x90, 0xA6, 0xDE, 0x12, 0x08, 0x79, 0x00, 0x00, 0x00, 0x00, 0xB1, 0x6F, 0x90, 0xA6, 0xC8, -0x12, 0x08, 0x79, 0x00, 0x00, 0x0C, 0x00, 0x90, 0xA6, 0xCC, 0x12, 0x08, 0x79, 0x00, 0x00, 0x04, -0x00, 0x80, 0x65, 0x90, 0x06, 0x03, 0xE0, 0x44, 0x04, 0xF0, 0x90, 0xA6, 0xDA, 0x12, 0x08, 0x79, -0x00, 0x00, 0x00, 0x01, 0x90, 0xA6, 0xDE, 0x12, 0x08, 0x79, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, -0x7E, 0x08, 0xB1, 0x73, 0x90, 0xA6, 0xDA, 0x12, 0x08, 0x79, 0x00, 0x00, 0x00, 0x01, 0x90, 0xA6, -0xDE, 0x12, 0x08, 0x79, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x7E, 0x09, 0xB1, 0x73, 0x90, 0xA6, -0xDA, 0x12, 0x08, 0x79, 0x00, 0x00, 0x0C, 0x00, 0x90, 0xA6, 0xDE, 0x12, 0x08, 0x79, 0x00, 0x00, -0x0C, 0x00, 0xB1, 0x6F, 0x90, 0xA6, 0xC8, 0x12, 0x08, 0x79, 0x00, 0x00, 0x0C, 0x00, 0x90, 0xA6, -0xCC, 0x12, 0x08, 0x79, 0x00, 0x00, 0x0C, 0x00, 0xD1, 0x62, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x7F, -0x84, 0x7E, 0x08, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0xA6, 0xD8, 0xEE, 0xF0, 0xA3, -0xEF, 0xF0, 0x12, 0x37, 0xAD, 0x90, 0xA6, 0xE2, 0x12, 0x08, 0x6D, 0x90, 0xA6, 0xDA, 0x12, 0x48, -0x11, 0x12, 0x08, 0x3A, 0x90, 0xA6, 0xE2, 0x12, 0x48, 0x2D, 0x12, 0x47, 0xE6, 0xC0, 0x04, 0xC0, -0x05, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0xA6, 0xDA, 0x12, 0x48, 0x11, 0x90, 0xA6, 0xDE, 0x12, 0x48, -0x2D, 0x12, 0x47, 0xE6, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0x12, 0x47, 0xF3, 0x90, -0xA6, 0xE6, 0x12, 0x08, 0x6D, 0x90, 0xA6, 0xE6, 0x12, 0x48, 0x11, 0x90, 0xAA, 0xB9, 0x12, 0x08, -0x6D, 0x90, 0xA6, 0xD8, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12, 0x38, 0xA4, 0xD0, 0xD0, 0x92, 0xAF, -0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0xA7, 0x6F, 0xEF, 0xF0, 0xED, 0x64, 0x01, -0x70, 0x2F, 0xEB, 0xB4, 0x01, 0x07, 0xE0, 0x24, 0x02, 0xF5, 0x73, 0x80, 0x08, 0x90, 0xA7, 0x6F, -0xE0, 0x24, 0xFE, 0xF5, 0x73, 0x90, 0xA6, 0xC8, 0x12, 0x08, 0x79, 0x00, 0x00, 0x00, 0xFF, 0xAF, -0x73, 0xD1, 0x58, 0x90, 0xA6, 0xC8, 0x12, 0x08, 0x79, 0x00, 0x00, 0x00, 0xFF, 0xAF, 0x73, 0x80, -0x20, 0x90, 0xA6, 0xC8, 0x12, 0x08, 0x79, 0x00, 0x00, 0x00, 0xFF, 0x90, 0xA7, 0x6F, 0xE0, 0xFF, -0xD1, 0x58, 0x90, 0xA6, 0xC8, 0x12, 0x08, 0x79, 0x00, 0x00, 0x00, 0xFF, 0x90, 0xA7, 0x6F, 0xE0, -0xFF, 0xE4, 0xFC, 0xFD, 0xFE, 0x90, 0xA6, 0xCC, 0x12, 0x08, 0x6D, 0x7D, 0x18, 0x7C, 0x00, 0x7F, -0x01, 0xD1, 0x68, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xE4, 0xFC, 0xFD, 0xFE, 0x90, 0xA6, 0xCC, 0x12, -0x08, 0x6D, 0x7D, 0x18, 0x7C, 0x00, 0xE4, 0xFF, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, -0xA6, 0xC6, 0xEC, 0xF0, 0xA3, 0xED, 0xF0, 0x90, 0xA6, 0xC5, 0xEF, 0xF0, 0xA3, 0xA3, 0xE0, 0xFD, -0x12, 0x3E, 0x39, 0x90, 0xA6, 0xD0, 0x12, 0x08, 0x6D, 0x90, 0xA6, 0xC8, 0x12, 0x48, 0x11, 0x12, -0x08, 0x3A, 0x90, 0xA6, 0xD0, 0x12, 0x48, 0x2D, 0x12, 0x47, 0xE6, 0xC0, 0x04, 0xC0, 0x05, 0xC0, -0x06, 0xC0, 0x07, 0x90, 0xA6, 0xC8, 0x12, 0x48, 0x11, 0x90, 0xA6, 0xCC, 0x12, 0x48, 0x2D, 0x12, -0x47, 0xE6, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0x12, 0x47, 0xF3, 0x90, 0xA6, 0xD4, -0x12, 0x08, 0x6D, 0x90, 0xA6, 0xC6, 0xA3, 0xE0, 0xFD, 0xC0, 0x05, 0x90, 0xA6, 0xD4, 0x12, 0x48, -0x11, 0x90, 0xAA, 0x96, 0x12, 0x08, 0x6D, 0x90, 0xA6, 0xC5, 0xE0, 0xFF, 0xD0, 0x05, 0x12, 0x3D, -0x39, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x7D, 0x20, 0xE4, 0xFF, 0x74, 0x1D, 0x2F, 0xF8, 0xE6, 0xFE, -0xED, 0xF4, 0x5E, 0xFE, 0xF6, 0x74, 0x38, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, -0xF0, 0x22, 0x90, 0xA5, 0xAD, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0xF1, 0xF0, 0x54, 0x0F, 0xF0, 0xE4, -0xA3, 0xF0, 0xA3, 0xF0, 0xFF, 0x75, 0xF0, 0x0D, 0xEF, 0x90, 0xA5, 0xB1, 0x12, 0x48, 0x49, 0xE0, -0x54, 0xFC, 0xF0, 0x75, 0xF0, 0x0D, 0xEF, 0x90, 0xA5, 0xB0, 0x12, 0x48, 0x49, 0xE4, 0xF0, 0x75, -0xF0, 0x0D, 0xEF, 0x90, 0xA5, 0xB9, 0x12, 0x48, 0x49, 0xE4, 0xF0, 0x75, 0xF0, 0x0D, 0xEF, 0x90, -0xA5, 0xBA, 0x12, 0x48, 0x49, 0xE4, 0xF0, 0x75, 0xF0, 0x0D, 0xEF, 0x90, 0xA5, 0xB1, 0x12, 0x48, -0x49, 0xE0, 0x54, 0xE3, 0xF0, 0x75, 0xF0, 0x0D, 0xEF, 0x90, 0xA5, 0xB1, 0x12, 0x48, 0x49, 0xE0, -0x54, 0x1F, 0xF0, 0x75, 0xF0, 0x0D, 0xEF, 0x90, 0xA5, 0xBC, 0x12, 0x48, 0x49, 0xE4, 0xF0, 0x75, -0xF0, 0x0D, 0xEF, 0x90, 0xA5, 0xB8, 0x12, 0x48, 0x49, 0xE0, 0x54, 0xFE, 0xF0, 0x75, 0xF0, 0x0D, -0xEF, 0x90, 0xA5, 0xBB, 0x12, 0x48, 0x49, 0xE4, 0xF0, 0x0F, 0xEF, 0x64, 0x03, 0x70, 0x86, 0x22, -0x12, 0x06, 0x89, 0x54, 0x01, 0xFF, 0x90, 0xA5, 0xDF, 0xE0, 0x54, 0xFE, 0x4F, 0xF0, 0x30, 0xE0, -0x19, 0x90, 0xA3, 0x9D, 0xE0, 0xFF, 0xB4, 0x01, 0x07, 0x90, 0xA5, 0x25, 0x74, 0xDC, 0xF0, 0x22, -0xEF, 0xB4, 0x03, 0x06, 0x90, 0xA5, 0x25, 0x74, 0xD4, 0xF0, 0x22, 0x90, 0xA6, 0x69, 0x12, 0x48, -0x5E, 0x12, 0x06, 0x89, 0xFF, 0x54, 0x7F, 0x90, 0xA5, 0x1B, 0xF0, 0xEF, 0xC4, 0x13, 0x13, 0x13, -0x54, 0x01, 0xA3, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x06, 0xA2, 0xFF, 0x54, 0xF0, 0xC4, 0x54, 0x0F, -0xFE, 0x90, 0xA5, 0x19, 0xE0, 0x54, 0xF0, 0x4E, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x06, 0xA2, 0x54, -0x01, 0x25, 0xE0, 0xFE, 0x90, 0xA5, 0x17, 0xE0, 0x54, 0xFD, 0x4E, 0xF0, 0xEF, 0x54, 0x0F, 0xC4, -0x54, 0xF0, 0xFF, 0x90, 0xA5, 0x19, 0xE0, 0x54, 0x0F, 0x4F, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x06, -0xA2, 0x90, 0xA5, 0x1A, 0xF0, 0x90, 0x00, 0x06, 0x12, 0x06, 0xA2, 0x30, 0xE0, 0x5E, 0xC3, 0x13, -0x54, 0x07, 0xFF, 0xC3, 0x94, 0x04, 0x90, 0xA5, 0x2D, 0x50, 0x04, 0xEF, 0xF0, 0x80, 0x2E, 0x74, -0x03, 0xF0, 0x90, 0xA6, 0x69, 0x12, 0x48, 0x55, 0xE9, 0x24, 0x06, 0xF9, 0xE4, 0x3A, 0xFA, 0x12, -0x06, 0x89, 0xFF, 0x74, 0x03, 0x24, 0xFD, 0xFE, 0xEF, 0xC4, 0x54, 0x0F, 0xFD, 0xEF, 0x54, 0x0F, -0xFF, 0xED, 0x2E, 0x54, 0x0F, 0xFE, 0xC4, 0x54, 0xF0, 0x4F, 0x12, 0x06, 0xCF, 0x90, 0xA6, 0x69, -0x12, 0x48, 0x55, 0x90, 0x00, 0x06, 0x12, 0x06, 0xA2, 0xC4, 0x54, 0x0F, 0xFF, 0xC3, 0x94, 0x04, -0x90, 0xA5, 0x23, 0x50, 0x05, 0x74, 0x04, 0xF0, 0x80, 0x02, 0xEF, 0xF0, 0x90, 0xA6, 0x69, 0x12, -0x48, 0x55, 0x90, 0x00, 0x04, 0x12, 0x06, 0xA2, 0xFD, 0x7F, 0x02, 0x12, 0x52, 0xCD, 0x90, 0xA6, -0x69, 0x12, 0x48, 0x55, 0x90, 0x00, 0x05, 0x12, 0x06, 0xA2, 0xFF, 0x54, 0x01, 0xFE, 0x90, 0xA5, -0x4C, 0xE0, 0x54, 0xFE, 0x4E, 0xFE, 0xF0, 0xEF, 0x54, 0x02, 0xFF, 0xEE, 0x54, 0xFD, 0x4F, 0xFF, -0xF0, 0x90, 0x00, 0x05, 0x12, 0x06, 0xA2, 0xFE, 0x54, 0x04, 0xFD, 0xEF, 0x54, 0xFB, 0x4D, 0xFF, -0x90, 0xA5, 0x4C, 0xF0, 0xEE, 0x54, 0x08, 0xFE, 0xEF, 0x54, 0xF7, 0x4E, 0xFF, 0xF0, 0x90, 0x00, -0x05, 0x12, 0x06, 0xA2, 0xFE, 0x54, 0x10, 0xFD, 0xEF, 0x54, 0xEF, 0x4D, 0xFF, 0x90, 0xA5, 0x4C, -0xF0, 0xEE, 0x54, 0x20, 0xFE, 0xEF, 0x54, 0xDF, 0x4E, 0xFF, 0xF0, 0x90, 0x00, 0x05, 0x12, 0x06, -0xA2, 0x54, 0x40, 0xFE, 0xEF, 0x54, 0xBF, 0x4E, 0x90, 0xA5, 0x4C, 0xF0, 0xE0, 0xFF, 0xC4, 0x13, -0x13, 0x54, 0x03, 0x20, 0xE0, 0x29, 0xEF, 0xC3, 0x13, 0x20, 0xE0, 0x0B, 0x75, 0x52, 0x01, 0x90, -0xA5, 0x8D, 0xE0, 0x60, 0x0B, 0x80, 0x0E, 0xE4, 0xF5, 0x52, 0x90, 0xA5, 0x8D, 0xE0, 0x60, 0x05, -0xE4, 0xF5, 0x51, 0x80, 0x03, 0x75, 0x51, 0x01, 0xAD, 0x52, 0xAF, 0x51, 0x12, 0x69, 0xF2, 0x90, -0xA6, 0x69, 0x12, 0x48, 0x55, 0x31, 0x5C, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, -0xF0, 0x90, 0xA5, 0x1B, 0xE0, 0x90, 0x01, 0xBA, 0xF0, 0x90, 0xA5, 0x1D, 0xE0, 0x90, 0x01, 0xBB, -0xF0, 0x90, 0xA5, 0x19, 0xE0, 0x54, 0x0F, 0x90, 0x01, 0xBE, 0xF0, 0x22, 0x90, 0xA6, 0x6C, 0x12, -0x48, 0x5E, 0x31, 0x8B, 0x90, 0xA5, 0x1B, 0xE0, 0xFF, 0x12, 0x75, 0x6F, 0x90, 0xA5, 0x1B, 0xE0, -0x60, 0x18, 0x90, 0xA6, 0x6C, 0x12, 0x48, 0x55, 0x90, 0x00, 0x01, 0x12, 0x06, 0xA2, 0x54, 0x0F, -0xFF, 0x90, 0x00, 0x02, 0x12, 0x06, 0xA2, 0xFD, 0x31, 0x9C, 0x22, 0x90, 0xA5, 0x17, 0xE0, 0x54, -0xFB, 0xF0, 0xE4, 0x90, 0xA5, 0x24, 0xF0, 0x90, 0xA5, 0x1F, 0xF0, 0x22, 0xEF, 0x24, 0xFE, 0x60, -0x0B, 0x04, 0x70, 0x27, 0x90, 0xA5, 0x21, 0x74, 0x02, 0xF0, 0x80, 0x16, 0xED, 0x70, 0x0A, 0x90, -0xA5, 0x4A, 0xE0, 0x90, 0xA5, 0x21, 0xF0, 0x80, 0x05, 0x90, 0xA5, 0x21, 0xED, 0xF0, 0x90, 0xA5, -0x21, 0xE0, 0xA3, 0xF0, 0x90, 0xA5, 0x18, 0xE0, 0x44, 0x08, 0xF0, 0x22, 0x90, 0x00, 0x02, 0x12, -0x06, 0xA2, 0xFF, 0x30, 0xE0, 0x26, 0x12, 0x06, 0x89, 0x90, 0xA5, 0x47, 0xF0, 0x90, 0x00, 0x01, -0x12, 0x06, 0xA2, 0x90, 0xA5, 0x48, 0xF0, 0xEF, 0x54, 0xFE, 0xFF, 0xA3, 0xE0, 0x54, 0x01, 0x4F, -0xF0, 0x90, 0x00, 0x03, 0x12, 0x06, 0xA2, 0x90, 0xA5, 0x4A, 0xF0, 0x22, 0x90, 0xA5, 0x47, 0x74, -0x03, 0xF0, 0xA3, 0x74, 0x05, 0xF0, 0xA3, 0xE0, 0x54, 0x01, 0x44, 0x28, 0xF0, 0xA3, 0x74, 0x05, -0xF0, 0x22, 0x12, 0x06, 0x89, 0x90, 0xA5, 0x25, 0xF0, 0x22, 0x12, 0x06, 0x89, 0x90, 0xA5, 0x4D, -0xF0, 0x60, 0x35, 0xA3, 0xE0, 0x20, 0xE0, 0x30, 0xE4, 0xFD, 0x7F, 0x04, 0x12, 0x50, 0x8A, 0x90, -0xA5, 0x4C, 0xE0, 0xFF, 0xC3, 0x13, 0x30, 0xE0, 0x1F, 0xEF, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x20, -0xE0, 0x16, 0x90, 0xA5, 0x4C, 0xE0, 0x13, 0x13, 0x54, 0x3F, 0x90, 0x07, 0x78, 0x30, 0xE0, 0x05, -0x74, 0x0D, 0xF0, 0x80, 0x03, 0x74, 0x09, 0xF0, 0x90, 0xA5, 0x4D, 0xE0, 0x90, 0x01, 0xE7, 0xF0, -0x22, 0x90, 0xA6, 0x69, 0x12, 0x48, 0x5E, 0x90, 0xA7, 0x84, 0xE0, 0x70, 0x13, 0x7F, 0x80, 0x7E, -0x08, 0x12, 0x37, 0xAD, 0x90, 0xA5, 0x85, 0x12, 0x08, 0x6D, 0x90, 0xA7, 0x84, 0x74, 0x01, 0xF0, -0x90, 0xA6, 0x69, 0x12, 0x48, 0x55, 0x12, 0x06, 0x89, 0xFF, 0xE4, 0x8F, 0x54, 0xF5, 0x53, 0xF5, -0x52, 0xF5, 0x51, 0x90, 0xA5, 0x85, 0x12, 0x48, 0x11, 0xEC, 0x54, 0xC1, 0xFC, 0xC0, 0x04, 0xC0, -0x05, 0xC0, 0x06, 0xC0, 0x07, 0xAF, 0x54, 0xAE, 0x53, 0xAD, 0x52, 0xAC, 0x51, 0x78, 0x19, 0x12, -0x08, 0x5A, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0x12, 0x47, 0xF3, 0x90, 0xA5, 0x81, -0x02, 0x08, 0x6D, 0x12, 0x06, 0x89, 0x90, 0xA5, 0x8D, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x06, 0xA2, -0x90, 0xA5, 0x8E, 0xF0, 0x90, 0x04, 0x8F, 0xF0, 0x22, 0x12, 0x06, 0x89, 0xFF, 0x54, 0x01, 0xFE, -0x90, 0xA5, 0x9A, 0xE0, 0x54, 0xFE, 0x4E, 0xFE, 0xF0, 0xEF, 0x54, 0x06, 0xFF, 0xEE, 0x54, 0xF9, -0x4F, 0xFF, 0xF0, 0x12, 0x06, 0x89, 0xFE, 0x54, 0x08, 0xFD, 0xEF, 0x54, 0xF7, 0x4D, 0xFF, 0x90, -0xA5, 0x9A, 0xF0, 0xEE, 0x54, 0x10, 0xFE, 0xEF, 0x54, 0xEF, 0x4E, 0xFF, 0xF0, 0x12, 0x06, 0x89, -0x54, 0x20, 0xFE, 0xEF, 0x54, 0xDF, 0x4E, 0x90, 0xA5, 0x9A, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x06, -0xA2, 0xFF, 0x54, 0x03, 0xFE, 0x90, 0xA5, 0x9B, 0xE0, 0x54, 0xFC, 0x4E, 0xFE, 0xF0, 0xEF, 0x54, -0x04, 0xFF, 0xEE, 0x54, 0xFB, 0x4F, 0xFF, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x06, 0xA2, 0xFE, 0x54, -0x30, 0xFD, 0xEF, 0x54, 0xCF, 0x4D, 0xFF, 0x90, 0xA5, 0x9B, 0xF0, 0xEE, 0x54, 0x40, 0xFE, 0xEF, -0x54, 0xBF, 0x4E, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x06, 0xA2, 0x90, 0xA5, 0x9C, 0xF0, 0x90, 0x00, -0x03, 0x12, 0x06, 0xA2, 0x90, 0xA5, 0x9D, 0xF0, 0x90, 0x00, 0x04, 0x12, 0x06, 0xA2, 0x90, 0xA5, -0x9E, 0xF0, 0x90, 0xA5, 0x9C, 0xE0, 0xFF, 0x7E, 0x00, 0x7C, 0x01, 0x7D, 0x40, 0x12, 0x07, 0x03, -0xEF, 0x78, 0x05, 0xCE, 0xC3, 0x13, 0xCE, 0x13, 0xD8, 0xF9, 0xFF, 0x90, 0xA5, 0xA4, 0xEE, 0xF0, -0xA3, 0xEF, 0xF0, 0x90, 0xA5, 0x9D, 0xE0, 0xFF, 0x7E, 0x00, 0x7C, 0x01, 0x7D, 0x40, 0x12, 0x07, -0x03, 0xEF, 0x78, 0x05, 0xCE, 0xC3, 0x13, 0xCE, 0x13, 0xD8, 0xF9, 0xFF, 0x90, 0xA5, 0xA6, 0xEE, -0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0xA5, 0x9E, 0xE0, 0xFF, 0x7E, 0x00, 0x7C, 0x01, 0x7D, 0x40, 0x12, -0x07, 0x03, 0x90, 0xA5, 0xA8, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0xA5, 0x9A, 0xE0, 0x30, 0xE0, -0x17, 0x90, 0xA5, 0x9F, 0x74, 0x01, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, -0x90, 0x07, 0x83, 0xE0, 0x44, 0x20, 0xF0, 0x22, 0xE4, 0x90, 0xA5, 0x9F, 0xF0, 0xA3, 0xF0, 0xA3, -0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x07, 0x83, 0xE0, 0x54, 0xDF, 0xF0, 0x22, 0x90, 0xA6, 0x69, -0x12, 0x48, 0x5E, 0x90, 0xA6, 0x69, 0x12, 0x48, 0x55, 0x12, 0x06, 0x89, 0x90, 0xA5, 0xAA, 0xF0, -0x90, 0x00, 0x01, 0x12, 0x06, 0xA2, 0x90, 0xA5, 0xAB, 0xF0, 0x90, 0xA6, 0x69, 0x12, 0x48, 0x55, -0x7D, 0x02, 0x7F, 0x38, 0x02, 0x58, 0xA1, 0x90, 0x01, 0xCC, 0xE0, 0x54, 0x0F, 0x90, 0xA7, 0x95, -0xF0, 0x90, 0xA7, 0x95, 0xE0, 0xFD, 0x70, 0x02, 0xA1, 0x76, 0x90, 0xA3, 0xF4, 0xE0, 0xFF, 0x70, -0x06, 0xA3, 0xE0, 0x64, 0x09, 0x60, 0x0A, 0xEF, 0x14, 0xFF, 0x90, 0xA3, 0xF5, 0xE0, 0xB5, 0x07, -0x04, 0x7F, 0x01, 0x80, 0x02, 0x7F, 0x00, 0xEF, 0x60, 0x08, 0x90, 0x01, 0xC1, 0xE0, 0x44, 0x01, -0xF0, 0x22, 0x90, 0xA7, 0x85, 0xE0, 0xFF, 0x74, 0x01, 0x7E, 0x00, 0xA8, 0x07, 0x08, 0x80, 0x05, -0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8, 0xF9, 0xFF, 0xEF, 0x5D, 0x70, 0x02, 0xA1, 0x53, 0xE4, 0x90, -0xA7, 0x96, 0xF0, 0x90, 0xA7, 0x96, 0xE0, 0xF9, 0xC3, 0x94, 0x04, 0x50, 0x73, 0x90, 0xA7, 0x85, -0xE0, 0x75, 0xF0, 0x04, 0xA4, 0xFF, 0xE9, 0xFD, 0x7C, 0x00, 0x2F, 0xFF, 0xEC, 0x35, 0xF0, 0xFE, -0x74, 0xD0, 0x2F, 0xF5, 0x82, 0x74, 0x01, 0x3E, 0xF5, 0x83, 0xE0, 0xFF, 0x90, 0xA3, 0xF5, 0xE0, -0x75, 0xF0, 0x08, 0x90, 0xA3, 0xA4, 0x12, 0x48, 0x49, 0xE5, 0x82, 0x29, 0xF5, 0x82, 0xE4, 0x35, -0x83, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0xA7, 0x85, 0xE0, 0x75, 0xF0, 0x04, 0xA4, 0x2D, 0xFF, 0xEC, -0x35, 0xF0, 0xFE, 0x74, 0xF0, 0x2F, 0xF5, 0x82, 0x74, 0x01, 0x3E, 0xF5, 0x83, 0xE0, 0xFF, 0x90, -0xA3, 0xF5, 0xE0, 0x75, 0xF0, 0x08, 0x90, 0xA3, 0xA8, 0x12, 0x48, 0x49, 0xE5, 0x82, 0x29, 0xF5, -0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0xA7, 0x96, 0xE0, 0x04, 0xF0, 0x80, 0x83, -0x90, 0xA7, 0x95, 0xE0, 0xFF, 0x90, 0xA7, 0x85, 0xE0, 0xFE, 0x74, 0x01, 0xA8, 0x06, 0x08, 0x80, -0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0x5F, 0x90, 0xA7, 0x95, 0xF0, 0x90, 0xA7, 0x85, 0xE0, 0xFF, -0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0x90, 0x01, 0xCC, 0xF0, 0x90, -0xA7, 0x85, 0xE0, 0x04, 0xF0, 0xE0, 0x54, 0x03, 0xF0, 0x90, 0xA3, 0xF5, 0xE0, 0x04, 0xF0, 0xE0, -0x7F, 0x00, 0xB4, 0x0A, 0x02, 0x7F, 0x01, 0xEF, 0x70, 0x02, 0x81, 0x31, 0xE4, 0x90, 0xA3, 0xF5, -0xF0, 0x81, 0x31, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x02, 0xF0, 0x90, 0xA7, 0x85, 0xE0, 0x44, 0x80, -0x90, 0x00, 0x8A, 0xF0, 0x90, 0xA7, 0x85, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD0, 0x12, 0x48, -0x49, 0xE0, 0x90, 0x01, 0xC3, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0xA7, -0x63, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0xA7, 0x63, 0xE0, 0xFE, -0xA3, 0xE0, 0xF5, 0x82, 0x8E, 0x83, 0xE0, 0x60, 0x2D, 0xC3, 0x90, 0xA7, 0x66, 0xE0, 0x94, 0xE8, -0x90, 0xA7, 0x65, 0xE0, 0x94, 0x03, 0x40, 0x0B, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x80, 0xF0, 0x7F, -0x00, 0x80, 0x15, 0x90, 0xA7, 0x65, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x08, 0xD6, 0x7F, 0x0A, 0x7E, -0x00, 0x12, 0x3E, 0x87, 0x80, 0xC5, 0x7F, 0x01, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, -0x01, 0xC3, 0xC0, 0xD0, 0x90, 0xA7, 0x6B, 0x12, 0x48, 0x5E, 0x7F, 0x96, 0x7E, 0x02, 0xB1, 0x77, -0xEF, 0x60, 0x58, 0x90, 0x01, 0x17, 0xE0, 0xFE, 0x90, 0x01, 0x16, 0xE0, 0x7C, 0x00, 0x24, 0x00, -0xFF, 0xEC, 0x3E, 0xFE, 0xEF, 0x24, 0x01, 0xFF, 0xE4, 0x3E, 0xFE, 0x90, 0xA7, 0x6E, 0xEF, 0xF0, -0xEE, 0xFF, 0x90, 0xFD, 0x11, 0xF0, 0x90, 0xA7, 0x6E, 0xE0, 0xFD, 0x90, 0x02, 0x94, 0xF0, 0xA3, -0xEF, 0xF0, 0x90, 0xA7, 0x6B, 0x12, 0x48, 0x55, 0x90, 0x00, 0x0E, 0x12, 0x06, 0xA2, 0x24, 0x02, -0xFF, 0xE4, 0x33, 0xFE, 0xD1, 0x40, 0x90, 0xA7, 0x6E, 0xE0, 0x24, 0x18, 0xFF, 0x90, 0xA7, 0x6B, -0x12, 0x48, 0x55, 0xD1, 0x9B, 0x90, 0x02, 0x96, 0x74, 0x01, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, -0xE4, 0xFC, 0xED, 0x2C, 0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE4, 0xF0, 0x0C, -0xEC, 0xB4, 0x18, 0xEE, 0x74, 0x00, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xEF, 0xF0, -0xEE, 0x54, 0x3F, 0xFF, 0x74, 0x01, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xEF, 0xF0, -0x74, 0x02, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x54, 0xF0, 0xF0, 0x74, 0x03, -0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x44, 0x80, 0xF0, 0x74, 0x0B, 0x2D, 0xF5, -0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x44, 0x10, 0xF0, 0x22, 0x90, 0xA7, 0x67, 0xEF, 0xF0, -0xA3, 0x12, 0x48, 0x5E, 0x90, 0xA7, 0x86, 0xE0, 0xFE, 0x04, 0xF0, 0x90, 0x00, 0x01, 0xEE, 0x12, -0x06, 0xE1, 0x74, 0x00, 0x2F, 0xF9, 0xE4, 0x34, 0xFB, 0xFA, 0x7B, 0x01, 0xC0, 0x03, 0xC0, 0x02, -0xC0, 0x01, 0x90, 0xA7, 0x68, 0x12, 0x48, 0x55, 0x8B, 0x40, 0x8A, 0x41, 0x89, 0x42, 0x75, 0x43, -0x02, 0xD0, 0x01, 0xD0, 0x02, 0xD0, 0x03, 0x12, 0x35, 0x85, 0x90, 0xA7, 0x67, 0xE0, 0x24, 0x02, -0xF9, 0xE4, 0x34, 0xFB, 0xFA, 0x7B, 0x01, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0xA3, 0x12, 0x48, -0x55, 0xE9, 0x24, 0x02, 0xF9, 0xE4, 0x3A, 0x8B, 0x40, 0xF5, 0x41, 0x89, 0x42, 0x90, 0xA7, 0x68, -0x12, 0x48, 0x55, 0x90, 0x00, 0x0E, 0x12, 0x06, 0xA2, 0xF5, 0x43, 0xD0, 0x01, 0xD0, 0x02, 0xD0, -0x03, 0x02, 0x35, 0x85, 0x8F, 0x57, 0x75, 0xF0, 0x10, 0xEF, 0x90, 0x81, 0x05, 0x12, 0x48, 0x49, -0xE0, 0x54, 0xFB, 0xF0, 0x22, 0x8F, 0x57, 0x75, 0xF0, 0x10, 0xEF, 0x90, 0x81, 0x05, 0x12, 0x48, -0x49, 0xE0, 0x44, 0x04, 0xF0, 0x22, 0x90, 0xA7, 0x87, 0x12, 0x48, 0x5E, 0xE4, 0xFF, 0x90, 0xA7, -0x87, 0x12, 0x48, 0x55, 0x8F, 0x82, 0x75, 0x83, 0x00, 0x12, 0x06, 0xA2, 0xFE, 0x74, 0xF0, 0x2F, -0xF5, 0x82, 0xE4, 0x34, 0x02, 0xF5, 0x83, 0xEE, 0xF0, 0x0F, 0xEF, 0xB4, 0x10, 0xE0, 0x22, 0x75, -0x15, 0x12, 0xE4, 0xF5, 0x16, 0x75, 0x17, 0x07, 0x75, 0x18, 0x72, 0x90, 0x01, 0x30, 0xE5, 0x15, -0xF0, 0xA3, 0xE5, 0x16, 0xF0, 0xA3, 0xE5, 0x17, 0xF0, 0xA3, 0xE5, 0x18, 0xF0, 0x22, 0x75, 0x1D, -0x0E, 0x75, 0x1E, 0x01, 0x43, 0x1E, 0x08, 0x75, 0x1F, 0x03, 0x75, 0x20, 0x62, 0x43, 0x20, 0x80, -0x43, 0x1F, 0x04, 0x90, 0x01, 0x38, 0xE5, 0x1D, 0xF0, 0xA3, 0xE5, 0x1E, 0xF0, 0xA3, 0xE5, 0x1F, -0xF0, 0xA3, 0xE5, 0x20, 0xF0, 0x22, 0x90, 0x01, 0x94, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x01, 0xC7, -0xE4, 0xF0, 0x22, 0x90, 0x01, 0x01, 0xE0, 0x44, 0x04, 0xF0, 0x90, 0x01, 0x9A, 0xE0, 0x54, 0xC0, -0xF0, 0x7F, 0x0A, 0x7E, 0x00, 0x12, 0x3E, 0x87, 0x90, 0x01, 0x99, 0xE0, 0x44, 0xC0, 0xF0, 0x90, -0x01, 0x9B, 0x74, 0x80, 0xF0, 0x22, 0x90, 0x01, 0x9A, 0xE0, 0x54, 0xC0, 0x44, 0x0B, 0xF0, 0x7F, -0x0A, 0x7E, 0x00, 0x12, 0x3E, 0x87, 0x90, 0x01, 0x98, 0xE0, 0x54, 0xC0, 0x7F, 0x00, 0xB4, 0x40, -0x02, 0x7F, 0x01, 0x22, 0xE4, 0x90, 0xA6, 0x62, 0xF0, 0xA3, 0xF0, 0xF1, 0xD6, 0xEF, 0x64, 0x01, -0x60, 0x45, 0xC3, 0x90, 0xA6, 0x63, 0xE0, 0x94, 0x88, 0x90, 0xA6, 0x62, 0xE0, 0x94, 0x13, 0x40, -0x0F, 0x90, 0x01, 0xC1, 0xE0, 0x44, 0x10, 0xF0, 0x90, 0x01, 0xC7, 0x74, 0xFD, 0xF0, 0x80, 0x27, -0x90, 0xA6, 0x62, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x08, 0xD6, 0x7F, 0x14, 0x7E, 0x00, 0x12, 0x3E, -0x87, 0xD3, 0x90, 0xA6, 0x63, 0xE0, 0x94, 0x32, 0x90, 0xA6, 0x62, 0xE0, 0x94, 0x00, 0x40, 0xBB, -0x90, 0x01, 0xC6, 0xE0, 0x30, 0xE3, 0xB4, 0x90, 0x01, 0xC7, 0x74, 0xFE, 0xF0, 0x22, 0x7D, 0x02, -0x90, 0x01, 0xC4, 0x74, 0x4E, 0xF0, 0x74, 0xB0, 0xA3, 0xF0, 0x90, 0xA5, 0xAC, 0xE0, 0xFF, 0xED, -0xC3, 0x9F, 0x50, 0x18, 0xED, 0x25, 0xE0, 0x24, 0x81, 0xF8, 0xE6, 0x30, 0xE4, 0x0B, 0x90, 0x01, -0xB8, 0x74, 0x08, 0xF0, 0xA3, 0xF0, 0x7F, 0x00, 0x22, 0x0D, 0x80, 0xDE, 0x7F, 0x01, 0x22, 0xE4, -0x90, 0xA3, 0x98, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x22, 0x90, 0x01, 0xE4, -0x74, 0x12, 0xF0, 0xA3, 0xE4, 0xF0, 0x22, 0x90, 0x01, 0x34, 0xE0, 0x55, 0x15, 0xF5, 0x19, 0xA3, -0xE0, 0x55, 0x16, 0xF5, 0x1A, 0xA3, 0xE0, 0x55, 0x17, 0xF5, 0x1B, 0xA3, 0xE0, 0x55, 0x18, 0xF5, -0x1C, 0x90, 0x01, 0x34, 0xE5, 0x19, 0xF0, 0xA3, 0xE5, 0x1A, 0xF0, 0xA3, 0xE5, 0x1B, 0xF0, 0xA3, -0xE5, 0x1C, 0xF0, 0x90, 0x01, 0x24, 0xE0, 0x55, 0x25, 0xF5, 0x26, 0xF0, 0x22, 0x90, 0x01, 0x3C, -0xE0, 0x55, 0x1D, 0xF5, 0x21, 0xA3, 0xE0, 0x55, 0x1E, 0xF5, 0x22, 0xA3, 0xE0, 0x55, 0x1F, 0xF5, -0x23, 0xA3, 0xE0, 0x55, 0x20, 0xF5, 0x24, 0x90, 0x01, 0x3C, 0xE5, 0x21, 0xF0, 0xA3, 0xE5, 0x22, -0xF0, 0xA3, 0xE5, 0x23, 0xF0, 0xA3, 0xE5, 0x24, 0xF0, 0x53, 0x91, 0xDF, 0x22, 0x90, 0x01, 0xCF, -0xE0, 0x90, 0xA6, 0x83, 0xF0, 0xE0, 0xFF, 0x30, 0xE0, 0x07, 0x90, 0x01, 0xCF, 0xE0, 0x54, 0xFE, -0xF0, 0xEF, 0x30, 0xE5, 0x23, 0x90, 0x01, 0xCF, 0xE0, 0x54, 0xDF, 0xF0, 0x90, 0x01, 0x34, 0x74, -0x20, 0xF0, 0xE4, 0xF5, 0xA8, 0xF5, 0xE8, 0x12, 0x4F, 0x0D, 0x90, 0x00, 0x03, 0xE0, 0x54, 0xFB, -0xFD, 0x7F, 0x03, 0x12, 0x4B, 0xED, 0x80, 0xFE, 0x22, 0x90, 0xA4, 0x91, 0xE0, 0x64, 0x01, 0x70, -0x20, 0x90, 0xA5, 0x1B, 0xE0, 0x60, 0x1A, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, -0x02, 0xF0, 0xE4, 0x90, 0xA7, 0x42, 0xF0, 0x90, 0xA5, 0x48, 0xE0, 0x90, 0xA7, 0x43, 0x12, 0x5A, -0x79, 0x22, 0x90, 0xA4, 0x91, 0xE0, 0x64, 0x01, 0x70, 0x26, 0x90, 0xA5, 0x1B, 0xE0, 0x60, 0x20, -0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, 0xF0, 0x90, 0xA5, 0x17, 0xE0, 0x54, -0xFB, 0xF0, 0x90, 0xA5, 0x1F, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0x07, 0x70, 0x03, 0x12, 0x50, 0x71, -0x22, 0x90, 0xA4, 0x91, 0xE0, 0xB4, 0x01, 0x14, 0x90, 0xA5, 0x1B, 0xE0, 0x60, 0x0E, 0x90, 0xA5, -0x1F, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0x07, 0x70, 0x03, 0x12, 0x50, 0x71, 0x22, 0x51, 0x45, 0x90, -0xA6, 0x93, 0xEF, 0xF0, 0x30, 0xE0, 0x05, 0x7D, 0x01, 0xE4, 0x80, 0x02, 0xE4, 0xFD, 0xFF, 0x12, -0x52, 0xCD, 0x90, 0xA6, 0x93, 0xE0, 0x30, 0xE6, 0x11, 0x90, 0x01, 0x2F, 0xE0, 0x30, 0xE7, 0x04, -0xE4, 0xF0, 0x80, 0x06, 0x90, 0x01, 0x2F, 0x74, 0x80, 0xF0, 0x90, 0xA5, 0x2C, 0xE0, 0xFF, 0xA3, -0xE0, 0xFD, 0x90, 0xA5, 0x31, 0xE0, 0xFB, 0xAC, 0x07, 0x90, 0xA5, 0x17, 0xE0, 0x30, 0xE0, 0x32, -0x90, 0xA5, 0x2D, 0xE0, 0xD3, 0x94, 0x03, 0x50, 0x07, 0x90, 0xA5, 0x23, 0xEB, 0xF0, 0x80, 0x0A, -0xED, 0x24, 0xFD, 0x2B, 0x90, 0xA5, 0x23, 0xF0, 0x7D, 0x03, 0x90, 0xA5, 0x46, 0xE0, 0x24, 0x04, -0xC3, 0x9D, 0x2C, 0xFF, 0x90, 0xA5, 0x30, 0xF0, 0x90, 0xA5, 0x26, 0xE4, 0xF0, 0xA3, 0xEF, 0xF0, -0x80, 0x0E, 0x90, 0xA5, 0x26, 0xE4, 0xF0, 0xA3, 0x74, 0x02, 0xF0, 0x90, 0xA5, 0x23, 0xEB, 0xF0, -0x90, 0xA5, 0x26, 0xA3, 0xE0, 0x90, 0x05, 0x58, 0xF0, 0x90, 0xA5, 0x46, 0xE0, 0x24, 0x04, 0xFD, -0x7F, 0xFF, 0x02, 0x4B, 0xED, 0xE4, 0x90, 0xA6, 0x94, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x7F, 0x83, -0x12, 0x4B, 0x31, 0x90, 0xA6, 0x94, 0xEF, 0xF0, 0x7F, 0x83, 0x12, 0x4B, 0x31, 0xAE, 0x07, 0x90, -0xA6, 0x94, 0xE0, 0xFF, 0xB5, 0x06, 0x01, 0x22, 0xC3, 0x90, 0xA6, 0x96, 0xE0, 0x94, 0x64, 0x90, -0xA6, 0x95, 0xE0, 0x94, 0x00, 0x40, 0x0D, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0xA6, -0x94, 0xE0, 0xFF, 0x22, 0x90, 0xA6, 0x95, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x08, 0xD6, 0x80, 0xBE, -0x90, 0xA5, 0x12, 0xE0, 0xFF, 0x30, 0xE0, 0x3E, 0x90, 0xA5, 0x16, 0xE0, 0x7E, 0x00, 0xB4, 0x02, -0x02, 0x7E, 0x01, 0x90, 0xA5, 0x15, 0xE0, 0x7D, 0x00, 0xB4, 0x04, 0x02, 0x7D, 0x01, 0xED, 0x4E, -0x70, 0x24, 0xEF, 0xC3, 0x13, 0x30, 0xE0, 0x03, 0x02, 0x67, 0x3A, 0x51, 0xD7, 0x90, 0xA5, 0x16, -0xE0, 0xB4, 0x08, 0x06, 0xE4, 0xFD, 0x7F, 0x0C, 0x80, 0x09, 0x90, 0xA5, 0x16, 0xE0, 0x70, 0x06, -0xFD, 0x7F, 0x04, 0x12, 0x50, 0x8A, 0x22, 0x90, 0xA5, 0x12, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x54, -0x03, 0x30, 0xE0, 0x0F, 0x90, 0xA5, 0x16, 0xE0, 0x64, 0x02, 0x60, 0x07, 0x7D, 0x01, 0x7F, 0x02, -0x12, 0x50, 0x8A, 0x90, 0xA5, 0x16, 0xE0, 0x64, 0x02, 0x60, 0x03, 0x12, 0x67, 0x1D, 0x22, 0x90, -0xA5, 0x12, 0xE0, 0xFF, 0x30, 0xE0, 0x3F, 0x90, 0xA5, 0x16, 0xE0, 0x7E, 0x00, 0xB4, 0x02, 0x02, -0x7E, 0x01, 0x90, 0xA5, 0x15, 0xE0, 0x7D, 0x00, 0xB4, 0x04, 0x02, 0x7D, 0x01, 0xED, 0x4E, 0x70, -0x25, 0xEF, 0xC3, 0x13, 0x30, 0xE0, 0x03, 0x02, 0x67, 0x3A, 0x71, 0x47, 0x90, 0xA5, 0x16, 0xE0, -0xB4, 0x0C, 0x06, 0xE4, 0xFD, 0x7F, 0x08, 0x80, 0x0A, 0x90, 0xA5, 0x16, 0xE0, 0xB4, 0x04, 0x06, -0xE4, 0xFD, 0xFF, 0x12, 0x50, 0x8A, 0x22, 0x90, 0x01, 0x57, 0xE0, 0x60, 0x48, 0xE4, 0xF0, 0x90, -0x01, 0x3C, 0x74, 0x02, 0xF0, 0x90, 0xA5, 0x17, 0xE0, 0xFF, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, -0x0C, 0xEF, 0x54, 0xFB, 0xF0, 0x90, 0xA5, 0x1F, 0xE0, 0x54, 0xFD, 0xF0, 0x22, 0x90, 0xA5, 0x24, -0xE0, 0x04, 0xF0, 0x90, 0xA5, 0x1F, 0xE0, 0x54, 0xEF, 0xF0, 0x90, 0xA5, 0x47, 0xE0, 0xFF, 0x90, -0xA5, 0x24, 0xE0, 0xD3, 0x9F, 0x40, 0x0E, 0x90, 0xA4, 0x91, 0xE0, 0xB4, 0x01, 0x07, 0x90, 0xA5, -0x18, 0xE0, 0x54, 0xFB, 0xF0, 0x22, 0x90, 0xA5, 0x17, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x54, 0x03, -0x30, 0xE0, 0x3A, 0xEF, 0x54, 0xBF, 0xF0, 0x90, 0x04, 0xE0, 0xE0, 0x90, 0xA5, 0x18, 0x30, 0xE0, -0x06, 0xE0, 0x44, 0x01, 0xF0, 0x80, 0x10, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x01, 0xB9, 0x74, 0x01, -0xF0, 0x90, 0x01, 0xB8, 0x74, 0x04, 0xF0, 0x90, 0xA5, 0x54, 0xE0, 0xFF, 0xC4, 0x13, 0x54, 0x07, -0x30, 0xE0, 0x07, 0x7D, 0x01, 0x7F, 0x0C, 0x02, 0x50, 0x8A, 0x12, 0x50, 0x71, 0x22, 0x90, 0xA5, -0x17, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x2C, 0xEF, 0x54, 0x7F, 0xF0, -0x90, 0x04, 0xE0, 0xE0, 0x90, 0xA5, 0x18, 0x30, 0xE1, 0x06, 0xE0, 0x44, 0x02, 0xF0, 0x80, 0x0F, -0xE0, 0x54, 0xFD, 0xF0, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, 0x04, 0xF0, 0x90, -0xA5, 0x1B, 0xE0, 0x60, 0x03, 0x12, 0x50, 0x71, 0x90, 0xA5, 0x52, 0xE0, 0xFF, 0xC4, 0x13, 0x13, -0x54, 0x03, 0x30, 0xE0, 0x22, 0x90, 0xA5, 0x55, 0xE0, 0xFF, 0xC3, 0x13, 0x30, 0xE0, 0x18, 0xEF, -0x54, 0xFD, 0xF0, 0x90, 0x04, 0xE0, 0xE0, 0x90, 0xA5, 0x55, 0x30, 0xE1, 0x06, 0xE0, 0x44, 0x04, -0xF0, 0x80, 0x04, 0xE0, 0x54, 0xFB, 0xF0, 0x90, 0x04, 0xE0, 0xE0, 0x30, 0xE1, 0x02, 0x91, 0x51, -0x22, 0x90, 0xA5, 0xAD, 0xE0, 0x30, 0xE0, 0x35, 0xC3, 0x13, 0x54, 0x07, 0xFF, 0x75, 0xF0, 0x0D, -0x90, 0xA5, 0xB8, 0x12, 0x48, 0x49, 0xE0, 0xFE, 0x30, 0xE0, 0x22, 0x75, 0xF0, 0x0D, 0xEF, 0x90, -0xA5, 0xB8, 0x12, 0x48, 0x49, 0xEE, 0x54, 0xFE, 0xF0, 0x90, 0xA5, 0xAF, 0x74, 0x05, 0xF0, 0x90, -0xA5, 0xAD, 0xE0, 0xC3, 0x13, 0x54, 0x07, 0xFD, 0x7F, 0x01, 0x12, 0x5E, 0x52, 0x22, 0xD3, 0x10, -0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x04, 0x1D, 0xE0, 0x60, 0x1A, 0x90, 0x05, 0x22, 0xE0, 0x54, -0x90, 0x60, 0x07, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x08, 0xF0, 0x90, 0x01, 0xC6, 0xE0, 0x30, 0xE1, -0xE4, 0x7F, 0x00, 0x80, 0x02, 0x7F, 0x01, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x01, 0xC4, 0x74, -0xBC, 0xF0, 0x74, 0xB4, 0xA3, 0xF0, 0x7F, 0x90, 0x12, 0x4B, 0x31, 0xEF, 0x20, 0xE0, 0xF7, 0x74, -0xBC, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0xB4, 0xA3, 0xF0, 0x22, 0xE4, 0x90, 0xA7, 0x90, 0xF0, -0xA3, 0xF0, 0x90, 0x05, 0x22, 0xE0, 0x90, 0xA7, 0x92, 0xF0, 0x90, 0x04, 0x2D, 0xE0, 0x54, 0x01, -0xF0, 0x90, 0x04, 0x1D, 0xE0, 0x60, 0x3C, 0xC3, 0x90, 0xA7, 0x91, 0xE0, 0x94, 0xD0, 0x90, 0xA7, -0x90, 0xE0, 0x94, 0x07, 0x50, 0x2D, 0x90, 0xA5, 0xD7, 0xE0, 0xB4, 0xFF, 0x0D, 0x7D, 0x18, 0x7F, -0xFF, 0x12, 0x53, 0x88, 0xE4, 0x90, 0xA5, 0xDE, 0xF0, 0x22, 0x90, 0x05, 0x22, 0x74, 0xFF, 0xF0, -0x7F, 0x01, 0x7E, 0x00, 0x12, 0x3E, 0x87, 0x90, 0xA7, 0x90, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x08, -0xD6, 0x80, 0xBE, 0x90, 0xA5, 0xD7, 0xE0, 0xFF, 0x7B, 0x18, 0x7D, 0x01, 0x12, 0x5C, 0xAD, 0x74, -0x14, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0xC4, 0x13, 0x54, 0x03, 0xFF, 0x90, -0xA5, 0xDB, 0xE0, 0x54, 0xFC, 0x4F, 0xF0, 0x90, 0xA7, 0x92, 0xE0, 0x54, 0x6F, 0xFF, 0x7D, 0x19, -0x12, 0x53, 0x88, 0x90, 0x04, 0x1F, 0x74, 0x20, 0xF0, 0x90, 0xA5, 0xDC, 0xE4, 0x75, 0xF0, 0x01, -0x12, 0x08, 0xD6, 0x90, 0xA5, 0xDE, 0x74, 0x01, 0xF0, 0x22, 0x12, 0x06, 0x89, 0x90, 0xA6, 0x69, -0xF0, 0xF4, 0x60, 0x1C, 0xE0, 0x90, 0xA5, 0xD7, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x06, 0xA2, 0x75, -0xF0, 0x0A, 0xA4, 0xFF, 0x90, 0xA5, 0xD8, 0xE5, 0xF0, 0xF0, 0xA3, 0xEF, 0xF0, 0x02, 0x69, 0x09, -0x90, 0xA6, 0x69, 0xE0, 0x90, 0xA5, 0xD7, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0x5F, -0xF0, 0x22, 0x7D, 0x1F, 0x7F, 0x6F, 0x12, 0x53, 0x88, 0x90, 0x05, 0x27, 0xE0, 0x54, 0xBF, 0xF0, -0x90, 0xA5, 0x15, 0x74, 0x04, 0xF0, 0x22, 0xD1, 0xEA, 0x80, 0xE7, 0xD3, 0x10, 0xAF, 0x01, 0xC3, -0xC0, 0xD0, 0x90, 0xA5, 0x15, 0xE0, 0x90, 0xA7, 0xA7, 0xF0, 0x6F, 0x70, 0x02, 0xC1, 0xD5, 0xEF, -0x14, 0x60, 0x42, 0x14, 0x60, 0x6D, 0x14, 0x70, 0x02, 0xC1, 0x80, 0x14, 0x70, 0x02, 0xC1, 0xAC, -0x24, 0x04, 0x60, 0x02, 0xC1, 0xD5, 0x90, 0xA7, 0xA7, 0xE0, 0xB4, 0x04, 0x04, 0xD1, 0xF1, 0xC1, -0xD5, 0x90, 0xA7, 0xA7, 0xE0, 0xB4, 0x02, 0x04, 0xF1, 0x04, 0xC1, 0xD5, 0x90, 0xA7, 0xA7, 0xE0, -0xB4, 0x03, 0x04, 0xF1, 0x00, 0xC1, 0xD5, 0x90, 0xA7, 0xA7, 0xE0, 0x64, 0x01, 0x60, 0x02, 0xC1, -0xD5, 0xD1, 0xF3, 0xC1, 0xD5, 0x90, 0xA7, 0xA7, 0xE0, 0xB4, 0x04, 0x04, 0xF1, 0x16, 0xC1, 0xD5, -0x90, 0xA7, 0xA7, 0xE0, 0xB4, 0x02, 0x05, 0x12, 0x6F, 0xD9, 0xC1, 0xD5, 0x90, 0xA7, 0xA7, 0xE0, -0xB4, 0x03, 0x04, 0xF1, 0x09, 0xC1, 0xD5, 0x90, 0xA7, 0xA7, 0xE0, 0x60, 0x02, 0xC1, 0xD5, 0xD1, -0xEA, 0xC1, 0xD5, 0x90, 0xA7, 0xA7, 0xE0, 0xB4, 0x04, 0x04, 0xF1, 0x34, 0x80, 0x77, 0x90, 0xA7, -0xA7, 0xE0, 0xB4, 0x01, 0x05, 0x12, 0x4F, 0xDE, 0x80, 0x6B, 0x90, 0xA7, 0xA7, 0xE0, 0xB4, 0x03, -0x04, 0xF1, 0x2A, 0x80, 0x60, 0x90, 0xA7, 0xA7, 0xE0, 0x70, 0x5A, 0x12, 0x4F, 0xE9, 0x80, 0x55, -0x90, 0xA7, 0xA7, 0xE0, 0xB4, 0x04, 0x04, 0xF1, 0x47, 0x80, 0x4A, 0x90, 0xA7, 0xA7, 0xE0, 0xB4, -0x01, 0x04, 0xD1, 0xDC, 0x80, 0x3F, 0x90, 0xA7, 0xA7, 0xE0, 0xB4, 0x02, 0x05, 0x12, 0x6F, 0xD0, -0x80, 0x33, 0x90, 0xA7, 0xA7, 0xE0, 0x70, 0x2D, 0xD1, 0xDA, 0x80, 0x29, 0x90, 0xA7, 0xA7, 0xE0, -0xB4, 0x03, 0x04, 0xF1, 0x5C, 0x80, 0x1E, 0x90, 0xA7, 0xA7, 0xE0, 0xB4, 0x01, 0x04, 0xB1, 0xB2, -0x80, 0x13, 0x90, 0xA7, 0xA7, 0xE0, 0xB4, 0x02, 0x04, 0xF1, 0x71, 0x80, 0x08, 0x90, 0xA7, 0xA7, -0xE0, 0x70, 0x02, 0xB1, 0xC7, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD1, 0xEA, 0x7D, 0x21, 0x7F, 0xFF, -0x12, 0x53, 0x88, 0x90, 0xA5, 0x15, 0x74, 0x03, 0xF0, 0x22, 0x90, 0xA5, 0x15, 0x74, 0x01, 0xF0, -0x22, 0xF1, 0x16, 0x90, 0x05, 0x27, 0xE0, 0x54, 0xBF, 0xF0, 0xE4, 0x90, 0xA5, 0x15, 0xF0, 0x22, -0xF1, 0x09, 0x80, 0xEF, 0x12, 0x6F, 0xD9, 0x80, 0xEA, 0xE4, 0xFD, 0xFF, 0x12, 0x53, 0x88, 0x90, -0xA5, 0x15, 0x74, 0x01, 0xF0, 0x22, 0xE4, 0xFD, 0xFF, 0x12, 0x53, 0x88, 0x90, 0x05, 0x27, 0xE0, -0x44, 0x40, 0xF0, 0x90, 0xA5, 0x15, 0x74, 0x01, 0xF0, 0x22, 0x12, 0x4B, 0x58, 0x90, 0xA5, 0x15, -0x74, 0x02, 0xF0, 0x22, 0x90, 0x05, 0x27, 0xE0, 0x44, 0x40, 0xF0, 0x7D, 0x23, 0x12, 0x4B, 0x53, -0x90, 0xA5, 0x15, 0x74, 0x02, 0xF0, 0x22, 0x7D, 0x22, 0x7F, 0xFF, 0x12, 0x53, 0x88, 0x90, 0x05, -0x27, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0xA5, 0x15, 0x74, 0x03, 0xF0, 0x22, 0x7D, 0x25, 0x7F, 0x6F, -0x12, 0x53, 0x88, 0x90, 0x05, 0x27, 0xE0, 0x54, 0xBF, 0xF0, 0x90, 0xA5, 0x15, 0x74, 0x04, 0xF0, -0x22, 0x12, 0x6E, 0x7A, 0x7D, 0x24, 0x7F, 0x6F, 0x12, 0x53, 0x88, 0x90, 0x05, 0x27, 0xE0, 0x54, -0xBF, 0xF0, 0x90, 0xA5, 0x15, 0x74, 0x04, 0xF0, 0x22, 0x90, 0xA5, 0x15, 0xE0, 0x64, 0x02, 0x7F, -0x01, 0x60, 0x02, 0x7F, 0x00, 0x22, 0x90, 0xA5, 0x17, 0xE0, 0x30, 0xE0, 0x18, 0x90, 0xA5, 0x12, -0xE0, 0xFF, 0x30, 0xE0, 0x0E, 0xC3, 0x13, 0x30, 0xE0, 0x07, 0xF1, 0x89, 0xBF, 0x01, 0x06, 0x80, -0x02, 0x80, 0x00, 0xF1, 0xB6, 0x22, 0x90, 0xA5, 0x1E, 0xE0, 0xFF, 0x60, 0x03, 0xB4, 0x08, 0x0F, -0x12, 0xBB, 0x0A, 0xBF, 0x01, 0x09, 0x12, 0xBB, 0xEA, 0x90, 0x01, 0xE5, 0xE0, 0x04, 0xF0, 0x22, -0xAE, 0x07, 0x12, 0x67, 0x5F, 0xBF, 0x01, 0x16, 0x90, 0xA5, 0x12, 0xE0, 0xC4, 0x13, 0x13, 0x54, -0x03, 0x20, 0xE0, 0x0A, 0xAF, 0x06, 0x7D, 0x01, 0x12, 0x50, 0x8A, 0x7F, 0x01, 0x22, 0x7F, 0x00, -0x22, 0x90, 0xA7, 0x4C, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x90, 0x81, 0x00, 0xE0, 0x54, 0x0F, 0xFD, -0xAC, 0x07, 0x74, 0x0D, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x01, 0xF0, -0x74, 0x0D, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xFB, 0xF0, 0xAC, 0x07, -0x74, 0x12, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0xFA, 0xF0, 0x74, 0x11, -0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x1F, 0xF0, 0xAC, 0x07, 0x74, 0x06, -0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x0E, 0xF0, 0x90, 0x04, 0xA7, 0xE4, -0xF0, 0x90, 0x04, 0xA6, 0xF0, 0x90, 0x04, 0xA5, 0x74, 0xFF, 0xF0, 0x90, 0x04, 0xA4, 0x74, 0xFD, -0xF0, 0x74, 0x14, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xC0, 0x4D, 0xFD, -0x74, 0x14, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xED, 0xF0, 0x22, 0x90, 0xA7, 0x4A, -0xE0, 0xFF, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0xA7, 0xA8, 0xEF, 0xF0, 0x90, 0xA3, -0xA0, 0xE0, 0xFF, 0x90, 0x04, 0x1C, 0xE0, 0x6F, 0x70, 0x49, 0x90, 0xA5, 0x1E, 0xE0, 0x64, 0x0E, -0x70, 0x15, 0x90, 0xA7, 0xA8, 0xE0, 0x70, 0x3B, 0x90, 0xA5, 0x17, 0xE0, 0x54, 0x7F, 0xF0, 0x90, -0x06, 0x04, 0x12, 0x52, 0xC5, 0x80, 0x26, 0x90, 0xA5, 0x1E, 0xE0, 0x64, 0x06, 0x70, 0x24, 0x90, -0xA7, 0xA8, 0xE0, 0x60, 0x1E, 0x90, 0xA5, 0x17, 0xE0, 0x54, 0xBF, 0xF0, 0x90, 0x06, 0x04, 0xE0, -0x44, 0x40, 0xF0, 0xE0, 0x44, 0x80, 0xF0, 0x90, 0xA5, 0x1E, 0x74, 0x04, 0xF0, 0xE4, 0xFD, 0xFF, -0x12, 0x53, 0x88, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0xA5, 0x17, 0xE0, 0x13, 0x13, 0x13, 0x54, -0x1F, 0x30, 0xE0, 0x05, 0x90, 0x01, 0x5B, 0xE4, 0xF0, 0x90, 0x06, 0x92, 0x74, 0x02, 0xF0, 0x90, -0x01, 0x3C, 0x74, 0x04, 0xF0, 0xE4, 0x90, 0xA7, 0x42, 0xF0, 0x90, 0xA5, 0x49, 0xE0, 0xC3, 0x13, -0x54, 0x7F, 0x90, 0xA7, 0x43, 0xF0, 0xE4, 0xFB, 0xFD, 0x7F, 0x58, 0x7E, 0x01, 0x12, 0x5A, 0x81, -0x90, 0xA5, 0x17, 0xE0, 0x44, 0x08, 0xF0, 0x22, 0xE4, 0x90, 0xA5, 0x1B, 0xF0, 0xA3, 0xF0, 0x90, -0xA5, 0x19, 0xE0, 0x54, 0x0F, 0xF0, 0xA3, 0x74, 0x02, 0xF0, 0x90, 0xA5, 0x19, 0xE0, 0x54, 0xF0, -0xF0, 0x90, 0xA5, 0x17, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0xEF, 0xF0, 0x54, 0xF7, 0xF0, 0x90, 0xA5, -0x21, 0x74, 0x01, 0xF0, 0xA3, 0xF0, 0x90, 0xA5, 0x17, 0xE0, 0x54, 0xFB, 0xF0, 0xA3, 0xE0, 0x54, -0xFB, 0xF0, 0xE4, 0x90, 0xA5, 0x24, 0xF0, 0x90, 0xA5, 0x23, 0x74, 0x08, 0xF0, 0x90, 0xA5, 0x26, -0xE4, 0xF0, 0xA3, 0x74, 0x02, 0xF0, 0xE4, 0x90, 0xA5, 0x1F, 0xF0, 0x90, 0xA5, 0x17, 0xE0, 0x54, -0xDF, 0xF0, 0xE4, 0xFD, 0xFF, 0x12, 0x52, 0xCD, 0x7D, 0x0C, 0x7F, 0x02, 0x12, 0x52, 0xCD, 0x12, -0x52, 0xC9, 0x90, 0xA5, 0x17, 0xE0, 0x54, 0xBF, 0xF0, 0x54, 0x7F, 0xF0, 0xA3, 0xE0, 0x54, 0xFE, -0xF0, 0x54, 0xFD, 0xF0, 0x54, 0xF7, 0xF0, 0x90, 0xA5, 0x28, 0x12, 0x08, 0x79, 0x00, 0x00, 0x00, -0x00, 0xE4, 0x90, 0xA5, 0x46, 0xF0, 0x90, 0xA5, 0x2C, 0xF0, 0x90, 0xA3, 0x9D, 0xE0, 0xB4, 0x01, -0x08, 0x90, 0xA5, 0x25, 0x74, 0xDD, 0xF0, 0x80, 0x12, 0x90, 0xA3, 0x9D, 0xE0, 0x90, 0xA5, 0x25, -0xB4, 0x03, 0x05, 0x74, 0xD5, 0xF0, 0x80, 0x03, 0x74, 0x40, 0xF0, 0x90, 0xA5, 0x47, 0x74, 0x03, -0xF0, 0xA3, 0x74, 0x05, 0xF0, 0xA3, 0xE0, 0x54, 0x01, 0x44, 0x28, 0xF0, 0xA3, 0x74, 0x05, 0xF0, -0xE4, 0x90, 0xA5, 0x2D, 0xF0, 0x90, 0xA5, 0x46, 0xE0, 0x24, 0x04, 0x90, 0xA5, 0x30, 0xF0, 0xA3, -0x74, 0x08, 0xF0, 0xE4, 0xA3, 0xF0, 0x90, 0xA5, 0x4B, 0xF0, 0xA3, 0xE0, 0x54, 0xFE, 0xF0, 0x54, -0xFD, 0xF0, 0x54, 0xFB, 0xF0, 0x54, 0xF7, 0xF0, 0x54, 0xEF, 0xF0, 0x54, 0xDF, 0xF0, 0x54, 0xBF, -0xF0, 0x90, 0x06, 0x04, 0xE0, 0x54, 0x7F, 0xF0, 0x90, 0x06, 0x0A, 0xE0, 0x54, 0xF8, 0xF0, 0xE4, -0xFD, 0xFF, 0x12, 0x53, 0x88, 0xE4, 0x90, 0xA5, 0x4D, 0xF0, 0x22, 0x90, 0xA5, 0x4E, 0xE0, 0x30, -0xE0, 0x23, 0x90, 0xA5, 0x60, 0xE0, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x40, 0xF0, 0x61, 0x01, -0x90, 0xA5, 0x1D, 0xE0, 0xD3, 0x94, 0x00, 0x40, 0x02, 0x80, 0x35, 0x90, 0xA5, 0x4D, 0xE0, 0x70, -0x02, 0x41, 0xF9, 0x80, 0x67, 0x12, 0x77, 0xBE, 0xEF, 0x64, 0x01, 0x60, 0x08, 0x90, 0x01, 0xB8, -0x74, 0x01, 0xF0, 0x61, 0x01, 0x90, 0xA5, 0x1F, 0xE0, 0xFF, 0x54, 0x03, 0x60, 0x08, 0x90, 0x01, -0xB8, 0x74, 0x02, 0xF0, 0x80, 0x7B, 0x90, 0xA5, 0x1D, 0xE0, 0xFE, 0xE4, 0xC3, 0x9E, 0x50, 0x08, -0x90, 0x01, 0xB8, 0x74, 0x04, 0xF0, 0x80, 0x69, 0xEF, 0x30, 0xE2, 0x08, 0x90, 0x01, 0xB8, 0x74, -0x08, 0xF0, 0x80, 0x5D, 0x90, 0xA5, 0x1F, 0xE0, 0x30, 0xE4, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x10, -0xF0, 0x80, 0x4E, 0x90, 0xA5, 0x18, 0xE0, 0x13, 0x13, 0x54, 0x3F, 0x20, 0xE0, 0x08, 0x90, 0x01, -0xB8, 0x74, 0x20, 0xF0, 0x80, 0x3B, 0x90, 0xA5, 0x4D, 0xE0, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, -0x80, 0xF0, 0x80, 0x2D, 0x90, 0x06, 0x62, 0xE0, 0x30, 0xE1, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x11, -0xF0, 0x80, 0x1E, 0x90, 0x06, 0x62, 0xE0, 0x30, 0xE0, 0x0F, 0xE0, 0x54, 0xFC, 0xFF, 0xBF, 0x80, -0x08, 0x90, 0x01, 0xB8, 0x74, 0x12, 0xF0, 0x80, 0x08, 0x90, 0x01, 0xB8, 0xE4, 0xF0, 0x7F, 0x01, -0x22, 0x90, 0x01, 0xB9, 0x74, 0x04, 0xF0, 0x7F, 0x00, 0x22, 0x90, 0x02, 0x87, 0xE0, 0x60, 0x08, -0x90, 0x01, 0xB8, 0x74, 0x01, 0xF0, 0x80, 0x25, 0x90, 0x02, 0x96, 0xE0, 0x60, 0x08, 0x90, 0x01, -0xB8, 0x74, 0x10, 0xF0, 0x80, 0x17, 0x90, 0x02, 0x86, 0xE0, 0x20, 0xE1, 0x08, 0x90, 0x01, 0xB8, -0x74, 0x04, 0xF0, 0x80, 0x08, 0x90, 0x01, 0xB8, 0xE4, 0xF0, 0x7F, 0x01, 0x22, 0x90, 0x01, 0xB9, -0x74, 0x08, 0xF0, 0x7F, 0x00, 0x22, 0xEF, 0x60, 0x48, 0x90, 0xA4, 0x91, 0xE0, 0x64, 0x01, 0x70, -0x40, 0x90, 0xA5, 0x18, 0xE0, 0x54, 0xFE, 0xF0, 0x7D, 0x2B, 0x7F, 0x0F, 0x12, 0x53, 0x88, 0x90, -0x06, 0x04, 0xE0, 0x54, 0xBF, 0xF0, 0x7D, 0x08, 0xE4, 0xFF, 0x12, 0x53, 0x9E, 0xBF, 0x01, 0x15, -0x90, 0xA5, 0x17, 0xE0, 0x44, 0x40, 0xF0, 0x7D, 0x06, 0x7F, 0x01, 0x12, 0x52, 0xCD, 0x90, 0xA5, -0x16, 0x74, 0x06, 0xF0, 0x22, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, 0x74, 0x08, -0xF0, 0x22, 0x7D, 0x2D, 0x12, 0x5F, 0x3B, 0x90, 0x01, 0x37, 0x74, 0x02, 0xF0, 0xFD, 0x7F, 0x03, -0x12, 0x66, 0xC9, 0x12, 0x4B, 0x58, 0xE4, 0xFD, 0x7F, 0x01, 0x12, 0x52, 0xCD, 0xE4, 0x90, 0xA5, -0x16, 0xF0, 0x22, 0x7D, 0x2E, 0x7F, 0x6F, 0x12, 0x53, 0x88, 0x7D, 0x02, 0x7F, 0x01, 0x12, 0x52, -0xCD, 0x90, 0x05, 0x27, 0xE0, 0x54, 0xBF, 0xF0, 0x90, 0xA5, 0x16, 0x74, 0x02, 0xF0, 0x22, 0xE4, -0xFD, 0xFF, 0x12, 0x53, 0x88, 0x7D, 0x04, 0x7F, 0x01, 0x12, 0x52, 0xCD, 0x90, 0x05, 0x27, 0xE0, -0x44, 0x40, 0xF0, 0x90, 0xA5, 0x16, 0x74, 0x04, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, -0xD0, 0x12, 0x4C, 0xAE, 0x12, 0x4F, 0x72, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0xA5, 0x17, 0xE0, -0xFF, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x11, 0xEF, 0x54, 0xFB, 0xF0, 0x90, 0xA5, 0x1F, 0xE0, -0x54, 0xFD, 0xF0, 0x54, 0x07, 0x70, 0x2E, 0x80, 0x29, 0x90, 0xA5, 0x24, 0xE0, 0x04, 0xF0, 0x90, -0xA5, 0x1F, 0xE0, 0x54, 0xEF, 0xF0, 0x90, 0xA5, 0x47, 0xE0, 0xFF, 0x90, 0xA5, 0x24, 0xE0, 0xD3, -0x9F, 0x40, 0x0F, 0x90, 0xA4, 0x91, 0xE0, 0xB4, 0x01, 0x0B, 0x90, 0xA5, 0x18, 0xE0, 0x54, 0xFB, -0xF0, 0x22, 0x12, 0x50, 0x71, 0x22, 0x12, 0x6E, 0x7A, 0xE4, 0xFD, 0xFF, 0x12, 0x53, 0x88, 0x12, -0x52, 0xC9, 0x90, 0xA5, 0x16, 0x74, 0x0C, 0xF0, 0x22, 0x00, 0x76, 0xE5, -}; -u4Byte ArrayLength_MP_8192E_FW_NIC = 31868; - - -void -ODM_ReadFirmware_MP_8192E_FW_NIC( - IN PDM_ODM_T pDM_Odm, - OUT u1Byte *pFirmware, - OUT u4Byte *pFirmwareSize -) -{ -#if(DM_ODM_SUPPORT_TYPE & (ODM_WIN)) - ODM_MoveMemory(pDM_Odm, pFirmware, Array_MP_8192E_FW_NIC, ArrayLength_MP_8192E_FW_NIC); -#elif(DM_ODM_SUPPORT_TYPE & (ODM_CE)) - *((SIZE_PTR *)pFirmware) = (SIZE_PTR)Array_MP_8192E_FW_NIC; -#endif - *pFirmwareSize = ArrayLength_MP_8192E_FW_NIC; -} - - -u1Byte Array_MP_8192E_FW_WoWLAN[] = { -0xE1, 0x92, 0x30, 0x00, 0x12, 0x00, 0x00, 0x00, 0x11, 0x29, 0x19, 0x31, 0xE8, 0x48, 0x00, 0x00, -0x9D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x02, 0x4A, 0x79, 0x02, 0x6A, 0x5D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x02, 0x51, 0x5D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x02, 0x6E, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x02, 0x6A, 0x5E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x6A, 0xBF, 0x00, 0x00, -0x00, 0x00, 0x00, 0x02, 0x6E, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0xC2, 0xAF, 0x80, 0xFE, 0x32, 0x12, 0x45, 0x34, 0x85, 0xD0, 0x0B, 0x75, 0xD0, 0x08, 0xAA, 0xE0, -0xC2, 0x8C, 0xE5, 0x8A, 0x24, 0x67, 0xF5, 0x8A, 0xE5, 0x8C, 0x34, 0x79, 0xF5, 0x8C, 0xD2, 0x8C, -0xEC, 0x24, 0x87, 0xF8, 0xE6, 0xBC, 0x02, 0x02, 0x74, 0xFF, 0xC3, 0x95, 0x81, 0xB4, 0x40, 0x00, -0x40, 0xCE, 0x79, 0x03, 0x78, 0x80, 0x16, 0xE6, 0x08, 0x70, 0x0B, 0xC2, 0xAF, 0xE6, 0x30, 0xE1, -0x03, 0x44, 0x18, 0xF6, 0xD2, 0xAF, 0x08, 0xD9, 0xED, 0xEA, 0x8B, 0xD0, 0x22, 0xE5, 0x0C, 0xFF, -0x23, 0x24, 0x81, 0xF8, 0x0F, 0x08, 0x08, 0xBF, 0x03, 0x04, 0x7F, 0x00, 0x78, 0x81, 0xE6, 0x30, -0xE4, 0xF2, 0x00, 0xE5, 0x0C, 0xC3, 0x9F, 0x50, 0x20, 0x05, 0x0C, 0x74, 0x86, 0x25, 0x0C, 0xF8, -0xE6, 0xFD, 0xA6, 0x81, 0x08, 0xE6, 0xAE, 0x0C, 0xBE, 0x02, 0x02, 0x74, 0xFF, 0xCD, 0xF8, 0xE8, -0x6D, 0x60, 0xE0, 0x08, 0xE6, 0xC0, 0xE0, 0x80, 0xF6, 0xE5, 0x0C, 0xD3, 0x9F, 0x40, 0x27, 0xE5, -0x0C, 0x24, 0x87, 0xF8, 0xE6, 0xAE, 0x0C, 0xBE, 0x02, 0x02, 0x74, 0xFF, 0xFD, 0x18, 0xE6, 0xCD, -0xF8, 0xE5, 0x81, 0x6D, 0x60, 0x06, 0xD0, 0xE0, 0xF6, 0x18, 0x80, 0xF5, 0xE5, 0x0C, 0x24, 0x86, -0xC8, 0xF6, 0x15, 0x0C, 0x80, 0xD3, 0xE5, 0x0C, 0x23, 0x24, 0x81, 0xF8, 0x7F, 0x04, 0xC2, 0xAF, -0xE6, 0x30, 0xE0, 0x03, 0x10, 0xE2, 0x0C, 0x7F, 0x00, 0x30, 0xE1, 0x07, 0x30, 0xE3, 0x04, 0x7F, -0x08, 0x54, 0xF4, 0x54, 0x7C, 0xC6, 0xD2, 0xAF, 0x54, 0x80, 0x42, 0x07, 0x22, 0x78, 0x86, 0xA6, -0x81, 0x74, 0x02, 0x60, 0x06, 0xFF, 0x08, 0x76, 0xFF, 0xDF, 0xFB, 0x7F, 0x03, 0xE4, 0x78, 0x80, -0xF6, 0x08, 0xF6, 0x08, 0xDF, 0xFA, 0x78, 0x81, 0x76, 0x30, 0x90, 0x4A, 0x89, 0x74, 0x01, 0x93, -0xC0, 0xE0, 0xE4, 0x93, 0xC0, 0xE0, 0x43, 0x89, 0x01, 0x75, 0x8A, 0x60, 0x75, 0x8C, 0x79, 0xD2, -0x8C, 0xD2, 0xAF, 0x22, 0x02, 0xEF, 0xD3, 0x94, 0x02, 0x40, 0x03, 0x7F, 0xFF, 0x22, 0x74, 0x81, -0x2F, 0x2F, 0xF8, 0xE6, 0x20, 0xE5, 0xF4, 0xC2, 0xAF, 0xE6, 0x44, 0x30, 0xF6, 0xD2, 0xAF, 0xAE, -0x0C, 0xEE, 0xC3, 0x9F, 0x50, 0x21, 0x0E, 0x74, 0x86, 0x2E, 0xF8, 0xE6, 0xF9, 0x08, 0xE6, 0x18, -0xBE, 0x02, 0x02, 0x74, 0xFF, 0xFD, 0xED, 0x69, 0x60, 0x09, 0x09, 0xE7, 0x19, 0x19, 0xF7, 0x09, -0x09, 0x80, 0xF3, 0x16, 0x16, 0x80, 0xDA, 0xEE, 0xD3, 0x9F, 0x40, 0x04, 0x05, 0x81, 0x05, 0x81, -0xEE, 0xD3, 0x9F, 0x40, 0x22, 0x74, 0x86, 0x2E, 0xF8, 0x08, 0xE6, 0xF9, 0xEE, 0xB5, 0x0C, 0x02, -0xA9, 0x81, 0x18, 0x06, 0x06, 0xE6, 0xFD, 0xED, 0x69, 0x60, 0x09, 0x19, 0x19, 0xE7, 0x09, 0x09, -0xF7, 0x19, 0x80, 0xF3, 0x1E, 0x80, 0xD9, 0xEF, 0x24, 0x86, 0xF8, 0xE6, 0x04, 0xF8, 0xEF, 0x2F, -0x04, 0x90, 0x4A, 0x89, 0x93, 0xF6, 0x08, 0xEF, 0x2F, 0x93, 0xF6, 0x7F, 0x00, 0x22, 0xEF, 0xD3, -0x94, 0x02, 0x40, 0x03, 0x7F, 0xFF, 0x22, 0xEF, 0x23, 0x24, 0x81, 0xF8, 0xE6, 0x30, 0xE5, 0xF4, -0xC2, 0xAF, 0xE6, 0x54, 0x8C, 0xF6, 0xD2, 0xAF, 0xE5, 0x0C, 0xB5, 0x07, 0x0A, 0x74, 0x86, 0x2F, -0xF8, 0xE6, 0xF5, 0x81, 0x02, 0x45, 0x7D, 0x50, 0x2E, 0x74, 0x87, 0x2F, 0xF8, 0xE6, 0xBF, 0x02, -0x02, 0x74, 0xFF, 0xFD, 0x18, 0xE6, 0xF9, 0x74, 0x86, 0x2F, 0xF8, 0xFB, 0xE6, 0xFC, 0xE9, 0x6C, -0x60, 0x08, 0xA8, 0x05, 0xE7, 0xF6, 0x1D, 0x19, 0x80, 0xF4, 0xA8, 0x03, 0xA6, 0x05, 0x1F, 0xE5, -0x0C, 0xB5, 0x07, 0xE3, 0x7F, 0x00, 0x22, 0x74, 0x87, 0x2F, 0xF8, 0xE6, 0xFD, 0x18, 0x86, 0x01, -0x0F, 0x74, 0x86, 0x2F, 0xF8, 0xA6, 0x01, 0x08, 0x86, 0x04, 0xE5, 0x0C, 0xB5, 0x07, 0x02, 0xAC, -0x81, 0xED, 0x6C, 0x60, 0x08, 0x0D, 0x09, 0xA8, 0x05, 0xE6, 0xF7, 0x80, 0xF4, 0xE5, 0x0C, 0xB5, -0x07, 0xDE, 0x89, 0x81, 0x7F, 0x00, 0x22, 0xEF, 0xD3, 0x94, 0x02, 0x40, 0x03, 0x7F, 0xFF, 0x22, -0xEF, 0x23, 0x24, 0x81, 0xF8, 0xC2, 0xAF, 0xE6, 0x30, 0xE5, 0x05, 0x30, 0xE0, 0x02, 0xD2, 0xE4, -0xD2, 0xE2, 0xC6, 0xD2, 0xAF, 0x7F, 0x00, 0x30, 0xE2, 0x01, 0x0F, 0x02, 0x45, 0x7C, 0x8F, 0xF0, -0xE4, 0xFF, 0xFE, 0xE5, 0x0C, 0x23, 0x24, 0x80, 0xF8, 0xC2, 0xA9, 0x30, 0xF7, 0x0D, 0x7F, 0x08, -0xE6, 0x60, 0x0B, 0x2D, 0xF6, 0x60, 0x30, 0x50, 0x2E, 0x80, 0x07, 0x30, 0xF1, 0x06, 0xED, 0xF6, -0x60, 0x25, 0x7E, 0x02, 0x08, 0x30, 0xF0, 0x10, 0xC2, 0xAF, 0xE6, 0x10, 0xE7, 0x23, 0x0E, 0x30, -0xE2, 0x0C, 0xD2, 0xAF, 0x7F, 0x04, 0x80, 0x12, 0xC2, 0xAF, 0xE6, 0x10, 0xE7, 0x13, 0x54, 0xEC, -0x4E, 0xF6, 0xD2, 0xAF, 0x02, 0x45, 0x7D, 0x7F, 0x08, 0x08, 0xEF, 0x44, 0x83, 0xF4, 0xC2, 0xAF, -0x56, 0xC6, 0xD2, 0xAF, 0x54, 0x80, 0x4F, 0xFF, 0x22, 0xEF, 0x5B, 0xFF, 0xEE, 0x5A, 0xFE, 0xED, -0x59, 0xFD, 0xEC, 0x58, 0xFC, 0x22, 0xEF, 0x4B, 0xFF, 0xEE, 0x4A, 0xFE, 0xED, 0x49, 0xFD, 0xEC, -0x48, 0xFC, 0x22, 0xE0, 0xFC, 0xA3, 0xE0, 0xFD, 0xA3, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x22, 0xE0, -0xF8, 0xA3, 0xE0, 0xF9, 0xA3, 0xE0, 0xFA, 0xA3, 0xE0, 0xFB, 0x22, 0xA4, 0x25, 0x82, 0xF5, 0x82, -0xE5, 0xF0, 0x35, 0x83, 0xF5, 0x83, 0x22, 0xE0, 0xFB, 0xA3, 0xE0, 0xFA, 0xA3, 0xE0, 0xF9, 0x22, -0xEB, 0xF0, 0xA3, 0xEA, 0xF0, 0xA3, 0xE9, 0xF0, 0x22, 0xD0, 0x83, 0xD0, 0x82, 0xF8, 0xE4, 0x93, -0x70, 0x12, 0x74, 0x01, 0x93, 0x70, 0x0D, 0xA3, 0xA3, 0x93, 0xF8, 0x74, 0x01, 0x93, 0xF5, 0x82, -0x88, 0x83, 0xE4, 0x73, 0x74, 0x02, 0x93, 0x68, 0x60, 0xEF, 0xA3, 0xA3, 0xA3, 0x80, 0xDF, 0xE3, -0xF5, 0xF0, 0x09, 0xE2, 0x08, 0xB5, 0xF0, 0x6B, 0xDF, 0xF5, 0x80, 0x67, 0xE3, 0xF5, 0xF0, 0x09, -0xE6, 0x08, 0xB5, 0xF0, 0x5E, 0xDF, 0xF5, 0x80, 0x5A, 0x87, 0xF0, 0x09, 0xE6, 0x08, 0xB5, 0xF0, -0x52, 0xDF, 0xF6, 0x80, 0x4E, 0x87, 0xF0, 0x09, 0xE2, 0x08, 0xB5, 0xF0, 0x46, 0xDF, 0xF6, 0x80, -0x42, 0x88, 0x82, 0x8C, 0x83, 0x87, 0xF0, 0x09, 0xE0, 0xA3, 0xB5, 0xF0, 0x36, 0xDF, 0xF6, 0x80, -0x32, 0x88, 0x82, 0x8C, 0x83, 0x87, 0xF0, 0x09, 0xE4, 0x93, 0xA3, 0xB5, 0xF0, 0x25, 0xDF, 0xF5, -0x80, 0x21, 0x88, 0x82, 0x8C, 0x83, 0xE3, 0xF5, 0xF0, 0x09, 0xE0, 0xA3, 0xB5, 0xF0, 0x14, 0xDF, -0xF5, 0x80, 0x10, 0x88, 0x82, 0x8C, 0x83, 0xE3, 0xF5, 0xF0, 0x09, 0xE4, 0x93, 0xA3, 0xB5, 0xF0, -0x02, 0xDF, 0xF4, 0x02, 0x49, 0x7E, 0x80, 0x87, 0x80, 0xE9, 0x80, 0x90, 0x80, 0xD4, 0x80, 0x3E, -0x80, 0x15, 0x80, 0x6E, 0x80, 0x7E, 0x80, 0x9D, 0x80, 0xB7, 0x80, 0x8D, 0x80, 0xA3, 0x80, 0x51, -0x80, 0x74, 0x80, 0x3C, 0x02, 0x49, 0x8A, 0x89, 0x82, 0x8A, 0x83, 0xEC, 0xFA, 0xE4, 0x93, 0xF5, -0xF0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xE4, 0x93, 0xA3, 0xC8, 0xC5, 0x82, -0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xB5, 0xF0, 0x76, 0xDF, 0xE3, 0xDE, 0xE1, 0x80, 0x70, 0x89, 0x82, -0x8A, 0x83, 0xE4, 0x93, 0xF5, 0xF0, 0xA3, 0xE2, 0x08, 0xB5, 0xF0, 0x62, 0xDF, 0xF4, 0x80, 0x5E, -0x89, 0x82, 0x8A, 0x83, 0xE0, 0xF5, 0xF0, 0xA3, 0xE6, 0x08, 0xB5, 0xF0, 0x51, 0xDF, 0xF5, 0x80, -0x4D, 0x89, 0x82, 0x8A, 0x83, 0xE0, 0xF5, 0xF0, 0xA3, 0xE2, 0x08, 0xB5, 0xF0, 0x40, 0xDF, 0xF5, -0x80, 0x3C, 0x89, 0x82, 0x8A, 0x83, 0xE4, 0x93, 0xF5, 0xF0, 0xA3, 0xE6, 0x08, 0xB5, 0xF0, 0x2E, -0xDF, 0xF4, 0x80, 0x2A, 0x80, 0x02, 0x80, 0x57, 0x89, 0x82, 0x8A, 0x83, 0xEC, 0xFA, 0xE4, 0x93, -0xF5, 0xF0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xE0, 0xA3, 0xC8, 0xC5, 0x82, -0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xB5, 0xF0, 0x06, 0xDF, 0xE4, 0xDE, 0xE2, 0x80, 0x00, 0x7F, 0xFF, -0xB5, 0xF0, 0x02, 0x0F, 0x22, 0x40, 0x02, 0x7F, 0x01, 0x22, 0x89, 0x82, 0x8A, 0x83, 0xEC, 0xFA, -0xE0, 0xF5, 0xF0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xE0, 0xA3, 0xC8, 0xC5, -0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xB5, 0xF0, 0xD5, 0xDF, 0xE5, 0xDE, 0xE3, 0x80, 0xCF, 0x89, -0x82, 0x8A, 0x83, 0xEC, 0xFA, 0xE0, 0xF5, 0xF0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, -0xCC, 0xE4, 0x93, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCC, 0xC5, 0x83, 0xCC, 0xB5, 0xF0, 0xAF, 0xDF, -0xE4, 0xDE, 0xE2, 0x80, 0xA9, 0x88, 0xF0, 0xEF, 0x60, 0x01, 0x0E, 0x4E, 0x60, 0xAB, 0xED, 0x24, -0x02, 0xB4, 0x04, 0x00, 0x50, 0x98, 0xF5, 0x82, 0xEB, 0x24, 0x02, 0xB4, 0x04, 0x00, 0x50, 0x8E, -0x23, 0x23, 0x45, 0x82, 0x23, 0x90, 0x48, 0xC6, 0x73, 0x02, 0x46, 0x0D, 0xE4, 0x93, 0xA3, 0xF8, -0xE4, 0x93, 0xA3, 0x40, 0x03, 0xF6, 0x80, 0x01, 0xF2, 0x08, 0xDF, 0xF4, 0x80, 0x29, 0xE4, 0x93, -0xA3, 0xF8, 0x54, 0x07, 0x24, 0x0C, 0xC8, 0xC3, 0x33, 0xC4, 0x54, 0x0F, 0x44, 0x20, 0xC8, 0x83, -0x40, 0x04, 0xF4, 0x56, 0x80, 0x01, 0x46, 0xF6, 0xDF, 0xE4, 0x80, 0x0B, 0x01, 0x02, 0x04, 0x08, -0x10, 0x20, 0x40, 0x80, 0x90, 0x4A, 0x7C, 0xE4, 0x7E, 0x01, 0x93, 0x60, 0xBC, 0xA3, 0xFF, 0x54, -0x3F, 0x30, 0xE5, 0x09, 0x54, 0x1F, 0xFE, 0xE4, 0x93, 0xA3, 0x60, 0x01, 0x0E, 0xCF, 0x54, 0xC0, -0x25, 0xE0, 0x60, 0xA8, 0x40, 0xB8, 0xE4, 0x93, 0xA3, 0xFA, 0xE4, 0x93, 0xA3, 0xF8, 0xE4, 0x93, -0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCA, 0xC5, 0x83, 0xCA, 0xF0, 0xA3, 0xC8, 0xC5, 0x82, 0xC8, 0xCA, -0xC5, 0x83, 0xCA, 0xDF, 0xE9, 0xDE, 0xE7, 0x80, 0xBE, 0x02, 0x4A, 0x34, 0x00, 0x41, 0x91, 0x46, -0x00, 0x41, 0x91, 0x47, 0x00, 0x41, 0x91, 0x5C, 0x00, 0x4C, 0xE2, 0x5F, 0xF5, 0x67, 0xE7, 0x51, -0xE2, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0xE4, 0xFF, 0x90, 0x90, 0xF8, 0xF0, 0x90, 0x01, -0xC7, 0xE0, 0x64, 0xAD, 0x70, 0x37, 0xF0, 0x90, 0x91, 0x05, 0x74, 0x0F, 0xF0, 0x90, 0x90, 0xF7, -0x74, 0x0A, 0xF0, 0xA3, 0xE0, 0x04, 0xF0, 0x90, 0x90, 0xF8, 0xE0, 0x2F, 0xFE, 0x74, 0xF9, 0x2F, -0xF5, 0x82, 0xE4, 0x34, 0x90, 0xF5, 0x83, 0xEE, 0xF0, 0x0F, 0xEF, 0xB4, 0x0F, 0xE9, 0x90, 0x01, -0x3F, 0x74, 0x04, 0xF0, 0x7B, 0x01, 0x7A, 0x90, 0x79, 0xF7, 0x12, 0x68, 0x83, 0xD0, 0xD0, 0x92, -0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x7F, 0x8F, 0x71, 0x14, 0xEF, 0x30, 0xE6, -0x1E, 0x90, 0x00, 0x8C, 0xE0, 0xF5, 0x59, 0x7F, 0x8D, 0x71, 0x14, 0x90, 0x00, 0x8E, 0xE0, 0xF5, -0x5A, 0x7F, 0x8F, 0x71, 0x14, 0xEF, 0x30, 0xE0, 0x06, 0xE4, 0xFD, 0x7F, 0x8D, 0x91, 0x5C, 0xD0, -0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x8F, 0x82, 0x75, 0x83, 0x00, -0xE0, 0x90, 0x91, 0x54, 0xF0, 0x7F, 0x10, 0x7E, 0x00, 0x12, 0x3E, 0x87, 0x90, 0x91, 0x54, 0xE0, -0xFF, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x8E, 0xB6, 0xE0, 0x54, 0x7F, 0xFF, 0x90, 0x8E, 0xB5, -0xE0, 0xFE, 0xC4, 0x13, 0x54, 0x01, 0xFD, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x91, -0x4F, 0xED, 0xF0, 0x90, 0x91, 0x4E, 0xEF, 0xF0, 0xD3, 0x94, 0x07, 0x50, 0x6D, 0x7F, 0x47, 0x71, -0x14, 0x90, 0x91, 0x4E, 0xE0, 0xFE, 0x74, 0x01, 0xA8, 0x06, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, -0xFC, 0xF4, 0x5F, 0xFD, 0x7F, 0x47, 0x91, 0x5C, 0x7F, 0x46, 0x71, 0x14, 0x90, 0x91, 0x4E, 0xE0, -0xFE, 0x74, 0x01, 0xA8, 0x06, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0x4F, 0xFD, 0x7F, 0x46, -0x91, 0x5C, 0x90, 0x91, 0x4F, 0xE0, 0x60, 0x17, 0x7F, 0x45, 0x71, 0x14, 0x90, 0x91, 0x4E, 0xE0, -0xFE, 0x74, 0x01, 0xA8, 0x06, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0x4F, 0x80, 0x16, 0x7F, -0x45, 0x71, 0x14, 0x90, 0x91, 0x4E, 0xE0, 0xFE, 0x74, 0x01, 0xA8, 0x06, 0x08, 0x80, 0x02, 0xC3, -0x33, 0xD8, 0xFC, 0xF4, 0x5F, 0xFD, 0x7F, 0x45, 0x80, 0x75, 0x90, 0x91, 0x4E, 0xE0, 0x24, 0xF8, -0xF0, 0x7F, 0x63, 0x71, 0x14, 0x90, 0x91, 0x4E, 0xE0, 0xFE, 0x74, 0x01, 0xA8, 0x06, 0x08, 0x80, -0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0x5F, 0xFD, 0x7F, 0x63, 0x91, 0x5C, 0x7F, 0x62, 0x71, 0x14, -0x90, 0x91, 0x4E, 0xE0, 0xFE, 0x74, 0x01, 0xA8, 0x06, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, -0x4F, 0xFD, 0x7F, 0x62, 0x91, 0x5C, 0x90, 0x91, 0x4F, 0xE0, 0x60, 0x1A, 0x7F, 0x61, 0x71, 0x14, -0x90, 0x91, 0x4E, 0xE0, 0xFE, 0x74, 0x01, 0xA8, 0x06, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, -0x4F, 0xFD, 0x7F, 0x61, 0x80, 0x19, 0x7F, 0x61, 0x71, 0x14, 0x90, 0x91, 0x4E, 0xE0, 0xFE, 0x74, -0x01, 0xA8, 0x06, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0x5F, 0xFD, 0x7F, 0x61, 0x91, -0x5C, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x7F, 0x02, 0x71, 0x14, 0xEF, 0x44, 0x01, 0xFD, 0x7F, 0x02, -0x91, 0x5C, 0x7F, 0x02, 0x71, 0x14, 0xEF, 0x54, 0xFE, 0xFD, 0x7F, 0x02, 0xD3, 0x10, 0xAF, 0x01, -0xC3, 0xC0, 0xD0, 0x8F, 0x82, 0x75, 0x83, 0x00, 0xED, 0xF0, 0x7F, 0x10, 0x7E, 0x00, 0x12, 0x3E, -0x87, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x7F, 0xFF, 0x12, 0x54, 0x7F, 0xD3, 0x10, 0xAF, 0x01, 0xC3, -0xC0, 0xD0, 0x12, 0x76, 0x45, 0x91, 0x52, 0x91, 0x46, 0x91, 0x46, 0x90, 0x01, 0x00, 0x74, 0x3F, -0xF0, 0xA3, 0xE0, 0x54, 0xFD, 0xF0, 0x90, 0x05, 0x53, 0xE0, 0x44, 0x20, 0xF0, 0xD0, 0xD0, 0x92, -0xAF, 0x22, 0x7F, 0x54, 0x71, 0x14, 0xE5, 0x0D, 0x5F, 0xF5, 0x11, 0x7F, 0x55, 0x71, 0x14, 0xE5, -0x0E, 0x5F, 0xF5, 0x12, 0x7F, 0x56, 0x71, 0x14, 0xE5, 0x0F, 0x5F, 0xF5, 0x13, 0x7F, 0x57, 0x71, -0x14, 0xE5, 0x10, 0x5F, 0xF5, 0x14, 0xAD, 0x11, 0x7F, 0x54, 0x91, 0x5C, 0xAD, 0x12, 0x7F, 0x55, -0x91, 0x5C, 0xAD, 0x13, 0x7F, 0x56, 0x91, 0x5C, 0xAD, 0x14, 0x7F, 0x57, 0x91, 0x5C, 0x53, 0x91, -0xEF, 0x22, 0x7F, 0x81, 0x71, 0x14, 0xEF, 0x54, 0xFE, 0xFD, 0x7F, 0x81, 0x91, 0x5C, 0x7F, 0x80, -0x71, 0x14, 0xEF, 0x44, 0x80, 0xFD, 0x7F, 0x80, 0x91, 0x5C, 0x12, 0x73, 0x0C, 0x12, 0x3E, 0x48, -0x12, 0x73, 0x19, 0x12, 0x73, 0x70, 0x7F, 0x01, 0x12, 0x46, 0x45, 0x90, 0x8F, 0xD6, 0x74, 0x02, -0xF0, 0xFF, 0x12, 0x46, 0x45, 0x90, 0x8F, 0xD6, 0xE0, 0x04, 0xF0, 0x12, 0x50, 0x5F, 0x12, 0x5D, -0x5E, 0x7F, 0x80, 0x71, 0x14, 0xEF, 0x44, 0x40, 0xFD, 0x7F, 0x80, 0x91, 0x5C, 0x75, 0x28, 0xFF, -0x12, 0x5F, 0xEE, 0x12, 0x73, 0x38, 0x7F, 0x81, 0x71, 0x14, 0xEF, 0x44, 0x04, 0xFD, 0x7F, 0x81, -0x91, 0x5C, 0x12, 0x73, 0x7E, 0xE4, 0xFF, 0x02, 0x46, 0xCE, 0x90, 0x8E, 0x89, 0xE0, 0xFD, 0x7F, -0x93, 0x91, 0x5C, 0x90, 0x8E, 0x80, 0xE0, 0x60, 0x12, 0x90, 0x01, 0x2F, 0xE0, 0x30, 0xE7, 0x05, -0x74, 0x10, 0xF0, 0x80, 0x06, 0x90, 0x01, 0x2F, 0x74, 0x90, 0xF0, 0x7F, 0x08, 0x71, 0x14, 0xEF, -0x44, 0x10, 0xFD, 0x7F, 0x08, 0x91, 0x5C, 0x7F, 0x01, 0xF1, 0xEA, 0x7F, 0x90, 0x71, 0x14, 0xEF, -0x44, 0x01, 0xFD, 0x7F, 0x90, 0x91, 0x5C, 0x7F, 0x14, 0x7E, 0x00, 0x02, 0x3E, 0x87, 0xD3, 0x10, -0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x8F, 0xEB, 0x11, 0x20, 0x12, 0x06, 0x89, 0x20, 0xE0, 0x05, -0x12, 0x85, 0xF4, 0xC1, 0xE1, 0x90, 0x8E, 0xEB, 0x74, 0x05, 0xF0, 0x90, 0x8F, 0xEB, 0x11, 0x17, -0x12, 0x06, 0x89, 0xFF, 0x54, 0x01, 0xFE, 0x90, 0x8E, 0xB5, 0xE0, 0x54, 0xFE, 0x4E, 0xFE, 0xF0, -0xEF, 0x54, 0x02, 0xFF, 0xEE, 0x54, 0xFD, 0x4F, 0xFF, 0xF0, 0x12, 0x06, 0x89, 0xFE, 0x54, 0x04, -0xFD, 0xEF, 0x54, 0xFB, 0x4D, 0xFF, 0x90, 0x8E, 0xB5, 0xF0, 0xEE, 0x54, 0x08, 0xFE, 0xEF, 0x54, -0xF7, 0x4E, 0xFF, 0xF0, 0x12, 0x06, 0x89, 0xFE, 0x54, 0x10, 0xFD, 0xEF, 0x54, 0xEF, 0x4D, 0xFF, -0x90, 0x8E, 0xB5, 0xF0, 0xEE, 0x54, 0x20, 0xFE, 0xEF, 0x54, 0xDF, 0x4E, 0xFF, 0xF0, 0x12, 0x06, -0x89, 0xFE, 0x54, 0x40, 0xFD, 0xEF, 0x54, 0xBF, 0x4D, 0xFF, 0x90, 0x8E, 0xB5, 0xF0, 0xEE, 0x54, -0x80, 0xFE, 0xEF, 0x54, 0x7F, 0x4E, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x06, 0xA2, 0x54, 0x80, 0xFF, -0x90, 0x8E, 0xB6, 0xE0, 0x54, 0x7F, 0x4F, 0xF0, 0x12, 0x06, 0x89, 0x13, 0x13, 0x54, 0x3F, 0x30, -0xE0, 0x07, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x04, 0xF0, 0x90, 0x8F, 0xEB, 0x11, 0x17, 0x12, 0x06, -0x89, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x07, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x08, 0xF0, -0x90, 0x8D, 0x06, 0xE0, 0xB4, 0x02, 0x0D, 0x90, 0x8E, 0xB6, 0xE0, 0xC4, 0x13, 0x13, 0x13, 0x54, -0x01, 0x20, 0xE0, 0x6F, 0x90, 0x00, 0x01, 0x12, 0x06, 0xA2, 0x54, 0x7F, 0xFF, 0x90, 0x8E, 0xB6, -0xE0, 0x54, 0x80, 0x4F, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x06, 0xA2, 0x90, 0x8E, 0xB7, 0xF0, 0x90, -0x00, 0x03, 0x12, 0x06, 0xA2, 0xFF, 0x54, 0x01, 0xFE, 0x90, 0x8E, 0xB8, 0xE0, 0x54, 0xFE, 0x4E, -0xFE, 0xF0, 0xEF, 0x54, 0xFE, 0xFF, 0xEE, 0x54, 0x01, 0x4F, 0xF0, 0x90, 0x8E, 0xB6, 0xE0, 0x54, -0x7F, 0xFF, 0x90, 0x8E, 0xB5, 0xE0, 0xFE, 0xC4, 0x13, 0x54, 0x07, 0x7D, 0x00, 0x20, 0xE0, 0x02, -0x7D, 0x01, 0x71, 0x47, 0x90, 0x8D, 0x06, 0xE0, 0xB4, 0x01, 0x18, 0x7F, 0x4E, 0x71, 0x14, 0xEF, -0x54, 0xBF, 0xFD, 0x7F, 0x4E, 0x91, 0x5C, 0x7F, 0x4A, 0x71, 0x14, 0xEF, 0x54, 0xFB, 0xFD, 0x7F, -0x4A, 0x91, 0x5C, 0x90, 0x8D, 0x06, 0xE0, 0xB4, 0x01, 0x07, 0x90, 0xFE, 0x10, 0xE0, 0x44, 0x04, -0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xAD, 0x07, 0x90, 0x8E, 0xB7, 0xE0, 0x75, 0xF0, 0x40, 0xA4, -0xFF, 0x90, 0x91, 0x39, 0xE5, 0xF0, 0xF0, 0xA3, 0xEF, 0xF0, 0xE4, 0xA3, 0xF0, 0x90, 0x8E, 0xB8, -0xE0, 0xC3, 0x13, 0x54, 0x7F, 0x90, 0x91, 0x3C, 0xF0, 0xED, 0x64, 0x01, 0x60, 0x02, 0xE1, 0xB6, -0x90, 0x91, 0x39, 0xE0, 0x70, 0x02, 0xA3, 0xE0, 0x60, 0x0B, 0x90, 0x91, 0x39, 0x74, 0xFF, 0x75, -0xF0, 0xD0, 0x12, 0x08, 0xD6, 0x90, 0x8E, 0xB6, 0xE0, 0x54, 0x7F, 0xFF, 0x90, 0x8E, 0xB5, 0xE0, -0xFE, 0xC4, 0x13, 0x54, 0x07, 0x7D, 0x00, 0x20, 0xE0, 0x02, 0x7D, 0x01, 0x71, 0x47, 0x71, 0x36, -0x90, 0x8E, 0xB8, 0xE0, 0x30, 0xE0, 0x6F, 0x90, 0x91, 0x39, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12, -0x3E, 0x87, 0x90, 0x8E, 0xB6, 0xE0, 0x54, 0x7F, 0xFF, 0x90, 0x8E, 0xB5, 0xE0, 0xFE, 0xC4, 0x13, -0x54, 0x07, 0x7D, 0x00, 0x20, 0xE0, 0x02, 0x7D, 0x01, 0x71, 0x47, 0xE4, 0x90, 0x91, 0x3B, 0xF0, -0x90, 0x91, 0x3C, 0xE0, 0xFF, 0x90, 0x91, 0x3B, 0xE0, 0xC3, 0x9F, 0x50, 0x39, 0x90, 0x91, 0x39, -0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12, 0x3E, 0x87, 0x71, 0x36, 0x90, 0x91, 0x39, 0xE0, 0xFE, 0xA3, -0xE0, 0xFF, 0x12, 0x3E, 0x87, 0x90, 0x8E, 0xB6, 0xE0, 0x54, 0x7F, 0xFF, 0x90, 0x8E, 0xB5, 0xE0, -0xFE, 0xC4, 0x13, 0x54, 0x07, 0x7D, 0x00, 0x20, 0xE0, 0x02, 0x7D, 0x01, 0x71, 0x47, 0x90, 0x91, -0x3B, 0xE0, 0x04, 0xF0, 0x80, 0xBA, 0x22, 0xE4, 0xF5, 0x0D, 0xF5, 0x0E, 0xF5, 0x0F, 0x75, 0x10, -0x80, 0xAD, 0x0D, 0x7F, 0x50, 0x91, 0x5C, 0xAD, 0x0E, 0x7F, 0x51, 0x91, 0x5C, 0xAD, 0x0F, 0x7F, -0x52, 0x91, 0x5C, 0xAD, 0x10, 0x7F, 0x53, 0x81, 0x5C, 0x12, 0x7F, 0x50, 0x7F, 0x08, 0x71, 0x14, -0xEF, 0x54, 0xEF, 0xFD, 0x7F, 0x08, 0x91, 0x5C, 0xE4, 0xFF, 0x90, 0x91, 0x43, 0xEF, 0xF0, 0xE4, -0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0x09, 0xE0, 0x7F, 0x00, 0x30, 0xE7, 0x02, 0x7F, 0x01, 0x90, -0x91, 0x43, 0xE0, 0x6F, 0x60, 0x3E, 0xC3, 0x90, 0x91, 0x45, 0xE0, 0x94, 0x88, 0x90, 0x91, 0x44, -0xE0, 0x94, 0x13, 0x40, 0x08, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x10, 0xF0, 0x22, 0x90, 0x91, 0x44, -0xE4, 0x75, 0xF0, 0x01, 0x12, 0x08, 0xD6, 0x7F, 0x14, 0x7E, 0x00, 0x12, 0x3E, 0x87, 0xD3, 0x90, -0x91, 0x45, 0xE0, 0x94, 0x32, 0x90, 0x91, 0x44, 0xE0, 0x94, 0x00, 0x40, 0xB7, 0x90, 0x01, 0xC6, -0xE0, 0x30, 0xE0, 0xB0, 0x22, 0x7F, 0xF4, 0x12, 0x4B, 0x14, 0xEF, 0x20, 0xE5, 0x0E, 0x7F, 0xF4, -0x12, 0x4B, 0x14, 0xEF, 0x7F, 0x01, 0x20, 0xE4, 0x05, 0x7F, 0x02, 0x22, 0x7F, 0x03, 0x22, 0x11, -0x45, 0x90, 0x8D, 0x06, 0xEF, 0xF0, 0x11, 0x78, 0x90, 0x01, 0x64, 0x74, 0x01, 0xF0, 0x90, 0x04, -0x23, 0xE0, 0x44, 0x80, 0xF0, 0x02, 0x37, 0xF8, 0x11, 0xC1, 0x11, 0xF1, 0x11, 0x83, 0x11, 0xA2, -0x02, 0x4F, 0xB7, 0x75, 0x15, 0x10, 0xE4, 0xF5, 0x16, 0x75, 0x17, 0x07, 0x75, 0x18, 0x42, 0x90, -0x01, 0x30, 0xE5, 0x15, 0xF0, 0xA3, 0xE5, 0x16, 0xF0, 0xA3, 0xE5, 0x17, 0xF0, 0xA3, 0xE5, 0x18, -0xF0, 0x22, 0x75, 0x1D, 0x06, 0x75, 0x1E, 0x01, 0x75, 0x1F, 0x03, 0x75, 0x20, 0x62, 0x90, 0x01, -0x38, 0xE5, 0x1D, 0xF0, 0xA3, 0xE5, 0x1E, 0xF0, 0xA3, 0xE5, 0x1F, 0xF0, 0xA3, 0xE5, 0x20, 0xF0, -0x22, 0x90, 0x01, 0x30, 0xE4, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0x38, 0xF0, -0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xFD, 0x7F, 0x50, 0x12, 0x4C, 0x5C, 0xE4, 0xFD, 0x7F, 0x51, -0x12, 0x4C, 0x5C, 0xE4, 0xFD, 0x7F, 0x52, 0x12, 0x4C, 0x5C, 0xE4, 0xFD, 0x7F, 0x53, 0x02, 0x4C, -0x5C, 0x90, 0x01, 0x34, 0x74, 0xFF, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x01, 0x3C, -0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xFD, 0x7F, 0x54, 0x12, 0x4C, 0x5C, 0x7D, 0xFF, 0x7F, -0x55, 0x12, 0x4C, 0x5C, 0x7D, 0xFF, 0x7F, 0x56, 0x12, 0x4C, 0x5C, 0x7D, 0xFF, 0x7F, 0x57, 0x02, -0x4C, 0x5C, 0x90, 0x01, 0xCF, 0xE0, 0x90, 0x90, 0x99, 0xF0, 0xE0, 0xFF, 0x30, 0xE0, 0x07, 0x90, -0x01, 0xCF, 0xE0, 0x54, 0xFE, 0xF0, 0xEF, 0x30, 0xE5, 0x22, 0x90, 0x01, 0xCF, 0xE0, 0x54, 0xDF, -0xF0, 0x90, 0x01, 0x34, 0x74, 0x20, 0xF0, 0xE4, 0xF5, 0xA8, 0xF5, 0xE8, 0x11, 0xC1, 0x90, 0x00, -0x03, 0xE0, 0x54, 0xFB, 0xFD, 0x7F, 0x03, 0x12, 0x4C, 0x5C, 0x80, 0xFE, 0x22, 0xC0, 0xE0, 0xC0, -0xF0, 0xC0, 0x83, 0xC0, 0x82, 0xC0, 0xD0, 0x75, 0xD0, 0x00, 0xC0, 0x00, 0xC0, 0x01, 0xC0, 0x02, -0xC0, 0x03, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, 0x12, 0x73, 0x88, 0xE5, 0x19, 0x30, -0xE3, 0x03, 0x12, 0x6B, 0xE6, 0xE5, 0x19, 0x30, 0xE4, 0x03, 0x12, 0x6B, 0xE0, 0xE5, 0x19, 0x30, -0xE5, 0x02, 0x31, 0x22, 0xE5, 0x1B, 0x30, 0xE0, 0x02, 0x31, 0xF3, 0xE5, 0x1B, 0x30, 0xE1, 0x03, -0x12, 0x73, 0xBE, 0xE5, 0x1B, 0x30, 0xE2, 0x03, 0x12, 0x5E, 0x77, 0xE5, 0x1B, 0x30, 0xE3, 0x03, -0x12, 0x6F, 0x6C, 0xE5, 0x1B, 0x30, 0xE4, 0x03, 0x12, 0x77, 0xE9, 0xE5, 0x1B, 0x30, 0xE5, 0x02, -0xF1, 0xD2, 0xE5, 0x1B, 0x30, 0xE6, 0x03, 0x12, 0x78, 0x18, 0xE5, 0x1C, 0x30, 0xE1, 0x02, 0xF1, -0xBE, 0xE5, 0x1C, 0x30, 0xE6, 0x02, 0xF1, 0xEF, 0xD0, 0x07, 0xD0, 0x06, 0xD0, 0x05, 0xD0, 0x04, -0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0xD0, 0xD0, 0xD0, 0x82, 0xD0, 0x83, 0xD0, 0xF0, -0xD0, 0xE0, 0x32, 0xE4, 0xF5, 0x58, 0x90, 0x8E, 0x7F, 0xE0, 0x60, 0x76, 0x90, 0x8D, 0xFA, 0xE0, -0x64, 0x01, 0x70, 0x6E, 0x90, 0x8E, 0x7D, 0xE0, 0xC4, 0x54, 0x0F, 0x60, 0x22, 0x24, 0xFE, 0x60, -0x03, 0x04, 0x70, 0x1E, 0x90, 0x8E, 0x86, 0xE0, 0x14, 0xF0, 0xE0, 0xFF, 0x60, 0x06, 0x90, 0x8E, -0x88, 0xE0, 0x60, 0x0E, 0xEF, 0x70, 0x08, 0x90, 0x8E, 0x85, 0xE0, 0xA3, 0xF0, 0x80, 0x00, 0x75, -0x58, 0x01, 0xE5, 0x58, 0x60, 0x3C, 0x90, 0x8E, 0x83, 0xE0, 0x44, 0x10, 0xF0, 0x90, 0x8E, 0x88, -0xE0, 0x60, 0x03, 0xB4, 0x01, 0x0B, 0xE4, 0x90, 0x91, 0x20, 0xF0, 0x90, 0x8E, 0x88, 0xE0, 0x80, -0x0F, 0xE4, 0x90, 0x91, 0x20, 0xF0, 0x90, 0x8E, 0x88, 0xE0, 0x75, 0xF0, 0x03, 0xA4, 0x24, 0xFE, -0xFF, 0x90, 0x8E, 0x87, 0xE0, 0x2F, 0x12, 0x6E, 0x13, 0x90, 0x8E, 0x82, 0xE0, 0x20, 0xE2, 0x02, -0x51, 0x73, 0x22, 0x7D, 0x01, 0x7F, 0x04, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x91, -0x5A, 0xED, 0xF0, 0x90, 0x8E, 0x7B, 0xE0, 0xFE, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, 0x02, -0x61, 0xCE, 0xEE, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x02, 0x61, 0xCE, 0x90, 0x8E, -0x82, 0xE0, 0xFE, 0x6F, 0x70, 0x02, 0x61, 0xCE, 0xEF, 0x70, 0x02, 0x61, 0x36, 0x24, 0xFE, 0x70, -0x02, 0x61, 0x6F, 0x24, 0xFE, 0x60, 0x47, 0x24, 0xFC, 0x70, 0x02, 0x61, 0xA9, 0x24, 0xFC, 0x60, -0x02, 0x61, 0xBE, 0xEE, 0xB4, 0x0E, 0x02, 0x91, 0x3A, 0x90, 0x8E, 0x82, 0xE0, 0x70, 0x04, 0x7F, -0x01, 0x91, 0x5D, 0x90, 0x8E, 0x82, 0xE0, 0xB4, 0x06, 0x02, 0x91, 0x19, 0x90, 0x8E, 0x82, 0xE0, -0xB4, 0x04, 0x0D, 0x90, 0x91, 0x5A, 0xE0, 0xFF, 0x60, 0x04, 0xB1, 0x7A, 0x80, 0x02, 0xF1, 0xAC, -0x90, 0x8E, 0x82, 0xE0, 0x64, 0x08, 0x60, 0x02, 0x61, 0xBE, 0xB1, 0x34, 0x61, 0xBE, 0x90, 0x8E, -0x82, 0xE0, 0x70, 0x04, 0x7F, 0x01, 0x91, 0x5D, 0x90, 0x8E, 0x82, 0xE0, 0xB4, 0x06, 0x02, 0x91, -0x19, 0x90, 0x8E, 0x82, 0xE0, 0xB4, 0x0E, 0x07, 0x71, 0xD3, 0xBF, 0x01, 0x02, 0x91, 0x3A, 0x90, -0x8E, 0x82, 0xE0, 0x64, 0x0C, 0x60, 0x02, 0x61, 0xBE, 0x71, 0xD3, 0xEF, 0x64, 0x01, 0x60, 0x02, -0x61, 0xBE, 0x91, 0x8A, 0x61, 0xBE, 0x90, 0x8E, 0x82, 0xE0, 0xB4, 0x0E, 0x07, 0x71, 0xD3, 0xBF, -0x01, 0x02, 0x91, 0x3A, 0x90, 0x8E, 0x82, 0xE0, 0xB4, 0x06, 0x02, 0x91, 0x19, 0x90, 0x8E, 0x82, -0xE0, 0xB4, 0x0C, 0x07, 0x71, 0xD3, 0xBF, 0x01, 0x02, 0x91, 0x8A, 0x90, 0x8E, 0x82, 0xE0, 0x64, -0x04, 0x70, 0x5B, 0x12, 0x82, 0xD4, 0xEF, 0x64, 0x01, 0x70, 0x53, 0xB1, 0x42, 0x80, 0x4F, 0x90, -0x8E, 0x82, 0xE0, 0xB4, 0x0E, 0x07, 0x71, 0xD3, 0xBF, 0x01, 0x02, 0x91, 0x3A, 0x90, 0x8E, 0x82, -0xE0, 0xB4, 0x06, 0x02, 0x91, 0x19, 0x90, 0x8E, 0x82, 0xE0, 0xB4, 0x0C, 0x07, 0x71, 0xD3, 0xBF, -0x01, 0x02, 0x91, 0x8A, 0x90, 0x8E, 0x82, 0xE0, 0x70, 0x04, 0x7F, 0x01, 0x91, 0x5D, 0x90, 0x8E, -0x82, 0xE0, 0xB4, 0x04, 0x19, 0xF1, 0xA0, 0x80, 0x15, 0x90, 0x8E, 0x82, 0xE0, 0xB4, 0x0C, 0x0E, -0x90, 0x8E, 0x7C, 0xE0, 0xFF, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x02, 0xF1, 0x95, 0x90, 0x8E, -0x82, 0xE0, 0x90, 0x01, 0xBA, 0xF0, 0x90, 0x8E, 0x81, 0xE0, 0x90, 0x01, 0xBB, 0xF0, 0xD0, 0xD0, -0x92, 0xAF, 0x22, 0x12, 0x82, 0xBB, 0xEF, 0x64, 0x01, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x01, -0xF0, 0x80, 0x2D, 0x90, 0x8E, 0x7B, 0xE0, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x08, 0x90, -0x01, 0xB8, 0x74, 0x02, 0xF0, 0x80, 0x19, 0x90, 0x8E, 0x81, 0xE0, 0xD3, 0x94, 0x04, 0x40, 0x08, -0x90, 0x01, 0xB8, 0x74, 0x08, 0xF0, 0x80, 0x08, 0x90, 0x01, 0xB8, 0xE4, 0xF0, 0x7F, 0x01, 0x22, -0x90, 0x01, 0xB9, 0x74, 0x02, 0xF0, 0x7F, 0x00, 0x22, 0x90, 0x8E, 0x7C, 0xE0, 0x90, 0x06, 0x04, -0x20, 0xE0, 0x08, 0xE0, 0x44, 0x40, 0xF0, 0x7D, 0x04, 0x80, 0x06, 0xE0, 0x54, 0x7F, 0xF0, 0x7D, -0x0C, 0x7F, 0x01, 0x91, 0xC5, 0xE4, 0xFD, 0xFF, 0x80, 0x45, 0x90, 0x8E, 0x7C, 0xE0, 0xC3, 0x13, -0x20, 0xE0, 0x04, 0x7D, 0x0C, 0x80, 0x0D, 0x90, 0x06, 0x04, 0xE0, 0x44, 0x40, 0xF0, 0xE0, 0x44, -0x80, 0xF0, 0x7D, 0x04, 0x7F, 0x01, 0x91, 0xC5, 0xE4, 0xFD, 0xFF, 0x80, 0x22, 0x90, 0x91, 0x59, -0xEF, 0xF0, 0x12, 0x5F, 0x4A, 0x90, 0x91, 0x59, 0xE0, 0x60, 0x05, 0xE4, 0xFD, 0xFF, 0x91, 0x7F, -0x7D, 0x04, 0x7F, 0x01, 0x80, 0x4F, 0xE4, 0xFD, 0x7F, 0x0C, 0x51, 0x77, 0xE4, 0xFD, 0xFF, 0x90, -0x05, 0x22, 0xEF, 0xF0, 0x90, 0x8D, 0x05, 0xED, 0xF0, 0x22, 0x90, 0x8D, 0xFA, 0xE0, 0x64, 0x01, -0x70, 0x2E, 0x90, 0x8E, 0x7C, 0xE0, 0x54, 0xFD, 0xF0, 0x7D, 0x2C, 0x7F, 0x6F, 0x91, 0x7F, 0x7D, -0x08, 0x7F, 0x01, 0xB1, 0xBC, 0xBF, 0x01, 0x0D, 0x90, 0x8E, 0x7B, 0xE0, 0x44, 0x80, 0xF0, 0x7D, -0x0E, 0x7F, 0x01, 0x80, 0x10, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, 0x04, 0xF0, -0x22, 0x7D, 0x0C, 0x7F, 0x01, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x91, 0x58, 0xEF, -0xF0, 0x14, 0x60, 0x15, 0x14, 0x60, 0x19, 0x24, 0x02, 0x70, 0x1A, 0xED, 0x54, 0x01, 0xFF, 0x90, -0x8E, 0x7B, 0xE0, 0x54, 0xFE, 0x4F, 0xF0, 0x80, 0x0C, 0x90, 0x8E, 0x82, 0xED, 0xF0, 0x80, 0x05, -0x90, 0x8E, 0x81, 0xED, 0xF0, 0x7F, 0x8F, 0x12, 0x4B, 0x14, 0xEF, 0x30, 0xE4, 0x31, 0x90, 0x91, -0x58, 0xE0, 0x14, 0x60, 0x07, 0x14, 0x60, 0x1D, 0x24, 0x02, 0x70, 0x23, 0x90, 0x8E, 0x7B, 0xE0, -0x54, 0x01, 0xC4, 0x33, 0x33, 0x33, 0x54, 0x80, 0xFF, 0x90, 0x8E, 0x82, 0xE0, 0x54, 0x7F, 0x4F, -0xFD, 0x7F, 0x88, 0x80, 0x07, 0x90, 0x8E, 0x81, 0xE0, 0xFD, 0x7F, 0x89, 0x12, 0x4C, 0x5C, 0xD0, -0xD0, 0x92, 0xAF, 0x22, 0x12, 0x5F, 0x4A, 0xE4, 0xFD, 0xFF, 0x91, 0x7F, 0x7D, 0x0C, 0x7F, 0x01, -0x80, 0x83, 0x7D, 0x2D, 0x12, 0x76, 0x40, 0x90, 0x01, 0x37, 0x74, 0x02, 0xF0, 0xFD, 0x7F, 0x03, -0x12, 0x5D, 0x38, 0x12, 0x4C, 0x7B, 0xE4, 0xFD, 0x7F, 0x01, 0x81, 0xC5, 0x90, 0x8E, 0x7F, 0xE0, -0x64, 0x01, 0x70, 0x15, 0x90, 0x8E, 0x7D, 0xE0, 0x54, 0x0F, 0x60, 0x05, 0x91, 0x76, 0x02, 0x6F, -0xAB, 0x90, 0x8E, 0x82, 0xE0, 0x70, 0x02, 0x51, 0x73, 0x22, 0xEF, 0x60, 0x3A, 0x90, 0x8D, 0xFA, -0xE0, 0x64, 0x01, 0x70, 0x32, 0x90, 0x8E, 0x7C, 0xE0, 0x54, 0xFE, 0xF0, 0x7D, 0x2B, 0x7F, 0x0F, -0x91, 0x7F, 0x90, 0x06, 0x04, 0xE0, 0x54, 0xBF, 0xF0, 0xB1, 0xB8, 0xBF, 0x01, 0x0D, 0x90, 0x8E, -0x7B, 0xE0, 0x44, 0x40, 0xF0, 0x7D, 0x06, 0x7F, 0x01, 0x81, 0xC5, 0x90, 0x01, 0xB9, 0x74, 0x01, -0xF0, 0x90, 0x01, 0xB8, 0x74, 0x08, 0xF0, 0x22, 0x7D, 0x08, 0xE4, 0xFF, 0xD3, 0x10, 0xAF, 0x01, -0xC3, 0xC0, 0xD0, 0x90, 0x91, 0x28, 0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0x90, 0x8D, 0x03, 0xE0, 0x04, -0xF0, 0x90, 0x04, 0x1D, 0xE0, 0x60, 0x22, 0x90, 0x05, 0x22, 0xE0, 0x90, 0x91, 0x2C, 0xF0, 0x7D, -0x26, 0x12, 0x76, 0x40, 0xEF, 0x64, 0x01, 0x70, 0x03, 0x12, 0x7D, 0x38, 0x90, 0x91, 0x2C, 0xE0, -0xFF, 0x7D, 0x27, 0x91, 0x7F, 0xD1, 0x0B, 0x80, 0x05, 0xD1, 0x0B, 0x12, 0x7D, 0x38, 0x90, 0x04, -0x1F, 0x74, 0x20, 0xF0, 0x7F, 0x01, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x91, 0x28, 0xE0, 0xFF, -0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x91, 0x57, 0xEF, 0xF0, 0x90, 0x8D, 0x09, 0xE0, -0xFF, 0x90, 0x04, 0x1C, 0xE0, 0x6F, 0x70, 0x4B, 0x90, 0x8E, 0x82, 0xE0, 0x64, 0x0E, 0x70, 0x18, -0x90, 0x91, 0x57, 0xE0, 0x70, 0x3D, 0x90, 0x8E, 0x7B, 0xE0, 0x54, 0x7F, 0xF0, 0x90, 0x06, 0x04, -0xE0, 0x54, 0x7F, 0xF0, 0x91, 0xC1, 0x80, 0x26, 0x90, 0x8E, 0x82, 0xE0, 0x64, 0x06, 0x70, 0x23, -0x90, 0x91, 0x57, 0xE0, 0x60, 0x1D, 0x90, 0x8E, 0x7B, 0xE0, 0x54, 0xBF, 0xF0, 0x90, 0x06, 0x04, -0xE0, 0x44, 0x40, 0xF0, 0xE0, 0x44, 0x80, 0xF0, 0x90, 0x8E, 0x82, 0x74, 0x04, 0xF0, 0xE4, 0xFD, -0xFF, 0x91, 0x7F, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x12, 0x6F, 0xAB, 0x90, 0x8E, 0x82, 0xE0, 0x64, -0x0C, 0x60, 0x04, 0x91, 0x76, 0xB1, 0xB8, 0x22, 0xE4, 0x90, 0x8E, 0x7F, 0xF0, 0xA3, 0xF0, 0x90, -0x8E, 0x7D, 0xE0, 0x54, 0x0F, 0xF0, 0xA3, 0x74, 0x02, 0xF0, 0x90, 0x8E, 0x7D, 0xE0, 0x54, 0xF0, -0xF0, 0x90, 0x8E, 0x7B, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0xEF, 0xF0, 0x54, 0xF7, 0xF0, 0x90, 0x8E, -0x85, 0x74, 0x01, 0xF0, 0xA3, 0xF0, 0x90, 0x8E, 0x7B, 0xE0, 0x54, 0xFB, 0xF0, 0xA3, 0xE0, 0x54, -0xFB, 0xF0, 0xE4, 0x90, 0x8E, 0x88, 0xF0, 0x90, 0x8E, 0x87, 0x74, 0x08, 0xF0, 0x90, 0x8E, 0x8A, -0xE4, 0xF0, 0xA3, 0x74, 0x02, 0xF0, 0xE4, 0x90, 0x8E, 0x83, 0xF0, 0x90, 0x8E, 0x7B, 0xE0, 0x54, -0xDF, 0xF0, 0xE4, 0xFD, 0xFF, 0x91, 0xC5, 0x7D, 0x0C, 0x7F, 0x02, 0x91, 0xC5, 0x91, 0xC1, 0x90, -0x8E, 0x7B, 0xE0, 0x54, 0xBF, 0xF0, 0x54, 0x7F, 0xF0, 0xA3, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0xFD, -0xF0, 0x54, 0xF7, 0xF0, 0x90, 0x8E, 0x8C, 0x12, 0x08, 0x79, 0x00, 0x00, 0x00, 0x00, 0xE4, 0x90, -0x8E, 0xAA, 0xF0, 0x90, 0x8E, 0x90, 0xF0, 0x90, 0x8D, 0x06, 0xE0, 0xB4, 0x01, 0x08, 0x90, 0x8E, -0x89, 0x74, 0xDD, 0xF0, 0x80, 0x12, 0x90, 0x8D, 0x06, 0xE0, 0x90, 0x8E, 0x89, 0xB4, 0x03, 0x05, -0x74, 0xD5, 0xF0, 0x80, 0x03, 0x74, 0x40, 0xF0, 0x90, 0x8E, 0xAB, 0x74, 0x05, 0xF0, 0xA3, 0xF0, -0xA3, 0xE0, 0x54, 0x01, 0x44, 0x28, 0xF0, 0xA3, 0x74, 0x05, 0xF0, 0xE4, 0x90, 0x8E, 0x91, 0xF0, -0x90, 0x8E, 0xAA, 0xE0, 0x24, 0x04, 0x90, 0x8E, 0x94, 0xF0, 0xA3, 0x74, 0x08, 0xF0, 0xE4, 0xA3, -0xF0, 0x90, 0x8E, 0xAF, 0xF0, 0xA3, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0xFD, 0xF0, 0x54, 0xFB, 0xF0, -0x54, 0xF7, 0xF0, 0x54, 0xEF, 0xF0, 0x54, 0xDF, 0xF0, 0x54, 0xBF, 0xF0, 0x90, 0x06, 0x04, 0xE0, -0x54, 0x7F, 0xF0, 0x90, 0x06, 0x0A, 0xE0, 0x54, 0xF8, 0xF0, 0xE4, 0xFD, 0xFF, 0x91, 0x7F, 0xE4, -0x90, 0x8E, 0xB1, 0xF0, 0x22, 0x7D, 0x2F, 0x12, 0x4C, 0x76, 0x7D, 0x08, 0x7F, 0x01, 0x81, 0xC5, -0x7D, 0x2E, 0x7F, 0x6F, 0x91, 0x7F, 0x7D, 0x02, 0x7F, 0x01, 0x81, 0xC5, 0x90, 0x06, 0x04, 0xE0, -0x54, 0x7F, 0xF0, 0xE4, 0xFD, 0xFF, 0x91, 0x7F, 0x7D, 0x0C, 0x7F, 0x01, 0x81, 0xC5, 0x90, 0x8E, -0x7F, 0xE0, 0x60, 0x02, 0xB1, 0x5C, 0x22, 0xE4, 0xFD, 0xFF, 0x91, 0x7F, 0x7D, 0x04, 0x7F, 0x01, -0x81, 0xC5, 0x90, 0x8D, 0xFA, 0xE0, 0xB4, 0x01, 0x15, 0x90, 0x8E, 0x7F, 0xE0, 0x60, 0x0F, 0x90, -0x8E, 0x7D, 0xE0, 0x54, 0x0F, 0x64, 0x02, 0x60, 0x03, 0x02, 0x6E, 0xB2, 0xD1, 0x78, 0x22, 0x90, -0x07, 0x1F, 0xE0, 0x54, 0x7F, 0xF0, 0x90, 0x07, 0x1C, 0xE0, 0x54, 0x01, 0xFF, 0x90, 0x90, 0x9B, -0xF0, 0x90, 0x90, 0x99, 0x74, 0x02, 0xF0, 0x90, 0x90, 0xA7, 0x14, 0xF0, 0xFB, 0x7A, 0x90, 0x79, -0x99, 0x11, 0x63, 0x7F, 0x04, 0x90, 0x91, 0x55, 0xEF, 0xF0, 0x7F, 0x02, 0x12, 0x47, 0x57, 0x90, -0x8D, 0x01, 0xE0, 0xFF, 0x90, 0x91, 0x55, 0xE0, 0xFE, 0xEF, 0x4E, 0x90, 0x8D, 0x01, 0xF0, 0x22, -0x90, 0x8F, 0xF6, 0x74, 0x12, 0xF0, 0x90, 0x90, 0x04, 0x74, 0x05, 0xF0, 0x90, 0x8F, 0xF8, 0xEF, -0xF0, 0xA3, 0xED, 0xF0, 0xA3, 0xEB, 0xF0, 0x90, 0x8F, 0xF4, 0xE0, 0x90, 0x8F, 0xFB, 0xF0, 0x90, -0x8F, 0xF5, 0xE0, 0x90, 0x8F, 0xFC, 0xF0, 0x7B, 0x01, 0x7A, 0x8F, 0x79, 0xF6, 0x11, 0x63, 0x7F, -0x04, 0x80, 0xB2, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x8D, 0xF5, 0xE0, 0xFF, 0x70, -0x06, 0xA3, 0xE0, 0x64, 0x09, 0x60, 0x0A, 0xEF, 0x14, 0xFF, 0x90, 0x8D, 0xF6, 0xE0, 0xB5, 0x07, -0x04, 0x7F, 0x01, 0x80, 0x02, 0x7F, 0x00, 0xEF, 0x60, 0x09, 0x90, 0x01, 0xC1, 0xE0, 0x44, 0x02, -0xF0, 0x80, 0x35, 0xC0, 0x01, 0x90, 0x8D, 0xF6, 0xE0, 0x75, 0xF0, 0x0F, 0xA4, 0x24, 0x5F, 0xF9, -0x74, 0x8D, 0x35, 0xF0, 0xA8, 0x01, 0xFC, 0x7D, 0x01, 0xD0, 0x01, 0x7E, 0x00, 0x7F, 0x0F, 0x12, -0x06, 0x63, 0x90, 0x8D, 0xF6, 0xE0, 0x04, 0xF0, 0xE0, 0x7F, 0x00, 0xB4, 0x0A, 0x02, 0x7F, 0x01, -0xEF, 0x60, 0x05, 0xE4, 0x90, 0x8D, 0xF6, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x7B, 0x01, 0x7A, -0x8F, 0x79, 0xEB, 0x7F, 0xF5, 0x7E, 0x01, 0x12, 0x34, 0xBC, 0xBF, 0x01, 0x06, 0x90, 0x8F, 0xEB, -0xE0, 0xA3, 0xF0, 0x7B, 0x01, 0x7A, 0x8F, 0x79, 0xEB, 0x7F, 0xF6, 0x7E, 0x01, 0x12, 0x34, 0xBC, -0xBF, 0x01, 0x08, 0x90, 0x8F, 0xEB, 0xE0, 0x90, 0x8F, 0xED, 0xF0, 0x7B, 0x01, 0x7A, 0x8F, 0x79, -0xEB, 0x7F, 0xF4, 0x7E, 0x01, 0x12, 0x34, 0xBC, 0xBF, 0x01, 0x08, 0x90, 0x8F, 0xEB, 0xE0, 0x90, -0x8F, 0xEE, 0xF0, 0x7B, 0x01, 0x7A, 0x8F, 0x79, 0xEB, 0x7F, 0xF3, 0x7E, 0x01, 0x12, 0x34, 0xBC, -0xBF, 0x01, 0x08, 0x90, 0x8F, 0xEB, 0xE0, 0x90, 0x8F, 0xEF, 0xF0, 0x7B, 0x01, 0x7A, 0x8F, 0x79, -0xEB, 0x7F, 0xF2, 0x7E, 0x01, 0x12, 0x34, 0xBC, 0xBF, 0x01, 0x08, 0x90, 0x8F, 0xEB, 0xE0, 0x90, -0x8F, 0xF0, 0xF0, 0x90, 0x8F, 0xEC, 0xE0, 0xFF, 0xA3, 0xE0, 0xFD, 0xA3, 0xE0, 0xFB, 0xA3, 0xE0, -0x90, 0x8F, 0xF4, 0xF0, 0x90, 0x8F, 0xF0, 0xE0, 0x90, 0x8F, 0xF5, 0xF0, 0x01, 0x30, 0x12, 0x06, -0x89, 0xFF, 0x90, 0x8D, 0xF9, 0xF0, 0xBF, 0x01, 0x07, 0x11, 0xCD, 0xE4, 0x90, 0x8D, 0xF9, 0xF0, -0x22, 0x90, 0x8F, 0xE8, 0x12, 0x48, 0x20, 0x90, 0x8F, 0xE7, 0xEF, 0xF0, 0x12, 0x48, 0x29, 0x59, -0xB3, 0x00, 0x59, 0xBC, 0x01, 0x59, 0xC4, 0x02, 0x59, 0xCD, 0x03, 0x59, 0xD6, 0x04, 0x59, 0xDE, -0x12, 0x59, 0xE6, 0x14, 0x59, 0xEF, 0x20, 0x59, 0xF8, 0x21, 0x5A, 0x01, 0x23, 0x5A, 0x0A, 0x25, -0x5A, 0x1B, 0x80, 0x5A, 0x13, 0x81, 0x5A, 0x24, 0x82, 0x5A, 0x2D, 0x83, 0x5A, 0x36, 0x84, 0x00, -0x00, 0x5A, 0x3F, 0x90, 0x8F, 0xE8, 0x12, 0x48, 0x17, 0x02, 0x70, 0x05, 0x90, 0x8F, 0xE8, 0x12, -0x48, 0x17, 0x41, 0xDF, 0x90, 0x8F, 0xE8, 0x12, 0x48, 0x17, 0x02, 0x70, 0x51, 0x90, 0x8F, 0xE8, -0x12, 0x48, 0x17, 0x02, 0x83, 0xEF, 0x90, 0x8F, 0xE8, 0x12, 0x48, 0x17, 0x80, 0x71, 0x90, 0x8F, -0xE8, 0x12, 0x48, 0x17, 0x21, 0x5E, 0x90, 0x8F, 0xE8, 0x12, 0x48, 0x17, 0x02, 0x70, 0x94, 0x90, -0x8F, 0xE8, 0x12, 0x48, 0x17, 0x02, 0x70, 0xBF, 0x90, 0x8F, 0xE8, 0x12, 0x48, 0x17, 0x02, 0x72, -0x2F, 0x90, 0x8F, 0xE8, 0x12, 0x48, 0x17, 0x02, 0x72, 0x73, 0x90, 0x8F, 0xE8, 0x12, 0x48, 0x17, -0x02, 0x72, 0x7B, 0x90, 0x8F, 0xE8, 0x12, 0x48, 0x17, 0x61, 0x5B, 0x90, 0x8F, 0xE8, 0x12, 0x48, -0x17, 0x02, 0x4D, 0x8E, 0x90, 0x8F, 0xE8, 0x12, 0x48, 0x17, 0x02, 0x87, 0xD6, 0x90, 0x8F, 0xE8, -0x12, 0x48, 0x17, 0x02, 0x87, 0xF0, 0x90, 0x8F, 0xE8, 0x12, 0x48, 0x17, 0x02, 0x88, 0x45, 0x90, -0x01, 0xC0, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x8F, 0xE7, 0xE0, 0x90, 0x01, 0xC2, 0xF0, 0x22, 0xB1, -0x81, 0x12, 0x06, 0x89, 0xFF, 0x54, 0x01, 0xFE, 0x90, 0x8F, 0xDB, 0xE0, 0x54, 0xFE, 0x4E, 0xF0, -0xEF, 0xC3, 0x13, 0x30, 0xE0, 0x14, 0x90, 0x00, 0x01, 0x12, 0x06, 0xA2, 0x90, 0x8F, 0xDC, 0xF0, -0x90, 0x00, 0x02, 0x12, 0x06, 0xA2, 0x90, 0x8F, 0xDD, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, -0xC0, 0xD0, 0x90, 0x8D, 0x5E, 0xE0, 0xFF, 0x90, 0x8D, 0x5D, 0xE0, 0xB5, 0x07, 0x04, 0x7F, 0x01, -0x80, 0x02, 0x7F, 0x00, 0xEF, 0x70, 0x43, 0x90, 0x8D, 0x5D, 0xE0, 0xFE, 0x75, 0xF0, 0x08, 0x90, -0x8D, 0x0D, 0x12, 0x48, 0x0B, 0xE0, 0xFD, 0xEE, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x0E, 0xF9, 0x74, -0x8D, 0x35, 0xF0, 0xFA, 0x7B, 0x01, 0xAF, 0x05, 0x31, 0x71, 0x90, 0x8D, 0x5D, 0xE0, 0x04, 0xF0, -0xE0, 0x7F, 0x00, 0xB4, 0x0A, 0x02, 0x7F, 0x01, 0xEF, 0x60, 0x05, 0xE4, 0x90, 0x8D, 0x5D, 0xF0, -0x12, 0x6C, 0xB7, 0x90, 0x8D, 0x01, 0xE0, 0x44, 0x02, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x8B, -0x51, 0x8A, 0x52, 0x89, 0x53, 0x90, 0x00, 0x01, 0x12, 0x06, 0xA2, 0xFF, 0xF5, 0x55, 0x12, 0x06, -0x89, 0xFE, 0xC3, 0x13, 0x30, 0xE0, 0x0A, 0x90, 0x00, 0x02, 0x12, 0x06, 0xA2, 0xF5, 0x56, 0x80, -0x02, 0x8F, 0x56, 0x85, 0x55, 0x54, 0xE5, 0x54, 0xD3, 0x95, 0x56, 0x50, 0x35, 0xAB, 0x51, 0xAA, -0x52, 0xA9, 0x53, 0x12, 0x06, 0x89, 0x54, 0x01, 0xFF, 0x74, 0xFA, 0x25, 0x54, 0xF5, 0x82, 0xE4, -0x34, 0x8D, 0xF5, 0x83, 0xEF, 0xF0, 0x74, 0xFA, 0x25, 0x54, 0xF5, 0x82, 0xE4, 0x34, 0x8D, 0xF5, -0x83, 0xE0, 0xAF, 0x54, 0x70, 0x05, 0x12, 0x72, 0xAA, 0x80, 0x03, 0x12, 0x72, 0x99, 0x05, 0x54, -0x80, 0xC4, 0x90, 0x8D, 0xFA, 0xE0, 0x70, 0x12, 0xF1, 0x4A, 0x12, 0x57, 0xAC, 0x90, 0x8E, 0x7B, -0xE0, 0x54, 0xF7, 0xF0, 0x54, 0xBF, 0xF0, 0x54, 0x7F, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, -0xC0, 0xD0, 0x12, 0x06, 0x89, 0xFF, 0x54, 0x01, 0xFE, 0x90, 0x8E, 0xB2, 0xE0, 0x54, 0xFE, 0x4E, -0xFE, 0xF0, 0xEF, 0x54, 0x02, 0xFF, 0xEE, 0x54, 0xFD, 0x4F, 0xFF, 0xF0, 0x12, 0x06, 0x89, 0xFE, -0x54, 0x04, 0xFD, 0xEF, 0x54, 0xFB, 0x4D, 0xFF, 0x90, 0x8E, 0xB2, 0xF0, 0xEE, 0x54, 0x08, 0xFE, -0xEF, 0x54, 0xF7, 0x4E, 0xFF, 0xF0, 0x12, 0x06, 0x89, 0xFE, 0x54, 0x10, 0xFD, 0xEF, 0x54, 0xEF, -0x4D, 0xFF, 0x90, 0x8E, 0xB2, 0xF0, 0xEE, 0x54, 0x20, 0xFE, 0xEF, 0x54, 0xDF, 0x4E, 0xFF, 0xF0, -0x12, 0x06, 0x89, 0xFE, 0x54, 0x40, 0xFD, 0xEF, 0x54, 0xBF, 0x4D, 0xFF, 0x90, 0x8E, 0xB2, 0xF0, -0xEE, 0x54, 0x80, 0xFE, 0xEF, 0x54, 0x7F, 0x4E, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x06, 0xA2, 0x54, -0x01, 0xFF, 0x90, 0x8E, 0xB4, 0xE0, 0x54, 0xFE, 0x4F, 0xF0, 0x90, 0x01, 0x17, 0xE0, 0xFE, 0x90, -0x01, 0x16, 0xE0, 0x7C, 0x00, 0x24, 0x00, 0xFF, 0xEC, 0x3E, 0x90, 0x8D, 0xF7, 0xF0, 0xA3, 0xEF, -0xF0, 0x90, 0x04, 0x8F, 0xE0, 0x90, 0x8E, 0xCE, 0xF0, 0x90, 0x8E, 0xB2, 0xE0, 0xC3, 0x13, 0x54, -0x01, 0xFF, 0x91, 0x34, 0x90, 0x8E, 0xB2, 0xE0, 0x13, 0x13, 0x54, 0x01, 0xFF, 0xF1, 0xE8, 0x90, -0x8E, 0xB2, 0xE0, 0x13, 0x13, 0x13, 0x54, 0x01, 0xFF, 0x91, 0x3F, 0x90, 0x8E, 0xB2, 0xE0, 0xC4, -0x54, 0x01, 0xFF, 0x12, 0x88, 0xDF, 0x90, 0x8E, 0xB2, 0xE0, 0x54, 0x01, 0xFF, 0x91, 0x9A, 0xD0, -0xD0, 0x92, 0xAF, 0x22, 0xEF, 0x60, 0x07, 0x90, 0x8F, 0xCA, 0xE0, 0xFF, 0xB1, 0xBE, 0x22, 0xE4, -0xFD, 0xFC, 0xEF, 0x60, 0x54, 0x90, 0x8F, 0xCD, 0xE0, 0xFF, 0xB1, 0xB6, 0x7C, 0x00, 0xAD, 0x07, -0x74, 0x00, 0x2F, 0xF9, 0xE4, 0x34, 0xFC, 0xFA, 0x7B, 0x01, 0x90, 0x8F, 0xEB, 0x12, 0x48, 0x20, -0x90, 0x8F, 0xEB, 0x12, 0x48, 0x17, 0x8B, 0x40, 0x8A, 0x41, 0x89, 0x42, 0x75, 0x43, 0x40, 0x7B, -0x01, 0x7A, 0x8E, 0x79, 0xED, 0x12, 0x35, 0x85, 0xE4, 0xFD, 0x7F, 0x03, 0x12, 0x30, 0xC9, 0x90, -0x8F, 0xCE, 0xE0, 0xFE, 0xE4, 0x78, 0x03, 0xCE, 0xC3, 0x13, 0xCE, 0x13, 0xD8, 0xF9, 0xFF, 0x12, -0x3A, 0x35, 0x7D, 0x01, 0x7F, 0x03, 0x12, 0x30, 0xC9, 0x22, 0xEF, 0x60, 0x53, 0x90, 0x8F, 0xC9, -0xE0, 0xFF, 0x60, 0x02, 0xB1, 0x98, 0x90, 0x01, 0xC7, 0xE4, 0xF0, 0x90, 0x01, 0x17, 0xE0, 0xFE, -0x90, 0x01, 0x16, 0xE0, 0x7C, 0x00, 0x24, 0x00, 0xFF, 0xEC, 0x3E, 0x90, 0x8D, 0xF7, 0xF0, 0xA3, -0xEF, 0xF0, 0x90, 0x06, 0x09, 0xE0, 0x54, 0xFE, 0xF0, 0x7D, 0x35, 0x12, 0x4C, 0x76, 0x90, 0x02, -0x86, 0xE0, 0x44, 0x04, 0xF0, 0x12, 0x85, 0x14, 0xF1, 0xE0, 0xF1, 0x4A, 0xE4, 0xFD, 0xFF, 0x12, -0x54, 0x7F, 0x12, 0x88, 0xA7, 0x90, 0x01, 0x34, 0x74, 0x08, 0xF0, 0xFD, 0xE4, 0xFF, 0x80, 0x48, -0x7D, 0x08, 0xE4, 0xFF, 0xD1, 0x5F, 0x90, 0x06, 0x90, 0xE0, 0x54, 0xF0, 0xF0, 0x90, 0x02, 0x86, -0xE0, 0x54, 0xFB, 0xF0, 0x12, 0x85, 0xF4, 0xF1, 0xE1, 0x90, 0x8E, 0xB2, 0xE0, 0x54, 0xFE, 0xF0, -0x90, 0x8E, 0xBA, 0xE0, 0x54, 0xFE, 0xF0, 0xE4, 0x90, 0x8E, 0xC7, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, -0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x20, 0xF0, 0x12, -0x85, 0xA8, 0xE4, 0x90, 0x8E, 0xCE, 0xF0, 0x22, 0x74, 0x15, 0x2F, 0xF8, 0xE6, 0x4D, 0xFE, 0xF6, -0x74, 0x30, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0xF1, 0xAE, 0x90, -0x8E, 0x85, 0xE0, 0x14, 0x90, 0x05, 0x73, 0xF0, 0x7D, 0x02, 0x7F, 0x02, 0x80, 0xDA, 0xF1, 0xE2, -0x12, 0x72, 0x8B, 0x12, 0x56, 0x88, 0xB1, 0x09, 0x12, 0x83, 0xD8, 0xB1, 0x81, 0x90, 0x8F, 0xE1, -0xE0, 0x54, 0x7F, 0xF0, 0x54, 0xBF, 0xF0, 0x54, 0xDF, 0xF0, 0x54, 0xF0, 0xF0, 0xE4, 0xA3, 0xF0, -0x22, 0x90, 0x8F, 0xDB, 0xE0, 0x54, 0xFE, 0xF0, 0xA3, 0x74, 0x08, 0xF0, 0xA3, 0x74, 0x03, 0xF0, -0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x22, 0xB1, 0xB6, 0x7E, 0x00, 0x74, 0x00, 0x2F, 0xF9, -0xE4, 0x34, 0xFC, 0x75, 0x40, 0x01, 0xF5, 0x41, 0x89, 0x42, 0x75, 0x43, 0x08, 0x7B, 0x01, 0x7A, -0x8E, 0x79, 0xE3, 0x02, 0x35, 0x85, 0x90, 0xFD, 0x10, 0xEF, 0xF0, 0x7F, 0x00, 0x22, 0xB1, 0xB6, -0x7E, 0x00, 0x90, 0x8F, 0xEB, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xF1, 0x7D, 0x90, 0x8F, 0xED, 0xEF, -0xF0, 0x90, 0x8F, 0xEB, 0xA3, 0xE0, 0x24, 0x38, 0xF9, 0xE4, 0x34, 0xFC, 0x75, 0x40, 0x01, 0xF5, -0x41, 0x89, 0x42, 0x75, 0x43, 0x06, 0x7B, 0x01, 0x7A, 0x8E, 0x79, 0xCF, 0x12, 0x35, 0x85, 0x90, -0x8F, 0xEB, 0xA3, 0xE0, 0xFF, 0xA3, 0xE0, 0x2F, 0x24, 0x3E, 0xF9, 0xE4, 0x34, 0xFC, 0x75, 0x40, -0x01, 0xF5, 0x41, 0x89, 0x42, 0x75, 0x43, 0x04, 0x7B, 0x01, 0x7A, 0x8E, 0x79, 0xD5, 0x12, 0x35, -0x85, 0x90, 0x8F, 0xEB, 0xA3, 0xE0, 0xFF, 0xA3, 0xE0, 0x2F, 0x24, 0x42, 0xF9, 0xE4, 0x34, 0xFC, -0x75, 0x40, 0x01, 0xF5, 0x41, 0x89, 0x42, 0x75, 0x43, 0x06, 0x7B, 0x01, 0x7A, 0x8E, 0x79, 0xD9, -0x12, 0x35, 0x85, 0x90, 0x8F, 0xEB, 0xA3, 0xE0, 0xFF, 0xA3, 0xE0, 0x2F, 0x24, 0x48, 0xF9, 0xE4, -0x34, 0xFC, 0x75, 0x40, 0x01, 0xF5, 0x41, 0x89, 0x42, 0x75, 0x43, 0x04, 0x7B, 0x01, 0x7A, 0x8E, -0x79, 0xDF, 0x02, 0x35, 0x85, 0x7D, 0x02, 0x7F, 0x02, 0xD1, 0x5F, 0x7D, 0x01, 0x7F, 0x02, 0x74, -0x15, 0x2F, 0xF8, 0xE6, 0xFE, 0xED, 0xF4, 0x5E, 0xFE, 0xF6, 0x74, 0x30, 0x2F, 0xF5, 0x82, 0xE4, -0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0x90, 0x8F, 0xE0, 0xE0, 0x04, 0xF0, 0x90, 0x8E, 0x82, -0xE0, 0x64, 0x02, 0x60, 0x2A, 0x12, 0x6E, 0xD3, 0x90, 0x8E, 0x7C, 0xE0, 0x13, 0x13, 0x13, 0x54, -0x1F, 0x30, 0xE0, 0x15, 0x90, 0x8E, 0x85, 0xE0, 0xFF, 0xA3, 0xE0, 0x6F, 0x70, 0x0B, 0x12, 0x6F, -0x87, 0xD1, 0x55, 0x90, 0x8E, 0x86, 0xE0, 0x14, 0xF0, 0x90, 0x01, 0xE6, 0xE0, 0x04, 0xF0, 0x22, -0xEF, 0x70, 0x4E, 0x7D, 0x78, 0x7F, 0x02, 0xD1, 0x5F, 0x7D, 0x02, 0x7F, 0x03, 0xD1, 0x5F, 0x7D, -0xC8, 0x7F, 0x02, 0x12, 0x7F, 0x6F, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x02, -0xF0, 0x90, 0x8D, 0xFA, 0xE0, 0x70, 0x14, 0xF1, 0x4A, 0x12, 0x57, 0xAC, 0x90, 0x8E, 0x7B, 0xE0, -0x54, 0xF7, 0xF0, 0x54, 0xBF, 0xF0, 0x54, 0x7F, 0xF0, 0x80, 0x07, 0x7D, 0x01, 0x7F, 0x0C, 0x12, -0x52, 0x77, 0x90, 0x8E, 0x7B, 0xE0, 0x54, 0xF7, 0xF0, 0x90, 0x06, 0x0A, 0xE0, 0x54, 0xF8, 0xF0, -0x22, 0x90, 0x01, 0x36, 0x74, 0x78, 0xF0, 0xA3, 0x74, 0x02, 0xF0, 0x7D, 0x78, 0xFF, 0xB1, 0x38, -0x7D, 0x02, 0x7F, 0x03, 0xB1, 0x38, 0x90, 0x06, 0x0A, 0xE0, 0x44, 0x07, 0xF0, 0x90, 0x8E, 0x8A, -0xA3, 0xE0, 0x90, 0x05, 0x58, 0xF0, 0x90, 0x8D, 0xFA, 0xE0, 0xB4, 0x01, 0x15, 0x90, 0x8E, 0x7C, -0xE0, 0x54, 0xFB, 0xF0, 0x90, 0x8E, 0x82, 0xE0, 0x20, 0xE2, 0x0E, 0x7D, 0x01, 0x7F, 0x04, 0x02, -0x52, 0x77, 0x90, 0x8E, 0x7C, 0xE0, 0x44, 0x04, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, -0xD0, 0x90, 0x01, 0x01, 0xE0, 0x44, 0x02, 0xF0, 0x90, 0x01, 0x00, 0x74, 0xFF, 0xF0, 0x90, 0x06, -0xB7, 0x74, 0x09, 0xF0, 0x90, 0x06, 0xB4, 0x74, 0x86, 0xF0, 0x7F, 0x02, 0x12, 0x4B, 0x14, 0xEF, -0x44, 0x01, 0xFD, 0x7F, 0x02, 0x12, 0x4C, 0x5C, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xFE, 0x24, 0x28, -0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0xFF, 0x74, 0x2C, 0x2E, 0xF5, 0x82, 0xE4, 0x34, -0xFC, 0xF5, 0x83, 0xE0, 0xFD, 0xE4, 0xFE, 0xEF, 0x30, 0xE7, 0x04, 0x7C, 0x02, 0x80, 0x02, 0xE4, -0xFC, 0xAF, 0x05, 0x12, 0x77, 0x30, 0xAE, 0x07, 0xEC, 0x24, 0x18, 0x2E, 0xFF, 0x22, 0x90, 0x8E, -0x7F, 0xE0, 0x60, 0x2B, 0x90, 0x8D, 0xFA, 0xE0, 0x64, 0x01, 0x70, 0x23, 0x90, 0x8E, 0x86, 0xF0, -0x04, 0x60, 0x1C, 0x90, 0x8E, 0x83, 0xE0, 0x44, 0x10, 0xF0, 0xE4, 0x90, 0x91, 0x20, 0xF0, 0x90, -0x8E, 0x87, 0x12, 0x6E, 0x12, 0x90, 0x8E, 0x82, 0xE0, 0x20, 0xE2, 0x03, 0x12, 0x52, 0x73, 0x22, -0x22, 0x22, 0xE4, 0x90, 0x8D, 0xFA, 0xF0, 0x22, 0x90, 0x8F, 0xEB, 0xEF, 0xF0, 0x22, 0x75, 0xE8, -0x03, 0x75, 0xA8, 0x85, 0x22, 0xE4, 0x90, 0x8F, 0xE6, 0xF0, 0x90, 0x8F, 0xE6, 0xE0, 0x64, 0x01, -0xF0, 0x24, 0xF5, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x5F, 0xA3, 0xF0, 0x12, 0x3E, 0x7B, 0xBF, 0x01, -0x03, 0x12, 0x31, 0xF7, 0x90, 0x8E, 0x7F, 0xE0, 0x60, 0x0E, 0x90, 0x8E, 0x82, 0xE0, 0xFF, 0x90, -0x8E, 0x81, 0xE0, 0x6F, 0x60, 0x02, 0x11, 0x5F, 0xC2, 0xAF, 0x12, 0x73, 0x3F, 0xBF, 0x01, 0x02, -0x11, 0x3C, 0xD2, 0xAF, 0x12, 0x4A, 0x8F, 0x12, 0x45, 0x7D, 0x80, 0xBE, 0x90, 0x8E, 0x7B, 0xE0, -0x30, 0xE0, 0x02, 0x11, 0x46, 0x22, 0x90, 0x8E, 0x82, 0xE0, 0xFF, 0x60, 0x03, 0xB4, 0x08, 0x0E, -0x12, 0x83, 0x78, 0xBF, 0x01, 0x08, 0xF1, 0xD5, 0x90, 0x01, 0xE5, 0xE0, 0x04, 0xF0, 0x22, 0x90, -0x8E, 0x81, 0xE0, 0xFF, 0x7D, 0x01, 0x02, 0x52, 0x77, 0x90, 0x8E, 0x7F, 0xE0, 0x60, 0x13, 0x90, -0x06, 0x92, 0xE0, 0x30, 0xE1, 0x03, 0x02, 0x6F, 0xAB, 0x90, 0x8E, 0x7B, 0xE0, 0x54, 0xF7, 0xF0, -0x11, 0x5F, 0x22, 0x90, 0x8E, 0x7B, 0xE0, 0xFF, 0xC4, 0x13, 0x13, 0x54, 0x03, 0x30, 0xE0, 0x26, -0xEF, 0x54, 0xBF, 0xF0, 0x90, 0x04, 0xE0, 0xE0, 0x90, 0x8E, 0x7C, 0x30, 0xE0, 0x06, 0xE0, 0x44, -0x01, 0xF0, 0x80, 0x10, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, -0xB8, 0x74, 0x04, 0xF0, 0x11, 0x5F, 0xE4, 0xFF, 0x90, 0x8F, 0xDB, 0xE0, 0x30, 0xE0, 0x4A, 0x90, -0x8F, 0xDF, 0xE0, 0xFD, 0x60, 0x43, 0x74, 0x01, 0x7E, 0x00, 0xA8, 0x07, 0x08, 0x80, 0x05, 0xC3, -0x33, 0xCE, 0x33, 0xCE, 0xD8, 0xF9, 0xFF, 0x90, 0x04, 0xE0, 0xE0, 0xFB, 0xEF, 0x5B, 0x60, 0x06, -0xE4, 0x90, 0x8F, 0xDF, 0xF0, 0x22, 0x90, 0x8F, 0xDD, 0xE0, 0xD3, 0x9D, 0x50, 0x12, 0x90, 0x01, -0xC7, 0x74, 0x10, 0xF0, 0x7F, 0x01, 0x31, 0x0A, 0x90, 0x8F, 0xDB, 0xE0, 0x54, 0xFE, 0xF0, 0x22, -0x12, 0x55, 0xB8, 0x90, 0x8F, 0xDF, 0xE0, 0x04, 0xF0, 0x22, 0x90, 0x91, 0x5B, 0xEF, 0xF0, 0x90, -0x8D, 0x06, 0xE0, 0x64, 0x02, 0x70, 0x1F, 0x90, 0x91, 0x5B, 0xE0, 0xFF, 0x64, 0x01, 0x70, 0x25, -0x90, 0x8E, 0xB6, 0xE0, 0xFE, 0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x14, 0x90, 0x01, -0x4D, 0xE0, 0x64, 0x80, 0xF0, 0x22, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x91, 0x5B, -0xE0, 0xFF, 0x12, 0x4E, 0xE6, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x06, 0x31, -0xE0, 0x54, 0xEF, 0x44, 0x08, 0xF0, 0xED, 0x2F, 0xFF, 0xE4, 0x3E, 0xFE, 0x7C, 0x00, 0xEF, 0x24, -0x08, 0xFF, 0xEC, 0x3E, 0x90, 0x8F, 0xF0, 0xF0, 0xA3, 0xEF, 0xF0, 0x7E, 0x00, 0x7F, 0x83, 0x7D, -0x00, 0x7B, 0x01, 0x7A, 0x8F, 0x79, 0x2D, 0x12, 0x08, 0xAA, 0x90, 0x8F, 0xF1, 0xE0, 0x24, 0x01, -0xFF, 0x90, 0x8F, 0xF0, 0xE0, 0x34, 0x00, 0xFE, 0xE4, 0xFD, 0x51, 0xD9, 0x90, 0x8F, 0x2E, 0xEF, -0xF0, 0x90, 0x8F, 0xF1, 0xE0, 0x24, 0x04, 0xFF, 0x90, 0x8F, 0xF0, 0xE0, 0x34, 0x00, 0xFE, 0xE4, -0xFD, 0x51, 0xD9, 0x90, 0x8F, 0x31, 0xEF, 0xF0, 0x90, 0x8F, 0xF1, 0xE0, 0x24, 0x05, 0xFF, 0x90, -0x8F, 0xF0, 0xE0, 0x34, 0x00, 0xFE, 0xE4, 0xFD, 0x51, 0xD9, 0x90, 0x8F, 0x32, 0xEF, 0xF0, 0x90, -0x8F, 0xF1, 0xE0, 0x24, 0x06, 0xFF, 0x90, 0x8F, 0xF0, 0xE0, 0x34, 0x00, 0xFE, 0xE4, 0xFD, 0x51, -0xD9, 0x90, 0x8F, 0x33, 0xEF, 0xF0, 0x90, 0x8F, 0xF1, 0xE0, 0x24, 0x07, 0xFF, 0x90, 0x8F, 0xF0, -0xE0, 0x34, 0x00, 0xFE, 0xE4, 0xFD, 0x51, 0xD9, 0x90, 0x8F, 0x34, 0xEF, 0xF0, 0x90, 0x8F, 0xF1, -0xE0, 0x24, 0x08, 0xFF, 0x90, 0x8F, 0xF0, 0xE0, 0x34, 0x00, 0xFE, 0xE4, 0xFD, 0x51, 0xD9, 0x90, -0x8F, 0x35, 0xEF, 0xF0, 0xE4, 0x90, 0x8F, 0xEF, 0xF0, 0x90, 0x8F, 0xEF, 0xE0, 0xFF, 0xC3, 0x94, -0x08, 0x50, 0x1F, 0x90, 0x8F, 0xF1, 0xE0, 0x24, 0x09, 0x51, 0xC7, 0x90, 0x8F, 0xEF, 0xE0, 0x24, -0x36, 0xF5, 0x82, 0xE4, 0x34, 0x8F, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x8F, 0xEF, 0xE0, 0x04, 0xF0, -0x80, 0xD7, 0xE4, 0x90, 0x8F, 0xEF, 0xF0, 0x90, 0x8F, 0xEF, 0xE0, 0xFF, 0xC3, 0x94, 0x20, 0x50, -0x1F, 0x90, 0x8F, 0xF1, 0xE0, 0x24, 0x63, 0x51, 0xC7, 0x90, 0x8F, 0xEF, 0xE0, 0x24, 0x90, 0xF5, -0x82, 0xE4, 0x34, 0x8F, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x8F, 0xEF, 0xE0, 0x04, 0xF0, 0x80, 0xD7, -0x90, 0x8F, 0x32, 0xE0, 0xFE, 0xA3, 0xE0, 0xFD, 0xED, 0xFF, 0x90, 0x8F, 0xED, 0xEE, 0xF0, 0xA3, -0xEF, 0xF0, 0x30, 0xE3, 0x0C, 0x7F, 0x01, 0x31, 0x0A, 0x90, 0x01, 0xC7, 0x74, 0x03, 0xF0, 0x80, -0x3F, 0x90, 0x8F, 0xED, 0xA3, 0xE0, 0xFF, 0x7C, 0x00, 0x54, 0x07, 0xFD, 0x64, 0x01, 0x60, 0x05, -0xED, 0x64, 0x02, 0x70, 0x2B, 0xED, 0x64, 0x02, 0x4C, 0x70, 0x25, 0xEF, 0x54, 0x30, 0xFF, 0xE4, -0xC4, 0xF8, 0x54, 0xF0, 0xC8, 0xEF, 0xC4, 0x54, 0x0F, 0x48, 0x90, 0x8F, 0xC6, 0xF0, 0xAE, 0x04, -0xAF, 0x05, 0xE4, 0xFD, 0x12, 0x7D, 0x1C, 0x90, 0x06, 0x31, 0xE0, 0x54, 0xF7, 0x44, 0x10, 0xF0, -0x7F, 0x00, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xFD, 0x90, 0x8F, 0xF0, 0xE0, 0x34, 0x00, 0xFC, 0x7E, -0x00, 0xED, 0x2F, 0xFF, 0xEE, 0x3C, 0xFE, 0xE4, 0xFD, 0xAB, 0x07, 0xAA, 0x06, 0xED, 0x2B, 0xFB, -0xE4, 0x3A, 0xFA, 0xC3, 0x90, 0x8D, 0xF8, 0xE0, 0x9B, 0x90, 0x8D, 0xF7, 0xE0, 0x9A, 0x50, 0x13, -0xA3, 0xE0, 0x24, 0x01, 0xFF, 0x90, 0x8D, 0xF7, 0xE0, 0x34, 0x00, 0xFE, 0xC3, 0xEB, 0x9F, 0xFB, -0xEA, 0x9E, 0xFA, 0xEA, 0x90, 0xFD, 0x11, 0xF0, 0xAF, 0x03, 0x74, 0x00, 0x2F, 0xF5, 0x82, 0xE4, -0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFF, 0x22, 0x90, 0x8F, 0xE7, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xA3, -0xED, 0xF0, 0x78, 0xF0, 0x7C, 0x8F, 0x7D, 0x01, 0x7B, 0xFF, 0x7A, 0x40, 0x79, 0x56, 0x7E, 0x00, -0x7F, 0x06, 0x12, 0x06, 0x63, 0x78, 0xF6, 0x7C, 0x8F, 0x7D, 0x01, 0x7B, 0xFF, 0x7A, 0x40, 0x79, -0x5C, 0x7E, 0x00, 0x7F, 0x04, 0x12, 0x06, 0x63, 0x78, 0xFA, 0x7C, 0x8F, 0x7D, 0x01, 0x7B, 0xFF, -0x7A, 0x40, 0x79, 0x60, 0x7E, 0x00, 0x7F, 0x04, 0x12, 0x06, 0x63, 0xE4, 0x90, 0x8F, 0xFF, 0xF0, -0x90, 0x8F, 0xE9, 0xE0, 0xFF, 0x90, 0x8F, 0xE8, 0xE0, 0x2F, 0xFF, 0x90, 0x8F, 0xE7, 0xE0, 0x34, -0x00, 0xCF, 0x24, 0x06, 0xCF, 0x34, 0x00, 0xFE, 0xE4, 0xFD, 0x51, 0xD9, 0xEF, 0x64, 0x08, 0x60, -0x02, 0xA1, 0x07, 0x90, 0x8F, 0xE9, 0xE0, 0xFF, 0x90, 0x8F, 0xE8, 0xE0, 0x2F, 0xFF, 0x90, 0x8F, -0xE7, 0xE0, 0x34, 0x00, 0xCF, 0x24, 0x07, 0xCF, 0x34, 0x00, 0xFE, 0xE4, 0xFD, 0x51, 0xD9, 0xEF, -0x64, 0x06, 0x60, 0x02, 0xA1, 0x07, 0x90, 0x8F, 0xFF, 0x04, 0xF0, 0xE4, 0x90, 0x8F, 0xFE, 0xF0, -0x90, 0x8F, 0xFE, 0xE0, 0xFF, 0xC3, 0x94, 0x06, 0x50, 0x23, 0x90, 0x8F, 0xE8, 0xE0, 0x24, 0x0A, -0xFD, 0x90, 0x8F, 0xE7, 0x51, 0xCB, 0x90, 0x8F, 0xFE, 0xE0, 0x24, 0xEA, 0xF5, 0x82, 0xE4, 0x34, -0x8F, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x8F, 0xFE, 0xE0, 0x04, 0xF0, 0x80, 0xD3, 0x78, 0xEA, 0x7C, -0x8F, 0x7D, 0x01, 0x7B, 0x01, 0x7A, 0x8E, 0x79, 0xC1, 0x7E, 0x00, 0x7F, 0x06, 0x12, 0x49, 0xD5, -0xEF, 0x60, 0x02, 0xA1, 0x07, 0x90, 0x8F, 0xFE, 0xF0, 0x90, 0x8F, 0xFE, 0xE0, 0xFF, 0xC3, 0x94, -0x04, 0x50, 0x2E, 0x90, 0x8F, 0xE9, 0xE0, 0xFD, 0x90, 0x8F, 0xE8, 0xE0, 0x2D, 0xFD, 0x90, 0x8F, -0xE7, 0xE0, 0x34, 0x00, 0xCD, 0x24, 0x20, 0xCD, 0x51, 0xCC, 0x90, 0x8F, 0xFE, 0xE0, 0x24, 0xFA, -0xF5, 0x82, 0xE4, 0x34, 0x8F, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x8F, 0xFE, 0xE0, 0x04, 0xF0, 0x80, -0xC8, 0x78, 0xFA, 0x7C, 0x8F, 0x7D, 0x01, 0x7B, 0x01, 0x7A, 0x8E, 0x79, 0xD5, 0x7E, 0x00, 0x7F, -0x04, 0x12, 0x49, 0xD5, 0xEF, 0x60, 0x02, 0x81, 0xFE, 0x90, 0x06, 0x30, 0xE0, 0x44, 0x01, 0x54, -0xDF, 0xF0, 0x90, 0x8E, 0xB4, 0xE0, 0x30, 0xE0, 0x0F, 0x90, 0x01, 0xC7, 0x74, 0x09, 0xF0, 0x90, -0x8E, 0xBA, 0xE0, 0x44, 0x01, 0xF0, 0xA1, 0x07, 0xE4, 0x90, 0x8F, 0xFE, 0xF0, 0x90, 0x8F, 0xFE, -0xE0, 0xFF, 0xC3, 0x94, 0x06, 0x50, 0x2E, 0x90, 0x8F, 0xE9, 0xE0, 0xFD, 0x90, 0x8F, 0xE8, 0xE0, -0x2D, 0xFD, 0x90, 0x8F, 0xE7, 0xE0, 0x34, 0x00, 0xCD, 0x24, 0x10, 0xCD, 0x51, 0xCC, 0x90, 0x8F, -0xFE, 0xE0, 0x24, 0xF0, 0xF5, 0x82, 0xE4, 0x34, 0x8F, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x8F, 0xFE, -0xE0, 0x04, 0xF0, 0x80, 0xC8, 0xE4, 0x90, 0x8F, 0xFE, 0xF0, 0x90, 0x8F, 0xFE, 0xE0, 0xFF, 0xC3, -0x94, 0x04, 0x50, 0x2E, 0x90, 0x8F, 0xE9, 0xE0, 0xFD, 0x90, 0x8F, 0xE8, 0xE0, 0x2D, 0xFD, 0x90, -0x8F, 0xE7, 0xE0, 0x34, 0x00, 0xCD, 0x24, 0x16, 0xCD, 0x51, 0xCC, 0x90, 0x8F, 0xFE, 0xE0, 0x24, -0xF6, 0xF5, 0x82, 0xE4, 0x34, 0x8F, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x8F, 0xFE, 0xE0, 0x04, 0xF0, -0x80, 0xC8, 0x7B, 0x01, 0x7A, 0x8F, 0x79, 0xF0, 0x90, 0x90, 0xE8, 0x12, 0x48, 0x20, 0xE4, 0x90, -0x90, 0xEB, 0xF0, 0xA3, 0xF0, 0x7A, 0x8F, 0x79, 0xF6, 0x12, 0x74, 0x78, 0x80, 0x09, 0x90, 0x06, -0x30, 0xE0, 0x44, 0x21, 0x54, 0xEF, 0xF0, 0x90, 0x8F, 0xFF, 0xE0, 0xFF, 0x22, 0xD3, 0x10, 0xAF, -0x01, 0xC3, 0xC0, 0xD0, 0xE4, 0x90, 0x90, 0xB5, 0xF0, 0xA3, 0xF0, 0xA3, 0x74, 0x08, 0xF0, 0xA3, -0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x90, 0xBD, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x01, -0xC4, 0x74, 0x0D, 0xF0, 0x74, 0x65, 0xA3, 0xF0, 0x90, 0x01, 0x1F, 0xE0, 0xFE, 0x90, 0x01, 0x1E, -0xE0, 0x7C, 0x00, 0x24, 0x00, 0xFF, 0xEC, 0x3E, 0x90, 0x90, 0xAC, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, -0x02, 0x82, 0xE0, 0x90, 0x90, 0xB4, 0xF0, 0x90, 0x8E, 0xB2, 0xE0, 0x20, 0xE0, 0x02, 0xE1, 0x88, -0xE4, 0x90, 0x90, 0xB3, 0xF0, 0x90, 0x90, 0xB4, 0xE0, 0xFF, 0x90, 0x90, 0xB3, 0xE0, 0xC3, 0x9F, -0x40, 0x02, 0xE1, 0x88, 0x90, 0x90, 0xAC, 0xE0, 0xFC, 0xA3, 0xE0, 0xFD, 0xEC, 0xFF, 0x90, 0xFD, -0x11, 0xF0, 0x90, 0x90, 0xBD, 0xEF, 0xF0, 0x74, 0x01, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, -0x83, 0xE0, 0xFE, 0x74, 0x00, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x7A, 0x00, -0x24, 0x00, 0xFF, 0xEA, 0x3E, 0x54, 0x3F, 0xFE, 0x90, 0x90, 0xAE, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, -0x90, 0xB9, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x74, 0x02, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, -0x83, 0xE0, 0x54, 0x0F, 0x33, 0x33, 0x33, 0x54, 0xF8, 0xFF, 0x74, 0x03, 0x2D, 0xF5, 0x82, 0xE4, -0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x54, 0x03, 0xFE, 0xEF, 0x24, 0x18, 0x2E, 0xFF, 0x90, 0x90, 0xBE, -0xF0, 0x90, 0x90, 0xAD, 0xE0, 0x2F, 0xFF, 0x90, 0x90, 0xAC, 0xE0, 0x34, 0x00, 0xFE, 0x90, 0x90, -0xB0, 0xF0, 0xA3, 0xEF, 0xF0, 0xE4, 0xFD, 0x51, 0xD9, 0xC0, 0x07, 0x90, 0x90, 0xB0, 0xE0, 0xFE, -0xA3, 0xE0, 0xFF, 0x7D, 0x04, 0x51, 0xD9, 0xAD, 0x07, 0xD0, 0x07, 0x12, 0x5F, 0x95, 0x90, 0x90, -0xB5, 0xEF, 0xF0, 0x90, 0x90, 0xB0, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xE4, 0xFD, 0x51, 0xD9, 0xEF, -0x54, 0xFC, 0x90, 0x90, 0xB2, 0xF0, 0x90, 0x90, 0xBE, 0xE0, 0xFF, 0x90, 0x90, 0xAE, 0xE4, 0x8F, -0xF0, 0x12, 0x08, 0xD6, 0x90, 0x90, 0xAE, 0x12, 0x85, 0x7A, 0x90, 0x90, 0xAE, 0xEE, 0xF0, 0xA3, -0xEF, 0xF0, 0x90, 0x90, 0xAC, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x7D, 0x0F, 0x51, 0xD9, 0x90, 0x90, -0xAE, 0xE0, 0xFC, 0xA3, 0xE0, 0xFD, 0x90, 0x90, 0xAC, 0xEC, 0x8D, 0xF0, 0x12, 0x08, 0xD6, 0x90, -0x8D, 0xF7, 0xE0, 0xFC, 0xA3, 0xE0, 0xFD, 0xD3, 0x90, 0x90, 0xAD, 0xE0, 0x9D, 0x90, 0x90, 0xAC, -0xE0, 0x9C, 0x40, 0x1B, 0x90, 0x8D, 0xF8, 0xE0, 0x24, 0x01, 0xFD, 0x90, 0x8D, 0xF7, 0xE0, 0x34, -0x00, 0xFC, 0xC3, 0x90, 0x90, 0xAD, 0xE0, 0x9D, 0xF0, 0x90, 0x90, 0xAC, 0xE0, 0x9C, 0xF0, 0xEF, -0x30, 0xE6, 0x06, 0x90, 0x01, 0xC7, 0x74, 0x22, 0xF0, 0xEF, 0x30, 0xE7, 0x06, 0x90, 0x01, 0xC7, -0x74, 0x21, 0xF0, 0xEF, 0x30, 0xE5, 0x06, 0x90, 0x01, 0xC7, 0x74, 0x23, 0xF0, 0x90, 0x90, 0xB2, -0xE0, 0x24, 0x40, 0x60, 0x04, 0x24, 0x20, 0x70, 0x32, 0x90, 0x8E, 0xB5, 0xE0, 0xFF, 0xC4, 0x13, -0x13, 0x13, 0x54, 0x01, 0x30, 0xE0, 0x5A, 0x90, 0x8E, 0xC7, 0xE0, 0x04, 0xF0, 0x90, 0x90, 0xB0, -0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12, 0x86, 0x7E, 0xEF, 0x60, 0x46, 0x90, 0x90, 0xB2, 0xE0, 0xFF, -0x12, 0x86, 0x67, 0x90, 0x8E, 0xC8, 0xE0, 0x04, 0xF0, 0x80, 0x36, 0x90, 0x90, 0xB0, 0xE0, 0xFE, -0xA3, 0xE0, 0xFF, 0x90, 0x90, 0xB5, 0xE0, 0xFD, 0x90, 0x90, 0xB8, 0xE0, 0xFB, 0x90, 0x90, 0xBD, -0xE0, 0x90, 0x8F, 0xEB, 0xF0, 0x12, 0x86, 0xF1, 0x90, 0x8E, 0xB2, 0xE0, 0xFF, 0xC3, 0x13, 0x30, -0xE0, 0x0F, 0x90, 0x90, 0xB0, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x90, 0x90, 0xB5, 0xE0, 0xFD, 0x71, -0x17, 0x12, 0x87, 0xB2, 0xEF, 0x64, 0x01, 0x60, 0x07, 0x90, 0x01, 0x3F, 0xE0, 0x30, 0xE2, 0x04, -0x7F, 0x01, 0x31, 0x0A, 0x12, 0x86, 0x41, 0xEF, 0x64, 0x01, 0x70, 0x3B, 0x90, 0x8E, 0xC9, 0xE0, -0x04, 0xF0, 0x12, 0x85, 0x64, 0xAD, 0x07, 0xEF, 0x64, 0x01, 0x60, 0x23, 0x90, 0x8E, 0xBA, 0xE0, -0x44, 0x01, 0xF0, 0xED, 0xB4, 0x02, 0x08, 0x90, 0x01, 0xC7, 0x74, 0x42, 0xF0, 0x80, 0x0A, 0xED, -0xB4, 0x04, 0x06, 0x90, 0x01, 0xC7, 0x74, 0x43, 0xF0, 0x7F, 0x01, 0x31, 0x0A, 0x80, 0x19, 0x90, -0x90, 0xAC, 0x12, 0x84, 0x1B, 0x80, 0x09, 0x90, 0x8E, 0xB2, 0xE0, 0x54, 0xFE, 0xF0, 0x80, 0x08, -0x90, 0x90, 0xB3, 0xE0, 0x04, 0xF0, 0xA1, 0x65, 0x74, 0x0D, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, -0x65, 0xA3, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x8E, 0x7B, 0xE0, 0xFF, 0xC4, 0x13, 0x13, -0x13, 0x54, 0x01, 0x30, 0xE0, 0x2B, 0xEF, 0x54, 0x7F, 0xF0, 0x90, 0x04, 0xE0, 0xE0, 0x90, 0x8E, -0x7C, 0x30, 0xE1, 0x06, 0xE0, 0x44, 0x02, 0xF0, 0x80, 0x0F, 0xE0, 0x54, 0xFD, 0xF0, 0x90, 0x01, -0xB9, 0x74, 0x01, 0xF0, 0x90, 0x01, 0xB8, 0x04, 0xF0, 0x90, 0x8E, 0x7F, 0xE0, 0x60, 0x02, 0x11, -0x5F, 0x7F, 0x01, 0x01, 0xB8, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x12, 0x4D, 0x4A, 0x12, -0x4F, 0xD9, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xE4, 0xFB, 0xFA, 0xFD, 0x7F, 0x01, 0x12, 0x47, 0x7E, -0xEF, 0x60, 0xF4, 0x90, 0x8D, 0x01, 0xE0, 0xFF, 0x60, 0xED, 0xC2, 0xAF, 0x30, 0xE1, 0x06, 0x54, -0xFD, 0xF0, 0x12, 0x5A, 0x7B, 0xD2, 0xAF, 0xC2, 0xAF, 0x90, 0x8D, 0x01, 0xE0, 0xFF, 0x30, 0xE2, -0x05, 0x54, 0xFB, 0xF0, 0x11, 0x31, 0xD2, 0xAF, 0xC2, 0xAF, 0x90, 0x8D, 0x01, 0xE0, 0xFF, 0x30, -0xE4, 0x0B, 0x54, 0xEF, 0xF0, 0x11, 0xF6, 0xBF, 0x01, 0x03, 0x12, 0x65, 0x0D, 0xD2, 0xAF, 0x80, -0xC2, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0xE4, 0xFF, 0x90, 0x8D, 0xF6, 0xE0, 0xFE, 0x90, -0x8D, 0xF5, 0xE0, 0xFD, 0xB5, 0x06, 0x04, 0x7E, 0x01, 0x80, 0x02, 0x7E, 0x00, 0xEE, 0x64, 0x01, -0x60, 0x2C, 0xED, 0x75, 0xF0, 0x0F, 0xA4, 0x24, 0x5F, 0xF9, 0x74, 0x8D, 0x35, 0xF0, 0xFA, 0x7B, -0x01, 0x11, 0x83, 0x7F, 0x01, 0xEF, 0x60, 0x16, 0x90, 0x8D, 0xF5, 0xE0, 0x04, 0xF0, 0xE0, 0xB4, -0x0A, 0x02, 0x80, 0x02, 0x7F, 0x00, 0xEF, 0x60, 0x05, 0xE4, 0x90, 0x8D, 0xF5, 0xF0, 0xD0, 0xD0, -0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x91, 0x35, 0x12, 0x48, 0x20, -0x7F, 0x96, 0x7E, 0x02, 0x31, 0x33, 0xEF, 0x60, 0x58, 0x90, 0x01, 0x17, 0xE0, 0xFE, 0x90, 0x01, -0x16, 0xE0, 0x7C, 0x00, 0x24, 0x00, 0xFF, 0xEC, 0x3E, 0xFE, 0xEF, 0x24, 0x01, 0xFF, 0xE4, 0x3E, -0xFE, 0x90, 0x91, 0x38, 0xEF, 0xF0, 0xEE, 0xFF, 0x90, 0xFD, 0x11, 0xF0, 0x90, 0x91, 0x38, 0xE0, -0xFD, 0x90, 0x02, 0x94, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x91, 0x35, 0x12, 0x48, 0x17, 0x90, 0x00, -0x0E, 0x12, 0x06, 0xA2, 0x24, 0x02, 0xFF, 0xE4, 0x33, 0xFE, 0x31, 0x89, 0x90, 0x91, 0x38, 0xE0, -0x24, 0x18, 0xFF, 0x90, 0x91, 0x35, 0x12, 0x48, 0x17, 0x31, 0xE4, 0x90, 0x02, 0x96, 0x74, 0x01, -0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xE4, 0x90, 0x91, 0x52, 0xF0, 0xA3, 0xF0, 0x90, 0x02, 0x86, -0xE0, 0x20, 0xE1, 0x2C, 0xC3, 0x90, 0x91, 0x53, 0xE0, 0x94, 0xD0, 0x90, 0x91, 0x52, 0xE0, 0x94, -0x07, 0x40, 0x0A, 0x90, 0x01, 0xC1, 0xE0, 0x44, 0x04, 0xF0, 0x7F, 0x00, 0x22, 0x90, 0x91, 0x52, -0xE4, 0x75, 0xF0, 0x01, 0x12, 0x08, 0xD6, 0x7F, 0x0A, 0x7E, 0x00, 0x12, 0x3E, 0x87, 0x80, 0xCD, -0x7F, 0x01, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x91, 0x2D, 0xEE, 0xF0, 0xA3, -0xEF, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x91, 0x2D, 0xE0, 0xFE, 0xA3, 0xE0, 0xF5, 0x82, -0x8E, 0x83, 0xE0, 0x60, 0x2D, 0xC3, 0x90, 0x91, 0x30, 0xE0, 0x94, 0xE8, 0x90, 0x91, 0x2F, 0xE0, -0x94, 0x03, 0x40, 0x0B, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x80, 0xF0, 0x7F, 0x00, 0x80, 0x15, 0x90, -0x91, 0x2F, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x08, 0xD6, 0x7F, 0x0A, 0x7E, 0x00, 0x12, 0x3E, 0x87, -0x80, 0xC5, 0x7F, 0x01, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xE4, 0xFC, 0xED, 0x2C, 0x24, 0x00, 0xF5, -0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE4, 0xF0, 0x0C, 0xEC, 0xB4, 0x18, 0xEE, 0x74, 0x00, 0x2D, -0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xEF, 0xF0, 0xEE, 0x54, 0x3F, 0xFF, 0x74, 0x01, 0x2D, -0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xEF, 0xF0, 0x74, 0x02, 0x2D, 0xF5, 0x82, 0xE4, 0x34, -0xFB, 0xF5, 0x83, 0xE0, 0x54, 0xF0, 0xF0, 0x74, 0x03, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, -0x83, 0xE0, 0x44, 0x80, 0xF0, 0x74, 0x0B, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, -0x44, 0x10, 0xF0, 0x22, 0x90, 0x91, 0x31, 0xEF, 0xF0, 0xA3, 0x12, 0x48, 0x20, 0x90, 0x91, 0x47, -0xE0, 0xFE, 0x04, 0xF0, 0x90, 0x00, 0x01, 0xEE, 0x12, 0x06, 0xE1, 0x74, 0x00, 0x2F, 0xF9, 0xE4, -0x34, 0xFB, 0xFA, 0x7B, 0x01, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90, 0x91, 0x32, 0x12, 0x48, -0x17, 0x8B, 0x40, 0x8A, 0x41, 0x89, 0x42, 0x75, 0x43, 0x02, 0xD0, 0x01, 0xD0, 0x02, 0xD0, 0x03, -0x12, 0x35, 0x85, 0x90, 0x91, 0x31, 0xE0, 0x24, 0x02, 0xF9, 0xE4, 0x34, 0xFB, 0xFA, 0x7B, 0x01, -0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0xA3, 0x12, 0x48, 0x17, 0xE9, 0x24, 0x02, 0xF9, 0xE4, 0x3A, -0x8B, 0x40, 0xF5, 0x41, 0x89, 0x42, 0x90, 0x91, 0x32, 0x12, 0x48, 0x17, 0x90, 0x00, 0x0E, 0x12, -0x06, 0xA2, 0xF5, 0x43, 0xD0, 0x01, 0xD0, 0x02, 0xD0, 0x03, 0x02, 0x35, 0x85, 0x32, 0xC0, 0xE0, -0xC0, 0xF0, 0xC0, 0x83, 0xC0, 0x82, 0xC0, 0xD0, 0x75, 0xD0, 0x00, 0xC0, 0x00, 0xC0, 0x01, 0xC0, -0x02, 0xC0, 0x03, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, 0x12, 0x4C, 0xA2, 0xE5, 0x14, -0x30, 0xE7, 0x02, 0x51, 0xA0, 0xD0, 0x07, 0xD0, 0x06, 0xD0, 0x05, 0xD0, 0x04, 0xD0, 0x03, 0xD0, -0x02, 0xD0, 0x01, 0xD0, 0x00, 0xD0, 0xD0, 0xD0, 0x82, 0xD0, 0x83, 0xD0, 0xF0, 0xD0, 0xE0, 0x32, -0x7F, 0x01, 0x7E, 0x00, 0x12, 0x3E, 0x0C, 0x7F, 0xF2, 0x12, 0x4B, 0x14, 0xEF, 0x20, 0xE6, 0x0E, -0x7F, 0x05, 0x12, 0x4B, 0x14, 0xEF, 0x44, 0x80, 0xFD, 0x7F, 0x05, 0x12, 0x4C, 0x5C, 0x22, 0xC0, -0xE0, 0xC0, 0xF0, 0xC0, 0x83, 0xC0, 0x82, 0xC0, 0xD0, 0x75, 0xD0, 0x00, 0xC0, 0x00, 0xC0, 0x01, -0xC0, 0x02, 0xC0, 0x03, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, 0x71, 0xF2, 0xE5, 0x21, -0x30, 0xE1, 0x02, 0x71, 0x30, 0xE5, 0x21, 0x30, 0xE2, 0x03, 0x12, 0x60, 0x69, 0xE5, 0x22, 0x30, -0xE0, 0x02, 0x71, 0x39, 0xE5, 0x24, 0x30, 0xE1, 0x04, 0x7F, 0x04, 0x71, 0xD1, 0xE5, 0x24, 0x30, -0xE4, 0x03, 0x12, 0x5D, 0x4D, 0xE5, 0x24, 0x30, 0xE5, 0x03, 0x12, 0x60, 0x83, 0xE5, 0x24, 0x30, -0xE6, 0x03, 0x12, 0x67, 0x98, 0xD0, 0x07, 0xD0, 0x06, 0xD0, 0x05, 0xD0, 0x04, 0xD0, 0x03, 0xD0, -0x02, 0xD0, 0x01, 0xD0, 0x00, 0xD0, 0xD0, 0xD0, 0x82, 0xD0, 0x83, 0xD0, 0xF0, 0xD0, 0xE0, 0x32, -0x90, 0x8E, 0x7F, 0xE0, 0x60, 0x02, 0x91, 0x22, 0x22, 0x91, 0x6C, 0x90, 0x90, 0xA8, 0xEF, 0xF0, -0x30, 0xE0, 0x05, 0x7D, 0x01, 0xE4, 0x80, 0x02, 0xE4, 0xFD, 0xFF, 0x12, 0x54, 0xC5, 0x90, 0x90, -0xA8, 0xE0, 0x30, 0xE6, 0x11, 0x90, 0x01, 0x2F, 0xE0, 0x30, 0xE7, 0x04, 0xE4, 0xF0, 0x80, 0x06, -0x90, 0x01, 0x2F, 0x74, 0x80, 0xF0, 0x90, 0x8E, 0x90, 0xE0, 0xFF, 0xA3, 0xE0, 0xFD, 0x90, 0x8E, -0x95, 0xE0, 0xFB, 0xAC, 0x07, 0x90, 0x8E, 0x7B, 0xE0, 0x30, 0xE0, 0x32, 0x90, 0x8E, 0x91, 0xE0, -0xD3, 0x94, 0x03, 0x50, 0x07, 0x90, 0x8E, 0x87, 0xEB, 0xF0, 0x80, 0x0A, 0xED, 0x24, 0xFD, 0x2B, -0x90, 0x8E, 0x87, 0xF0, 0x7D, 0x03, 0x90, 0x8E, 0xAA, 0xE0, 0x24, 0x04, 0xC3, 0x9D, 0x2C, 0xFF, -0x90, 0x8E, 0x94, 0xF0, 0x90, 0x8E, 0x8A, 0xE4, 0xF0, 0xA3, 0xEF, 0xF0, 0x80, 0x0E, 0x90, 0x8E, -0x8A, 0xE4, 0xF0, 0xA3, 0x74, 0x02, 0xF0, 0x90, 0x8E, 0x87, 0xEB, 0xF0, 0x90, 0x8E, 0x8A, 0xA3, -0xE0, 0x90, 0x05, 0x58, 0xF0, 0x90, 0x8E, 0xAA, 0xE0, 0x24, 0x04, 0xFD, 0x7F, 0xFF, 0x02, 0x4C, -0x5C, 0x8F, 0x5B, 0x7F, 0x02, 0x12, 0x47, 0x57, 0x90, 0x8D, 0x01, 0xE0, 0x45, 0x5B, 0xF0, 0x22, -0x91, 0xB7, 0x7F, 0x02, 0x80, 0xEB, 0x90, 0x8E, 0xB2, 0xE0, 0x30, 0xE0, 0x04, 0x7F, 0x10, 0x71, -0xD1, 0x22, 0x90, 0x01, 0x3C, 0xE0, 0x55, 0x1D, 0xF5, 0x21, 0xA3, 0xE0, 0x55, 0x1E, 0xF5, 0x22, -0xA3, 0xE0, 0x55, 0x1F, 0xF5, 0x23, 0xA3, 0xE0, 0x55, 0x20, 0xF5, 0x24, 0x90, 0x01, 0x3C, 0xE5, -0x21, 0xF0, 0xA3, 0xE5, 0x22, 0xF0, 0xA3, 0xE5, 0x23, 0xF0, 0xA3, 0xE5, 0x24, 0xF0, 0x53, 0x91, -0xDF, 0x22, 0x90, 0x8E, 0x7B, 0xE0, 0xFF, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x11, 0xEF, 0x54, -0xFB, 0xF0, 0x90, 0x8E, 0x83, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0x07, 0x70, 0x2E, 0x80, 0x29, 0x90, -0x8E, 0x88, 0xE0, 0x04, 0xF0, 0x90, 0x8E, 0x83, 0xE0, 0x54, 0xEF, 0xF0, 0x90, 0x8E, 0xAB, 0xE0, -0xFF, 0x90, 0x8E, 0x88, 0xE0, 0xD3, 0x9F, 0x40, 0x0F, 0x90, 0x8D, 0xFA, 0xE0, 0xB4, 0x01, 0x0B, -0x90, 0x8E, 0x7C, 0xE0, 0x54, 0xFB, 0xF0, 0x22, 0x12, 0x60, 0x5F, 0x22, 0xE4, 0x90, 0x90, 0xA9, -0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x7F, 0x83, 0x12, 0x4B, 0x14, 0x90, 0x90, 0xA9, 0xEF, 0xF0, 0x7F, -0x83, 0x12, 0x4B, 0x14, 0xAE, 0x07, 0x90, 0x90, 0xA9, 0xE0, 0xFF, 0xB5, 0x06, 0x01, 0x22, 0xC3, -0x90, 0x90, 0xAB, 0xE0, 0x94, 0x64, 0x90, 0x90, 0xAA, 0xE0, 0x94, 0x00, 0x40, 0x0D, 0x90, 0x01, -0xC0, 0xE0, 0x44, 0x40, 0xF0, 0x90, 0x90, 0xA9, 0xE0, 0xFF, 0x22, 0x90, 0x90, 0xAA, 0xE4, 0x75, -0xF0, 0x01, 0x12, 0x08, 0xD6, 0x80, 0xBE, 0x90, 0x01, 0xCC, 0xE0, 0x54, 0x0F, 0x90, 0x91, 0x48, -0xF0, 0x90, 0x91, 0x48, 0xE0, 0xFD, 0x70, 0x02, 0xC1, 0x06, 0x90, 0x8D, 0x5D, 0xE0, 0xFF, 0x70, -0x06, 0xA3, 0xE0, 0x64, 0x09, 0x60, 0x0A, 0xEF, 0x14, 0xFF, 0x90, 0x8D, 0x5E, 0xE0, 0xB5, 0x07, -0x04, 0x7F, 0x01, 0x80, 0x02, 0x7F, 0x00, 0xEF, 0x60, 0x08, 0x90, 0x01, 0xC1, 0xE0, 0x44, 0x01, -0xF0, 0x22, 0x90, 0x91, 0x46, 0xE0, 0xFF, 0x74, 0x01, 0x7E, 0x00, 0xA8, 0x07, 0x08, 0x80, 0x05, -0xC3, 0x33, 0xCE, 0x33, 0xCE, 0xD8, 0xF9, 0xFF, 0xEF, 0x5D, 0x70, 0x02, 0xA1, 0xE3, 0xE4, 0x90, -0x91, 0x49, 0xF0, 0x90, 0x91, 0x49, 0xE0, 0xF9, 0xC3, 0x94, 0x04, 0x50, 0x73, 0x90, 0x91, 0x46, -0xE0, 0x75, 0xF0, 0x04, 0xA4, 0xFF, 0xE9, 0xFD, 0x7C, 0x00, 0x2F, 0xFF, 0xEC, 0x35, 0xF0, 0xFE, -0x74, 0xD0, 0x2F, 0xF5, 0x82, 0x74, 0x01, 0x3E, 0xF5, 0x83, 0xE0, 0xFF, 0x90, 0x8D, 0x5E, 0xE0, -0x75, 0xF0, 0x08, 0x90, 0x8D, 0x0D, 0x12, 0x48, 0x0B, 0xE5, 0x82, 0x29, 0xF5, 0x82, 0xE4, 0x35, -0x83, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x91, 0x46, 0xE0, 0x75, 0xF0, 0x04, 0xA4, 0x2D, 0xFF, 0xEC, -0x35, 0xF0, 0xFE, 0x74, 0xF0, 0x2F, 0xF5, 0x82, 0x74, 0x01, 0x3E, 0xF5, 0x83, 0xE0, 0xFF, 0x90, -0x8D, 0x5E, 0xE0, 0x75, 0xF0, 0x08, 0x90, 0x8D, 0x11, 0x12, 0x48, 0x0B, 0xE5, 0x82, 0x29, 0xF5, -0x82, 0xE4, 0x35, 0x83, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x91, 0x49, 0xE0, 0x04, 0xF0, 0x80, 0x83, -0x90, 0x91, 0x48, 0xE0, 0xFF, 0x90, 0x91, 0x46, 0xE0, 0xFE, 0x74, 0x01, 0xA8, 0x06, 0x08, 0x80, -0x02, 0xC3, 0x33, 0xD8, 0xFC, 0xF4, 0x5F, 0x90, 0x91, 0x48, 0xF0, 0x90, 0x91, 0x46, 0xE0, 0xFF, -0x74, 0x01, 0xA8, 0x07, 0x08, 0x80, 0x02, 0xC3, 0x33, 0xD8, 0xFC, 0x90, 0x01, 0xCC, 0xF0, 0x90, -0x91, 0x46, 0xE0, 0x04, 0xF0, 0xE0, 0x54, 0x03, 0xF0, 0x90, 0x8D, 0x5E, 0xE0, 0x04, 0xF0, 0xE0, -0x7F, 0x00, 0xB4, 0x0A, 0x02, 0x7F, 0x01, 0xEF, 0x70, 0x02, 0x81, 0xC1, 0xE4, 0x90, 0x8D, 0x5E, -0xF0, 0x81, 0xC1, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x02, 0xF0, 0x90, 0x91, 0x46, 0xE0, 0x44, 0x80, -0x90, 0x00, 0x8A, 0xF0, 0x90, 0x91, 0x46, 0xE0, 0x75, 0xF0, 0x04, 0x90, 0x01, 0xD0, 0x12, 0x48, -0x0B, 0xE0, 0x90, 0x01, 0xC3, 0xF0, 0x22, 0x32, 0x32, 0xF0, 0xE4, 0x90, 0x91, 0x20, 0xF0, 0x90, -0x8E, 0xAC, 0xE0, 0x90, 0x91, 0x21, 0xF0, 0xE4, 0xFB, 0xFD, 0x7F, 0x54, 0x7E, 0x01, 0xD3, 0x10, -0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x91, 0x1C, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x91, 0x20, -0xE0, 0xF5, 0x3B, 0xA3, 0xE0, 0xF5, 0x3C, 0x12, 0x36, 0x9D, 0x90, 0x91, 0x1C, 0xE0, 0xFE, 0xA3, -0xE0, 0xF5, 0x82, 0x8E, 0x83, 0xA3, 0xA3, 0xA3, 0x74, 0x05, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, -0xE4, 0xF5, 0x58, 0x90, 0x06, 0xA9, 0xE0, 0xF5, 0x58, 0x54, 0xC0, 0x70, 0x0D, 0x90, 0x8E, 0x83, -0xE0, 0x54, 0xFE, 0xF0, 0x54, 0xFD, 0xF0, 0x02, 0x60, 0x5F, 0xE5, 0x58, 0x30, 0xE6, 0x22, 0x90, -0x8E, 0x7F, 0xE0, 0x64, 0x01, 0x70, 0x21, 0x90, 0x8E, 0x83, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x8E, -0x7D, 0xE0, 0x54, 0x0F, 0x64, 0x02, 0x60, 0x04, 0xD1, 0xB2, 0x80, 0x0C, 0x12, 0x56, 0x78, 0x80, -0x07, 0x90, 0x8E, 0x83, 0xE0, 0x54, 0xFE, 0xF0, 0xE5, 0x58, 0x90, 0x8E, 0x83, 0x30, 0xE7, 0x0D, -0xE0, 0x44, 0x02, 0xD1, 0x09, 0x90, 0x8E, 0x7B, 0xE0, 0x44, 0x04, 0xF0, 0x22, 0xE0, 0x54, 0xFD, -0xF0, 0x22, 0x90, 0x04, 0x1D, 0xE0, 0x70, 0x1A, 0x90, 0x8D, 0x08, 0xE0, 0xFF, 0x7B, 0x18, 0xE4, -0xFD, 0x12, 0x78, 0x6B, 0x90, 0x91, 0x50, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x04, 0x1F, 0x74, -0x20, 0xF0, 0x22, 0x90, 0x8D, 0xFA, 0xE0, 0x64, 0x01, 0x60, 0x02, 0xE1, 0x6B, 0x90, 0x8E, 0x7F, -0xE0, 0x70, 0x02, 0xE1, 0x6B, 0x90, 0x8E, 0x7D, 0xE0, 0xC4, 0x54, 0x0F, 0x64, 0x01, 0x70, 0x26, -0x90, 0x06, 0xAB, 0xE0, 0x90, 0x8E, 0x86, 0xF0, 0x90, 0x06, 0xAA, 0xE0, 0x04, 0x90, 0x8E, 0x85, -0xF0, 0xA3, 0xE0, 0xFF, 0x70, 0x08, 0x90, 0x8E, 0x85, 0xE0, 0xFE, 0xFF, 0x80, 0x03, 0xEF, 0x04, -0xFF, 0x90, 0x8E, 0x86, 0xEF, 0xF0, 0x90, 0x8E, 0x7C, 0xE0, 0x44, 0x04, 0xF0, 0xE4, 0x90, 0x8E, -0x88, 0xF0, 0x90, 0x8E, 0x8A, 0xA3, 0xE0, 0x90, 0x05, 0x58, 0xF0, 0x90, 0x01, 0x57, 0xE4, 0xF0, -0x90, 0x01, 0x3C, 0x74, 0x02, 0xF0, 0x90, 0x8E, 0x83, 0xE0, 0x54, 0xFD, 0xF0, 0x54, 0xEF, 0xF0, -0x90, 0x8E, 0x7D, 0xE0, 0xFF, 0xC4, 0x54, 0x0F, 0x24, 0xFD, 0x50, 0x02, 0x80, 0x02, 0xD1, 0x50, -0x90, 0x8E, 0x7C, 0xE0, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x0F, 0x90, 0x8E, 0x85, 0xE0, -0xFF, 0xA3, 0xE0, 0xB5, 0x07, 0x05, 0xF1, 0x87, 0x12, 0x5E, 0x5B, 0x22, 0x90, 0x8D, 0xFA, 0xE0, -0x64, 0x01, 0x70, 0x12, 0x90, 0x8E, 0x7F, 0xE0, 0x60, 0x0C, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, -0x01, 0x3C, 0x74, 0x02, 0xD1, 0x09, 0x22, 0xEF, 0x14, 0x90, 0x05, 0x73, 0xF0, 0x90, 0x01, 0x3F, -0x74, 0x10, 0xF0, 0xFD, 0x7F, 0x03, 0x74, 0x1D, 0x2F, 0xF8, 0xE6, 0x4D, 0xFE, 0xF6, 0x74, 0x38, -0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0x90, 0x8E, 0x7B, 0xE0, 0x13, -0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x05, 0x90, 0x01, 0x5B, 0xE4, 0xF0, 0x90, 0x06, 0x92, 0x74, -0x02, 0xF0, 0x90, 0x01, 0x3C, 0x74, 0x04, 0xF0, 0xE4, 0x90, 0x91, 0x20, 0xF0, 0x90, 0x8E, 0xAD, -0xE0, 0xC3, 0x13, 0x54, 0x7F, 0x90, 0x91, 0x21, 0xF0, 0xE4, 0xFB, 0xFD, 0x7F, 0x58, 0x7E, 0x01, -0xD1, 0x1E, 0x90, 0x8E, 0x7B, 0xE0, 0x44, 0x08, 0xF0, 0x22, 0x90, 0x91, 0x56, 0xEF, 0xF0, 0x7F, -0x02, 0x12, 0x47, 0x57, 0x90, 0x8D, 0x02, 0xE0, 0xFF, 0x90, 0x91, 0x56, 0xE0, 0xFE, 0xEF, 0x4E, -0x90, 0x8D, 0x02, 0xF0, 0x22, 0x90, 0x02, 0x09, 0xE0, 0xF5, 0x51, 0x12, 0x06, 0x89, 0x25, 0x51, -0x90, 0x8D, 0x07, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x06, 0xA2, 0x25, 0x51, 0x90, 0x8D, 0x08, 0xF0, -0x90, 0x00, 0x02, 0x12, 0x06, 0xA2, 0x25, 0x51, 0x90, 0x8D, 0x09, 0xF0, 0x90, 0x00, 0x03, 0x12, -0x06, 0xA2, 0x25, 0x51, 0x90, 0x8D, 0x0A, 0xF0, 0x90, 0x00, 0x04, 0x12, 0x06, 0xA2, 0x25, 0x51, -0x90, 0x8D, 0x0B, 0xF0, 0x90, 0x00, 0x05, 0x12, 0x06, 0xA2, 0x25, 0x51, 0x90, 0x8D, 0x0C, 0xF0, -0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x8B, 0x51, 0x8A, 0x52, 0x89, 0x53, 0x12, 0x06, -0x89, 0xFF, 0x90, 0x8E, 0x7A, 0xF0, 0xBF, 0x01, 0x10, 0x90, 0x00, 0x01, 0x12, 0x06, 0xA2, 0x64, -0x01, 0x60, 0x1C, 0x7D, 0x13, 0x7F, 0x6F, 0x80, 0x13, 0xAB, 0x51, 0xAA, 0x52, 0xA9, 0x53, 0x90, -0x00, 0x01, 0x12, 0x06, 0xA2, 0x64, 0x01, 0x60, 0x06, 0xE4, 0xFD, 0xFF, 0x12, 0x54, 0x7F, 0xD0, -0xD0, 0x92, 0xAF, 0x22, 0x12, 0x06, 0x89, 0x54, 0x01, 0xFF, 0x90, 0x8F, 0xE5, 0xE0, 0x54, 0xFE, -0x4F, 0xF0, 0x30, 0xE0, 0x19, 0x90, 0x8D, 0x06, 0xE0, 0xFF, 0xB4, 0x01, 0x07, 0x90, 0x8E, 0x89, -0x74, 0xDC, 0xF0, 0x22, 0xEF, 0xB4, 0x03, 0x06, 0x90, 0x8E, 0x89, 0x74, 0xD4, 0xF0, 0x22, 0x90, -0x8F, 0xEB, 0x12, 0x48, 0x20, 0x12, 0x06, 0x89, 0xFF, 0x54, 0x7F, 0x90, 0x8E, 0x7F, 0xF0, 0xEF, -0xC4, 0x13, 0x13, 0x13, 0x54, 0x01, 0xA3, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x06, 0xA2, 0xFF, 0x54, -0xF0, 0xC4, 0x54, 0x0F, 0xFE, 0x90, 0x8E, 0x7D, 0xE0, 0x54, 0xF0, 0x4E, 0xF0, 0x90, 0x00, 0x03, -0x12, 0x06, 0xA2, 0x54, 0x01, 0x25, 0xE0, 0xFE, 0x90, 0x8E, 0x7B, 0xE0, 0x54, 0xFD, 0x4E, 0xF0, -0xEF, 0x54, 0x0F, 0xC4, 0x54, 0xF0, 0xFF, 0x90, 0x8E, 0x7D, 0xE0, 0x54, 0x0F, 0x4F, 0xF0, 0x90, -0x00, 0x02, 0x12, 0x06, 0xA2, 0x90, 0x8E, 0x7E, 0xF0, 0x90, 0x00, 0x06, 0x12, 0x06, 0xA2, 0x30, -0xE0, 0x5E, 0xC3, 0x13, 0x54, 0x07, 0xFF, 0xC3, 0x94, 0x04, 0x90, 0x8E, 0x91, 0x50, 0x04, 0xEF, -0xF0, 0x80, 0x2E, 0x74, 0x03, 0xF0, 0x90, 0x8F, 0xEB, 0x12, 0x48, 0x17, 0xE9, 0x24, 0x06, 0xF9, -0xE4, 0x3A, 0xFA, 0x12, 0x06, 0x89, 0xFF, 0x74, 0x03, 0x24, 0xFD, 0xFE, 0xEF, 0xC4, 0x54, 0x0F, -0xFD, 0xEF, 0x54, 0x0F, 0xFF, 0xED, 0x2E, 0x54, 0x0F, 0xFE, 0xC4, 0x54, 0xF0, 0x4F, 0x12, 0x06, -0xCF, 0x90, 0x8F, 0xEB, 0x12, 0x48, 0x17, 0x90, 0x00, 0x06, 0x12, 0x06, 0xA2, 0xC4, 0x54, 0x0F, -0xFF, 0xC3, 0x94, 0x04, 0x90, 0x8E, 0x87, 0x50, 0x05, 0x74, 0x04, 0xF0, 0x80, 0x02, 0xEF, 0xF0, -0x90, 0x8F, 0xEB, 0x12, 0x48, 0x17, 0x90, 0x00, 0x04, 0x12, 0x06, 0xA2, 0xFD, 0x7F, 0x02, 0x12, -0x54, 0xC5, 0x90, 0x8F, 0xEB, 0x12, 0x48, 0x17, 0x31, 0xBF, 0x90, 0x01, 0xB9, 0x74, 0x01, 0xF0, -0x90, 0x01, 0xB8, 0xF0, 0x90, 0x8E, 0x7F, 0xE0, 0x90, 0x01, 0xBA, 0xF0, 0x90, 0x8E, 0x81, 0xE0, -0x90, 0x01, 0xBB, 0xF0, 0x90, 0x8E, 0x7D, 0xE0, 0x54, 0x0F, 0x90, 0x01, 0xBE, 0xF0, 0x22, 0x90, -0x8F, 0xEE, 0x12, 0x48, 0x20, 0x31, 0xEE, 0x90, 0x8E, 0x7F, 0xE0, 0xFF, 0x12, 0x5E, 0xB0, 0x90, -0x8E, 0x7F, 0xE0, 0x60, 0x18, 0x90, 0x8F, 0xEE, 0x12, 0x48, 0x17, 0x90, 0x00, 0x01, 0x12, 0x06, -0xA2, 0x54, 0x0F, 0xFF, 0x90, 0x00, 0x02, 0x12, 0x06, 0xA2, 0xFD, 0x31, 0xFF, 0x22, 0x90, 0x8E, -0x7B, 0xE0, 0x54, 0xFB, 0xF0, 0xE4, 0x90, 0x8E, 0x88, 0xF0, 0x90, 0x8E, 0x83, 0xF0, 0x22, 0xEF, -0x24, 0xFE, 0x60, 0x0B, 0x04, 0x70, 0x27, 0x90, 0x8E, 0x85, 0x74, 0x02, 0xF0, 0x80, 0x16, 0xED, -0x70, 0x0A, 0x90, 0x8E, 0xAE, 0xE0, 0x90, 0x8E, 0x85, 0xF0, 0x80, 0x05, 0x90, 0x8E, 0x85, 0xED, -0xF0, 0x90, 0x8E, 0x85, 0xE0, 0xA3, 0xF0, 0x90, 0x8E, 0x7C, 0xE0, 0x44, 0x08, 0xF0, 0x22, 0x90, -0x00, 0x02, 0x12, 0x06, 0xA2, 0xFF, 0x30, 0xE0, 0x26, 0x12, 0x06, 0x89, 0x90, 0x8E, 0xAB, 0xF0, -0x90, 0x00, 0x01, 0x12, 0x06, 0xA2, 0x90, 0x8E, 0xAC, 0xF0, 0xEF, 0x54, 0xFE, 0xFF, 0xA3, 0xE0, -0x54, 0x01, 0x4F, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x06, 0xA2, 0x90, 0x8E, 0xAE, 0xF0, 0x22, 0x90, -0x8E, 0xAB, 0x74, 0x05, 0xF0, 0xA3, 0xF0, 0xA3, 0xE0, 0x54, 0x01, 0x44, 0x28, 0xF0, 0xA3, 0x74, -0x05, 0xF0, 0x22, 0x12, 0x06, 0x89, 0x90, 0x8E, 0x89, 0xF0, 0x22, 0x12, 0x06, 0x89, 0x90, 0x8E, -0xB1, 0xF0, 0x90, 0x8E, 0xB1, 0xE0, 0x90, 0x01, 0xE7, 0xF0, 0x22, 0xE4, 0x90, 0x8D, 0xF5, 0xF0, -0xA3, 0xF0, 0x90, 0x8D, 0x5D, 0xF0, 0xA3, 0xF0, 0x22, 0x8F, 0x57, 0x75, 0xF0, 0x10, 0xEF, 0x90, -0x81, 0x05, 0x12, 0x48, 0x0B, 0xE0, 0x54, 0xFB, 0xF0, 0x22, 0x8F, 0x57, 0x75, 0xF0, 0x10, 0xEF, -0x90, 0x81, 0x05, 0x12, 0x48, 0x0B, 0xE0, 0x44, 0x04, 0xF0, 0x22, 0xEF, 0x70, 0x04, 0x74, 0xF0, -0x80, 0x16, 0xEF, 0xB4, 0x01, 0x04, 0x74, 0xF4, 0x80, 0x0E, 0xEF, 0xB4, 0x02, 0x04, 0x74, 0xF8, -0x80, 0x06, 0xEF, 0xB4, 0x03, 0x0C, 0x74, 0xFC, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0x02, 0xF5, 0x83, -0xEB, 0xF0, 0x22, 0x90, 0x91, 0x3D, 0x12, 0x48, 0x20, 0xE4, 0xFF, 0x90, 0x91, 0x3D, 0x12, 0x48, -0x17, 0x8F, 0x82, 0x75, 0x83, 0x00, 0x12, 0x06, 0xA2, 0xFE, 0x74, 0xF0, 0x2F, 0xF5, 0x82, 0xE4, -0x34, 0x02, 0xF5, 0x83, 0xEE, 0xF0, 0x0F, 0xEF, 0xB4, 0x10, 0xE0, 0x22, 0x90, 0x01, 0x94, 0xE0, -0x44, 0x01, 0xF0, 0x90, 0x01, 0xC7, 0xE4, 0xF0, 0x22, 0x22, 0x90, 0x01, 0x9A, 0xE0, 0x54, 0xC0, -0x44, 0x0B, 0xF0, 0x7F, 0x0A, 0x7E, 0x00, 0x12, 0x3E, 0x87, 0x90, 0x01, 0x98, 0xE0, 0x54, 0xC0, -0x7F, 0x00, 0xB4, 0x40, 0x02, 0x7F, 0x01, 0x22, 0x90, 0x01, 0xC7, 0x74, 0xFE, 0xF0, 0x22, 0x7D, -0x02, 0x90, 0x01, 0xC4, 0x74, 0x3F, 0xF0, 0x74, 0x73, 0xA3, 0xF0, 0x90, 0x8F, 0xD6, 0xE0, 0xFF, -0xED, 0xC3, 0x9F, 0x50, 0x18, 0xED, 0x25, 0xE0, 0x24, 0x81, 0xF8, 0xE6, 0x30, 0xE4, 0x0B, 0x90, -0x01, 0xB8, 0x74, 0x08, 0xF0, 0xA3, 0xF0, 0x7F, 0x00, 0x22, 0x0D, 0x80, 0xDE, 0x7F, 0x01, 0x22, -0xE4, 0x90, 0x8D, 0x01, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x22, 0x90, 0x01, -0xE4, 0x74, 0x12, 0xF0, 0xA3, 0xE4, 0xF0, 0x22, 0x90, 0x01, 0x34, 0xE0, 0x55, 0x15, 0xF5, 0x19, -0xA3, 0xE0, 0x55, 0x16, 0xF5, 0x1A, 0xA3, 0xE0, 0x55, 0x17, 0xF5, 0x1B, 0xA3, 0xE0, 0x55, 0x18, -0xF5, 0x1C, 0x90, 0x01, 0x34, 0xE5, 0x19, 0xF0, 0xA3, 0xE5, 0x1A, 0xF0, 0xA3, 0xE5, 0x1B, 0xF0, -0xA3, 0xE5, 0x1C, 0xF0, 0x90, 0x01, 0x24, 0xE0, 0x55, 0x25, 0xF5, 0x26, 0xF0, 0x22, 0x90, 0x8E, -0x7F, 0xE0, 0x60, 0x46, 0x90, 0x8E, 0x7C, 0xE0, 0xFF, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, -0x13, 0x90, 0x01, 0x3B, 0xE0, 0x30, 0xE4, 0x0C, 0x12, 0x5E, 0x55, 0x90, 0x8E, 0x85, 0xE0, 0x14, -0x90, 0x05, 0x73, 0xF0, 0x90, 0x91, 0x4A, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x08, 0xD6, 0xC3, 0x90, -0x91, 0x4B, 0xE0, 0x94, 0x80, 0x90, 0x91, 0x4A, 0xE0, 0x64, 0x80, 0x94, 0x80, 0x40, 0x0B, 0x90, -0x01, 0x98, 0xE0, 0x54, 0xFE, 0xF0, 0xE0, 0x44, 0x01, 0xF0, 0xB1, 0xF8, 0x91, 0x14, 0xE4, 0x90, -0x8F, 0xDA, 0xF0, 0x22, 0x90, 0x8F, 0xD7, 0xE0, 0x30, 0xE0, 0x37, 0x90, 0x8D, 0xFA, 0xE0, 0x64, -0x01, 0x70, 0x2F, 0x90, 0x91, 0x5C, 0xE0, 0x04, 0xF0, 0xE0, 0xB4, 0x0A, 0x0B, 0x90, 0x8F, 0xD9, -0xE0, 0x04, 0xF0, 0xE4, 0x90, 0x91, 0x5C, 0xF0, 0x90, 0x8F, 0xD9, 0xE0, 0xFF, 0x90, 0x8F, 0xD8, -0xE0, 0xD3, 0x9F, 0x50, 0x0D, 0x90, 0x8F, 0xDA, 0xE0, 0x70, 0x07, 0xE4, 0x90, 0x8F, 0xD9, 0xF0, -0x91, 0x53, 0x22, 0x90, 0x8F, 0xD7, 0xE0, 0xFF, 0x13, 0x13, 0x54, 0x3F, 0x30, 0xE0, 0x16, 0x7B, -0x00, 0x7A, 0x00, 0x79, 0x00, 0x90, 0x90, 0xE8, 0x12, 0x48, 0x20, 0xE4, 0x90, 0x90, 0xEB, 0xF0, -0xA3, 0x04, 0xF0, 0x80, 0x03, 0x02, 0x55, 0xB8, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, -0x90, 0xE5, 0x12, 0x48, 0x20, 0x78, 0xF1, 0x7C, 0x90, 0x7D, 0x01, 0x7B, 0xFF, 0x7A, 0x40, 0x79, -0x64, 0x7E, 0x00, 0x7F, 0x06, 0x12, 0x06, 0x63, 0x90, 0x05, 0x22, 0xE0, 0x90, 0x90, 0xF0, 0xF0, -0x90, 0x04, 0x1D, 0xE0, 0x60, 0x09, 0x7D, 0x33, 0xD1, 0x40, 0xBF, 0x01, 0x10, 0x80, 0x00, 0x90, -0x8F, 0xCA, 0x12, 0x78, 0x65, 0x90, 0x90, 0xED, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x90, 0xED, -0xA3, 0xE0, 0x12, 0x5F, 0x7D, 0x90, 0x90, 0xEF, 0xEF, 0xF0, 0x90, 0x90, 0xED, 0xA3, 0xE0, 0x24, -0x28, 0xF9, 0xE4, 0x34, 0xFC, 0xFA, 0x7B, 0x01, 0x90, 0x90, 0xEB, 0xE0, 0xFD, 0xD1, 0x8D, 0x90, -0x90, 0xEC, 0xE0, 0x60, 0x02, 0xA1, 0x6E, 0xA3, 0xA3, 0xE0, 0x24, 0x38, 0xF9, 0xE4, 0x34, 0xFC, -0xFA, 0x7B, 0x01, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90, 0x90, 0xE8, 0x12, 0x48, 0x17, 0x8B, -0x40, 0x8A, 0x41, 0x89, 0x42, 0x75, 0x43, 0x06, 0xD0, 0x01, 0xD0, 0x02, 0xD0, 0x03, 0x12, 0x35, -0x85, 0x90, 0x90, 0xED, 0xA3, 0xE0, 0xFF, 0xA3, 0xE0, 0x2F, 0x24, 0x42, 0xF9, 0xE4, 0x34, 0xFC, -0xFA, 0x7B, 0x01, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90, 0x90, 0xE8, 0x12, 0x48, 0x17, 0x8B, -0x40, 0x8A, 0x41, 0x89, 0x42, 0x75, 0x43, 0x06, 0xD0, 0x01, 0xD0, 0x02, 0xD0, 0x03, 0x12, 0x35, -0x85, 0x90, 0x90, 0xED, 0xA3, 0xE0, 0xFF, 0xA3, 0xE0, 0x2F, 0x24, 0x48, 0xF9, 0xE4, 0x34, 0xFC, -0xFA, 0x7B, 0x01, 0xC0, 0x03, 0xC0, 0x02, 0xC0, 0x01, 0x90, 0x90, 0xE5, 0x12, 0x48, 0x17, 0x8B, -0x40, 0x8A, 0x41, 0x89, 0x42, 0x75, 0x43, 0x04, 0xD0, 0x01, 0xD0, 0x02, 0x80, 0x69, 0x90, 0x90, -0xEC, 0xE0, 0x64, 0x01, 0x70, 0x66, 0xA3, 0xA3, 0xE0, 0x24, 0x38, 0xF9, 0xE4, 0x34, 0xFC, 0xFA, -0x7B, 0x01, 0xC0, 0x03, 0x8B, 0x40, 0x75, 0x41, 0x8E, 0x75, 0x42, 0xCF, 0x75, 0x43, 0x06, 0xD0, -0x03, 0x12, 0x35, 0x85, 0x90, 0x90, 0xED, 0xA3, 0xE0, 0xFF, 0xA3, 0xE0, 0x2F, 0x24, 0x42, 0xF9, -0xE4, 0x34, 0xFC, 0xFA, 0x7B, 0x01, 0xC0, 0x03, 0x8B, 0x40, 0x75, 0x41, 0x8E, 0x75, 0x42, 0xD9, -0x75, 0x43, 0x06, 0xD0, 0x03, 0x12, 0x35, 0x85, 0x90, 0x90, 0xED, 0xA3, 0xE0, 0xFF, 0xA3, 0xE0, -0x2F, 0x24, 0x48, 0xF9, 0xE4, 0x34, 0xFC, 0xFA, 0x7B, 0x01, 0xC0, 0x03, 0x8B, 0x40, 0x75, 0x41, -0x8E, 0x75, 0x42, 0xDF, 0x75, 0x43, 0x04, 0xD0, 0x03, 0x12, 0x35, 0x85, 0x90, 0x06, 0x30, 0xE0, -0x44, 0x10, 0xF0, 0x90, 0x90, 0xF0, 0xE0, 0xFF, 0x7D, 0x34, 0x12, 0x54, 0x7F, 0x90, 0x04, 0x1F, -0x74, 0x20, 0xF0, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, 0x8F, 0xDB, 0xE0, 0x30, 0xE0, 0x40, 0x90, -0x8F, 0xDE, 0xE0, 0x04, 0xF0, 0xE0, 0xFF, 0x90, 0x8F, 0xDC, 0xE0, 0xD3, 0x9F, 0x50, 0x30, 0x90, -0x06, 0x92, 0xE0, 0x20, 0xE2, 0x1A, 0x90, 0x8F, 0xE0, 0xE0, 0x70, 0x14, 0x7D, 0x08, 0xFF, 0x12, -0x55, 0xBC, 0x90, 0x8F, 0xDF, 0xE0, 0x04, 0xF0, 0x90, 0x8F, 0xDA, 0xE0, 0x04, 0xF0, 0x80, 0x06, -0x90, 0x06, 0x92, 0x74, 0x04, 0xF0, 0xE4, 0x90, 0x8F, 0xDE, 0xF0, 0x90, 0x8F, 0xE0, 0xF0, 0x22, -0x7F, 0xFF, 0x12, 0x54, 0x7F, 0xE4, 0x90, 0x91, 0x4C, 0xF0, 0xA3, 0xF0, 0x90, 0x05, 0xF8, 0xE0, -0x70, 0x0F, 0xA3, 0xE0, 0x70, 0x0B, 0xA3, 0xE0, 0x70, 0x07, 0xA3, 0xE0, 0x70, 0x03, 0x7F, 0x01, -0x22, 0xD3, 0x90, 0x91, 0x4D, 0xE0, 0x94, 0xE8, 0x90, 0x91, 0x4C, 0xE0, 0x94, 0x03, 0x40, 0x0A, -0x90, 0x01, 0xC0, 0xE0, 0x44, 0x20, 0xF0, 0x7F, 0x00, 0x22, 0x7F, 0x32, 0x7E, 0x00, 0x12, 0x3E, -0x87, 0x90, 0x91, 0x4C, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x08, 0xD6, 0x80, 0xBF, 0x90, 0x91, 0x25, -0xED, 0xF0, 0x90, 0x91, 0x22, 0x12, 0x48, 0x20, 0xE4, 0x90, 0x91, 0x26, 0xF0, 0xA3, 0xF0, 0x12, -0x06, 0x89, 0xFF, 0x90, 0x00, 0x04, 0x12, 0x06, 0xA2, 0xFD, 0x12, 0x5F, 0x95, 0x90, 0x91, 0x26, -0xEF, 0xF0, 0x90, 0x91, 0x22, 0x12, 0x48, 0x17, 0x90, 0x00, 0x04, 0x12, 0x06, 0xA2, 0xFF, 0xF1, -0x30, 0x90, 0x91, 0x27, 0xEF, 0xF0, 0x90, 0x8E, 0xEC, 0xE0, 0x24, 0xFE, 0x60, 0x1D, 0x24, 0xFE, -0x60, 0x19, 0x14, 0x60, 0x07, 0x14, 0x60, 0x04, 0x24, 0x05, 0x70, 0x53, 0x7B, 0x01, 0x7A, 0x8E, -0x79, 0xE3, 0x90, 0x91, 0x25, 0xE0, 0xFD, 0xF1, 0x6F, 0x80, 0x16, 0x7B, 0x01, 0x7A, 0x8E, 0x79, -0xE3, 0x90, 0x91, 0x25, 0xE0, 0xFD, 0x90, 0x8E, 0xEC, 0xE0, 0x90, 0x91, 0x0A, 0xF0, 0x12, 0x81, -0x99, 0x90, 0x91, 0x27, 0xE0, 0xFF, 0x90, 0x91, 0x22, 0x12, 0x48, 0x17, 0x90, 0x91, 0x26, 0xE0, -0x7C, 0x00, 0x29, 0xF9, 0xEC, 0x3A, 0xFA, 0xC3, 0xE9, 0x9F, 0xF9, 0xEA, 0x94, 0x00, 0xFA, 0x75, -0x40, 0x01, 0x75, 0x41, 0x8E, 0x75, 0x42, 0xE3, 0xA3, 0xE0, 0xF5, 0x43, 0x12, 0x35, 0x85, 0x22, -0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0xEF, 0x20, 0xE0, 0x05, 0x90, 0x8F, 0xC7, 0x80, 0x03, -0x90, 0x8F, 0xC8, 0xE0, 0x90, 0x8E, 0xEC, 0xF0, 0x90, 0x8E, 0xEC, 0xE0, 0x14, 0x60, 0x13, 0x14, -0x60, 0x14, 0x24, 0xFE, 0x60, 0x10, 0x14, 0x60, 0x09, 0x14, 0x60, 0x06, 0x24, 0x06, 0xE4, 0xFE, -0x80, 0x06, 0x7E, 0x04, 0x80, 0x02, 0x7E, 0x08, 0xAF, 0x06, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0x90, -0x91, 0x17, 0xED, 0xF0, 0x90, 0x91, 0x14, 0x12, 0x48, 0x20, 0x90, 0x00, 0x03, 0x12, 0x06, 0xA2, -0x90, 0x91, 0x1B, 0xF0, 0x90, 0x91, 0x14, 0x12, 0x48, 0x17, 0x8B, 0x40, 0x8A, 0x41, 0x89, 0x42, -0x75, 0x43, 0x03, 0x7B, 0x01, 0x7A, 0x91, 0x79, 0x18, 0x12, 0x35, 0x85, 0x90, 0x91, 0x17, 0xE0, -0x70, 0x46, 0xFF, 0x74, 0x18, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x91, 0xF5, 0x83, 0xE0, 0xB4, 0xFF, -0x0E, 0x74, 0x18, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x91, 0xF5, 0x83, 0xE4, 0xF0, 0x80, 0x0F, 0x74, -0x18, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x91, 0xF5, 0x83, 0xE0, 0x04, 0xF0, 0x80, 0x05, 0x0F, 0xEF, -0xB4, 0x03, 0xD0, 0x75, 0x40, 0x01, 0x75, 0x41, 0x91, 0x75, 0x42, 0x18, 0x75, 0x43, 0x03, 0x90, -0x91, 0x14, 0x12, 0x48, 0x17, 0x12, 0x35, 0x85, 0x22, 0x90, 0x8D, 0xFA, 0xE0, 0x64, 0x01, 0x70, -0x26, 0x90, 0x8E, 0x7F, 0xE0, 0x60, 0x20, 0x90, 0x01, 0x57, 0xE4, 0xF0, 0x90, 0x01, 0x3C, 0x74, -0x02, 0xF0, 0x90, 0x8E, 0x7B, 0xE0, 0x54, 0xFB, 0xF0, 0x90, 0x8E, 0x83, 0xE0, 0x54, 0xFD, 0xF0, -0x54, 0x07, 0x70, 0x03, 0x12, 0x60, 0x5F, 0x22, 0x90, 0x8D, 0xFA, 0xE0, 0xB4, 0x01, 0x14, 0x90, -0x8E, 0x7F, 0xE0, 0x60, 0x0E, 0x90, 0x8E, 0x83, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0x07, 0x70, 0x03, -0x12, 0x60, 0x5F, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x04, 0x1D, 0xE0, 0x60, -0x1A, 0x90, 0x05, 0x22, 0xE0, 0x54, 0x90, 0x60, 0x07, 0x90, 0x01, 0xC0, 0xE0, 0x44, 0x08, 0xF0, -0x90, 0x01, 0xC6, 0xE0, 0x30, 0xE1, 0xE4, 0x7F, 0x00, 0x80, 0x02, 0x7F, 0x01, 0xD0, 0xD0, 0x92, -0xAF, 0x22, 0x90, 0x8F, 0xCC, 0xE0, 0xFF, 0x7B, 0x18, 0x7D, 0x01, 0xD3, 0x10, 0xAF, 0x01, 0xC3, -0xC0, 0xD0, 0x90, 0x91, 0x41, 0xED, 0xF0, 0xA3, 0xEB, 0xF0, 0x90, 0x91, 0x40, 0xEF, 0xF0, 0xE4, -0xFD, 0xFC, 0x12, 0x5D, 0xB6, 0x7C, 0x00, 0xAD, 0x07, 0x90, 0x91, 0x40, 0xE0, 0x90, 0x04, 0x25, -0xF0, 0x90, 0x91, 0x41, 0xE0, 0x60, 0x0E, 0x74, 0x21, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, -0x83, 0xE0, 0x44, 0x80, 0xF0, 0xAF, 0x05, 0x74, 0x20, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, -0x83, 0xE0, 0x54, 0xC0, 0xF0, 0x74, 0x21, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, -0x54, 0xC0, 0xF0, 0x90, 0x00, 0x8B, 0xE0, 0xD3, 0x94, 0x03, 0x74, 0x10, 0x40, 0x0D, 0x2D, 0xF5, -0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0x74, 0x04, 0xF0, 0x80, 0x0A, 0x2D, 0xF5, 0x82, 0xE4, 0x34, -0xFC, 0xF5, 0x83, 0xE4, 0xF0, 0xAF, 0x05, 0x74, 0x12, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, -0x83, 0xE0, 0x54, 0x01, 0xFE, 0x90, 0x91, 0x42, 0xE0, 0x25, 0xE0, 0x25, 0xE0, 0xFB, 0xEE, 0x44, -0x02, 0x4B, 0xFE, 0x74, 0x12, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xEE, 0xF0, 0x74, -0x11, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0x74, 0xFF, 0xF0, 0x74, 0x29, 0x2F, 0xF5, -0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xF7, 0xF0, 0xAE, 0x04, 0xAF, 0x05, 0xD0, 0xD0, -0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x8F, 0xF5, 0xEE, 0xF0, 0xA3, -0xEF, 0xF0, 0xA3, 0xED, 0xF0, 0x90, 0x90, 0x0D, 0x74, 0x18, 0xF0, 0x7E, 0x00, 0x7F, 0x80, 0x7D, -0x00, 0x7B, 0x01, 0x7A, 0x90, 0x79, 0x15, 0x12, 0x08, 0xAA, 0x90, 0x01, 0xC4, 0x74, 0x33, 0xF0, -0x74, 0x79, 0xA3, 0xF0, 0x90, 0x8F, 0xCC, 0xE0, 0xFF, 0x12, 0x5D, 0xB6, 0x90, 0x90, 0x0C, 0xEF, -0xF0, 0xF9, 0xE0, 0xFE, 0x24, 0x29, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0x74, 0x41, 0xF0, -0xEE, 0x24, 0x28, 0xFD, 0xE4, 0x33, 0xFC, 0x90, 0x90, 0x0D, 0xE0, 0x7A, 0x00, 0x2D, 0xFE, 0xEA, -0x3C, 0x90, 0x90, 0x11, 0xF0, 0xA3, 0xCE, 0xF0, 0x74, 0x28, 0x29, 0xF9, 0xE4, 0x34, 0xFC, 0xFA, -0x7B, 0x01, 0x90, 0x8F, 0xF7, 0xE0, 0xFD, 0x12, 0x76, 0x8D, 0x90, 0x90, 0x11, 0xE4, 0x75, 0xF0, -0x08, 0x12, 0x08, 0xD6, 0x90, 0x90, 0x11, 0xE4, 0x75, 0xF0, 0x08, 0x12, 0x08, 0xD6, 0x90, 0x90, -0x11, 0xE0, 0xFF, 0xA3, 0xE0, 0x90, 0x90, 0x0F, 0xCF, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x90, 0x15, -0x74, 0x01, 0xF0, 0xA3, 0x74, 0x03, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0x74, 0x5F, 0xF0, 0x90, 0x90, -0x11, 0xE4, 0x75, 0xF0, 0x04, 0x12, 0x08, 0xD6, 0x90, 0x8F, 0x31, 0xE0, 0xFF, 0x7E, 0x02, 0xB4, -0xFE, 0x02, 0x7E, 0xFE, 0x90, 0x90, 0x11, 0xA3, 0xE0, 0xFD, 0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34, -0xFC, 0xF5, 0x83, 0xEE, 0xF0, 0x74, 0x00, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, -0x90, 0x90, 0x19, 0xF0, 0x90, 0x90, 0x11, 0xE4, 0x75, 0xF0, 0x01, 0x12, 0x08, 0xD6, 0x90, 0x8F, -0xC6, 0xE0, 0x90, 0x8F, 0xF5, 0xB4, 0x01, 0x0B, 0xE0, 0x44, 0x03, 0xFC, 0xA3, 0xE0, 0x44, 0x10, -0xFD, 0x80, 0x09, 0xE0, 0x44, 0x03, 0xFC, 0xA3, 0xE0, 0x44, 0x20, 0xFD, 0x90, 0x90, 0x13, 0xEC, -0xF0, 0xA3, 0xED, 0xF0, 0x90, 0x90, 0x1A, 0x74, 0x03, 0xF0, 0xA3, 0x74, 0x12, 0xF0, 0x90, 0x90, -0x11, 0xE4, 0x75, 0xF0, 0x02, 0x12, 0x08, 0xD6, 0xEF, 0x64, 0xFE, 0x70, 0x37, 0x90, 0x90, 0x11, -0xA3, 0xE0, 0x24, 0x00, 0xF9, 0xE4, 0x34, 0xFC, 0xFA, 0x7B, 0x01, 0xC0, 0x03, 0x8B, 0x40, 0x75, -0x41, 0x8F, 0x75, 0x42, 0x34, 0x75, 0x43, 0x02, 0xD0, 0x03, 0x12, 0x35, 0x85, 0x75, 0x40, 0x01, -0x75, 0x41, 0x8F, 0x75, 0x42, 0x34, 0x75, 0x43, 0x02, 0x7B, 0x01, 0x7A, 0x90, 0x79, 0x1C, 0x12, -0x35, 0x85, 0x80, 0x60, 0x90, 0x8F, 0xC7, 0xE0, 0xFF, 0xB4, 0x02, 0x2B, 0x90, 0x90, 0x11, 0xE0, -0xFC, 0xA3, 0xE0, 0xFD, 0x24, 0x00, 0xF5, 0x82, 0x74, 0xFC, 0x3C, 0xF5, 0x83, 0xE4, 0xF0, 0x74, -0x01, 0x2D, 0xF5, 0x82, 0x74, 0xFC, 0x3C, 0xF5, 0x83, 0x74, 0x20, 0xF0, 0xE4, 0x90, 0x90, 0x1C, -0xF0, 0xA3, 0x74, 0x20, 0xF0, 0x80, 0x2D, 0xEF, 0xB4, 0x04, 0x29, 0x90, 0x90, 0x11, 0xE0, 0xFE, -0xA3, 0xE0, 0xFF, 0x24, 0x00, 0xF5, 0x82, 0x74, 0xFC, 0x3E, 0xF5, 0x83, 0xE4, 0xF0, 0x74, 0x01, -0x2F, 0xF5, 0x82, 0x74, 0xFC, 0x3E, 0xF5, 0x83, 0x74, 0x10, 0xF0, 0xE4, 0x90, 0x90, 0x1C, 0xF0, -0xA3, 0x74, 0x10, 0xF0, 0x90, 0x90, 0x11, 0xE4, 0x75, 0xF0, 0x02, 0x12, 0x08, 0xD6, 0xE4, 0x90, -0x90, 0x0E, 0xF0, 0x90, 0x90, 0x0E, 0xE0, 0xFF, 0x24, 0x36, 0xF5, 0x82, 0xE4, 0x34, 0x8F, 0xF5, -0x83, 0xE0, 0xFE, 0x90, 0x90, 0x11, 0xA3, 0xE0, 0xFD, 0xEF, 0x2D, 0x24, 0x00, 0xF5, 0x82, 0xE4, -0x34, 0xFC, 0xF5, 0x83, 0xEE, 0xF0, 0x90, 0x90, 0x0E, 0xE0, 0xFF, 0x24, 0x36, 0xF5, 0x82, 0xE4, -0x34, 0x8F, 0xF5, 0x83, 0xE0, 0xFE, 0x74, 0x1E, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x90, 0xF5, 0x83, -0xEE, 0xF0, 0x90, 0x90, 0x0E, 0xE0, 0x04, 0xF0, 0xE0, 0xB4, 0x08, 0xB7, 0x90, 0x90, 0x11, 0xE4, -0x75, 0xF0, 0x08, 0x12, 0x08, 0xD6, 0x90, 0x90, 0x11, 0xE4, 0x75, 0xF0, 0x20, 0x12, 0x08, 0xD6, -0x90, 0x90, 0x11, 0xE4, 0x75, 0xF0, 0x10, 0x12, 0x08, 0xD6, 0x90, 0x90, 0x11, 0xE4, 0x75, 0xF0, -0x08, 0x12, 0x08, 0xD6, 0x90, 0x90, 0x11, 0xE4, 0x75, 0xF0, 0x08, 0x12, 0x08, 0xD6, 0xE4, 0x90, -0x90, 0x98, 0xF0, 0xE4, 0x90, 0x90, 0x0E, 0xF0, 0x90, 0x90, 0x0E, 0xE0, 0xFF, 0xC3, 0x94, 0x10, -0x50, 0x1B, 0x91, 0xF2, 0x90, 0x90, 0x0C, 0xEF, 0xF0, 0xE0, 0x24, 0x00, 0xF5, 0x82, 0xE4, 0x34, -0xFC, 0xF5, 0x83, 0xE4, 0xF0, 0x90, 0x90, 0x0E, 0xE0, 0x04, 0xF0, 0x80, 0xDB, 0x7F, 0x64, 0x7E, -0x00, 0x12, 0x3E, 0x87, 0x90, 0x06, 0x31, 0xE0, 0x54, 0xFB, 0xF0, 0x90, 0x8F, 0xCD, 0xE0, 0xFD, -0xFF, 0x90, 0x8F, 0xCC, 0xE0, 0xC3, 0x9F, 0xFF, 0xEF, 0xFE, 0x90, 0x90, 0x0D, 0xE0, 0x7A, 0x00, -0x24, 0x00, 0xFF, 0xEA, 0x3E, 0xCF, 0x24, 0x38, 0xCF, 0x34, 0x00, 0xFE, 0xC0, 0x06, 0xC0, 0x07, -0x90, 0xAC, 0x7B, 0x74, 0x10, 0xF0, 0xED, 0xFE, 0xE4, 0x78, 0x03, 0xCE, 0xC3, 0x13, 0xCE, 0x13, -0xD8, 0xF9, 0xFF, 0x90, 0xAC, 0x7C, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xD0, 0x07, 0xD0, 0x06, 0x7B, -0x63, 0xE4, 0xFD, 0xFC, 0x12, 0x39, 0xFB, 0x7B, 0x01, 0x7A, 0x90, 0x79, 0x15, 0x90, 0xAC, 0xA1, -0x12, 0x48, 0x20, 0x7A, 0x8F, 0x79, 0xF8, 0x90, 0xAC, 0xA4, 0x12, 0x48, 0x20, 0x90, 0xAC, 0xA7, -0x74, 0x10, 0xF0, 0x7A, 0x8E, 0x79, 0xED, 0x12, 0x35, 0xE5, 0x90, 0x90, 0x98, 0xE0, 0x04, 0xF0, -0x90, 0x06, 0x31, 0xE0, 0x30, 0xE2, 0x0B, 0x90, 0x90, 0x98, 0xE0, 0xC3, 0x94, 0x0A, 0x50, 0x02, -0x61, 0x83, 0x90, 0x90, 0x98, 0xE0, 0xC3, 0x94, 0x0A, 0x40, 0x0A, 0x90, 0x06, 0x35, 0xE0, 0x44, -0x20, 0x90, 0x06, 0x34, 0xF0, 0xE4, 0x90, 0x90, 0x0E, 0xF0, 0x90, 0x90, 0x0E, 0xE0, 0xFF, 0xC3, -0x94, 0x10, 0x50, 0x2D, 0x91, 0xF2, 0x90, 0x90, 0x0C, 0xEF, 0xF0, 0x90, 0x90, 0x0E, 0xE0, 0x24, -0xF8, 0xF5, 0x82, 0xE4, 0x34, 0x8F, 0xF5, 0x83, 0xE0, 0xFF, 0x90, 0x90, 0x0C, 0xE0, 0x24, 0x00, -0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x90, 0x0E, 0xE0, 0x04, 0xF0, 0x80, -0xC9, 0x90, 0x04, 0x1D, 0xE0, 0x60, 0x2B, 0x90, 0x05, 0x22, 0xE0, 0x90, 0x90, 0x97, 0xF0, 0x7D, -0x1D, 0x12, 0x76, 0x40, 0xBF, 0x01, 0x0F, 0x11, 0x62, 0x90, 0x90, 0x0C, 0xEF, 0xF0, 0x90, 0x8F, -0xCC, 0xE0, 0x90, 0x04, 0x25, 0xF0, 0x90, 0x90, 0x97, 0xE0, 0xFF, 0x7D, 0x1E, 0x12, 0x54, 0x7F, -0x80, 0x0F, 0x11, 0x62, 0x90, 0x90, 0x0C, 0xEF, 0xF0, 0x90, 0x8F, 0xCC, 0xE0, 0x90, 0x04, 0x25, -0xF0, 0x90, 0x04, 0x1F, 0x74, 0x20, 0xF0, 0x90, 0x8E, 0x82, 0xE0, 0x70, 0x05, 0x7F, 0x01, 0x12, -0x54, 0x5D, 0x74, 0x33, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x79, 0xA3, 0xF0, 0xD0, 0xD0, 0x92, -0xAF, 0x22, 0x90, 0x90, 0x12, 0xE0, 0x2F, 0xFF, 0x90, 0x90, 0x11, 0xE0, 0x34, 0x00, 0xFE, 0x90, -0x90, 0x95, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x8F, 0xCC, 0xE0, 0xFD, 0xC3, 0xEE, 0x94, 0x01, 0x40, -0x0A, 0x0D, 0xED, 0x13, 0x90, 0xFD, 0x10, 0xF0, 0xE4, 0x2F, 0xFF, 0x22, 0x90, 0x8F, 0xF4, 0xED, -0xF0, 0x90, 0x8F, 0xF2, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xD1, 0x2E, 0x90, 0x8F, 0xF2, 0xE0, 0xFE, -0xA3, 0xE0, 0xFF, 0xA3, 0xE0, 0xFD, 0x21, 0x33, 0x90, 0x8D, 0x09, 0xE0, 0xFF, 0x90, 0x91, 0x29, -0xE0, 0xFB, 0x7D, 0x01, 0x11, 0x6B, 0x90, 0x91, 0x2A, 0xEE, 0xF0, 0xFC, 0xA3, 0xEF, 0xF0, 0xFD, -0x90, 0x91, 0x28, 0xE0, 0xFF, 0xB1, 0xE3, 0x90, 0x91, 0x2A, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x90, -0x81, 0x00, 0xE0, 0x54, 0x0F, 0xFD, 0xAC, 0x07, 0x74, 0x0D, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, -0xF5, 0x83, 0xE0, 0x44, 0x01, 0xF0, 0x74, 0x0D, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, -0xE0, 0x54, 0xFB, 0xF0, 0xAC, 0x07, 0x74, 0x12, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, -0xE0, 0x44, 0xFA, 0xF0, 0x74, 0x11, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, -0x1F, 0xF0, 0xAC, 0x07, 0x74, 0x06, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, -0x0E, 0xF0, 0x90, 0x04, 0xA7, 0xE4, 0xF0, 0x90, 0x04, 0xA6, 0xF0, 0x90, 0x04, 0xA5, 0x74, 0xFF, -0xF0, 0x90, 0x04, 0xA4, 0x74, 0xFD, 0xF0, 0x74, 0x14, 0x2C, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, -0x83, 0xE0, 0x54, 0xC0, 0x4D, 0xFD, 0x74, 0x14, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, -0xED, 0xF0, 0x22, 0x74, 0x09, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0x3F, -0xF0, 0xEF, 0x60, 0x1D, 0x74, 0x29, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, -0x10, 0xF0, 0x74, 0x09, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x80, 0xF0, -0x22, 0x74, 0x29, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x54, 0xEF, 0xF0, 0x74, -0x09, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFC, 0xF5, 0x83, 0xE0, 0x44, 0x40, 0xF0, 0x22, 0xD3, 0x10, -0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x8F, 0xC8, 0xE0, 0xFD, 0xB4, 0x02, 0x0C, 0x90, 0x90, 0x45, -0x74, 0x80, 0xF0, 0xA3, 0x74, 0x08, 0xF0, 0x80, 0x0E, 0xED, 0xB4, 0x04, 0x0A, 0x90, 0x90, 0x45, -0x74, 0x80, 0xF0, 0xA3, 0x74, 0x10, 0xF0, 0xEF, 0x64, 0x02, 0x4E, 0x60, 0x02, 0xE1, 0x26, 0x90, -0x8F, 0x2E, 0xE0, 0xFF, 0x64, 0xFE, 0x70, 0x02, 0xE1, 0x26, 0xEF, 0x64, 0x02, 0x60, 0x07, 0xEF, -0x64, 0x03, 0x60, 0x02, 0xE1, 0x26, 0x90, 0x8F, 0x8E, 0xE0, 0xFE, 0xA3, 0xE0, 0xFD, 0xED, 0xFF, -0x90, 0x90, 0x47, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x7E, 0x00, 0x7F, 0x20, 0x7D, 0x00, 0x7B, 0x01, -0x7A, 0x90, 0x79, 0x05, 0x12, 0x08, 0xAA, 0x7E, 0x00, 0x7F, 0x20, 0x7D, 0x00, 0x7B, 0x01, 0x7A, -0x90, 0x79, 0x25, 0x12, 0x08, 0xAA, 0x90, 0xAC, 0x7B, 0x74, 0x10, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, -0xF0, 0x7B, 0x20, 0xFD, 0xFC, 0xFF, 0xFE, 0x12, 0x39, 0xFB, 0x7B, 0x01, 0x7A, 0x8F, 0x79, 0x90, -0x90, 0xAC, 0x8A, 0x12, 0x48, 0x20, 0x7A, 0x90, 0x79, 0x25, 0x90, 0xAC, 0x8D, 0x12, 0x48, 0x20, -0x90, 0xAC, 0x90, 0x74, 0x20, 0xF0, 0x7A, 0x8E, 0x79, 0xFD, 0x12, 0x34, 0x56, 0x75, 0x40, 0x01, -0x75, 0x41, 0x90, 0x75, 0x42, 0x2D, 0x75, 0x43, 0x18, 0x7B, 0x01, 0x7A, 0x90, 0x79, 0x05, 0x12, -0x35, 0x85, 0x75, 0x40, 0x01, 0x75, 0x41, 0x90, 0x75, 0x42, 0x0D, 0x75, 0x43, 0x10, 0x7B, 0x01, -0x7A, 0x8F, 0x79, 0xF5, 0x12, 0x35, 0x85, 0x90, 0x90, 0x0B, 0xE0, 0x54, 0x03, 0xFF, 0xC3, 0x94, -0x04, 0x90, 0x8E, 0xEB, 0x50, 0x04, 0xEF, 0xF0, 0x80, 0x03, 0x74, 0x05, 0xF0, 0x7B, 0x01, 0x7A, -0x8F, 0x79, 0xF5, 0x12, 0x80, 0x73, 0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xC3, 0xEE, 0x94, 0x01, 0x40, -0x1E, 0x90, 0xFD, 0x11, 0xE0, 0xB5, 0x05, 0x14, 0x90, 0x01, 0x17, 0xE0, 0xB5, 0x05, 0x07, 0x90, -0xFD, 0x11, 0xE4, 0xF0, 0x80, 0x06, 0xED, 0x04, 0x90, 0xFD, 0x11, 0xF0, 0xE4, 0x2F, 0xFF, 0x22, -0x90, 0x01, 0xC4, 0x74, 0x50, 0xF0, 0x74, 0x7F, 0xA3, 0xF0, 0x7F, 0x90, 0x12, 0x4B, 0x14, 0xEF, -0x20, 0xE0, 0xF7, 0x74, 0x50, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, 0x7F, 0xA3, 0xF0, 0x22, 0x74, -0x1D, 0x2F, 0xF8, 0xE6, 0xFE, 0xED, 0xF4, 0x5E, 0xFE, 0xF6, 0x74, 0x38, 0x2F, 0xF5, 0x82, 0xE4, -0x34, 0x01, 0xF5, 0x83, 0xEE, 0xF0, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x90, -0xD3, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0x12, 0x37, 0xAD, 0x90, 0x90, 0xDD, 0x12, 0x08, 0x6D, 0x90, -0x90, 0xD5, 0x12, 0x47, 0xF3, 0x12, 0x08, 0x3A, 0x90, 0x90, 0xDD, 0x12, 0x47, 0xFF, 0x12, 0x47, -0xD9, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, 0x90, 0x90, 0xD5, 0x12, 0x47, 0xF3, 0x90, -0x90, 0xD9, 0x12, 0x47, 0xFF, 0x12, 0x47, 0xD9, 0xD0, 0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, -0x12, 0x47, 0xE6, 0x90, 0x90, 0xE1, 0x12, 0x08, 0x6D, 0x90, 0x90, 0xE1, 0x12, 0x47, 0xF3, 0x90, -0xAA, 0xB9, 0x12, 0x08, 0x6D, 0x90, 0x90, 0xD3, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x12, 0x38, 0xA4, -0xD0, 0xD0, 0x92, 0xAF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, 0x90, 0xC1, 0xEC, -0xF0, 0xA3, 0xED, 0xF0, 0x90, 0x90, 0xC0, 0xEF, 0xF0, 0xA3, 0xA3, 0xE0, 0xFD, 0x12, 0x3E, 0x39, -0x90, 0x90, 0xCB, 0x12, 0x08, 0x6D, 0x90, 0x90, 0xC3, 0x12, 0x47, 0xF3, 0x12, 0x08, 0x3A, 0x90, -0x90, 0xCB, 0x12, 0x47, 0xFF, 0x12, 0x47, 0xD9, 0xC0, 0x04, 0xC0, 0x05, 0xC0, 0x06, 0xC0, 0x07, -0x90, 0x90, 0xC3, 0x12, 0x47, 0xF3, 0x90, 0x90, 0xC7, 0x12, 0x47, 0xFF, 0x12, 0x47, 0xD9, 0xD0, -0x03, 0xD0, 0x02, 0xD0, 0x01, 0xD0, 0x00, 0x12, 0x47, 0xE6, 0x90, 0x90, 0xCF, 0x12, 0x08, 0x6D, -0x90, 0x90, 0xC1, 0xA3, 0xE0, 0xFD, 0xC0, 0x05, 0x90, 0x90, 0xCF, 0x12, 0x47, 0xF3, 0x90, 0xAA, -0x96, 0x12, 0x08, 0x6D, 0x90, 0x90, 0xC0, 0xE0, 0xFF, 0xD0, 0x05, 0x12, 0x3D, 0x39, 0xD0, 0xD0, -0x92, 0xAF, 0x22, 0x90, 0x90, 0x49, 0xEF, 0xF0, 0xA3, 0x12, 0x48, 0x20, 0x90, 0x90, 0x4A, 0x12, -0x48, 0x17, 0x8B, 0x40, 0x8A, 0x41, 0x89, 0x42, 0x75, 0x43, 0x04, 0x7B, 0x01, 0x7A, 0x90, 0x79, -0x4D, 0x12, 0x35, 0x85, 0x90, 0x90, 0x49, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x02, 0x31, 0x57, -0x90, 0x90, 0x4A, 0x12, 0x48, 0x17, 0xE9, 0x24, 0x04, 0xF9, 0xE4, 0x3A, 0x8B, 0x40, 0xF5, 0x41, -0x89, 0x42, 0x75, 0x43, 0x04, 0x7B, 0x01, 0x7A, 0x90, 0x79, 0x4D, 0x12, 0x35, 0x85, 0x90, 0x90, -0x49, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x03, 0x31, 0x57, 0x90, 0x90, 0x4A, 0x12, 0x48, 0x17, -0xE9, 0x24, 0x08, 0xF9, 0xE4, 0x3A, 0x8B, 0x40, 0xF5, 0x41, 0x89, 0x42, 0x75, 0x43, 0x04, 0x7B, -0x01, 0x7A, 0x90, 0x79, 0x4D, 0x12, 0x35, 0x85, 0x90, 0x90, 0x49, 0xE0, 0x75, 0xF0, 0x08, 0xA4, -0x24, 0x04, 0x31, 0x57, 0x90, 0x90, 0x4A, 0x12, 0x48, 0x17, 0xE9, 0x24, 0x0C, 0xF9, 0xE4, 0x3A, -0x8B, 0x40, 0xF5, 0x41, 0x89, 0x42, 0x75, 0x43, 0x04, 0x7B, 0x01, 0x7A, 0x90, 0x79, 0x4D, 0x12, -0x35, 0x85, 0x90, 0x90, 0x49, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x24, 0x05, 0x31, 0x57, 0x90, 0x90, -0x49, 0xE0, 0xFE, 0x44, 0x10, 0x90, 0x90, 0x4D, 0xF0, 0xA3, 0x74, 0x80, 0xF0, 0xA3, 0x74, 0xFF, -0xF0, 0xA3, 0xF0, 0xEE, 0x75, 0xF0, 0x08, 0xA4, 0x31, 0x57, 0x90, 0x90, 0x4D, 0x74, 0xFF, 0xF0, -0xA3, 0xF0, 0xA3, 0xF0, 0xA3, 0xF0, 0x90, 0x90, 0x49, 0xE0, 0x75, 0xF0, 0x08, 0xA4, 0x04, 0x31, -0x57, 0x90, 0x06, 0x72, 0xE4, 0xF0, 0x22, 0xFF, 0x7B, 0x01, 0x7A, 0x90, 0x79, 0x4D, 0x12, 0x06, -0x89, 0x90, 0x06, 0x74, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x06, 0xA2, 0x90, 0x06, 0x75, 0xF0, 0x90, -0x00, 0x02, 0x12, 0x06, 0xA2, 0x90, 0x06, 0x76, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x06, 0xA2, 0x90, -0x06, 0x77, 0xF0, 0x90, 0x06, 0x70, 0xEF, 0xF0, 0xA3, 0xE4, 0xF0, 0xA3, 0x04, 0xF0, 0xA3, 0x74, -0x80, 0xF0, 0x7F, 0x01, 0x7E, 0x00, 0x02, 0x3E, 0x87, 0x90, 0x91, 0x06, 0x12, 0x48, 0x20, 0x12, -0x06, 0x89, 0x90, 0x91, 0x0B, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x06, 0xA2, 0x90, 0x91, 0x0C, 0xF0, -0x90, 0x00, 0x04, 0x12, 0x06, 0xA2, 0x90, 0x91, 0x0D, 0xF0, 0x90, 0x00, 0x05, 0x12, 0x06, 0xA2, -0x90, 0x91, 0x0E, 0xF0, 0x90, 0x00, 0x06, 0x12, 0x06, 0xA2, 0x90, 0x91, 0x0F, 0xF0, 0x90, 0x00, -0x07, 0x12, 0x06, 0xA2, 0x90, 0x91, 0x10, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x06, 0xA2, 0x90, 0x91, -0x13, 0xF0, 0xED, 0x70, 0x31, 0xFF, 0x74, 0x0B, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x91, 0xF5, 0x83, -0xE0, 0xB4, 0xFF, 0x0E, 0x74, 0x0B, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x91, 0xF5, 0x83, 0xE4, 0xF0, -0x80, 0x0F, 0x74, 0x0B, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x91, 0xF5, 0x83, 0xE0, 0x04, 0xF0, 0x80, -0x05, 0x0F, 0xEF, 0xB4, 0x06, 0xD0, 0x90, 0x91, 0x0A, 0xE0, 0xFF, 0xB4, 0x04, 0x25, 0xA3, 0xE0, -0xFE, 0x90, 0x91, 0x06, 0x12, 0x48, 0x17, 0xEE, 0x12, 0x06, 0xCF, 0x90, 0x91, 0x0C, 0xE0, 0xFE, -0x90, 0x91, 0x06, 0x12, 0x48, 0x17, 0x90, 0x00, 0x01, 0xEE, 0x12, 0x06, 0xE1, 0x90, 0x00, 0x02, -0xE4, 0x80, 0x30, 0xEF, 0xB4, 0x02, 0x2F, 0x90, 0x91, 0x0C, 0xE0, 0xFF, 0x90, 0x91, 0x06, 0x12, -0x48, 0x17, 0xEF, 0x12, 0x06, 0xCF, 0x90, 0x91, 0x0C, 0xE0, 0x44, 0x20, 0x54, 0x7F, 0xFF, 0x90, -0x91, 0x06, 0x12, 0x48, 0x17, 0x90, 0x00, 0x01, 0xEF, 0x12, 0x06, 0xE1, 0x90, 0x91, 0x0B, 0xE0, -0x90, 0x00, 0x02, 0x12, 0x06, 0xE1, 0x90, 0x91, 0x06, 0x12, 0x48, 0x17, 0xE9, 0x24, 0x03, 0xF9, -0xE4, 0x3A, 0xFA, 0x12, 0x06, 0x89, 0x44, 0x20, 0x12, 0x06, 0xCF, 0x90, 0x91, 0x0D, 0xE0, 0xFF, -0x90, 0x91, 0x06, 0x12, 0x48, 0x17, 0x90, 0x00, 0x04, 0xEF, 0x12, 0x06, 0xE1, 0x90, 0x91, 0x0E, -0xE0, 0x90, 0x00, 0x05, 0x12, 0x06, 0xE1, 0x90, 0x91, 0x0F, 0xE0, 0x90, 0x00, 0x06, 0x12, 0x06, -0xE1, 0x90, 0x91, 0x10, 0xE0, 0x90, 0x00, 0x07, 0x02, 0x06, 0xE1, 0x90, 0x04, 0x1A, 0xE0, 0xF4, -0x60, 0x03, 0x7F, 0x00, 0x22, 0x90, 0x04, 0x1B, 0xE0, 0x54, 0x07, 0x64, 0x07, 0x7F, 0x01, 0x60, -0x02, 0x7F, 0x00, 0x22, 0x51, 0xBB, 0xEF, 0x64, 0x01, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x01, -0xF0, 0x61, 0x6F, 0x90, 0x8E, 0x83, 0xE0, 0xFF, 0x54, 0x03, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, -0x02, 0xF0, 0x80, 0x7B, 0x90, 0x8E, 0x81, 0xE0, 0xFE, 0xE4, 0xC3, 0x9E, 0x50, 0x08, 0x90, 0x01, -0xB8, 0x74, 0x04, 0xF0, 0x80, 0x69, 0xEF, 0x30, 0xE2, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x08, 0xF0, -0x80, 0x5D, 0x90, 0x8E, 0x83, 0xE0, 0x30, 0xE4, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x10, 0xF0, 0x80, -0x4E, 0x90, 0x8E, 0x7C, 0xE0, 0x13, 0x13, 0x54, 0x3F, 0x20, 0xE0, 0x08, 0x90, 0x01, 0xB8, 0x74, -0x20, 0xF0, 0x80, 0x3B, 0x90, 0x8E, 0xB1, 0xE0, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x80, 0xF0, -0x80, 0x2D, 0x90, 0x06, 0x62, 0xE0, 0x30, 0xE1, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x11, 0xF0, 0x80, -0x1E, 0x90, 0x06, 0x62, 0xE0, 0x30, 0xE0, 0x0F, 0xE0, 0x54, 0xFC, 0xFF, 0xBF, 0x80, 0x08, 0x90, -0x01, 0xB8, 0x74, 0x12, 0xF0, 0x80, 0x08, 0x90, 0x01, 0xB8, 0xE4, 0xF0, 0x7F, 0x01, 0x22, 0x90, -0x01, 0xB9, 0x74, 0x04, 0xF0, 0x7F, 0x00, 0x22, 0x90, 0x02, 0x87, 0xE0, 0x60, 0x08, 0x90, 0x01, -0xB8, 0x74, 0x01, 0xF0, 0x80, 0x49, 0x90, 0x8E, 0xB2, 0xE0, 0x30, 0xE0, 0x0E, 0x90, 0x02, 0x82, -0xE0, 0x60, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x02, 0xF0, 0x80, 0x34, 0x90, 0x8E, 0xBA, 0xE0, 0x30, -0xE0, 0x08, 0x90, 0x01, 0xB8, 0x74, 0x08, 0xF0, 0x80, 0x25, 0x90, 0x02, 0x86, 0xE0, 0x20, 0xE1, -0x08, 0x90, 0x01, 0xB8, 0x74, 0x04, 0xF0, 0x80, 0x16, 0x90, 0x04, 0x1D, 0xE0, 0x60, 0x08, 0x90, -0x01, 0xB8, 0x74, 0x40, 0xF0, 0x80, 0x08, 0x90, 0x01, 0xB8, 0xE4, 0xF0, 0x7F, 0x01, 0x22, 0x90, -0x01, 0xB9, 0x74, 0x08, 0xF0, 0x7F, 0x00, 0x22, 0x90, 0x8F, 0xD7, 0xE0, 0x54, 0xFE, 0xF0, 0x54, -0x7F, 0xF0, 0x54, 0xFB, 0xF0, 0xA3, 0x74, 0x0A, 0xF0, 0xE4, 0xA3, 0xF0, 0xA3, 0xF0, 0x22, 0x12, -0x06, 0x89, 0xFF, 0x54, 0x01, 0xFE, 0x90, 0x8F, 0xD7, 0xE0, 0x54, 0xFE, 0x4E, 0xFE, 0xF0, 0xEF, -0x54, 0x04, 0xFF, 0xEE, 0x54, 0xFB, 0x4F, 0xF0, 0x12, 0x06, 0x89, 0xC3, 0x13, 0x30, 0xE0, 0x0A, -0x90, 0x00, 0x01, 0x12, 0x06, 0xA2, 0x90, 0x8F, 0xD8, 0xF0, 0x22, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, -0x90, 0x02, 0x84, 0xEF, 0xF0, 0xEE, 0xA3, 0xF0, 0xA3, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0x90, 0x01, -0x1F, 0xE0, 0xFE, 0x90, 0x01, 0x1E, 0xE0, 0x7C, 0x00, 0x24, 0x00, 0xFF, 0xEC, 0x3E, 0x90, 0x8F, -0xEB, 0xF0, 0xA3, 0xEF, 0xF0, 0x90, 0x02, 0x87, 0xE0, 0xF9, 0x90, 0x8E, 0xB2, 0xE0, 0x20, 0xE0, -0x02, 0xA1, 0x13, 0xEC, 0xC3, 0x99, 0x40, 0x02, 0xA1, 0x13, 0x90, 0x8F, 0xEB, 0xE0, 0xFA, 0xA3, -0xE0, 0xFB, 0xEA, 0x90, 0xFD, 0x11, 0xF0, 0xAF, 0x03, 0xAD, 0x07, 0x74, 0x01, 0x2D, 0xF5, 0x82, -0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0xFE, 0x74, 0x00, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, -0x83, 0xE0, 0x7A, 0x00, 0x24, 0x00, 0xFF, 0xEA, 0x3E, 0x54, 0x3F, 0x90, 0x8F, 0xED, 0xF0, 0xA3, -0xEF, 0xF0, 0x74, 0x02, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, 0x54, 0x0F, 0x33, -0x33, 0x33, 0x54, 0xF8, 0xFF, 0x74, 0x03, 0x2D, 0xF5, 0x82, 0xE4, 0x34, 0xFB, 0xF5, 0x83, 0xE0, -0x54, 0x03, 0xFB, 0xEF, 0x24, 0x18, 0xFF, 0xE4, 0x33, 0xCF, 0x2B, 0xCF, 0x3A, 0x90, 0x8F, 0xED, -0x8F, 0xF0, 0x12, 0x08, 0xD6, 0x90, 0x8F, 0xED, 0xB1, 0x7A, 0x90, 0x8F, 0xED, 0xEE, 0xF0, 0xA3, -0xEF, 0xF0, 0x90, 0x8F, 0xEB, 0xEE, 0x8F, 0xF0, 0x12, 0x08, 0xD6, 0x90, 0x8D, 0xF7, 0xE0, 0xFE, -0xA3, 0xE0, 0xFF, 0xD3, 0x90, 0x8F, 0xEC, 0xE0, 0x9F, 0x90, 0x8F, 0xEB, 0xE0, 0x9E, 0x40, 0x1B, -0x90, 0x8D, 0xF8, 0xE0, 0x24, 0x01, 0xFF, 0x90, 0x8D, 0xF7, 0xE0, 0x34, 0x00, 0xFE, 0xC3, 0x90, -0x8F, 0xEC, 0xE0, 0x9F, 0xF0, 0x90, 0x8F, 0xEB, 0xE0, 0x9E, 0xF0, 0x90, 0x8F, 0xEB, 0x91, 0x1B, -0x0C, 0x81, 0x53, 0x22, 0xB1, 0x64, 0xAD, 0x07, 0x90, 0x01, 0xC4, 0x74, 0x14, 0xF0, 0x74, 0x85, -0xA3, 0xF0, 0xED, 0x64, 0x01, 0x60, 0x22, 0x90, 0x8E, 0xBA, 0xE0, 0x44, 0x01, 0xF0, 0xED, 0xB4, -0x02, 0x08, 0x90, 0x01, 0xC7, 0x74, 0x40, 0xF0, 0x80, 0x0A, 0xED, 0xB4, 0x04, 0x06, 0x90, 0x01, -0xC7, 0x74, 0x41, 0xF0, 0x7F, 0x01, 0x02, 0x61, 0x0A, 0x91, 0x2E, 0x90, 0x02, 0x87, 0xE0, 0x70, -0xF8, 0x90, 0x06, 0x90, 0xE0, 0x44, 0x02, 0xF0, 0x74, 0x14, 0x04, 0x90, 0x01, 0xC4, 0xF0, 0x74, -0x85, 0xA3, 0xF0, 0x22, 0x90, 0x02, 0x86, 0xE0, 0x20, 0xE2, 0x03, 0x7F, 0x04, 0x22, 0x90, 0x02, -0x86, 0xE0, 0x7F, 0x01, 0x20, 0xE1, 0x02, 0x7F, 0x02, 0x22, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x7D, -0x07, 0xEF, 0x5D, 0xC3, 0x60, 0x14, 0x74, 0xFF, 0x9D, 0xFD, 0x74, 0xFF, 0x94, 0x00, 0x5E, 0xFE, -0xED, 0x5F, 0x24, 0x08, 0xFF, 0xE4, 0x3E, 0xFE, 0x80, 0x0D, 0x74, 0xFF, 0x9D, 0xFD, 0x74, 0xFF, -0x94, 0x00, 0x5E, 0xFE, 0xED, 0x5F, 0xFF, 0x22, 0xD3, 0x10, 0xAF, 0x01, 0xC3, 0xC0, 0xD0, 0x90, -0x8E, 0xB5, 0xE0, 0x54, 0xFE, 0xF0, 0x54, 0xFD, 0xF0, 0x54, 0xFB, 0xF0, 0x54, 0xF7, 0xF0, 0x54, -0xEF, 0xF0, 0x54, 0xDF, 0xF0, 0x54, 0xBF, 0xF0, 0x54, 0x7F, 0xF0, 0xA3, 0xE0, 0x54, 0x80, 0xF0, -0xE4, 0xA3, 0xF0, 0x90, 0x8E, 0xB9, 0xE0, 0x54, 0xFE, 0xF0, 0x90, 0x8E, 0xB6, 0xE0, 0x54, 0x7F, -0xF0, 0x90, 0x8E, 0xB9, 0xE0, 0x54, 0xFD, 0xF0, 0xE4, 0xFD, 0x7F, 0x8F, 0x12, 0x4C, 0x5C, 0xD0, -0xD0, 0x92, 0xAF, 0x22, 0xB1, 0xA8, 0xD1, 0x19, 0x90, 0x01, 0x3F, 0x74, 0x04, 0xF0, 0x90, 0x8D, -0x06, 0xE0, 0xFF, 0xB4, 0x01, 0x07, 0x90, 0xFD, 0x00, 0xE0, 0x54, 0xEF, 0xF0, 0xEF, 0xB4, 0x01, -0x07, 0x90, 0xFE, 0x10, 0xE0, 0x54, 0xFB, 0xF0, 0x22, 0xE4, 0xFF, 0x74, 0xE3, 0x2F, 0xF5, 0x82, -0xE4, 0x34, 0x8E, 0xF5, 0x83, 0xE0, 0xFE, 0x74, 0x84, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x04, 0xF5, -0x83, 0xEE, 0xF0, 0x0F, 0xEF, 0xB4, 0x08, 0xE3, 0x90, 0x8E, 0xEB, 0xE0, 0x90, 0x04, 0x8C, 0xF0, -0x22, 0x90, 0x8E, 0xBA, 0xE0, 0xFF, 0x20, 0xE0, 0x07, 0x90, 0x01, 0x3F, 0xE0, 0x30, 0xE2, 0x14, -0xEF, 0x44, 0x01, 0x90, 0x8E, 0xBA, 0xF0, 0x90, 0x8E, 0xB5, 0xE0, 0xC4, 0x54, 0x0F, 0x20, 0xE0, -0x03, 0x7F, 0x00, 0x22, 0x7F, 0x01, 0x22, 0xEF, 0x90, 0x01, 0xC7, 0xB4, 0xA0, 0x05, 0x74, 0x04, -0xF0, 0x80, 0x03, 0x74, 0x08, 0xF0, 0x90, 0x8E, 0xBA, 0xE0, 0x44, 0x01, 0xF0, 0x22, 0x90, 0x8F, -0xE7, 0xEE, 0xF0, 0xA3, 0xEF, 0xF0, 0xE4, 0x90, 0x8F, 0xEF, 0xF0, 0x90, 0x8F, 0xEF, 0xE0, 0xFD, -0xC3, 0x94, 0x06, 0x50, 0x28, 0x90, 0x8F, 0xE8, 0xE0, 0x24, 0x04, 0xFF, 0x90, 0x8F, 0xE7, 0xE0, -0x34, 0x00, 0xFE, 0x12, 0x62, 0xD9, 0x90, 0x8F, 0xEF, 0xE0, 0x24, 0xE9, 0xF5, 0x82, 0xE4, 0x34, -0x8F, 0xF5, 0x83, 0xEF, 0xF0, 0x90, 0x8F, 0xEF, 0xE0, 0x04, 0xF0, 0x80, 0xCE, 0x78, 0xBB, 0x7C, -0x8E, 0x7D, 0x01, 0x7B, 0x01, 0x7A, 0x8F, 0x79, 0xE9, 0x7E, 0x00, 0x7F, 0x06, 0x12, 0x49, 0xD5, -0xEF, 0x7F, 0x00, 0x70, 0x02, 0x7F, 0x01, 0x22, 0xE4, 0x90, 0x91, 0x5D, 0xF0, 0x12, 0x06, 0x89, -0xFF, 0x90, 0x00, 0x04, 0x12, 0x06, 0xA2, 0xFD, 0x12, 0x5F, 0x95, 0x90, 0x91, 0x5D, 0xEF, 0xF0, -0x22, 0x90, 0x8F, 0xE9, 0xED, 0xF0, 0xA3, 0xEB, 0xF0, 0x90, 0x8F, 0xE7, 0xEE, 0xF0, 0xA3, 0xEF, -0xF0, 0xE4, 0x90, 0x8F, 0xEC, 0xF0, 0xFD, 0x12, 0x62, 0xD9, 0xEF, 0x54, 0x0C, 0x64, 0x08, 0x60, -0x02, 0xE1, 0xAC, 0x90, 0x8F, 0xE7, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xA3, 0xE0, 0x24, 0x06, 0xFD, -0x12, 0x62, 0xD9, 0xEF, 0x64, 0x88, 0x60, 0x02, 0xE1, 0xAC, 0x90, 0x8F, 0xE7, 0xE0, 0xFE, 0xA3, -0xE0, 0xFF, 0xA3, 0xE0, 0x24, 0x07, 0xFD, 0x12, 0x62, 0xD9, 0xEF, 0x64, 0x8E, 0x70, 0x6D, 0x90, -0x8F, 0xEC, 0x04, 0xF0, 0x90, 0x8F, 0xE7, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x90, 0x8F, 0xEA, 0xE0, -0xFD, 0x90, 0x8F, 0xE9, 0xE0, 0x2D, 0x04, 0xFD, 0x12, 0x62, 0xD9, 0xEF, 0x64, 0x03, 0x70, 0x4C, -0x90, 0x8F, 0xE7, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0x90, 0x8F, 0xEA, 0xE0, 0xFD, 0x90, 0x8F, 0xE9, -0xE0, 0x2D, 0x24, 0x06, 0xFD, 0x12, 0x62, 0xD9, 0xEF, 0x30, 0xE3, 0x07, 0x90, 0x01, 0xC7, 0x74, -0x01, 0x80, 0x21, 0x90, 0x8E, 0xB2, 0xE0, 0x13, 0x13, 0x13, 0x54, 0x1F, 0x30, 0xE0, 0x10, 0x90, -0x8F, 0xE7, 0xE0, 0xFE, 0xA3, 0xE0, 0xFF, 0xA3, 0xE0, 0xFD, 0x12, 0x61, 0x46, 0x80, 0x0D, 0x90, -0x01, 0xC7, 0x74, 0x02, 0xF0, 0x90, 0x8E, 0xBA, 0xE0, 0x44, 0x01, 0xF0, 0x90, 0x8F, 0xEC, 0xE0, -0xFF, 0x22, 0x90, 0x8E, 0xBA, 0xE0, 0x30, 0xE0, 0x03, 0x7F, 0x01, 0x22, 0x90, 0x06, 0x90, 0xE0, -0x20, 0xE5, 0x10, 0x90, 0x01, 0x3F, 0xE0, 0x30, 0xE2, 0x09, 0x90, 0x01, 0xC7, 0x74, 0x25, 0xF0, -0x7F, 0x01, 0x22, 0x7F, 0x00, 0x22, 0x90, 0x02, 0x09, 0xE0, 0x90, 0x8F, 0xEB, 0xF0, 0x12, 0x06, -0x89, 0x90, 0x8F, 0xC7, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x06, 0xA2, 0x90, 0x8F, 0xC8, 0xF0, 0x22, -0x90, 0x02, 0x09, 0xE0, 0xFD, 0x12, 0x06, 0x89, 0xFE, 0xAF, 0x05, 0xED, 0x2E, 0x90, 0x8F, 0xC9, -0xF0, 0x90, 0x00, 0x01, 0x12, 0x06, 0xA2, 0xFF, 0xED, 0x2F, 0x90, 0x8F, 0xCA, 0xF0, 0x90, 0x00, -0x02, 0x12, 0x06, 0xA2, 0xFF, 0xED, 0x2F, 0x90, 0x8F, 0xCB, 0xF0, 0x90, 0x00, 0x03, 0x12, 0x06, -0xA2, 0xFF, 0xED, 0x2F, 0x90, 0x8F, 0xCC, 0xF0, 0x90, 0x00, 0x04, 0x12, 0x06, 0xA2, 0xFF, 0xED, -0x2F, 0x90, 0x8F, 0xCD, 0xF0, 0x90, 0x00, 0x05, 0x12, 0x06, 0xA2, 0xFF, 0xAE, 0x05, 0xED, 0x2F, -0x90, 0x8F, 0xCE, 0xF0, 0x22, 0x90, 0x02, 0x09, 0xE0, 0xFD, 0x12, 0x06, 0x89, 0xFE, 0xAF, 0x05, -0xED, 0x2E, 0x90, 0x8F, 0xCF, 0xF0, 0x90, 0x00, 0x01, 0x12, 0x06, 0xA2, 0xFF, 0xED, 0x2F, 0x90, -0x8F, 0xD0, 0xF0, 0x90, 0x00, 0x02, 0x12, 0x06, 0xA2, 0xFF, 0xED, 0x2F, 0x90, 0x8F, 0xD1, 0xF0, -0x90, 0x00, 0x03, 0x12, 0x06, 0xA2, 0xFF, 0xED, 0x2F, 0x90, 0x8F, 0xD2, 0xF0, 0x90, 0x00, 0x04, -0x12, 0x06, 0xA2, 0xFF, 0xED, 0x2F, 0x90, 0x8F, 0xD3, 0xF0, 0x90, 0x00, 0x05, 0x12, 0x06, 0xA2, -0xFF, 0xED, 0x2F, 0x90, 0x8F, 0xD4, 0xF0, 0x90, 0x00, 0x06, 0x12, 0x06, 0xA2, 0xFF, 0xAE, 0x05, -0xED, 0x2F, 0x90, 0x8F, 0xD5, 0xF0, 0x22, 0xE4, 0xFF, 0x74, 0x18, 0x2F, 0xF5, 0x82, 0xE4, 0x34, -0x06, 0xF5, 0x83, 0xE0, 0xFE, 0x74, 0xC1, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x8E, 0xF5, 0x83, 0xEE, -0xF0, 0x74, 0x10, 0x2F, 0xF5, 0x82, 0xE4, 0x34, 0x06, 0xF5, 0x83, 0xE0, 0xFE, 0x74, 0xBB, 0x2F, -0xF5, 0x82, 0xE4, 0x34, 0x8E, 0xF5, 0x83, 0xEE, 0xF0, 0x0F, 0xEF, 0xB4, 0x06, 0xCB, 0x22, 0x90, -0x8F, 0xEB, 0xEF, 0xF0, 0x22, 0x00, 0x57, 0x6C, -}; -u4Byte ArrayLength_MP_8192E_FW_WoWLAN = 18696; - - -void -ODM_ReadFirmware_MP_8192E_FW_WoWLAN( - IN PDM_ODM_T pDM_Odm, - OUT u1Byte *pFirmware, - OUT u4Byte *pFirmwareSize -) -{ -#if(DM_ODM_SUPPORT_TYPE & (ODM_WIN)) - ODM_MoveMemory(pDM_Odm, pFirmware, Array_MP_8192E_FW_WoWLAN, ArrayLength_MP_8192E_FW_WoWLAN); -#elif(DM_ODM_SUPPORT_TYPE & (ODM_CE)) - *((SIZE_PTR *)pFirmware) = (SIZE_PTR)Array_MP_8192E_FW_WoWLAN; -#endif - - *pFirmwareSize = ArrayLength_MP_8192E_FW_WoWLAN; -} -#endif // end of HWIMG_SUPPORT - diff --git a/hal/OUTSRC/rtl8192e/HalHWImg8192E_FW_v18.h b/hal/OUTSRC/rtl8192e/HalHWImg8192E_FW_v18.h deleted file mode 100644 index 3f2b6e5..0000000 --- a/hal/OUTSRC/rtl8192e/HalHWImg8192E_FW_v18.h +++ /dev/null @@ -1,61 +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 -* -* -******************************************************************************/ - -#if (RTL8192E_SUPPORT == 1) -#ifndef __INC_MP_FW_HW_IMG_8192E_H -#define __INC_MP_FW_HW_IMG_8192E_H - - -/****************************************************************************** -* FW_AP.TXT -******************************************************************************/ - -void -ODM_ReadFirmware_MP_8192E_FW_AP_WoWLAN( - IN PDM_ODM_T pDM_Odm, - OUT u1Byte *pFirmware, - OUT u4Byte *pFirmwareSize -); - -/****************************************************************************** -* FW_NIC.TXT -******************************************************************************/ - -void -ODM_ReadFirmware_MP_8192E_FW_NIC( - IN PDM_ODM_T pDM_Odm, - OUT u1Byte *pFirmware, - OUT u4Byte *pFirmwareSize -); - -/****************************************************************************** -* FW_WoWLAN.TXT -******************************************************************************/ - -void -ODM_ReadFirmware_MP_8192E_FW_WoWLAN( - IN PDM_ODM_T pDM_Odm, - OUT u1Byte *pFirmware, - OUT u4Byte *pFirmwareSize -); - -#endif -#endif // end of HWIMG_SUPPORT - diff --git a/hal/OUTSRC/rtl8192e/HalHWImg8192E_MAC.c b/hal/OUTSRC/rtl8192e/HalHWImg8192E_MAC.c index 49aa5ba..cad0f59 100644 --- a/hal/OUTSRC/rtl8192e/HalHWImg8192E_MAC.c +++ b/hal/OUTSRC/rtl8192e/HalHWImg8192E_MAC.c @@ -18,41 +18,95 @@ * ******************************************************************************/ - +#include "Mp_Precomp.h" #include "../odm_precomp.h" #if (RTL8192E_SUPPORT == 1) static BOOLEAN -CheckCondition( - const u4Byte Condition, - const u4Byte Hex +CheckPositive( + IN PDM_ODM_T pDM_Odm, + IN const u4Byte Condition1, + IN const u4Byte Condition2 ) { - u4Byte _board = (Hex & 0x000000FF); - u4Byte _interface = (Hex & 0x0000FF00) >> 8; - u4Byte _platform = (Hex & 0x00FF0000) >> 16; - u4Byte cond = Condition; + u1Byte _BoardType = ((pDM_Odm->BoardType & BIT4) >> 4) << 0 | // _GLNA + ((pDM_Odm->BoardType & BIT3) >> 3) << 1 | // _GPA + ((pDM_Odm->BoardType & BIT7) >> 7) << 2 | // _ALNA + ((pDM_Odm->BoardType & BIT6) >> 6) << 3 | // _APA + ((pDM_Odm->BoardType & BIT2) >> 2) << 4; // _BT - if ( Condition == 0xCDCDCDCD ) - return TRUE; + u4Byte cond1 = Condition1, cond2 = Condition2; + u4Byte driver1 = pDM_Odm->CutVersion << 24 | + pDM_Odm->SupportPlatform << 16 | + pDM_Odm->PackageType << 12 | + pDM_Odm->SupportInterface << 8 | + _BoardType; - 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) ) + u4Byte driver2 = pDM_Odm->TypeGLNA << 0 | + pDM_Odm->TypeGPA << 8 | + pDM_Odm->TypeALNA << 16 | + pDM_Odm->TypeAPA << 24; + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, + ("===> [8812A] CheckPositive (cond1, cond2) = (0x%X 0x%X)\n", cond1, cond2)); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, + ("===> [8812A] CheckPositive (driver1, driver2) = (0x%X 0x%X)\n", driver1, driver2)); + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, + (" (Platform, Interface) = (0x%X, 0x%X)\n", pDM_Odm->SupportPlatform, pDM_Odm->SupportInterface)); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, + (" (Board, Package) = (0x%X, 0x%X)\n", pDM_Odm->BoardType, pDM_Odm->PackageType)); + + + //============== Value Defined Check ===============// + //QFN Type [15:12] and Cut Version [27:24] need to do value check + + if(((cond1 & 0x0000F000) != 0) &&((cond1 & 0x0000F000) != (driver1 & 0x0000F000))) + return FALSE; + if(((cond1 & 0x0F000000) != 0) &&((cond1 & 0x0F000000) != (driver1 & 0x0F000000))) + return FALSE; + + //=============== Bit Defined Check ================// + // We don't care [31:28] and [23:20] + // + cond1 &= 0x000F0FFF; + driver1 &= 0x000F0FFF; + + if ((cond1 & driver1) == cond1) + { + u4Byte bitMask = 0; + if ((cond1 & 0x0F) == 0) // BoardType is DONTCARE + return TRUE; + + if ((cond1 & BIT0) != 0) //GLNA + bitMask |= 0x000000FF; + if ((cond1 & BIT1) != 0) //GPA + bitMask |= 0x0000FF00; + if ((cond1 & BIT2) != 0) //ALNA + bitMask |= 0x00FF0000; + if ((cond1 & BIT3) != 0) //APA + bitMask |= 0xFF000000; + + if ((cond2 & bitMask) == (driver2 & bitMask)) // BoardType of each RF path is matched + return TRUE; + else + return FALSE; + } + else + { return FALSE; + } +} +static BOOLEAN +CheckNegative( + IN PDM_ODM_T pDM_Odm, + IN const u4Byte Condition1, + IN const u4Byte Condition2 + ) +{ return TRUE; } - /****************************************************************************** * MAC_REG.TXT ******************************************************************************/ @@ -149,7 +203,7 @@ u4Byte Array_MP_8192E_MAC_REG[] = { 0x640, 0x00000040, 0x642, 0x00000040, 0x643, 0x00000000, - 0x652, 0x000000C8, + 0x652, 0x0000002B, 0x66E, 0x00000005, 0x700, 0x00000021, 0x701, 0x00000043, @@ -167,69 +221,70 @@ ODM_ReadAndConfig_MP_8192E_MAC_REG( IN PDM_ODM_T pDM_Odm ) { - #define READ_NEXT_PAIR(v1, v2, i) do { i += 2; v1 = Array[i]; v2 = Array[i+1]; } while(0) - - u4Byte hex = 0; - u4Byte i = 0; - u2Byte count = 0; - pu4Byte ptr_array = NULL; - u1Byte platform = pDM_Odm->SupportPlatform; - u1Byte _interface = pDM_Odm->SupportInterface; - u1Byte board = pDM_Odm->BoardType; - u4Byte ArrayLen = sizeof(Array_MP_8192E_MAC_REG)/sizeof(u4Byte); - pu4Byte Array = Array_MP_8192E_MAC_REG; - - - hex += board; - hex += _interface << 8; - hex += platform << 16; - hex += 0xFF000000; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8192E_MAC_REG, hex = 0x%X\n", hex)); - - for (i = 0; i < ArrayLen; i += 2 ) - { - u4Byte v1 = Array[i]; - u4Byte v2 = Array[i+1]; + u4Byte i = 0; + u1Byte cCond; + BOOLEAN bMatched = TRUE, bSkipped = FALSE; +//ask by Luke.Lee + u4Byte ArrayLen = sizeof(Array_MP_8192E_MAC_REG)/sizeof(u4Byte); + pu4Byte Array = Array_MP_8192E_MAC_REG; - // This (offset, data) pair meets the condition. - if ( v1 < 0xCDCDCDCD ) - { - odm_ConfigMAC_8192E(pDM_Odm, v1, (u1Byte)v2); - continue; - } + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("===> ODM_ReadAndConfig_MP_8192E_MAC_REG\n")); + + while(( i+1) < ArrayLen) + { + u4Byte v1 = Array[i]; + u4Byte v2 = Array[i+1]; + + if(v1 & (BIT31|BIT30)) //positive & negative condition + { + if(v1 & BIT31) // positive condition + { + cCond = (u1Byte)((v1 & (BIT29|BIT28)) >> 28); + if(cCond == COND_ENDIF) //end + { + bMatched = TRUE; + bSkipped = FALSE; + } + else if(cCond == COND_ELSE) //else + { + bMatched = bSkipped?FALSE:TRUE; + } + else //if , else if + { + if(bSkipped) + bMatched = FALSE; + else + { + if(CheckPositive(pDM_Odm, v1, v2)) + { + bMatched = TRUE; + bSkipped = TRUE; + } + else + { + bMatched = FALSE; + bSkipped = FALSE; + } + } + } + } + else if(v1 & BIT30){ //negative condition + //do nothing + } + } 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_8192E(pDM_Odm, v1, (u1Byte)v2); - READ_NEXT_PAIR(v1, v2, i); - } - - while (v2 != 0xDEAD && i < ArrayLen -2) - { - READ_NEXT_PAIR(v1, v2, i); - } - - } - } + { + if(bMatched) + odm_ConfigMAC_8192E(pDM_Odm, v1, (u1Byte)v2); + } + i = i + 2; } +} +u4Byte +ODM_GetVersion_MP_8192E_MAC_REG(void) +{ + return 36; } #endif // end of HWIMG_SUPPORT diff --git a/hal/OUTSRC/rtl8192e/HalHWImg8192E_MAC.h b/hal/OUTSRC/rtl8192e/HalHWImg8192E_MAC.h index 9fb5eeb..b9ff5d4 100644 --- a/hal/OUTSRC/rtl8192e/HalHWImg8192E_MAC.h +++ b/hal/OUTSRC/rtl8192e/HalHWImg8192E_MAC.h @@ -22,7 +22,6 @@ #ifndef __INC_MP_MAC_HW_IMG_8192E_H #define __INC_MP_MAC_HW_IMG_8192E_H -//static BOOLEAN CheckCondition(const u4Byte Condition, const u4Byte Hex); /****************************************************************************** * MAC_REG.TXT @@ -32,6 +31,7 @@ void ODM_ReadAndConfig_MP_8192E_MAC_REG( // TC: Test Chip, MP: MP Chip IN PDM_ODM_T pDM_Odm ); +u4Byte ODM_GetVersion_MP_8192E_MAC_REG(void); #endif #endif // end of HWIMG_SUPPORT diff --git a/hal/OUTSRC/rtl8192e/HalHWImg8192E_RF.c b/hal/OUTSRC/rtl8192e/HalHWImg8192E_RF.c index 2a1b857..fb6ace5 100644 --- a/hal/OUTSRC/rtl8192e/HalHWImg8192E_RF.c +++ b/hal/OUTSRC/rtl8192e/HalHWImg8192E_RF.c @@ -18,40 +18,95 @@ * ******************************************************************************/ +#include "Mp_Precomp.h" #include "../odm_precomp.h" #if (RTL8192E_SUPPORT == 1) static BOOLEAN -CheckCondition( - const u4Byte Condition, - const u4Byte Hex +CheckPositive( + IN PDM_ODM_T pDM_Odm, + IN const u4Byte Condition1, + IN const u4Byte Condition2 ) { - u4Byte _board = (Hex & 0x000000FF); - u4Byte _interface = (Hex & 0x0000FF00) >> 8; - u4Byte _platform = (Hex & 0x00FF0000) >> 16; - u4Byte cond = Condition; + u1Byte _BoardType = ((pDM_Odm->BoardType & BIT4) >> 4) << 0 | // _GLNA + ((pDM_Odm->BoardType & BIT3) >> 3) << 1 | // _GPA + ((pDM_Odm->BoardType & BIT7) >> 7) << 2 | // _ALNA + ((pDM_Odm->BoardType & BIT6) >> 6) << 3 | // _APA + ((pDM_Odm->BoardType & BIT2) >> 2) << 4; // _BT - if ( Condition == 0xCDCDCDCD ) - return TRUE; + u4Byte cond1 = Condition1, cond2 = Condition2; + u4Byte driver1 = pDM_Odm->CutVersion << 24 | + pDM_Odm->SupportPlatform << 16 | + pDM_Odm->PackageType << 12 | + pDM_Odm->SupportInterface << 8 | + _BoardType; - 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) ) + u4Byte driver2 = pDM_Odm->TypeGLNA << 0 | + pDM_Odm->TypeGPA << 8 | + pDM_Odm->TypeALNA << 16 | + pDM_Odm->TypeAPA << 24; + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, + ("===> [8812A] CheckPositive (cond1, cond2) = (0x%X 0x%X)\n", cond1, cond2)); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, + ("===> [8812A] CheckPositive (driver1, driver2) = (0x%X 0x%X)\n", driver1, driver2)); + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, + (" (Platform, Interface) = (0x%X, 0x%X)\n", pDM_Odm->SupportPlatform, pDM_Odm->SupportInterface)); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, + (" (Board, Package) = (0x%X, 0x%X)\n", pDM_Odm->BoardType, pDM_Odm->PackageType)); + + + //============== Value Defined Check ===============// + //QFN Type [15:12] and Cut Version [27:24] need to do value check + + if(((cond1 & 0x0000F000) != 0) &&((cond1 & 0x0000F000) != (driver1 & 0x0000F000))) + return FALSE; + if(((cond1 & 0x0F000000) != 0) &&((cond1 & 0x0F000000) != (driver1 & 0x0F000000))) + return FALSE; + + //=============== Bit Defined Check ================// + // We don't care [31:28] and [23:20] + // + cond1 &= 0x000F0FFF; + driver1 &= 0x000F0FFF; + + if ((cond1 & driver1) == cond1) + { + u4Byte bitMask = 0; + if ((cond1 & 0x0F) == 0) // BoardType is DONTCARE + return TRUE; + + if ((cond1 & BIT0) != 0) //GLNA + bitMask |= 0x000000FF; + if ((cond1 & BIT1) != 0) //GPA + bitMask |= 0x0000FF00; + if ((cond1 & BIT2) != 0) //ALNA + bitMask |= 0x00FF0000; + if ((cond1 & BIT3) != 0) //APA + bitMask |= 0xFF000000; + + if ((cond2 & bitMask) == (driver2 & bitMask)) // BoardType of each RF path is matched + return TRUE; + else + return FALSE; + } + else + { return FALSE; + } +} +static BOOLEAN +CheckNegative( + IN PDM_ODM_T pDM_Odm, + IN const u4Byte Condition1, + IN const u4Byte Condition2 + ) +{ return TRUE; } - /****************************************************************************** * RadioA.TXT ******************************************************************************/ @@ -63,7 +118,15 @@ u4Byte Array_MP_8192E_RadioA[] = { 0x008, 0x00008400, 0x018, 0x00000407, 0x019, 0x00000012, + 0x80010003,0x00000000,0x40000000,0x00000000, + 0x01B, 0x0000146C, + 0x90010002,0x00000000,0x40000000,0x00000000, 0x01B, 0x00000064, + 0x90010001,0x00000000,0x40000000,0x00000000, + 0x01B, 0x0000146C, + 0xA0000000,0x00000000, + 0x01B, 0x00000064, + 0xB0000000,0x00000000, 0x01E, 0x00080009, 0x01F, 0x00000880, 0x02F, 0x0001A060, @@ -81,10 +144,15 @@ u4Byte Array_MP_8192E_RadioA[] = { 0x0B6, 0x0000803E, 0x0B7, 0x0001C69F, 0x0B8, 0x0000407F, - 0x0B9, 0x00080001, + 0x0B9, 0x00090001, 0x0BA, 0x00040001, 0x0BB, 0x00000400, - 0x0BF, 0x000C0000, + 0x0BC, 0x00000078, + 0x0BD, 0x000B3333, + 0x0BE, 0x00033340, + 0x0BF, 0x00000000, + 0x0C0, 0x00005999, + 0x0C1, 0x00009999, 0x0C2, 0x00002400, 0x0C3, 0x00000009, 0x0C4, 0x00040C91, @@ -94,6 +162,15 @@ u4Byte Array_MP_8192E_RadioA[] = { 0x0C8, 0x00076C06, 0x0C9, 0x00000000, 0x0CA, 0x00080000, + 0x80010003,0x00000000,0x40000000,0x00000000, + 0x01C, 0x00001C00, + 0x90010002,0x00000000,0x40000000,0x00000000, + 0x01C, 0x00001C00, + 0x90010001,0x00000000,0x40000000,0x00000000, + 0x01C, 0x00000000, + 0xA0000000,0x00000000, + 0x01C, 0x00000000, + 0xB0000000,0x00000000, 0x0DF, 0x00000180, 0x0EF, 0x000001A0, 0x051, 0x00069545, @@ -110,7 +187,7 @@ u4Byte Array_MP_8192E_RadioA[] = { 0x018, 0x00000C07, 0x05A, 0x00048000, 0x019, 0x000739D0, - 0xFF010718, 0xABCD, + 0x80010003,0x00000000,0x40000000,0x00000000, 0x034, 0x0000A093, 0x034, 0x0000908F, 0x034, 0x0000808C, @@ -122,7 +199,19 @@ u4Byte Array_MP_8192E_RadioA[] = { 0x034, 0x00002004, 0x034, 0x00001001, 0x034, 0x00000000, - 0xCDCDCDCD, 0xCDCD, + 0x90010002,0x00000000,0x40000000,0x00000000, + 0x034, 0x0000A093, + 0x034, 0x0000908F, + 0x034, 0x0000808C, + 0x034, 0x0000704D, + 0x034, 0x0000604A, + 0x034, 0x00005047, + 0x034, 0x0000400A, + 0x034, 0x00003007, + 0x034, 0x00002004, + 0x034, 0x00001001, + 0x034, 0x00000000, + 0x90010001,0x00000000,0x40000000,0x00000000, 0x034, 0x0000ADD7, 0x034, 0x00009DD4, 0x034, 0x00008DD1, @@ -134,19 +223,47 @@ u4Byte Array_MP_8192E_RadioA[] = { 0x034, 0x0000244F, 0x034, 0x0000144C, 0x034, 0x00000014, - 0xFF010718, 0xDEAD, + 0xA0000000,0x00000000, + 0x034, 0x0000ADD7, + 0x034, 0x00009DD4, + 0x034, 0x00008DD1, + 0x034, 0x00007DCE, + 0x034, 0x00006DCB, + 0x034, 0x00005DC8, + 0x034, 0x00004DC5, + 0x034, 0x000034CC, + 0x034, 0x0000244F, + 0x034, 0x0000144C, + 0x034, 0x00000014, + 0xB0000000,0x00000000, 0x000, 0x00030159, 0x084, 0x00068180, 0x086, 0x0000014E, - 0x087, 0x00048E00, + 0x80000400,0x00000000,0x40000000,0x00000000, + 0x087, 0x00049F80, + 0x90010003,0x00000000,0x40000000,0x00000000, + 0x087, 0x00079F80, + 0x90010002,0x00000000,0x40000000,0x00000000, + 0x087, 0x00049F80, + 0x90010001,0x00000000,0x40000000,0x00000000, + 0x087, 0x00079F80, + 0xA0000000,0x00000000, + 0x087, 0x00049F80, + 0xB0000000,0x00000000, 0x08E, 0x00065540, 0x08F, 0x00088000, 0x0EF, 0x000020A0, - 0xFF010718, 0xABCD, + 0x80000400,0x00000000,0x40000000,0x00000000, + 0x03B, 0x000F52B0, + 0x90010003,0x00000000,0x40000000,0x00000000, 0x03B, 0x000F07B0, - 0xCDCDCDCD, 0xCDCD, + 0x90010002,0x00000000,0x40000000,0x00000000, 0x03B, 0x000F02B0, - 0xFF010718, 0xDEAD, + 0x90010001,0x00000000,0x40000000,0x00000000, + 0x03B, 0x000F07B0, + 0xA0000000,0x00000000, + 0x03B, 0x000F02B0, + 0xB0000000,0x00000000, 0x03B, 0x000EF7B0, 0x03B, 0x000D4FB0, 0x03B, 0x000CF060, @@ -154,11 +271,17 @@ u4Byte Array_MP_8192E_RadioA[] = { 0x03B, 0x000A0080, 0x03B, 0x00090080, 0x03B, 0x0008F780, - 0xFF010718, 0xABCD, + 0x80000400,0x00000000,0x40000000,0x00000000, + 0x03B, 0x00070730, + 0x90010003,0x00000000,0x40000000,0x00000000, 0x03B, 0x000787B0, - 0xCDCDCDCD, 0xCDCD, + 0x90010002,0x00000000,0x40000000,0x00000000, 0x03B, 0x00078730, - 0xFF010718, 0xDEAD, + 0x90010001,0x00000000,0x40000000,0x00000000, + 0x03B, 0x000787B0, + 0xA0000000,0x00000000, + 0x03B, 0x00078730, + 0xB0000000,0x00000000, 0x03B, 0x00060FB0, 0x03B, 0x0005FFA0, 0x03B, 0x00040620, @@ -184,69 +307,70 @@ ODM_ReadAndConfig_MP_8192E_RadioA( IN PDM_ODM_T pDM_Odm ) { - #define READ_NEXT_PAIR(v1, v2, i) do { i += 2; v1 = Array[i]; v2 = Array[i+1]; } while(0) - - u4Byte hex = 0; - u4Byte i = 0; - u2Byte count = 0; - pu4Byte ptr_array = NULL; - u1Byte platform = pDM_Odm->SupportPlatform; - u1Byte _interface = pDM_Odm->SupportInterface; - u1Byte board = pDM_Odm->BoardType; - u4Byte ArrayLen = sizeof(Array_MP_8192E_RadioA)/sizeof(u4Byte); - pu4Byte Array = Array_MP_8192E_RadioA; - - - hex += board; - hex += _interface << 8; - hex += platform << 16; - hex += 0xFF000000; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8192E_RadioA, hex = 0x%X\n", hex)); - - for (i = 0; i < ArrayLen; i += 2 ) - { - u4Byte v1 = Array[i]; - u4Byte v2 = Array[i+1]; + u4Byte i = 0; + u1Byte cCond; + BOOLEAN bMatched = TRUE, bSkipped = FALSE; +//ask by Luke.Lee + u4Byte ArrayLen = sizeof(Array_MP_8192E_RadioA)/sizeof(u4Byte); + pu4Byte Array = Array_MP_8192E_RadioA; - // This (offset, data) pair meets the condition. - if ( v1 < 0xCDCDCDCD ) - { - odm_ConfigRF_RadioA_8192E(pDM_Odm, v1, v2); - continue; - } + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("===> ODM_ReadAndConfig_MP_8192E_RadioA\n")); + + while(( i+1) < ArrayLen) + { + u4Byte v1 = Array[i]; + u4Byte v2 = Array[i+1]; + + if(v1 & (BIT31|BIT30)) //positive & negative condition + { + if(v1 & BIT31) // positive condition + { + cCond = (u1Byte)((v1 & (BIT29|BIT28)) >> 28); + if(cCond == COND_ENDIF) //end + { + bMatched = TRUE; + bSkipped = FALSE; + } + else if(cCond == COND_ELSE) //else + { + bMatched = bSkipped?FALSE:TRUE; + } + else //if , else if + { + if(bSkipped) + bMatched = FALSE; + else + { + if(CheckPositive(pDM_Odm, v1, v2)) + { + bMatched = TRUE; + bSkipped = TRUE; + } + else + { + bMatched = FALSE; + bSkipped = FALSE; + } + } + } + } + else if(v1 & BIT30){ //negative condition + //do nothing + } + } 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_8192E(pDM_Odm, v1, v2); - READ_NEXT_PAIR(v1, v2, i); - } - - while (v2 != 0xDEAD && i < ArrayLen -2) - { - READ_NEXT_PAIR(v1, v2, i); - } - - } - } + { + if(bMatched) + odm_ConfigRF_RadioA_8192E(pDM_Odm, v1, v2); + } + i = i + 2; } +} +u4Byte +ODM_GetVersion_MP_8192E_RadioA(void) +{ + return 36; } /****************************************************************************** @@ -260,7 +384,15 @@ u4Byte Array_MP_8192E_RadioB[] = { 0x008, 0x00008400, 0x018, 0x00000407, 0x019, 0x00000012, + 0x80010003,0x00000000,0x40000000,0x00000000, + 0x01B, 0x0000146C, + 0x90010002,0x00000000,0x40000000,0x00000000, 0x01B, 0x00000064, + 0x90010001,0x00000000,0x40000000,0x00000000, + 0x01B, 0x0000146C, + 0xA0000000,0x00000000, + 0x01B, 0x00000064, + 0xB0000000,0x00000000, 0x01E, 0x00080009, 0x01F, 0x00000880, 0x02F, 0x0001A060, @@ -272,6 +404,13 @@ u4Byte Array_MP_8192E_RadioB[] = { 0x07F, 0x00000082, 0x081, 0x0003F000, 0x083, 0x00000000, + 0x80010003,0x00000000,0x40000000,0x00000000, + 0x01C, 0x00001C00, + 0x90010002,0x00000000,0x40000000,0x00000000, + 0x01C, 0x00001C00, + 0xA0000000,0x00000000, + 0x01C, 0x00000000, + 0xB0000000,0x00000000, 0x0DF, 0x00000180, 0x0EF, 0x000001A0, 0x051, 0x00069545, @@ -288,7 +427,7 @@ u4Byte Array_MP_8192E_RadioB[] = { 0x018, 0x00000C07, 0x05A, 0x00048000, 0x019, 0x000739D0, - 0xFF010718, 0xABCD, + 0x80010003,0x00000000,0x40000000,0x00000000, 0x034, 0x0000A093, 0x034, 0x0000908F, 0x034, 0x0000808C, @@ -300,7 +439,19 @@ u4Byte Array_MP_8192E_RadioB[] = { 0x034, 0x00002004, 0x034, 0x00001001, 0x034, 0x00000000, - 0xCDCDCDCD, 0xCDCD, + 0x90010002,0x00000000,0x40000000,0x00000000, + 0x034, 0x0000A093, + 0x034, 0x0000908F, + 0x034, 0x0000808C, + 0x034, 0x0000704D, + 0x034, 0x0000604A, + 0x034, 0x00005047, + 0x034, 0x0000400A, + 0x034, 0x00003007, + 0x034, 0x00002004, + 0x034, 0x00001001, + 0x034, 0x00000000, + 0x90010001,0x00000000,0x40000000,0x00000000, 0x034, 0x0000ADD7, 0x034, 0x00009DD4, 0x034, 0x00008DD1, @@ -312,19 +463,47 @@ u4Byte Array_MP_8192E_RadioB[] = { 0x034, 0x0000244F, 0x034, 0x0000144C, 0x034, 0x00000014, - 0xFF010718, 0xDEAD, + 0xA0000000,0x00000000, + 0x034, 0x0000ADD7, + 0x034, 0x00009DD4, + 0x034, 0x00008DD1, + 0x034, 0x00007DCE, + 0x034, 0x00006DCB, + 0x034, 0x00005DC8, + 0x034, 0x00004DC5, + 0x034, 0x000034CC, + 0x034, 0x0000244F, + 0x034, 0x0000144C, + 0x034, 0x00000014, + 0xB0000000,0x00000000, 0x000, 0x00030159, 0x084, 0x00068180, 0x086, 0x000000CE, - 0x087, 0x00048A00, + 0x80000400,0x00000000,0x40000000,0x00000000, + 0x087, 0x00049F80, + 0x90010003,0x00000000,0x40000000,0x00000000, + 0x087, 0x00079F80, + 0x90010002,0x00000000,0x40000000,0x00000000, + 0x087, 0x00049F80, + 0x90010001,0x00000000,0x40000000,0x00000000, + 0x087, 0x00079F80, + 0xA0000000,0x00000000, + 0x087, 0x00049F80, + 0xB0000000,0x00000000, 0x08E, 0x00065540, 0x08F, 0x00088000, 0x0EF, 0x000020A0, - 0xFF010718, 0xABCD, + 0x80000400,0x00000000,0x40000000,0x00000000, + 0x03B, 0x000F52B0, + 0x90010003,0x00000000,0x40000000,0x00000000, 0x03B, 0x000F07B0, - 0xCDCDCDCD, 0xCDCD, + 0x90010002,0x00000000,0x40000000,0x00000000, 0x03B, 0x000F02B0, - 0xFF010718, 0xDEAD, + 0x90010001,0x00000000,0x40000000,0x00000000, + 0x03B, 0x000F07B0, + 0xA0000000,0x00000000, + 0x03B, 0x000F02B0, + 0xB0000000,0x00000000, 0x03B, 0x000EF7B0, 0x03B, 0x000D4FB0, 0x03B, 0x000CF060, @@ -332,11 +511,17 @@ u4Byte Array_MP_8192E_RadioB[] = { 0x03B, 0x000A0080, 0x03B, 0x00090080, 0x03B, 0x0008F780, - 0xFF010718, 0xABCD, + 0x80000400,0x00000000,0x40000000,0x00000000, + 0x03B, 0x00070730, + 0x90010003,0x00000000,0x40000000,0x00000000, 0x03B, 0x000787B0, - 0xCDCDCDCD, 0xCDCD, + 0x90010002,0x00000000,0x40000000,0x00000000, 0x03B, 0x00078730, - 0xFF010718, 0xDEAD, + 0x90010001,0x00000000,0x40000000,0x00000000, + 0x03B, 0x000787B0, + 0xA0000000,0x00000000, + 0x03B, 0x00078730, + 0xB0000000,0x00000000, 0x03B, 0x00060FB0, 0x03B, 0x0005FFA0, 0x03B, 0x00040620, @@ -361,79 +546,81 @@ ODM_ReadAndConfig_MP_8192E_RadioB( IN PDM_ODM_T pDM_Odm ) { - #define READ_NEXT_PAIR(v1, v2, i) do { i += 2; v1 = Array[i]; v2 = Array[i+1]; } while(0) - - u4Byte hex = 0; - u4Byte i = 0; - u2Byte count = 0; - pu4Byte ptr_array = NULL; - u1Byte platform = pDM_Odm->SupportPlatform; - u1Byte _interface = pDM_Odm->SupportInterface; - u1Byte board = pDM_Odm->BoardType; - u4Byte ArrayLen = sizeof(Array_MP_8192E_RadioB)/sizeof(u4Byte); - pu4Byte Array = Array_MP_8192E_RadioB; - - - hex += board; - hex += _interface << 8; - hex += platform << 16; - hex += 0xFF000000; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8192E_RadioB, hex = 0x%X\n", hex)); - - for (i = 0; i < ArrayLen; i += 2 ) - { - u4Byte v1 = Array[i]; - u4Byte v2 = Array[i+1]; + u4Byte i = 0; + u1Byte cCond; + BOOLEAN bMatched = TRUE, bSkipped = FALSE; +//ask by Luke.Lee + u4Byte ArrayLen = sizeof(Array_MP_8192E_RadioB)/sizeof(u4Byte); + pu4Byte Array = Array_MP_8192E_RadioB; - // This (offset, data) pair meets the condition. - if ( v1 < 0xCDCDCDCD ) - { - odm_ConfigRF_RadioB_8192E(pDM_Odm, v1, v2); - continue; - } + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("===> ODM_ReadAndConfig_MP_8192E_RadioB\n")); + + while(( i+1) < ArrayLen) + { + u4Byte v1 = Array[i]; + u4Byte v2 = Array[i+1]; + + if(v1 & (BIT31|BIT30)) //positive & negative condition + { + if(v1 & BIT31) // positive condition + { + cCond = (u1Byte)((v1 & (BIT29|BIT28)) >> 28); + if(cCond == COND_ENDIF) //end + { + bMatched = TRUE; + bSkipped = FALSE; + } + else if(cCond == COND_ELSE) //else + { + bMatched = bSkipped?FALSE:TRUE; + } + else //if , else if + { + if(bSkipped) + bMatched = FALSE; + else + { + if(CheckPositive(pDM_Odm, v1, v2)) + { + bMatched = TRUE; + bSkipped = TRUE; + } + else + { + bMatched = FALSE; + bSkipped = FALSE; + } + } + } + } + else if(v1 & BIT30){ //negative condition + //do nothing + } + } 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_RadioB_8192E(pDM_Odm, v1, v2); - READ_NEXT_PAIR(v1, v2, i); - } - - while (v2 != 0xDEAD && i < ArrayLen -2) - { - READ_NEXT_PAIR(v1, v2, i); - } - - } - } + { + if(bMatched) + odm_ConfigRF_RadioB_8192E(pDM_Odm, v1, v2); + } + i = i + 2; } +} +u4Byte +ODM_GetVersion_MP_8192E_RadioB(void) +{ + return 36; } /****************************************************************************** * TxPowerTrack_AP.TXT ******************************************************************************/ +#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) u1Byte gDeltaSwingTableIdx_MP_5GB_N_TxPowerTrack_AP_8192E[][DELTA_SWINGIDX_SIZE] = { {0, 1, 1, 2, 2, 3, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 11, 12, 12, 13, 13, 14, 14, 14, 14, 14, 14, 14}, - {0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 17, 18, 18, 19, 19, 20, 20, 20}, - {0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 17, 18, 18, 19, 20, 21, 21, 21}, + {0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 14, 14, 14, 14, 14}, + {0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 14, 14, 14, 14, 14}, }; u1Byte gDeltaSwingTableIdx_MP_5GB_P_TxPowerTrack_AP_8192E[][DELTA_SWINGIDX_SIZE] = { {0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 16, 17, 17, 18, 19, 20, 20, 20}, @@ -458,15 +645,17 @@ u1Byte gDeltaSwingTableIdx_MP_2GCCKB_N_TxPowerTrack_AP_8192E[] = {0, 0, 1, 2, 2, u1Byte gDeltaSwingTableIdx_MP_2GCCKB_P_TxPowerTrack_AP_8192E[] = {0, 0, 0, 0, 1, 1, 1, 3, 3, 4, 4, 4, 4, 6, 6, 6, 6, 7, 7, 7, 9, 10, 10, 11, 11, 12, 12, 13, 14, 15}; u1Byte gDeltaSwingTableIdx_MP_2GCCKA_N_TxPowerTrack_AP_8192E[] = {0, 0, 1, 2, 2, 3, 3, 4, 4, 5, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 11, 11, 12, 12, 13, 14, 15}; u1Byte gDeltaSwingTableIdx_MP_2GCCKA_P_TxPowerTrack_AP_8192E[] = {0, 0, 0, 0, 1, 1, 1, 3, 3, 4, 4, 4, 4, 6, 6, 6, 6, 7, 7, 7, 9, 10, 10, 11, 11, 12, 12, 13, 14, 15}; +#endif void ODM_ReadAndConfig_MP_8192E_TxPowerTrack_AP( IN PDM_ODM_T pDM_Odm ) { +#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) PODM_RF_CAL_T pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_MP_8192E\n")); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("===> ODM_ReadAndConfig_MP_MP_8192E\n")); ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GA_P, gDeltaSwingTableIdx_MP_2GA_P_TxPowerTrack_AP_8192E, DELTA_SWINGIDX_SIZE); @@ -483,16 +672,18 @@ ODM_ReadAndConfig_MP_8192E_TxPowerTrack_AP( ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_5GA_N, gDeltaSwingTableIdx_MP_5GA_N_TxPowerTrack_AP_8192E, DELTA_SWINGIDX_SIZE*3); ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_5GB_P, gDeltaSwingTableIdx_MP_5GB_P_TxPowerTrack_AP_8192E, DELTA_SWINGIDX_SIZE*3); ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_5GB_N, gDeltaSwingTableIdx_MP_5GB_N_TxPowerTrack_AP_8192E, DELTA_SWINGIDX_SIZE*3); +#endif } /****************************************************************************** * TxPowerTrack_PCIE.TXT ******************************************************************************/ +#if DEV_BUS_TYPE == RT_PCI_INTERFACE u1Byte gDeltaSwingTableIdx_MP_5GB_N_TxPowerTrack_PCIE_8192E[][DELTA_SWINGIDX_SIZE] = { {0, 1, 1, 2, 2, 3, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 11, 12, 12, 13, 13, 14, 14, 14, 14, 14, 14, 14}, - {0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 17, 18, 18, 19, 19, 20, 20, 20}, - {0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 17, 18, 18, 19, 20, 21, 21, 21}, + {0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 14, 14, 14, 14, 14}, + {0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 14, 14, 14, 14, 14}, }; u1Byte gDeltaSwingTableIdx_MP_5GB_P_TxPowerTrack_PCIE_8192E[][DELTA_SWINGIDX_SIZE] = { {0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 16, 17, 17, 18, 19, 20, 20, 20}, @@ -517,15 +708,17 @@ u1Byte gDeltaSwingTableIdx_MP_2GCCKB_N_TxPowerTrack_PCIE_8192E[] = {0, 0, 1, 2, u1Byte gDeltaSwingTableIdx_MP_2GCCKB_P_TxPowerTrack_PCIE_8192E[] = {0, 0, 0, 0, 1, 1, 1, 3, 3, 4, 4, 4, 4, 6, 6, 6, 6, 7, 7, 7, 9, 10, 10, 11, 11, 12, 12, 13, 14, 15}; u1Byte gDeltaSwingTableIdx_MP_2GCCKA_N_TxPowerTrack_PCIE_8192E[] = {0, 0, 1, 2, 2, 3, 3, 4, 4, 5, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 11, 11, 12, 12, 13, 14, 15}; u1Byte gDeltaSwingTableIdx_MP_2GCCKA_P_TxPowerTrack_PCIE_8192E[] = {0, 0, 0, 0, 1, 1, 1, 3, 3, 4, 4, 4, 4, 6, 6, 6, 6, 7, 7, 7, 9, 10, 10, 11, 11, 12, 12, 13, 14, 15}; +#endif void ODM_ReadAndConfig_MP_8192E_TxPowerTrack_PCIE( IN PDM_ODM_T pDM_Odm ) { +#if DEV_BUS_TYPE == RT_PCI_INTERFACE PODM_RF_CAL_T pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_MP_8192E\n")); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("===> ODM_ReadAndConfig_MP_MP_8192E\n")); ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GA_P, gDeltaSwingTableIdx_MP_2GA_P_TxPowerTrack_PCIE_8192E, DELTA_SWINGIDX_SIZE); @@ -542,16 +735,18 @@ ODM_ReadAndConfig_MP_8192E_TxPowerTrack_PCIE( ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_5GA_N, gDeltaSwingTableIdx_MP_5GA_N_TxPowerTrack_PCIE_8192E, DELTA_SWINGIDX_SIZE*3); ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_5GB_P, gDeltaSwingTableIdx_MP_5GB_P_TxPowerTrack_PCIE_8192E, DELTA_SWINGIDX_SIZE*3); ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_5GB_N, gDeltaSwingTableIdx_MP_5GB_N_TxPowerTrack_PCIE_8192E, DELTA_SWINGIDX_SIZE*3); +#endif } /****************************************************************************** * TxPowerTrack_USB.TXT ******************************************************************************/ +#if DEV_BUS_TYPE == RT_USB_INTERFACE u1Byte gDeltaSwingTableIdx_MP_5GB_N_TxPowerTrack_USB_8192E[][DELTA_SWINGIDX_SIZE] = { {0, 1, 1, 2, 2, 3, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 11, 12, 12, 13, 13, 14, 14, 14, 14, 14, 14, 14}, - {0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 17, 18, 18, 19, 19, 20, 20, 20}, - {0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 17, 18, 18, 19, 20, 21, 21, 21}, + {0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 14, 14, 14, 14, 14}, + {0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 14, 14, 14, 14, 14}, }; u1Byte gDeltaSwingTableIdx_MP_5GB_P_TxPowerTrack_USB_8192E[][DELTA_SWINGIDX_SIZE] = { {0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 16, 17, 17, 18, 19, 20, 20, 20}, @@ -568,34 +763,25 @@ u1Byte gDeltaSwingTableIdx_MP_5GA_P_TxPowerTrack_USB_8192E[][DELTA_SWINGIDX_SIZE {0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 17, 18, 18, 19, 20, 21, 21, 21}, {0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 17, 18, 18, 19, 20, 21, 21, 21}, }; -#if 0 -u1Byte gDeltaSwingTableIdx_MP_2GB_N_TxPowerTrack_USB_8192E[] = {0, 0, 1, 2, 2, 2, 3, 3, 3, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 8, 8, 9, 9, 10, 10, 11, 12, 13, 14, 15}; -u1Byte gDeltaSwingTableIdx_MP_2GB_P_TxPowerTrack_USB_8192E[] = {0, 0, 1, 2, 2, 2, 3, 3, 3, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 9, 10, 10, 11, 11, 12, 12, 13, 14, 15}; -u1Byte gDeltaSwingTableIdx_MP_2GA_N_TxPowerTrack_USB_8192E[] = {0, 0, 1, 2, 2, 2, 3, 3, 3, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 8, 8, 9, 9, 10, 10, 11, 12, 13, 14, 15}; -u1Byte gDeltaSwingTableIdx_MP_2GA_P_TxPowerTrack_USB_8192E[] = {0, 0, 1, 2, 2, 2, 3, 3, 3, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 9, 10, 10, 11, 11, 12, 12, 13, 14, 15}; +u1Byte gDeltaSwingTableIdx_MP_2GB_N_TxPowerTrack_USB_8192E[] = {0, 0, 0, 1, 1, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 5, 7, 7, 7, 8, 9, 9, 9, 10, 10, 11, 12, 13, 14, 15}; +u1Byte gDeltaSwingTableIdx_MP_2GB_P_TxPowerTrack_USB_8192E[] = {0, 0, 0, 1, 2, 2, 2, 3, 4, 4, 5, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 14, 15}; +u1Byte gDeltaSwingTableIdx_MP_2GA_N_TxPowerTrack_USB_8192E[] = {0, 0, 0, 1, 1, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 5, 7, 7, 7, 8, 9, 9, 9, 10, 10, 11, 12, 13, 14, 15}; +u1Byte gDeltaSwingTableIdx_MP_2GA_P_TxPowerTrack_USB_8192E[] = {0, 0, 0, 1, 2, 2, 2, 3, 4, 4, 5, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 14, 15}; u1Byte gDeltaSwingTableIdx_MP_2GCCKB_N_TxPowerTrack_USB_8192E[] = {0, 0, 1, 2, 2, 3, 3, 4, 4, 5, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 11, 11, 12, 12, 13, 14, 15}; u1Byte gDeltaSwingTableIdx_MP_2GCCKB_P_TxPowerTrack_USB_8192E[] = {0, 0, 0, 0, 1, 1, 1, 3, 3, 4, 4, 4, 4, 6, 6, 6, 6, 7, 7, 7, 9, 10, 10, 11, 11, 12, 12, 13, 14, 15}; u1Byte gDeltaSwingTableIdx_MP_2GCCKA_N_TxPowerTrack_USB_8192E[] = {0, 0, 1, 2, 2, 3, 3, 4, 4, 5, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 11, 11, 12, 12, 13, 14, 15}; u1Byte gDeltaSwingTableIdx_MP_2GCCKA_P_TxPowerTrack_USB_8192E[] = {0, 0, 0, 0, 1, 1, 1, 3, 3, 4, 4, 4, 4, 6, 6, 6, 6, 7, 7, 7, 9, 10, 10, 11, 11, 12, 12, 13, 14, 15}; -#else -u1Byte gDeltaSwingTableIdx_MP_2GB_N_TxPowerTrack_USB_8192E[] = {0, 0, 0, 1, 1, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 5, 7, 7, 7, 8, 9, 9, 9, 10, 10, 11, 12, 13, 14, 15}; -u1Byte gDeltaSwingTableIdx_MP_2GB_P_TxPowerTrack_USB_8192E[] = {0, 0, 0, 1, 2, 2, 2, 3, 4, 4, 5, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 14, 15}; -u1Byte gDeltaSwingTableIdx_MP_2GA_N_TxPowerTrack_USB_8192E[] = {0, 0, 0, 1, 1, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 5, 7, 7, 7, 8, 9, 9, 9, 10, 10, 11, 12, 13, 14, 15} ; -u1Byte gDeltaSwingTableIdx_MP_2GA_P_TxPowerTrack_USB_8192E[] = {0, 0, 0, 1, 2, 2, 2, 3, 4, 4, 5, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 14, 15}; -u1Byte gDeltaSwingTableIdx_MP_2GCCKB_N_TxPowerTrack_USB_8192E[] = {0, 0, 1, 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 11, 11, 12, 12, 13, 14, 15}; -u1Byte gDeltaSwingTableIdx_MP_2GCCKB_P_TxPowerTrack_USB_8192E[] = {0, 0, 0, 0, 1, 1, 1, 3, 3, 4, 4, 4, 4, 6, 6, 6, 6, 7, 7, 7, 9, 10, 10, 11, 11, 12, 12, 13, 14, 15}; -u1Byte gDeltaSwingTableIdx_MP_2GCCKA_N_TxPowerTrack_USB_8192E[] = {0, 0, 1, 1, 2, 3, 3, 4, 4, 5, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 11, 11, 12, 12, 13, 14, 15}; -u1Byte gDeltaSwingTableIdx_MP_2GCCKA_P_TxPowerTrack_USB_8192E[] = {0, 0, 0, 0, 1, 1, 1, 3, 3, 4, 4, 4, 4, 6, 6, 6, 6, 7, 7, 7, 9, 10, 10, 11, 11, 12, 12, 13, 14, 15}; - #endif + void ODM_ReadAndConfig_MP_8192E_TxPowerTrack_USB( IN PDM_ODM_T pDM_Odm ) { +#if DEV_BUS_TYPE == RT_USB_INTERFACE PODM_RF_CAL_T pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_MP_8192E\n")); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("===> ODM_ReadAndConfig_MP_MP_8192E\n")); ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_2GA_P, gDeltaSwingTableIdx_MP_2GA_P_TxPowerTrack_USB_8192E, DELTA_SWINGIDX_SIZE); @@ -612,6 +798,7 @@ ODM_ReadAndConfig_MP_8192E_TxPowerTrack_USB( ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_5GA_N, gDeltaSwingTableIdx_MP_5GA_N_TxPowerTrack_USB_8192E, DELTA_SWINGIDX_SIZE*3); ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_5GB_P, gDeltaSwingTableIdx_MP_5GB_P_TxPowerTrack_USB_8192E, DELTA_SWINGIDX_SIZE*3); ODM_MoveMemory(pDM_Odm, pRFCalibrateInfo->DeltaSwingTableIdx_5GB_N, gDeltaSwingTableIdx_MP_5GB_N_TxPowerTrack_USB_8192E, DELTA_SWINGIDX_SIZE*3); +#endif } /****************************************************************************** @@ -660,7 +847,49 @@ pu1Byte Array_MP_8192E_TXPWR_LMT[] = { "MKK", "2.4G", "20M", "CCK", "1T", "13", "32", "FCC", "2.4G", "20M", "CCK", "1T", "14", "63", "ETSI", "2.4G", "20M", "CCK", "1T", "14", "63", - "MKK", "2.4G", "20M", "CCK", "1T", "14", "32", + "MKK", "2.4G", "20M", "CCK", "1T", "14", "32", + "FCC", "2.4G", "20M", "CCK", "2T", "01", "26", + "ETSI", "2.4G", "20M", "CCK", "2T", "01", "26", + "MKK", "2.4G", "20M", "CCK", "2T", "01", "26", + "FCC", "2.4G", "20M", "CCK", "2T", "02", "26", + "ETSI", "2.4G", "20M", "CCK", "2T", "02", "26", + "MKK", "2.4G", "20M", "CCK", "2T", "02", "26", + "FCC", "2.4G", "20M", "CCK", "2T", "03", "26", + "ETSI", "2.4G", "20M", "CCK", "2T", "03", "26", + "MKK", "2.4G", "20M", "CCK", "2T", "03", "26", + "FCC", "2.4G", "20M", "CCK", "2T", "04", "26", + "ETSI", "2.4G", "20M", "CCK", "2T", "04", "26", + "MKK", "2.4G", "20M", "CCK", "2T", "04", "26", + "FCC", "2.4G", "20M", "CCK", "2T", "05", "26", + "ETSI", "2.4G", "20M", "CCK", "2T", "05", "26", + "MKK", "2.4G", "20M", "CCK", "2T", "05", "26", + "FCC", "2.4G", "20M", "CCK", "2T", "06", "26", + "ETSI", "2.4G", "20M", "CCK", "2T", "06", "26", + "MKK", "2.4G", "20M", "CCK", "2T", "06", "26", + "FCC", "2.4G", "20M", "CCK", "2T", "07", "26", + "ETSI", "2.4G", "20M", "CCK", "2T", "07", "26", + "MKK", "2.4G", "20M", "CCK", "2T", "07", "26", + "FCC", "2.4G", "20M", "CCK", "2T", "08", "26", + "ETSI", "2.4G", "20M", "CCK", "2T", "08", "26", + "MKK", "2.4G", "20M", "CCK", "2T", "08", "26", + "FCC", "2.4G", "20M", "CCK", "2T", "09", "26", + "ETSI", "2.4G", "20M", "CCK", "2T", "09", "26", + "MKK", "2.4G", "20M", "CCK", "2T", "09", "26", + "FCC", "2.4G", "20M", "CCK", "2T", "10", "26", + "ETSI", "2.4G", "20M", "CCK", "2T", "10", "26", + "MKK", "2.4G", "20M", "CCK", "2T", "10", "26", + "FCC", "2.4G", "20M", "CCK", "2T", "11", "26", + "ETSI", "2.4G", "20M", "CCK", "2T", "11", "26", + "MKK", "2.4G", "20M", "CCK", "2T", "11", "26", + "FCC", "2.4G", "20M", "CCK", "2T", "12", "63", + "ETSI", "2.4G", "20M", "CCK", "2T", "12", "26", + "MKK", "2.4G", "20M", "CCK", "2T", "12", "26", + "FCC", "2.4G", "20M", "CCK", "2T", "13", "63", + "ETSI", "2.4G", "20M", "CCK", "2T", "13", "26", + "MKK", "2.4G", "20M", "CCK", "2T", "13", "26", + "FCC", "2.4G", "20M", "CCK", "2T", "14", "63", + "ETSI", "2.4G", "20M", "CCK", "2T", "14", "63", + "MKK", "2.4G", "20M", "CCK", "2T", "14", "26", "FCC", "2.4G", "20M", "OFDM", "1T", "01", "30", "ETSI", "2.4G", "20M", "OFDM", "1T", "01", "28", "MKK", "2.4G", "20M", "OFDM", "1T", "01", "28", @@ -702,7 +931,49 @@ pu1Byte Array_MP_8192E_TXPWR_LMT[] = { "MKK", "2.4G", "20M", "OFDM", "1T", "13", "28", "FCC", "2.4G", "20M", "OFDM", "1T", "14", "63", "ETSI", "2.4G", "20M", "OFDM", "1T", "14", "63", - "MKK", "2.4G", "20M", "OFDM", "1T", "14", "63", + "MKK", "2.4G", "20M", "OFDM", "1T", "14", "63", + "FCC", "2.4G", "20M", "OFDM", "2T", "01", "26", + "ETSI", "2.4G", "20M", "OFDM", "2T", "01", "26", + "MKK", "2.4G", "20M", "OFDM", "2T", "01", "28", + "FCC", "2.4G", "20M", "OFDM", "2T", "02", "26", + "ETSI", "2.4G", "20M", "OFDM", "2T", "02", "26", + "MKK", "2.4G", "20M", "OFDM", "2T", "02", "28", + "FCC", "2.4G", "20M", "OFDM", "2T", "03", "34", + "ETSI", "2.4G", "20M", "OFDM", "2T", "03", "26", + "MKK", "2.4G", "20M", "OFDM", "2T", "03", "28", + "FCC", "2.4G", "20M", "OFDM", "2T", "04", "34", + "ETSI", "2.4G", "20M", "OFDM", "2T", "04", "26", + "MKK", "2.4G", "20M", "OFDM", "2T", "04", "28", + "FCC", "2.4G", "20M", "OFDM", "2T", "05", "34", + "ETSI", "2.4G", "20M", "OFDM", "2T", "05", "26", + "MKK", "2.4G", "20M", "OFDM", "2T", "05", "28", + "FCC", "2.4G", "20M", "OFDM", "2T", "06", "34", + "ETSI", "2.4G", "20M", "OFDM", "2T", "06", "26", + "MKK", "2.4G", "20M", "OFDM", "2T", "06", "28", + "FCC", "2.4G", "20M", "OFDM", "2T", "07", "34", + "ETSI", "2.4G", "20M", "OFDM", "2T", "07", "26", + "MKK", "2.4G", "20M", "OFDM", "2T", "07", "28", + "FCC", "2.4G", "20M", "OFDM", "2T", "08", "34", + "ETSI", "2.4G", "20M", "OFDM", "2T", "08", "26", + "MKK", "2.4G", "20M", "OFDM", "2T", "08", "28", + "FCC", "2.4G", "20M", "OFDM", "2T", "09", "30", + "ETSI", "2.4G", "20M", "OFDM", "2T", "09", "26", + "MKK", "2.4G", "20M", "OFDM", "2T", "09", "28", + "FCC", "2.4G", "20M", "OFDM", "2T", "10", "30", + "ETSI", "2.4G", "20M", "OFDM", "2T", "10", "26", + "MKK", "2.4G", "20M", "OFDM", "2T", "10", "28", + "FCC", "2.4G", "20M", "OFDM", "2T", "11", "30", + "ETSI", "2.4G", "20M", "OFDM", "2T", "11", "26", + "MKK", "2.4G", "20M", "OFDM", "2T", "11", "28", + "FCC", "2.4G", "20M", "OFDM", "2T", "12", "63", + "ETSI", "2.4G", "20M", "OFDM", "2T", "12", "26", + "MKK", "2.4G", "20M", "OFDM", "2T", "12", "28", + "FCC", "2.4G", "20M", "OFDM", "2T", "13", "63", + "ETSI", "2.4G", "20M", "OFDM", "2T", "13", "26", + "MKK", "2.4G", "20M", "OFDM", "2T", "13", "28", + "FCC", "2.4G", "20M", "OFDM", "2T", "14", "63", + "ETSI", "2.4G", "20M", "OFDM", "2T", "14", "63", + "MKK", "2.4G", "20M", "OFDM", "2T", "14", "63", "FCC", "2.4G", "20M", "HT", "1T", "01", "30", "ETSI", "2.4G", "20M", "HT", "1T", "01", "28", "MKK", "2.4G", "20M", "HT", "1T", "01", "28", @@ -966,8 +1237,7 @@ ODM_ReadAndConfig_MP_8192E_TXPWR_LMT( u4Byte ArrayLen = sizeof(Array_MP_8192E_TXPWR_LMT)/sizeof(pu1Byte); pu1Byte *Array = Array_MP_8192E_TXPWR_LMT; - - ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8192E_TXPWR_LMT\n")); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("===> ODM_ReadAndConfig_MP_8192E_TXPWR_LMT\n")); for (i = 0; i < ArrayLen; i += 7 ) { diff --git a/hal/OUTSRC/rtl8192e/HalHWImg8192E_RF.h b/hal/OUTSRC/rtl8192e/HalHWImg8192E_RF.h index d6cb324..f053c2e 100644 --- a/hal/OUTSRC/rtl8192e/HalHWImg8192E_RF.h +++ b/hal/OUTSRC/rtl8192e/HalHWImg8192E_RF.h @@ -22,7 +22,6 @@ #ifndef __INC_MP_RF_HW_IMG_8192E_H #define __INC_MP_RF_HW_IMG_8192E_H -//static BOOLEAN CheckCondition(const u4Byte Condition, const u4Byte Hex); /****************************************************************************** * RadioA.TXT @@ -32,6 +31,7 @@ void ODM_ReadAndConfig_MP_8192E_RadioA( // TC: Test Chip, MP: MP Chip IN PDM_ODM_T pDM_Odm ); +u4Byte ODM_GetVersion_MP_8192E_RadioA(void); /****************************************************************************** * RadioB.TXT @@ -41,6 +41,7 @@ void ODM_ReadAndConfig_MP_8192E_RadioB( // TC: Test Chip, MP: MP Chip IN PDM_ODM_T pDM_Odm ); +u4Byte ODM_GetVersion_MP_8192E_RadioB(void); /****************************************************************************** * TxPowerTrack_AP.TXT @@ -50,6 +51,7 @@ void ODM_ReadAndConfig_MP_8192E_TxPowerTrack_AP( // TC: Test Chip, MP: MP Chip IN PDM_ODM_T pDM_Odm ); +u4Byte ODM_GetVersion_MP_8192E_TxPowerTrack_AP(void); /****************************************************************************** * TxPowerTrack_PCIE.TXT @@ -59,6 +61,7 @@ void ODM_ReadAndConfig_MP_8192E_TxPowerTrack_PCIE( // TC: Test Chip, MP: MP Chip IN PDM_ODM_T pDM_Odm ); +u4Byte ODM_GetVersion_MP_8192E_TxPowerTrack_PCIE(void); /****************************************************************************** * TxPowerTrack_USB.TXT @@ -68,6 +71,7 @@ void ODM_ReadAndConfig_MP_8192E_TxPowerTrack_USB( // TC: Test Chip, MP: MP Chip IN PDM_ODM_T pDM_Odm ); +u4Byte ODM_GetVersion_MP_8192E_TxPowerTrack_USB(void); /****************************************************************************** * TXPWR_LMT.TXT @@ -77,6 +81,7 @@ void ODM_ReadAndConfig_MP_8192E_TXPWR_LMT( // TC: Test Chip, MP: MP Chip IN PDM_ODM_T pDM_Odm ); +u4Byte ODM_GetVersion_MP_8192E_TXPWR_LMT(void); #endif #endif // end of HWIMG_SUPPORT diff --git a/hal/OUTSRC/rtl8192e/HalPhyRf_8192e.c b/hal/OUTSRC/rtl8192e/HalPhyRf_8192e.c index ad37625..2d5e4fe 100644 --- a/hal/OUTSRC/rtl8192e/HalPhyRf_8192e.c +++ b/hal/OUTSRC/rtl8192e/HalPhyRf_8192e.c @@ -18,7 +18,7 @@ * ******************************************************************************/ - +#include "Mp_Precomp.h" #include "../odm_precomp.h" @@ -196,7 +196,7 @@ ODM_TxPwrTrackSetPwr92E( u1Byte i = 0; #if (MP_DRIVER==1) - if ( *(pDM_Odm->mp_mode) == 1) + if (pDM_Odm->mp_mode == TRUE) { #if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE )) #if (DM_ODM_SUPPORT_TYPE & (ODM_WIN)) @@ -272,7 +272,7 @@ ODM_TxPwrTrackSetPwr92E( #if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE )) #if (MP_DRIVER == 1) - if ( *(pDM_Odm->mp_mode) == 1) + if (pDM_Odm->mp_mode == TRUE) { if (RFPath == ODM_RF_PATH_A) { @@ -356,12 +356,12 @@ ODM_TxPwrTrackSetPwr92E( if (Final_OFDM_Swing_Index >= PwrTrackingLimit_OFDM) Final_OFDM_Swing_Index = PwrTrackingLimit_OFDM; - else if (Final_OFDM_Swing_Index < 0) + else if (Final_OFDM_Swing_Index <= 0) Final_OFDM_Swing_Index = 0; if (Final_CCK_Swing_Index >= CCK_TABLE_SIZE) Final_CCK_Swing_Index = CCK_TABLE_SIZE-1; - else if (pDM_Odm->BbSwingIdxCck < 0) + else if (pDM_Odm->BbSwingIdxCck <= 0) Final_CCK_Swing_Index = 0; // Adjust BB swing by OFDM IQ matrix @@ -429,7 +429,7 @@ ODM_TxPwrTrackSetPwr92E( ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("******Path_A Over BBSwing Limit , PwrTrackingLimit = %d , Remnant TxAGC Value = %d \n", PwrTrackingLimit_OFDM, pDM_Odm->Remnant_OFDMSwingIdx[RFPath])); } - else if (Final_OFDM_Swing_Index < 0) + else if (Final_OFDM_Swing_Index <= 0) { pDM_Odm->Remnant_OFDMSwingIdx[RFPath] = Final_OFDM_Swing_Index ; @@ -508,7 +508,7 @@ ODM_TxPwrTrackSetPwr92E( PHY_SetTxPowerIndexByRateSection(Adapter, ODM_RF_PATH_B, pHalData->CurrentChannel, CCK ); } - else if(Final_CCK_Swing_Index < 0) // Lowest CCK Index = 0 + else if(Final_CCK_Swing_Index <= 0) // Lowest CCK Index = 0 { pDM_Odm->Remnant_CCKSwingIdx = Final_CCK_Swing_Index; @@ -605,7 +605,7 @@ ODM_TxPwrTrackSetPwr92E( ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("******Path_B Over BBSwing Limit , PwrTrackingLimit = %d , Remnant TxAGC Value = %d \n", PwrTrackingLimit_OFDM, pDM_Odm->Remnant_OFDMSwingIdx[RFPath])); } - else if (Final_OFDM_Swing_Index < 0) + else if (Final_OFDM_Swing_Index <= 0) { pDM_Odm->Remnant_OFDMSwingIdx[RFPath] = Final_OFDM_Swing_Index ; @@ -716,7 +716,7 @@ void ConfigureTxpowerTrack_8192E( pConfig->Threshold_IQK = IQK_THRESHOLD; pConfig->AverageThermalNum = AVG_THERMAL_NUM_92E; pConfig->RfPathCount = MAX_PATH_NUM_8192E; - pConfig->ThermalRegAddr = RF_T_METER_8192E; + pConfig->ThermalRegAddr = RF_T_METER_88E; pConfig->ODM_TxPwrTrackSetPwr = ODM_TxPwrTrackSetPwr92E; pConfig->DoIQK = DoIQK_8192E; @@ -755,9 +755,16 @@ phy_PathA_IQK_8192E( //path-A IQK setting // PA/PAD controlled by 0x0 - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x000000); ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0xdf, bRFRegOffsetMask, 0x180); - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x80800000); + + //modify TXIQK mode table + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_WE_LUT, bRFRegOffsetMask, 0x800a0); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_RCK_OS, bRFRegOffsetMask, 0x20000); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_TXPA_G1, bRFRegOffsetMask, 0x0000f); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_TXPA_G2, bRFRegOffsetMask, 0x07f77); //PA off, default: 0x7f7f + + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x808000); // ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path-A IQK setting!\n")); @@ -800,17 +807,8 @@ phy_PathA_IQK_8192E( (((regE94 & 0x03FF0000)>>16) != 0x142) && (((regE9C & 0x03FF0000)>>16) != 0x42) ) result |= 0x01; - else //if Tx not OK, ignore Rx - return result; - -#if 0 - if(!(regEAC & BIT27) && //if Tx is OK, check whether Rx is OK - (((regEA4 & 0x03FF0000)>>16) != 0x132) && - (((regEAC & 0x03FF0000)>>16) != 0x36)) - result |= 0x02; else - ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("Path A Rx IQK fail!!\n")); -#endif + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("pathA TX IQK is not success\n")); return result; @@ -846,18 +844,24 @@ phy_PathA_RxIQK_92E( //modify RXIQK mode table // ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path-A Rx IQK modify RXIQK mode table!\n")); //leave IQK mode - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x000000); ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_WE_LUT, bRFRegOffsetMask, 0x800a0); ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_RCK_OS, bRFRegOffsetMask, 0x30000); ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_TXPA_G1, bRFRegOffsetMask, 0x0000f); - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_TXPA_G2, bRFRegOffsetMask, 0xf117b); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_TXPA_G2, bRFRegOffsetMask, 0xf1173); //PA off, deafault:0xf117b + + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_WE_LUT, bRFRegOffsetMask, 0x800a0); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_RCK_OS, bRFRegOffsetMask, 0x30000); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_TXPA_G1, bRFRegOffsetMask, 0x0000f); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_TXPA_G2, bRFRegOffsetMask, 0xf1173); //PA off, deafault:0xf117b + // PA/PAD control by 0x56, and set = 0x0 ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0xdf, bRFRegOffsetMask, 0x980); - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x56, bRFRegOffsetMask, 0x51000); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x56, bRFRegOffsetMask, 0x511e0); //enter IQK mode - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x80800000); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x808000); //IQK setting ODM_SetBBReg(pDM_Odm, rTx_IQK, bMaskDWord, 0x01007c00); @@ -869,8 +873,8 @@ phy_PathA_RxIQK_92E( ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_B, bMaskDWord, 0x38008c1c); ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_B, bMaskDWord, 0x38008c1c); - ODM_SetBBReg(pDM_Odm, rTx_IQK_PI_A, bMaskDWord, 0x82160c1f); - ODM_SetBBReg(pDM_Odm, rRx_IQK_PI_A, bMaskDWord, 0x68160c1f); + ODM_SetBBReg(pDM_Odm, rTx_IQK_PI_A, bMaskDWord, 0x8216031f); + ODM_SetBBReg(pDM_Odm, rRx_IQK_PI_A, bMaskDWord, 0x6816031f); //LO calibration setting // ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("LO calibration setting!\n")); @@ -878,7 +882,7 @@ phy_PathA_RxIQK_92E( //One shot, path A LOK & IQK // ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("One shot, path A LOK & IQK!\n")); - ODM_SetBBReg(pDM_Odm, rIQK_AGC_Pts, bMaskDWord, 0xfa000000); + ODM_SetBBReg(pDM_Odm, rIQK_AGC_Pts, bMaskDWord, 0xf9000000); ODM_SetBBReg(pDM_Odm, rIQK_AGC_Pts, bMaskDWord, 0xf8000000); // delay x ms @@ -906,9 +910,11 @@ phy_PathA_RxIQK_92E( else //if Tx not OK, ignore Rx { // PA/PAD controlled by 0x0 - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x000000); ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0xdf, bRFRegOffsetMask, 0x180); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("pathA get TXIMR is not success\n")); return result; + } u4tmp = 0x80007C00 | (regE94&0x3FF0000) | ((regE9C&0x3FF0000) >> 16); @@ -921,19 +927,26 @@ phy_PathA_RxIQK_92E( ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Do RXIQK!\n")); // ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path-A Rx IQK modify RXIQK mode table 2!\n")); //leave IQK mode - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x000000); ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_WE_LUT, bRFRegOffsetMask, 0x800a0 ); - //<20121009, Kordan> RF Mode = 3 - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_RCK_OS, bRFRegOffsetMask, 0x30000 ); // 0x30[19:0] = 0x18000 - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_TXPA_G1, bRFRegOffsetMask, 0x0000f ); // 0x31[19:0] = 0x0000f - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_TXPA_G2, bRFRegOffsetMask, 0xf7ffa ); // 0x32[19:0] = 0xf7ffa + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_RCK_OS, bRFRegOffsetMask, 0x30000 ); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_TXPA_G1, bRFRegOffsetMask, 0x0000f ); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_TXPA_G2, bRFRegOffsetMask, 0xf7ff2 ); //PA off : default:0xf7ffa + + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_WE_LUT, bRFRegOffsetMask, 0x800a0 ); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_RCK_OS, bRFRegOffsetMask, 0x30000 ); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_TXPA_G1, bRFRegOffsetMask, 0x0000f ); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_TXPA_G2, bRFRegOffsetMask, 0xf7ff2 ); //PA off : default:0xf7ffa + + // PA/PAD control by 0x56, and set = 0x0 ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0xdf, bRFRegOffsetMask, 0x980 ); - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x56, bRFRegOffsetMask, 0x51000 ); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x56, bRFRegOffsetMask, 0x510e0 ); +// ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0x56, bRFRegOffsetMask, 0x51000 ); //enter IQK mode - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x80800000); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x808000); //IQK setting ODM_SetBBReg(pDM_Odm, rRx_IQK, bMaskDWord, 0x01004800); @@ -944,8 +957,11 @@ phy_PathA_RxIQK_92E( ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_B, bMaskDWord, 0x38008c1c); ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_B, bMaskDWord, 0x38008c1c); - ODM_SetBBReg(pDM_Odm, rTx_IQK_PI_A, bMaskDWord, 0x82160c1f); - ODM_SetBBReg(pDM_Odm, rRx_IQK_PI_A, bMaskDWord, 0x28160c1f); + ODM_SetBBReg(pDM_Odm, rTx_IQK_PI_A, bMaskDWord, 0x821608ff); + ODM_SetBBReg(pDM_Odm, rRx_IQK_PI_A, bMaskDWord, 0x281608ff); + +// ODM_SetBBReg(pDM_Odm, rTx_IQK_PI_A, bMaskDWord, 0x82160cff); +// ODM_SetBBReg(pDM_Odm, rRx_IQK_PI_A, bMaskDWord, 0x28160cff); //LO calibration setting // ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("LO calibration setting!\n")); @@ -953,7 +969,7 @@ phy_PathA_RxIQK_92E( //One shot, path A LOK & IQK // ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("One shot, path A LOK & IQK!\n")); - ODM_SetBBReg(pDM_Odm, rIQK_AGC_Pts, bMaskDWord, 0xfa000000); + ODM_SetBBReg(pDM_Odm, rIQK_AGC_Pts, bMaskDWord, 0xf9000000); ODM_SetBBReg(pDM_Odm, rIQK_AGC_Pts, bMaskDWord, 0xf8000000); // delay x ms @@ -972,24 +988,15 @@ phy_PathA_RxIQK_92E( // PA/PAD controlled by 0x0 //leave IQK mode - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x000000); ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0xdf, bRFRegOffsetMask, 0x180); -#if 0 - if(!(regEAC & BIT28) && - (((regE94 & 0x03FF0000)>>16) != 0x142) && - (((regE9C & 0x03FF0000)>>16) != 0x42) ) - result |= 0x01; - else //if Tx not OK, ignore Rx - return result; -#endif - if(!(regEAC & BIT27) && //if Tx is OK, check whether Rx is OK (((regEA4 & 0x03FF0000)>>16) != 0x132) && (((regEAC & 0x03FF0000)>>16) != 0x36)) result |= 0x02; else - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A Rx IQK fail!!\n")); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A Rx IQK is not success!!\n")); return result; @@ -1023,24 +1030,31 @@ phy_PathB_IQK_8192E( // PA/PAD controlled by 0x0 - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x000000); ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0xdf, bRFRegOffsetMask, 0x180); - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x80800000); + + //modify TXIQK mode table + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_WE_LUT, bRFRegOffsetMask, 0x800a0); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_RCK_OS, bRFRegOffsetMask, 0x20000); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_TXPA_G1, bRFRegOffsetMask, 0x0000f); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_TXPA_G2, bRFRegOffsetMask, 0x07f77); //PA off, default: 0x7f7f - ODM_SetBBReg(pDM_Odm, 0xe28, bMaskDWord, 0x00000000); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x808000); +#if 0 + ODM_SetBBReg(pDM_Odm, 0xe28, 0xffffff00, 0x000000); ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("path A 0xdf = 0x%x\n", ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_A, 0xdf, bRFRegOffsetMask))); ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("path B 0xdf = 0x%x\n", ODM_GetRFReg(pDM_Odm, ODM_RF_PATH_B, 0xdf, bRFRegOffsetMask))); - ODM_SetBBReg(pDM_Odm, 0xe28, bMaskDWord, 0x80800000); - + ODM_SetBBReg(pDM_Odm, 0xe28, 0xffffff00, 0x808000); +#endif ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_A, bMaskDWord, 0x38008c1c); ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_A, bMaskDWord, 0x38008c1c); ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_B, bMaskDWord, 0x18008c1c); ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_B, bMaskDWord, 0x38008c1c); - ODM_SetBBReg(pDM_Odm, rTx_IQK_PI_B, bMaskDWord, 0x821403e2); + ODM_SetBBReg(pDM_Odm, rTx_IQK_PI_B, bMaskDWord, 0x82140303); ODM_SetBBReg(pDM_Odm, rRx_IQK_PI_B, bMaskDWord, 0x68160000); //LO calibration setting @@ -1076,16 +1090,8 @@ phy_PathB_IQK_8192E( (((regEBC & 0x03FF0000)>>16) != 0x42)) result |= 0x01; else - return result; -#if 0 - if(!(regEAC & BIT30) && - (((regEC4 & 0x03FF0000)>>16) != 0x132) && - (((regECC & 0x03FF0000)>>16) != 0x36)) - result |= 0x02; - else - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B Rx IQK fail!!\n")); - -#endif + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("pathB TX IQK is not success\n")); + return result; } @@ -1118,17 +1124,23 @@ phy_PathB_RxIQK_92E( ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Get RXIQK TXIMR!\n")); //modify RXIQK mode table // ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path-B Rx IQK modify RXIQK mode table!\n")); - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x000000); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_WE_LUT, bRFRegOffsetMask, 0x800a0 ); ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_RCK_OS, bRFRegOffsetMask, 0x30000 ); ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_TXPA_G1, bRFRegOffsetMask, 0x0000f ); - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_TXPA_G2, bRFRegOffsetMask, 0xf117b ); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_TXPA_G2, bRFRegOffsetMask, 0xf1173 ); //PA off, default: 0xf117b + + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_WE_LUT, bRFRegOffsetMask, 0x800a0 ); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_RCK_OS, bRFRegOffsetMask, 0x30000 ); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_TXPA_G1, bRFRegOffsetMask, 0x0000f ); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_TXPA_G2, bRFRegOffsetMask, 0xf1173 ); //PA off, default: 0xf117b // PA/PAD all off ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0xdf, bRFRegOffsetMask, 0x980 ); - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x56, bRFRegOffsetMask, 0x51000 ); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x56, bRFRegOffsetMask, 0x511e0 ); - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x80800000); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x808000); //IQK setting ODM_SetBBReg(pDM_Odm, rTx_IQK, bMaskDWord, 0x01007c00); @@ -1140,8 +1152,8 @@ phy_PathB_RxIQK_92E( ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_B, bMaskDWord, 0x18008c1c); ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_B, bMaskDWord, 0x38008c1c); - ODM_SetBBReg(pDM_Odm, rTx_IQK_PI_B, bMaskDWord, 0x82160c1f); - ODM_SetBBReg(pDM_Odm, rRx_IQK_PI_B, bMaskDWord, 0x68160c1f); + ODM_SetBBReg(pDM_Odm, rTx_IQK_PI_B, bMaskDWord, 0x8216031f); + ODM_SetBBReg(pDM_Odm, rRx_IQK_PI_B, bMaskDWord, 0x6816031f); //LO calibration setting // ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("LO calibration setting!\n")); @@ -1175,8 +1187,9 @@ phy_PathB_RxIQK_92E( else //if Tx not OK, ignore Rx { // PA/PAD controlled by 0x0 - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000); - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, 0xdf, bRFRegOffsetMask, 0x180); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x000000); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0xdf, bRFRegOffsetMask, 0x180); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("pathB get TXIMR is not success\n")); return result; } @@ -1190,20 +1203,24 @@ phy_PathB_RxIQK_92E( //modify RXIQK mode table // ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path-B Rx IQK modify RXIQK mode table 2!\n")); - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000); - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_WE_LUT, bRFRegOffsetMask, 0x800a0 ); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x000000); + + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_WE_LUT, bRFRegOffsetMask, 0x800a0 ); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_RCK_OS, bRFRegOffsetMask, 0x30000 ); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_TXPA_G1, bRFRegOffsetMask, 0x0000f ); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_TXPA_G2, bRFRegOffsetMask, 0xf7ff2 ); // PA off, default:0xf7ffa + + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_WE_LUT, bRFRegOffsetMask, 0x800a0 ); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_RCK_OS, bRFRegOffsetMask, 0x30000 ); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_TXPA_G1, bRFRegOffsetMask, 0x0000f ); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_TXPA_G2, bRFRegOffsetMask, 0xf7ff2 ); // PA off, default:0xf7ffa - //<20121009, Kordan> RF Mode = 3 -// ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_WE_LUT, 0x80000, 0x1); // 0xEF[19] = 0x1 - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_RCK_OS, bRFRegOffsetMask, 0x30000 ); // 0x30[19:0] = 0x18000 - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_TXPA_G1, bRFRegOffsetMask, 0x0000f ); // 0x31[19:0] = 0x0000f - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, RF_TXPA_G2, bRFRegOffsetMask, 0xf7ffa ); // 0x32[19:0] = 0xf7ffa -// ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_WE_LUT, 0x80000, 0x0); // 0xEF[19] = 0x0 // PA/PAD all off ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0xdf, bRFRegOffsetMask, 0x980 ); - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x56, bRFRegOffsetMask, 0x51000 ); + ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x56, bRFRegOffsetMask, 0x510e0 ); +// ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0x56, bRFRegOffsetMask, 0x51000 ); - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x80800000); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x808000); //IQK setting ODM_SetBBReg(pDM_Odm, rRx_IQK, bMaskDWord, 0x01004800); @@ -1214,8 +1231,11 @@ phy_PathB_RxIQK_92E( ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_B, bMaskDWord, 0x38008c1c); ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_B, bMaskDWord, 0x18008c1c); - ODM_SetBBReg(pDM_Odm, rTx_IQK_PI_B, bMaskDWord, 0x82160c1f); - ODM_SetBBReg(pDM_Odm, rRx_IQK_PI_B, bMaskDWord, 0x28160c1f); + ODM_SetBBReg(pDM_Odm, rTx_IQK_PI_B, bMaskDWord, 0x821608ff); + ODM_SetBBReg(pDM_Odm, rRx_IQK_PI_B, bMaskDWord, 0x281608ff); + +// ODM_SetBBReg(pDM_Odm, rTx_IQK_PI_B, bMaskDWord, 0x82160cff); +// ODM_SetBBReg(pDM_Odm, rRx_IQK_PI_B, bMaskDWord, 0x28160cff); //LO calibration setting // ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("LO calibration setting!\n")); @@ -1244,26 +1264,15 @@ phy_PathB_RxIQK_92E( // PA/PAD controlled by 0x0 //leave IQK mode - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x000000); ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_B, 0xdf, bRFRegOffsetMask, 0x180); - - -#if 0 - if(!(regEAC & BIT31) && - (((regEB4 & 0x03FF0000)>>16) != 0x142) && - (((regEBC & 0x03FF0000)>>16) != 0x42) ) - result |= 0x01; - else //if Tx not OK, ignore Rx - return result; -#endif - if(!(regEAC & BIT30) && //if Tx is OK, check whether Rx is OK (((regEC4 & 0x03FF0000)>>16) != 0x132) && (((regECC & 0x03FF0000)>>16) != 0x36)) result |= 0x02; else - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B Rx IQK fail!!\n")); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B Rx IQK is not sucess!!\n")); return result; @@ -1673,12 +1682,40 @@ _PHY_PathAStandBy_92E( #endif ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path-A standby mode!\n")); - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x0); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x000000); // ODM_SetBBReg(pDM_Odm, 0x840, bMaskDWord, 0x00010000); ODM_SetRFReg(pDM_Odm, (ODM_RF_RADIO_PATH_E)0x0, 0x0, bRFRegOffsetMask, 0x10000); - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x80800000); + + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x808000); } +VOID +_PHY_PathBStandBy_92E( +#if (DM_ODM_SUPPORT_TYPE & ODM_AP) + IN PDM_ODM_T pDM_Odm +#else + IN PADAPTER pAdapter +#endif + ) +{ +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); + #if (DM_ODM_SUPPORT_TYPE == ODM_CE) + PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + #endif + #if (DM_ODM_SUPPORT_TYPE == ODM_WIN) + PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; + #endif +#endif + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path-A standby mode!\n")); + + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x000000); + ODM_SetRFReg(pDM_Odm, (ODM_RF_RADIO_PATH_E)0x1, 0x0, bRFRegOffsetMask, 0x10000); + + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x808000); +} + + VOID _PHY_PIModeSwitch_92E( #if (DM_ODM_SUPPORT_TYPE & ODM_AP) @@ -1733,15 +1770,15 @@ phy_SimularityCompare_8192E( //#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) // BOOLEAN is2T = IS_92C_SERIAL( pHalData->VersionID); //#else - BOOLEAN is2T = IS_2T2R(pHalData->VersionID); + //BOOLEAN is2T = TRUE; //#endif s4Byte tmp1 = 0,tmp2 = 0; - if(is2T) + //if(is2T) bound = 8; - else - bound = 4; + //else + // bound = 4; ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("===> IQK:phy_SimularityCompare_8192E c1 %d c2 %d!!!\n", c1, c2)); @@ -1890,7 +1927,7 @@ phy_IQCalibrate_8192E( u4Byte retryCount = 2; #if MP_DRIVER - if ( *(pDM_Odm->mp_mode) == 1) + if (pDM_Odm->mp_mode == TRUE) retryCount = 9; #endif @@ -1963,40 +2000,33 @@ phy_IQCalibrate_8192E( ODM_SetBBReg(pDM_Odm, rCCK0_AFESetting, 0x0f000000, 0xf); ODM_SetBBReg(pDM_Odm, rOFDM0_TRxPathEnable, bMaskDWord, 0x03a05600); ODM_SetBBReg(pDM_Odm, rOFDM0_TRMuxPar, bMaskDWord, 0x000800e4); - ODM_SetBBReg(pDM_Odm, rFPGA0_XCD_RFInterfaceSW, bMaskDWord, 0x22208200); - -// - ODM_SetBBReg(pDM_Odm, rFPGA0_XAB_RFInterfaceSW, BIT10, 0x01); - ODM_SetBBReg(pDM_Odm, rFPGA0_XAB_RFInterfaceSW, BIT26, 0x01); - ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, BIT10, 0x01); - ODM_SetBBReg(pDM_Odm, rFPGA0_XB_RFInterfaceOE, BIT10, 0x01); -// ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, BIT10, 0x00); -// ODM_SetBBReg(pDM_Odm, rFPGA0_XB_RFInterfaceOE, BIT10, 0x00); -// - -// if(is2T) -// { -// ODM_SetBBReg(pDM_Odm, rFPGA0_XA_LSSIParameter, bMaskDWord, 0x00010000); -// ODM_SetBBReg(pDM_Odm, rFPGA0_XB_LSSIParameter, bMaskDWord, 0x00010000); -// } + ODM_SetBBReg(pDM_Odm, rFPGA0_XCD_RFInterfaceSW, bMaskDWord, 0x55204200); - //Page B init - //AP or IQK -/* - ODM_SetBBReg(pDM_Odm, rConfig_AntA, bMaskDWord, 0x0f600000); - - if(is2T) - { - ODM_SetBBReg(pDM_Odm, rConfig_AntB, bMaskDWord, 0x0f600000); - } -*/ // IQ calibration setting // ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK setting!\n")); - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x80800000); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x808000); ODM_SetBBReg(pDM_Odm, rTx_IQK, bMaskDWord, 0x01007c00); ODM_SetBBReg(pDM_Odm, rRx_IQK, bMaskDWord, 0x01004800); +if(is2T){ + +#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) + _PHY_PathBStandBy_92E(pAdapter); + + // Turn ADDA on + _PHY_PathADDAOn_92E(pAdapter, ADDA_REG, FALSE, is2T); +#else + _PHY_PathBStandBy_92E(pDM_Odm); + + // Turn ADDA on + _PHY_PathADDAOn_92E(pDM_Odm, ADDA_REG, FALSE, is2T); +#endif + + } + +//path A TXIQK +#if 1 for(i = 0 ; i < retryCount ; i++){ #if !(DM_ODM_SUPPORT_TYPE & ODM_AP) PathAOK = phy_PathA_IQK_8192E(pAdapter, is2T); @@ -2024,7 +2054,10 @@ phy_IQCalibrate_8192E( } #endif } +#endif +//path A RXIQK +#if 1 for(i = 0 ; i < retryCount ; i++){ #if !(DM_ODM_SUPPORT_TYPE & ODM_AP) PathAOK = phy_PathA_RxIQK_92E(pAdapter, is2T); @@ -2049,26 +2082,30 @@ phy_IQCalibrate_8192E( ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A IQK failed!!\n")); } +#endif + if(is2T){ + #if !(DM_ODM_SUPPORT_TYPE & ODM_AP) _PHY_PathAStandBy_92E(pAdapter); - // Turn Path B ADDA on + // Turn ADDA on _PHY_PathADDAOn_92E(pAdapter, ADDA_REG, FALSE, is2T); #else _PHY_PathAStandBy_92E(pDM_Odm); - // Turn Path B ADDA on + // Turn ADDA on _PHY_PathADDAOn_92E(pDM_Odm, ADDA_REG, FALSE, is2T); #endif // IQ calibration setting // ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK setting!\n")); - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x80800000); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x808000); ODM_SetBBReg(pDM_Odm, rTx_IQK, bMaskDWord, 0x01007c00); ODM_SetBBReg(pDM_Odm, rRx_IQK, bMaskDWord, 0x01004800); - +//path B Tx IQK +#if 1 for(i = 0 ; i < retryCount ; i++){ #if !(DM_ODM_SUPPORT_TYPE & ODM_AP) PathBOK = phy_PathB_IQK_8192E(pAdapter); @@ -2092,6 +2129,10 @@ phy_IQCalibrate_8192E( } #endif } +#endif + +//path B RX IQK +#if 1 for(i = 0 ; i < retryCount ; i++){ #if !(DM_ODM_SUPPORT_TYPE & ODM_AP) @@ -2118,26 +2159,16 @@ for(i = 0 ; i < retryCount ; i++){ if(0x00 == PathBOK){ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B IQK failed!!\n")); } +#endif } //Back to BB mode, load original value ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK:Back to BB mode, load original value!\n")); - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x000000); if(t!=0) { -//Allen -/* - if(!pDM_Odm->RFCalibrateInfo.bRfPiEnable){ - // Switch back BB to SI mode after finish IQ Calibration. -#if !(DM_ODM_SUPPORT_TYPE & ODM_AP) - _PHY_PIModeSwitch_92E(pAdapter, FALSE); -#else - _PHY_PIModeSwitch_92E(pDM_Odm, FALSE); -#endif - } -*/ #if !(DM_ODM_SUPPORT_TYPE & ODM_AP) @@ -2171,15 +2202,9 @@ for(i = 0 ; i < retryCount ; i++){ ODM_SetBBReg(pDM_Odm, rTx_IQK_Tone_A, bMaskDWord, 0x01008c00); ODM_SetBBReg(pDM_Odm, rRx_IQK_Tone_A, bMaskDWord, 0x01008c00); -/* - //Reload RX IQK mode table to RX mode - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_WE_LUT, bRFRegOffsetMask, 0x800a0 ); - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_RCK_OS, bRFRegOffsetMask, 0x30000 ); - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_TXPA_G1, bRFRegOffsetMask, 0x0000f ); - ODM_SetRFReg(pDM_Odm, ODM_RF_PATH_A, RF_TXPA_G2, bRFRegOffsetMask, 0x77f82 ); -*/ + } - ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_IQCalibrate_8188E() <==\n")); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_IQCalibrate_8192E() <==\n")); } @@ -2411,7 +2436,7 @@ phy_APCalibrate_8192E( // will disappear after disable/enable card many times on 88CU. RF SD and DD have not find the // root cause, so we remove these actions temporarily. Added by tynli and SD3 Allen. 2010.05.31. //#if MP_DRIVER != 1 - if ( *(pDM_Odm->mp_mode) != 1) + if (pDM_Odm->mp_mode == FALSE) return; //#endif @@ -2486,7 +2511,7 @@ phy_APCalibrate_8192E( } //page-B1 - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x40000000); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x400000); //path A offset = rPdp_AntA; @@ -2497,7 +2522,7 @@ phy_APCalibrate_8192E( offset += 0x04; } - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x000000); } else if(path == ODM_RF_PATH_B) { @@ -2530,7 +2555,7 @@ phy_APCalibrate_8192E( } //page-B1 - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x40000000); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x400000); //path B offset = 0xb60; @@ -2541,7 +2566,7 @@ phy_APCalibrate_8192E( offset += 0x04; } - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x000000); } //save RF default value @@ -2663,7 +2688,7 @@ phy_APCalibrate_8192E( i = 0; do { - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x80000000); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x800000); { ODM_SetBBReg(pDM_Odm, APK_offset[path], bMaskDWord, APK_value[0]); ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0x%x value 0x%x\n", APK_offset[path], ODM_GetBBReg(pDM_Odm, APK_offset[path], bMaskDWord))); @@ -2673,7 +2698,7 @@ phy_APCalibrate_8192E( ODM_delay_ms(20); } - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x000000); if(path == ODM_RF_PATH_A) tmpReg = ODM_GetBBReg(pDM_Odm, rAPK, 0x03E00000); @@ -2839,7 +2864,7 @@ PHY_IQCalibrate_8192E( #endif #if MP_DRIVER == 1 - if (*(pDM_Odm->mp_mode) == 1) + if (pDM_Odm->mp_mode == TRUE) { bStartContTx = pMptCtx->bStartContTx; bSingleTone = pMptCtx->bSingleTone; @@ -2859,11 +2884,6 @@ PHY_IQCalibrate_8192E( return; - ODM_AcquireSpinLock(pDM_Odm, RT_IQK_SPINLOCK); - pDM_Odm->RFCalibrateInfo.bIQKInProgress = TRUE; - ODM_ReleaseSpinLock(pDM_Odm, RT_IQK_SPINLOCK); - - #if (DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_AP)) if(bReCovery) #else//for ODM_WIN @@ -2881,6 +2901,10 @@ PHY_IQCalibrate_8192E( StartTime = ODM_GetCurrentTime( pDM_Odm); ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK:Start!!!\n")); + ODM_AcquireSpinLock(pDM_Odm, RT_IQK_SPINLOCK); + pDM_Odm->RFCalibrateInfo.bIQKInProgress = TRUE; + ODM_ReleaseSpinLock(pDM_Odm, RT_IQK_SPINLOCK); + for(i = 0; i < 8; i++) { result[0][i] = 0; @@ -3093,7 +3117,8 @@ PHY_LCCalibrate_8192E( #if MP_DRIVER == 1 - if ( *(pDM_Odm->mp_mode) == 1){ + if (pDM_Odm->mp_mode == TRUE) + { bStartContTx = pMptCtx->bStartContTx; bSingleTone = pMptCtx->bSingleTone; bCarrierSuppression = pMptCtx->bCarrierSuppression; @@ -3388,9 +3413,9 @@ phy_DigitalPredistortion_92E( // PA gain = 11 & PAD2 => tx_agc 10~0e // PA gain = 01 => tx_agc 0b~0d // PA gain = 00 => tx_agc 0a~00 - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x40000000); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x400000); ODM_SetBBReg(pDM_Odm, 0xbc0, bMaskDWord, 0x0005361f); - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x000000); //do inner loopback DPK 3 times for(i = 0; i < 3; i++) @@ -3461,8 +3486,8 @@ phy_DigitalPredistortion_92E( { ODM_SetBBReg(pDM_Odm, rPdp_AntA, bMaskDWord, 0x02017098); - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x80000000); - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x800000); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x000000); ODM_delay_ms(1); ODM_SetBBReg(pDM_Odm, rConfig_Pmpd_AntA, bMaskDWord, 0x800477c0); ODM_delay_ms(1); @@ -3488,7 +3513,7 @@ phy_DigitalPredistortion_92E( ODM_SetBBReg(pDM_Odm, rPdp_AntA_4, bMaskDWord, 0x776d9f84); ODM_SetBBReg(pDM_Odm, rConfig_Pmpd_AntA, bMaskDWord, 0x0004ab87); ODM_SetBBReg(pDM_Odm, rConfig_AntA, bMaskDWord, 0x00880000); - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x40000000); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x400000); for(i=rPdp_AntA; i<=0xb3c; i+=4) { @@ -3508,7 +3533,7 @@ phy_DigitalPredistortion_92E( //TX_AGC boundary ODM_SetBBReg(pDM_Odm, 0xbc0, bMaskDWord, 0x0005361f); - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x000000); } else { @@ -3527,9 +3552,9 @@ phy_DigitalPredistortion_92E( // PA gain = 11 & PAD2, => tx_agc 10 ~0e // PA gain = 01 => tx_agc 0b ~0d // PA gain = 00 => tx_agc 0a ~00 - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x40000000); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x400000); ODM_SetBBReg(pDM_Odm, 0xbc4, bMaskDWord, 0x0005361f); - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x000000); //do inner loopback DPK 3 times for(i = 0; i < 3; i++) @@ -3600,8 +3625,8 @@ phy_DigitalPredistortion_92E( { ODM_SetBBReg(pDM_Odm, rPdp_AntB, bMaskDWord, 0x02017098); - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x80000000); - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x800000); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x000000); ODM_delay_ms(1); ODM_SetBBReg(pDM_Odm, rConfig_Pmpd_AntB, bMaskDWord, 0x800477c0); ODM_delay_ms(1); @@ -3628,7 +3653,7 @@ phy_DigitalPredistortion_92E( ODM_SetBBReg(pDM_Odm, rConfig_Pmpd_AntB, bMaskDWord, 0x0004ab87); ODM_SetBBReg(pDM_Odm, rConfig_AntB, bMaskDWord, 0x00880000); - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x40000000); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x400000); for(i=0xb60; i<=0xb9c; i+=4) { ODM_SetBBReg(pDM_Odm, i, bMaskDWord, 0x40004000); @@ -3647,7 +3672,7 @@ phy_DigitalPredistortion_92E( // tx_agc boundary ODM_SetBBReg(pDM_Odm, 0xbc4, bMaskDWord, 0x0005361f); - ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000); + ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, 0xffffff00, 0x000000); } else diff --git a/hal/OUTSRC/rtl8192e/HalPhyRf_8192e.h b/hal/OUTSRC/rtl8192e/HalPhyRf_8192e.h index 0aa90ae..a7e6853 100644 --- a/hal/OUTSRC/rtl8192e/HalPhyRf_8192e.h +++ b/hal/OUTSRC/rtl8192e/HalPhyRf_8192e.h @@ -22,7 +22,7 @@ #define __HAL_PHY_RF_8192E_H__ /*--------------------------Define Parameters-------------------------------*/ -#define IQK_DELAY_TIME_92E 10 //ms +#define IQK_DELAY_TIME_92E 15 //ms #define index_mapping_NUM_92E 15 #define AVG_THERMAL_NUM_92E 4 diff --git a/hal/OUTSRC/rtl8192e/Mp_Precomp.h b/hal/OUTSRC/rtl8192e/Mp_Precomp.h new file mode 100644 index 0000000..1bd4da6 --- /dev/null +++ b/hal/OUTSRC/rtl8192e/Mp_Precomp.h @@ -0,0 +1,24 @@ +/****************************************************************************** + * + * 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 +//#include "odm_precomp.h" +//#include "../odm_precomp.h" + diff --git a/hal/OUTSRC/rtl8192e/odm_RTL8192E.c b/hal/OUTSRC/rtl8192e/odm_RTL8192E.c index 651a608..41f507b 100644 --- a/hal/OUTSRC/rtl8192e/odm_RTL8192E.c +++ b/hal/OUTSRC/rtl8192e/odm_RTL8192E.c @@ -22,7 +22,7 @@ // include files //============================================================ - +#include "Mp_Precomp.h" #include "../odm_precomp.h" #if (RTL8192E_SUPPORT == 1) @@ -72,6 +72,9 @@ odm_DynamicPrimaryCCA_Check( if(pDM_Odm->SupportICType != ODM_RTL8192E) return; + if(!(pDM_Odm->SupportAbility & ODM_BB_PRIMARY_CCA)) + return; + switch (pDM_Odm->SupportPlatform) { case ODM_WIN: diff --git a/hal/OUTSRC/rtl8192e/odm_RegConfig8192E.c b/hal/OUTSRC/rtl8192e/odm_RegConfig8192E.c index 2e2112a..3221b25 100644 --- a/hal/OUTSRC/rtl8192e/odm_RegConfig8192E.c +++ b/hal/OUTSRC/rtl8192e/odm_RegConfig8192E.c @@ -18,6 +18,7 @@ * ******************************************************************************/ +#include "Mp_Precomp.h" #include "../odm_precomp.h" #if (RTL8192E_SUPPORT == 1) diff --git a/hal/hal_btcoex.c b/hal/hal_btcoex.c index 46c52a8..6e09b27 100644 --- a/hal/hal_btcoex.c +++ b/hal/hal_btcoex.c @@ -77,9 +77,26 @@ const char *const ioStaString[] = "h2c stopped", }; +const char *const GLBtcWifiBwString[]={ + "11bg", + "HT20", + "HT40", + "HT80", + "HT160" +}; + +const char *const GLBtcWifiFreqString[]={ + "2.4G", + "5G" +}; + +#define HALBTCOUTSRC_AGG_CHK_WINDOW_IN_MS 8000 + BTC_COEXIST GLBtCoexist; u8 GLBtcWiFiInScanState; u8 GLBtcWiFiInIQKState; +u8 GLBtcWiFiInIPS; +u8 GLBtcWiFiInLPS; u32 GLBtcDbgType[BTC_MSG_MAX]; u8 GLBtcDbgBuf[BT_TMP_BUF_SIZE]; @@ -167,9 +184,24 @@ static void halbtcoutsrc_DbgInit(void) 0; } +static u8 halbtcoutsrc_IsCsrBtCoex(PBTC_COEXIST pBtCoexist) +{ + if (pBtCoexist->boardInfo.btChipType == BTC_CHIP_CSR_BC4 + || pBtCoexist->boardInfo.btChipType == BTC_CHIP_CSR_BC8 + ){ + return _TRUE; + } + return _FALSE; +} + static u8 halbtcoutsrc_IsHwMailboxExist(PBTC_COEXIST pBtCoexist) { - if (IS_HARDWARE_TYPE_8812(pBtCoexist->Adapter)) + if (pBtCoexist->boardInfo.btChipType == BTC_CHIP_CSR_BC4 + || pBtCoexist->boardInfo.btChipType == BTC_CHIP_CSR_BC8 + ){ + return _FALSE; + } + else if (IS_HARDWARE_TYPE_8812(pBtCoexist->Adapter)) { return _FALSE; } @@ -296,16 +328,41 @@ void halbtcoutsrc_DisableLowPower(PBTC_COEXIST pBtCoexist, u8 bLowPwrDisable) void halbtcoutsrc_AggregationCheck(PBTC_COEXIST pBtCoexist) { PADAPTER padapter; - BOOLEAN bNeedToAct; - + BOOLEAN bNeedToAct = _FALSE; + static u32 preTime = 0; + u32 curTime = 0; padapter = pBtCoexist->Adapter; - bNeedToAct = _FALSE; - if (pBtCoexist->btInfo.bRejectAggPkt) - rtw_btcoex_RejectApAggregatedPacket(padapter, _TRUE); + //===================================== + // To void continuous deleteBA=>addBA=>deleteBA=>addBA + // This function is not allowed to continuous called. + // It can only be called after 8 seconds. + //===================================== + + curTime = rtw_systime_to_ms(rtw_get_current_time()); + if((curTime - preTime) < HALBTCOUTSRC_AGG_CHK_WINDOW_IN_MS) // over 8 seconds you can execute this function again. + { + return; + } else { + preTime = curTime; + } + + if (pBtCoexist->btInfo.bRejectAggPkt) + { + rtw_btcoex_RejectApAggregatedPacket(padapter, _TRUE); + pBtCoexist->btInfo.bPreRejectAggPkt = pBtCoexist->btInfo.bRejectAggPkt; + } + else + { + if(pBtCoexist->btInfo.bPreRejectAggPkt) + { + bNeedToAct = _TRUE; + pBtCoexist->btInfo.bPreRejectAggPkt = pBtCoexist->btInfo.bRejectAggPkt; + } + if (pBtCoexist->btInfo.bPreBtCtrlAggBufSize != pBtCoexist->btInfo.bBtCtrlAggBufSize) { @@ -499,11 +556,11 @@ static u8 halbtcoutsrc_GetWifiScanAPNum(PADAPTER padapter) pmlmepriv = &padapter->mlmepriv; pmlmeext = &padapter->mlmeextpriv; - if (check_fwstate(pmlmepriv, WIFI_SITE_MONITOR) == _FALSE) { - if (pmlmeext->sitesurvey_res.bss_cnt > 0xFF) + if (GLBtcWiFiInScanState == _FALSE) { + if (pmlmepriv->num_of_scanned > 0xFF) scan_AP_num = 0xFF; else - scan_AP_num = (u8)pmlmeext->sitesurvey_res.bss_cnt; + scan_AP_num = (u8)pmlmepriv->num_of_scanned; } return scan_AP_num; @@ -712,6 +769,9 @@ u8 halbtcoutsrc_Get(void *pBtcContext, u8 getType, void *pOutBuf) case BTC_GET_U1_AP_NUM: *pU1Tmp = halbtcoutsrc_GetWifiScanAPNum(padapter); break; + case BTC_GET_U1_ANT_TYPE: + *pU1Tmp = (u1Byte)BTC_ANT_TYPE_0; + break; //=======1Ant=========== case BTC_GET_U1_LPS_MODE: @@ -783,6 +843,10 @@ u8 halbtcoutsrc_Set(void *pBtcContext, u8 setType, void *pInBuf) pBtCoexist->btInfo.bBtTxRxMask = *pu8; break; + case BTC_SET_BL_MIRACAST_PLUS_BT: + pBtCoexist->btInfo.bMiracastPlusBt = *pu8; + break; + // set some u8 type variables. case BTC_SET_U1_RSSI_ADJ_VAL_FOR_AGC_TABLE_ON: pBtCoexist->btInfo.rssiAdjustForAgcTableOn = *pU1Tmp; @@ -851,15 +915,24 @@ u8 halbtcoutsrc_Set(void *pBtcContext, u8 setType, void *pInBuf) break; case BTC_SET_ACT_SEND_MIMO_PS: -#if 0 // not implement yet { - u8 newMimoPsMode = *pU1Tmp; + u8 newMimoPsMode = 3; + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + + // *pU1Tmp = 0 use SM_PS static type + // *pU1Tmp = 1 disable SM_PS + if(*pU1Tmp==0) + newMimoPsMode = WLAN_HT_CAP_SM_PS_STATIC; + else if(*pU1Tmp==1) + newMimoPsMode = WLAN_HT_CAP_SM_PS_DISABLED; + if (check_fwstate(&padapter->mlmepriv, WIFI_ASOC_STATE) == _TRUE) - SendMimoPsFrame(padapter, padapter->MgntInfo.Bssid, newMimoPsMode); + { + //issue_action_SM_PS(padapter, get_my_bssid(&(pmlmeinfo->network)), newMimoPsMode); + issue_action_SM_PS_wait_ack(padapter, get_my_bssid(&(pmlmeinfo->network)), newMimoPsMode, 3, 1); + } } -#else - ret = _FALSE; -#endif break; case BTC_SET_ACT_CTRL_BT_INFO: @@ -917,6 +990,48 @@ u8 halbtcoutsrc_Set(void *pBtcContext, u8 setType, void *pInBuf) return ret; } +u8 halbtcoutsrc_UnderIps(PBTC_COEXIST pBtCoexist) +{ + PADAPTER padapter; + struct pwrctrl_priv *pwrpriv; + u8 bMacPwrCtrlOn; + + padapter = pBtCoexist->Adapter; + pwrpriv = &padapter->dvobj->pwrctl_priv; + bMacPwrCtrlOn = _FALSE; + + if ((_TRUE == pwrpriv->bips_processing) + && (IPS_NONE != pwrpriv->ips_mode_req) + ) + { + return _TRUE; + } + + if (rf_off == pwrpriv->rf_pwrstate) + { + return _TRUE; + } + + rtw_hal_get_hwreg(padapter, HW_VAR_APFM_ON_MAC, &bMacPwrCtrlOn); + if (_FALSE == bMacPwrCtrlOn) + { + return _TRUE; + } + + return _FALSE; +} + +u8 halbtcoutsrc_UnderLps(PBTC_COEXIST pBtCoexist) +{ + return GLBtcWiFiInLPS; +} + +u8 halbtcoutsrc_Under32K(PBTC_COEXIST pBtCoexist) +{ + /* todo: the method to check whether wifi is under 32K or not */ + return _FALSE; +} + void halbtcoutsrc_DisplayCoexStatistics(PBTC_COEXIST pBtCoexist) { #if 0 @@ -950,6 +1065,7 @@ void halbtcoutsrc_DisplayCoexStatistics(PBTC_COEXIST pBtCoexist) } } #endif +#if 0 CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "lastHMEBoxNum", \ pHalData->LastHMEBoxNum); CL_PRINTF(cliBuf); @@ -965,12 +1081,13 @@ void halbtcoutsrc_DisplayCoexStatistics(PBTC_COEXIST pBtCoexist) CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d", "c2hPacket", \ DBG_Var.c2hPacketCnt); CL_PRINTF(cliBuf); - +#endif CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "Periodical/ DbgCtrl", \ pBtCoexist->statistics.cntPeriodical, pBtCoexist->statistics.cntDbgCtrl); CL_PRINTF(cliBuf); - CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "InitHw/InitCoexDm/", \ - pBtCoexist->statistics.cntInitHwConfig, pBtCoexist->statistics.cntInitCoexDm); + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d/ %d/ %d", "PowerOn/InitHw/InitCoexDm/RfStatus", \ + pBtCoexist->statistics.cntPowerOn, pBtCoexist->statistics.cntInitHwConfig, pBtCoexist->statistics.cntInitCoexDm, + pBtCoexist->statistics.cntRfStatusNotify); CL_PRINTF(cliBuf); CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d/ %d/ %d/ %d", "Ips/Lps/Scan/Connect/Mstatus", \ pBtCoexist->statistics.cntIpsNotify, pBtCoexist->statistics.cntLpsNotify, @@ -1015,17 +1132,95 @@ void halbtcoutsrc_DisplayBtLinkInfo(PBTC_COEXIST pBtCoexist) #endif } -void halbtcoutsrc_DisplayFwPwrModeCmd(PBTC_COEXIST pBtCoexist) +void halbtcoutsrc_DisplayWifiStatus(PBTC_COEXIST pBtCoexist) { - u8 *cliBuf = pBtCoexist->cliBuf; + PADAPTER padapter = pBtCoexist->Adapter; + struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); + u8* cliBuf=pBtCoexist->cliBuf; + s32 wifiRssi=0, btHsRssi=0; + BOOLEAN bScan=_FALSE, bLink=_FALSE, bRoam=_FALSE, bWifiBusy=_FALSE, bWifiUnderBMode=_FALSE; + u32 wifiBw=BTC_WIFI_BW_HT20, wifiTrafficDir=BTC_WIFI_TRAFFIC_TX, wifiFreq=BTC_FREQ_2_4G; + u32 wifiLinkStatus=0x0; + BOOLEAN bBtHsOn=_FALSE, bLowPower=_FALSE; + u8 wifiChnl=0, wifiHsChnl=0, nScanAPNum = 0, FwPSState; - CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x %02x ", "Power mode cmd ", \ + wifiLinkStatus = halbtcoutsrc_GetWifiLinkStatus(pBtCoexist); + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d/ %d/ %d/ %d", "STA/vWifi/HS/p2pGo/p2pGc", \ + ((wifiLinkStatus&WIFI_STA_CONNECTED)? 1:0), ((wifiLinkStatus&WIFI_AP_CONNECTED)? 1:0), + ((wifiLinkStatus&WIFI_HS_CONNECTED)? 1:0), ((wifiLinkStatus&WIFI_P2P_GO_CONNECTED)? 1:0), + ((wifiLinkStatus&WIFI_P2P_GC_CONNECTED)? 1:0) ); + CL_PRINTF(cliBuf); + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_WIFI_DOT11_CHNL, &wifiChnl); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_WIFI_HS_CHNL, &wifiHsChnl); CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d / %d(%d)", "Dot11 channel / HsChnl(High Speed)", \ + wifiChnl, wifiHsChnl, bBtHsOn); + CL_PRINTF(cliBuf); + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_S4_WIFI_RSSI, &wifiRssi); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_S4_HS_RSSI, &btHsRssi); + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "Wifi rssi/ HS rssi", \ + wifiRssi-100, btHsRssi-100); + CL_PRINTF(cliBuf); + + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_SCAN, &bScan); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_LINK, &bLink); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_ROAM, &bRoam); + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d/ %d ", "Wifi bLink/ bRoam/ bScan", \ + bLink, bRoam, bScan); + CL_PRINTF(cliBuf); + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_UNDER_5G, &wifiFreq); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_TRAFFIC_DIRECTION, &wifiTrafficDir); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_UNDER_B_MODE, &bWifiUnderBMode); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_AP_NUM, &nScanAPNum); + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s / %s/ %s/ AP=%d ", "Wifi freq/ bw/ traffic", \ + GLBtcWifiFreqString[wifiFreq], ((bWifiUnderBMode)? "11b": GLBtcWifiBwString[wifiBw]), + ((!bWifiBusy)? "idle": ((BTC_WIFI_TRAFFIC_TX==wifiTrafficDir)? "uplink":"downlink")), + nScanAPNum); + CL_PRINTF(cliBuf); + + // power status + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s%s%s", "Power Status", \ + ((halbtcoutsrc_UnderIps(pBtCoexist) == _TRUE)? "IPS ON":"IPS OFF"), + ((halbtcoutsrc_UnderLps(pBtCoexist) == _TRUE)? ", LPS ON":", LPS OFF"), + ((halbtcoutsrc_Under32K(pBtCoexist) == _TRUE)? ", 32k":"")); + CL_PRINTF(cliBuf); + + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x %02x (0x%x/0x%x)", "Power mode cmd(lps/rpwm)", \ pBtCoexist->pwrModeVal[0], pBtCoexist->pwrModeVal[1], pBtCoexist->pwrModeVal[2], pBtCoexist->pwrModeVal[3], - pBtCoexist->pwrModeVal[4], pBtCoexist->pwrModeVal[5]); + pBtCoexist->pwrModeVal[4], pBtCoexist->pwrModeVal[5], + pBtCoexist->btInfo.lpsVal, + pBtCoexist->btInfo.rpwmVal); CL_PRINTF(cliBuf); } +void halbtcoutsrc_DisplayDbgMsg(void *pBtcContext, u8 dispType) +{ + PBTC_COEXIST pBtCoexist; + + + pBtCoexist = (PBTC_COEXIST)pBtcContext; + switch(dispType) + { + case BTC_DBG_DISP_COEX_STATISTICS: + halbtcoutsrc_DisplayCoexStatistics(pBtCoexist); + break; + case BTC_DBG_DISP_BT_LINK_INFO: + halbtcoutsrc_DisplayBtLinkInfo(pBtCoexist); + break; + case BTC_DBG_DISP_WIFI_STATUS: + halbtcoutsrc_DisplayWifiStatus(pBtCoexist); + break; + default: + break; + } +} + //==================================== // IO related function //==================================== @@ -1090,7 +1285,7 @@ void halbtcoutsrc_BitMaskWrite1Byte(void *pBtcContext, u32 regAddr, u8 bitMask, originalValue = 0; bitShift = 0; - if (bitMask != 0xFF) + if(bitMask != 0xff) { originalValue = rtw_read8(padapter, regAddr); @@ -1131,6 +1326,21 @@ void halbtcoutsrc_Write4Byte(void *pBtcContext, u32 RegAddr, u32 Data) rtw_write32(padapter, RegAddr, Data); } +void halbtcoutsrc_WriteLocalReg1Byte(void *pBtcContext, u32 RegAddr, u8 Data) +{ + PBTC_COEXIST pBtCoexist=(PBTC_COEXIST)pBtcContext; + PADAPTER Adapter=pBtCoexist->Adapter; + + if(BTC_INTF_SDIO == pBtCoexist->chipInterface) + { + rtw_write8(Adapter, SDIO_LOCAL_BASE | RegAddr, Data); + } + else + { + rtw_write8(Adapter, RegAddr, Data); + } +} + void halbtcoutsrc_SetBbReg(void *pBtcContext, u32 RegAddr, u32 BitMask, u32 Data) { PBTC_COEXIST pBtCoexist; @@ -1231,76 +1441,51 @@ void halbtcoutsrc_FillH2cCmd(void *pBtcContext, u8 elementId, u32 cmdLen, u8 *pC rtw_hal_fill_h2c_cmd(padapter, elementId, cmdLen, pCmdBuffer); } -void halbtcoutsrc_DisplayDbgMsg(void *pBtcContext, u8 dispType) -{ - PBTC_COEXIST pBtCoexist; - - - pBtCoexist = (PBTC_COEXIST)pBtcContext; - switch(dispType) - { - case BTC_DBG_DISP_COEX_STATISTICS: - halbtcoutsrc_DisplayCoexStatistics(pBtCoexist); - break; - case BTC_DBG_DISP_BT_LINK_INFO: - halbtcoutsrc_DisplayBtLinkInfo(pBtCoexist); - break; - case BTC_DBG_DISP_FW_PWR_MODE_CMD: - halbtcoutsrc_DisplayFwPwrModeCmd(pBtCoexist); - break; - default: - break; - } -} - -u8 halbtcoutsrc_UnderIps(PBTC_COEXIST pBtCoexist) -{ - PADAPTER padapter; - struct pwrctrl_priv *pwrpriv; - u8 bMacPwrCtrlOn; - - padapter = pBtCoexist->Adapter; - pwrpriv = &padapter->dvobj->pwrctl_priv; - bMacPwrCtrlOn = _FALSE; - - if ((_TRUE == pwrpriv->bips_processing) - && (IPS_NONE != pwrpriv->ips_mode_req) - ) - { - return _TRUE; - } - - if (rf_off == pwrpriv->rf_pwrstate) - { - return _TRUE; - } - - rtw_hal_get_hwreg(padapter, HW_VAR_APFM_ON_MAC, &bMacPwrCtrlOn); - if (_FALSE == bMacPwrCtrlOn) - { - return _TRUE; - } - - return _FALSE; -} - //==================================== // Extern functions called by other module //==================================== +u8 EXhalbtcoutsrc_BindBtCoexWithAdapter(void *padapter) +{ + PBTC_COEXIST pBtCoexist=&GLBtCoexist; + u1Byte antNum=2, chipType; + + if(pBtCoexist->bBinded) + return _FALSE; + else + pBtCoexist->bBinded = _TRUE; + + pBtCoexist->statistics.cntBind++; + + pBtCoexist->Adapter = padapter; + + pBtCoexist->stackInfo.bProfileNotified = _FALSE; + + pBtCoexist->btInfo.bBtCtrlAggBufSize = _FALSE; + pBtCoexist->btInfo.aggBufSize = 5; + + pBtCoexist->btInfo.bIncreaseScanDevNum = _FALSE; + pBtCoexist->btInfo.bMiracastPlusBt = _FALSE; + +#if 0 + chipType = HALBT_GetBtChipType(Adapter); + EXhalbtcoutsrc_SetChipType(chipType); + antNum = HALBT_GetPgAntNum(Adapter); + EXhalbtcoutsrc_SetAntNum(BT_COEX_ANT_TYPE_PG, antNum); +#endif + // set default antenna position to main port + pBtCoexist->boardInfo.btdmAntPos = BTC_ANTENNA_AT_MAIN_PORT; + + return _TRUE; +} + u8 EXhalbtcoutsrc_InitlizeVariables(void *padapter) { PBTC_COEXIST pBtCoexist = &GLBtCoexist; - - pBtCoexist->statistics.cntBind++; + //pBtCoexist->statistics.cntBind++; halbtcoutsrc_DbgInit(); - if (pBtCoexist->bBinded) - return _FALSE; - else - pBtCoexist->bBinded = _TRUE; - #ifdef CONFIG_PCI_HCI pBtCoexist->chipInterface = BTC_INTF_PCI; #elif defined(CONFIG_USB_HCI) @@ -1311,12 +1496,7 @@ u8 EXhalbtcoutsrc_InitlizeVariables(void *padapter) pBtCoexist->chipInterface = BTC_INTF_UNKNOWN; #endif - if (NULL == pBtCoexist->Adapter) - { - pBtCoexist->Adapter = padapter; - } - - pBtCoexist->stackInfo.bProfileNotified = _FALSE; + EXhalbtcoutsrc_BindBtCoexWithAdapter(padapter); pBtCoexist->fBtcRead1Byte = halbtcoutsrc_Read1Byte; pBtCoexist->fBtcWrite1Byte = halbtcoutsrc_Write1Byte; @@ -1325,6 +1505,7 @@ u8 EXhalbtcoutsrc_InitlizeVariables(void *padapter) pBtCoexist->fBtcWrite2Byte = halbtcoutsrc_Write2Byte; pBtCoexist->fBtcRead4Byte = halbtcoutsrc_Read4Byte; pBtCoexist->fBtcWrite4Byte = halbtcoutsrc_Write4Byte; + pBtCoexist->fBtcWriteLocalReg1Byte = halbtcoutsrc_WriteLocalReg1Byte; pBtCoexist->fBtcSetBbReg = halbtcoutsrc_SetBbReg; pBtCoexist->fBtcGetBbReg = halbtcoutsrc_GetBbReg; @@ -1332,29 +1513,60 @@ u8 EXhalbtcoutsrc_InitlizeVariables(void *padapter) pBtCoexist->fBtcSetRfReg = halbtcoutsrc_SetRfReg; pBtCoexist->fBtcGetRfReg = halbtcoutsrc_GetRfReg; - pBtCoexist->fBtcSetBtReg = halbtcoutsrc_SetBtReg; - pBtCoexist->fBtcGetBtReg = halbtcoutsrc_GetBtReg; - pBtCoexist->fBtcFillH2c = halbtcoutsrc_FillH2cCmd; pBtCoexist->fBtcDispDbgMsg = halbtcoutsrc_DisplayDbgMsg; pBtCoexist->fBtcGet = halbtcoutsrc_Get; pBtCoexist->fBtcSet = halbtcoutsrc_Set; + pBtCoexist->fBtcGetBtReg = halbtcoutsrc_GetBtReg; + pBtCoexist->fBtcSetBtReg = halbtcoutsrc_SetBtReg; - pBtCoexist->cliBuf = GLBtcDbgBuf; - - pBtCoexist->btInfo.bBtCtrlAggBufSize = _FALSE; - pBtCoexist->btInfo.aggBufSize = 5; - - pBtCoexist->btInfo.bIncreaseScanDevNum = _FALSE; + pBtCoexist->cliBuf = &GLBtcDbgBuf[0]; + pBtCoexist->boardInfo.singleAntPath = 0; + GLBtcWiFiInScanState = _FALSE; GLBtcWiFiInIQKState = _FALSE; + GLBtcWiFiInIPS = _FALSE; + + GLBtcWiFiInLPS = _FALSE; + return _TRUE; } +void EXhalbtcoutsrc_PowerOnSetting(PBTC_COEXIST pBtCoexist) +{ + if (!halbtcoutsrc_IsBtCoexistAvailable(pBtCoexist)) + return; + + /* Power on setting function is only added in 8723B currently */ + if (IS_HARDWARE_TYPE_8723B(pBtCoexist->Adapter)) + { + if (pBtCoexist->boardInfo.btdmAntNum == 2) + EXhalbtc8723b2ant_PowerOnSetting(pBtCoexist); + else if (pBtCoexist->boardInfo.btdmAntNum == 1) + EXhalbtc8723b1ant_PowerOnSetting(pBtCoexist); + } +} + +void EXhalbtcoutsrc_PreLoadFirmware(PBTC_COEXIST pBtCoexist) +{ + if(!halbtcoutsrc_IsBtCoexistAvailable(pBtCoexist)) + return; + + pBtCoexist->statistics.cntPreLoadFirmware++; + + if(IS_HARDWARE_TYPE_8723B(pBtCoexist->Adapter)) + { + if(pBtCoexist->boardInfo.btdmAntNum == 2) + EXhalbtc8723b2ant_PreLoadFirmware(pBtCoexist); + else if(pBtCoexist->boardInfo.btdmAntNum == 1) + EXhalbtc8723b1ant_PreLoadFirmware(pBtCoexist); + } +} + void EXhalbtcoutsrc_InitHwConfig(PBTC_COEXIST pBtCoexist, u8 bWifiOnly) { if (!halbtcoutsrc_IsBtCoexistAvailable(pBtCoexist)) @@ -1364,7 +1576,9 @@ void EXhalbtcoutsrc_InitHwConfig(PBTC_COEXIST pBtCoexist, u8 bWifiOnly) if (IS_HARDWARE_TYPE_8821(pBtCoexist->Adapter)) { - if (pBtCoexist->boardInfo.btdmAntNum == 2) + if (halbtcoutsrc_IsCsrBtCoex(pBtCoexist) == _TRUE) + EXhalbtc8821aCsr2ant_InitHwConfig(pBtCoexist, bWifiOnly); + else if (pBtCoexist->boardInfo.btdmAntNum == 2) EXhalbtc8821a2ant_InitHwConfig(pBtCoexist, bWifiOnly); else if (pBtCoexist->boardInfo.btdmAntNum == 1) EXhalbtc8821a1ant_InitHwConfig(pBtCoexist, bWifiOnly); @@ -1416,7 +1630,9 @@ void EXhalbtcoutsrc_InitCoexDm(PBTC_COEXIST pBtCoexist) if (IS_HARDWARE_TYPE_8821(pBtCoexist->Adapter)) { - if (pBtCoexist->boardInfo.btdmAntNum == 2) + if (halbtcoutsrc_IsCsrBtCoex(pBtCoexist) == _TRUE) + EXhalbtc8821aCsr2ant_InitCoexDm(pBtCoexist); + else if (pBtCoexist->boardInfo.btdmAntNum == 2) EXhalbtc8821a2ant_InitCoexDm(pBtCoexist); else if (pBtCoexist->boardInfo.btdmAntNum == 1) EXhalbtc8821a1ant_InitCoexDm(pBtCoexist); @@ -1473,16 +1689,24 @@ void EXhalbtcoutsrc_IpsNotify(PBTC_COEXIST pBtCoexist, u8 type) return; if (IPS_NONE == type) + { ipsType = BTC_IPS_LEAVE; + GLBtcWiFiInIPS = _FALSE; + } else + { ipsType = BTC_IPS_ENTER; - + GLBtcWiFiInIPS = _TRUE; + } + // All notify is called in cmd thread, don't need to leave low power again // halbtcoutsrc_LeaveLowPower(pBtCoexist); if (IS_HARDWARE_TYPE_8821(pBtCoexist->Adapter)) { - if (pBtCoexist->boardInfo.btdmAntNum == 2) + if (halbtcoutsrc_IsCsrBtCoex(pBtCoexist) == _TRUE) + EXhalbtc8821aCsr2ant_IpsNotify(pBtCoexist, ipsType); + else if (pBtCoexist->boardInfo.btdmAntNum == 2) EXhalbtc8821a2ant_IpsNotify(pBtCoexist, ipsType); else if (pBtCoexist->boardInfo.btdmAntNum == 1) EXhalbtc8821a1ant_IpsNotify(pBtCoexist, ipsType); @@ -1540,13 +1764,21 @@ void EXhalbtcoutsrc_LpsNotify(PBTC_COEXIST pBtCoexist, u8 type) return; if (PS_MODE_ACTIVE == type) + { lpsType = BTC_LPS_DISABLE; + GLBtcWiFiInLPS = _FALSE; + } else + { lpsType = BTC_LPS_ENABLE; - + GLBtcWiFiInLPS = _TRUE; + } + if (IS_HARDWARE_TYPE_8821(pBtCoexist->Adapter)) { - if (pBtCoexist->boardInfo.btdmAntNum == 2) + if (halbtcoutsrc_IsCsrBtCoex(pBtCoexist) == _TRUE) + EXhalbtc8821aCsr2ant_LpsNotify(pBtCoexist, lpsType); + else if (pBtCoexist->boardInfo.btdmAntNum == 2) EXhalbtc8821a2ant_LpsNotify(pBtCoexist, lpsType); else if (pBtCoexist->boardInfo.btdmAntNum == 1) EXhalbtc8821a1ant_LpsNotify(pBtCoexist, lpsType); @@ -1615,7 +1847,9 @@ void EXhalbtcoutsrc_ScanNotify(PBTC_COEXIST pBtCoexist, u8 type) if (IS_HARDWARE_TYPE_8821(pBtCoexist->Adapter)) { - if (pBtCoexist->boardInfo.btdmAntNum == 2) + if (halbtcoutsrc_IsCsrBtCoex(pBtCoexist) == _TRUE) + EXhalbtc8821aCsr2ant_ScanNotify(pBtCoexist, scanType); + else if (pBtCoexist->boardInfo.btdmAntNum == 2) EXhalbtc8821a2ant_ScanNotify(pBtCoexist, scanType); else if (pBtCoexist->boardInfo.btdmAntNum == 1) EXhalbtc8821a1ant_ScanNotify(pBtCoexist, scanType); @@ -1680,7 +1914,9 @@ void EXhalbtcoutsrc_ConnectNotify(PBTC_COEXIST pBtCoexist, u8 action) if (IS_HARDWARE_TYPE_8821(pBtCoexist->Adapter)) { - if (pBtCoexist->boardInfo.btdmAntNum == 2) + if (halbtcoutsrc_IsCsrBtCoex(pBtCoexist) == _TRUE) + EXhalbtc8821aCsr2ant_ConnectNotify(pBtCoexist, assoType); + else if (pBtCoexist->boardInfo.btdmAntNum == 2) EXhalbtc8821a2ant_ConnectNotify(pBtCoexist, assoType); else if (pBtCoexist->boardInfo.btdmAntNum == 1) EXhalbtc8821a1ant_ConnectNotify(pBtCoexist, assoType); @@ -1746,7 +1982,9 @@ void EXhalbtcoutsrc_MediaStatusNotify(PBTC_COEXIST pBtCoexist, RT_MEDIA_STATUS m if (IS_HARDWARE_TYPE_8821(pBtCoexist->Adapter)) { - if (pBtCoexist->boardInfo.btdmAntNum == 2) + if (halbtcoutsrc_IsCsrBtCoex(pBtCoexist) == _TRUE) + EXhalbtc8821aCsr2ant_MediaStatusNotify(pBtCoexist, mStatus); + else if (pBtCoexist->boardInfo.btdmAntNum == 2) EXhalbtc8821a2ant_MediaStatusNotify(pBtCoexist, mStatus); else if (pBtCoexist->boardInfo.btdmAntNum == 1) EXhalbtc8821a1ant_MediaStatusNotify(pBtCoexist, mStatus); @@ -1818,7 +2056,9 @@ void EXhalbtcoutsrc_SpecialPacketNotify(PBTC_COEXIST pBtCoexist, u8 pktType) if (IS_HARDWARE_TYPE_8821(pBtCoexist->Adapter)) { - if (pBtCoexist->boardInfo.btdmAntNum == 2) + if (halbtcoutsrc_IsCsrBtCoex(pBtCoexist) == _TRUE) + EXhalbtc8821aCsr2ant_SpecialPacketNotify(pBtCoexist, packetType); + else if (pBtCoexist->boardInfo.btdmAntNum == 2) EXhalbtc8821a2ant_SpecialPacketNotify(pBtCoexist, packetType); else if (pBtCoexist->boardInfo.btdmAntNum == 1) EXhalbtc8821a1ant_SpecialPacketNotify(pBtCoexist, packetType); @@ -1875,7 +2115,9 @@ void EXhalbtcoutsrc_BtInfoNotify(PBTC_COEXIST pBtCoexist, u8 *tmpBuf, u8 length) if (IS_HARDWARE_TYPE_8821(pBtCoexist->Adapter)) { - if (pBtCoexist->boardInfo.btdmAntNum == 2) + if (halbtcoutsrc_IsCsrBtCoex(pBtCoexist) == _TRUE) + EXhalbtc8821aCsr2ant_BtInfoNotify(pBtCoexist, tmpBuf, length); + else if (pBtCoexist->boardInfo.btdmAntNum == 2) EXhalbtc8821a2ant_BtInfoNotify(pBtCoexist, tmpBuf, length); else if (pBtCoexist->boardInfo.btdmAntNum == 1) EXhalbtc8821a1ant_BtInfoNotify(pBtCoexist, tmpBuf, length); @@ -1920,6 +2162,32 @@ void EXhalbtcoutsrc_BtInfoNotify(PBTC_COEXIST pBtCoexist, u8 *tmpBuf, u8 length) // halbtcoutsrc_NormalLowPower(pBtCoexist); } +VOID +EXhalbtcoutsrc_RfStatusNotify( + IN PBTC_COEXIST pBtCoexist, + IN u1Byte type + ) +{ + if(!halbtcoutsrc_IsBtCoexistAvailable(pBtCoexist)) + return; + pBtCoexist->statistics.cntRfStatusNotify++; + + if(IS_HARDWARE_TYPE_8821(pBtCoexist->Adapter)) + { + } + else if(IS_HARDWARE_TYPE_8723B(pBtCoexist->Adapter)) + { + if(pBtCoexist->boardInfo.btdmAntNum == 1) + EXhalbtc8723b1ant_RfStatusNotify(pBtCoexist, type); + } + else if(IS_HARDWARE_TYPE_8192E(pBtCoexist->Adapter)) + { + } + else if(IS_HARDWARE_TYPE_8812(pBtCoexist->Adapter)) + { + } +} + void EXhalbtcoutsrc_StackOperationNotify(PBTC_COEXIST pBtCoexist, u8 type) { #if 0 @@ -1964,7 +2232,9 @@ void EXhalbtcoutsrc_HaltNotify(PBTC_COEXIST pBtCoexist) if (IS_HARDWARE_TYPE_8821(pBtCoexist->Adapter)) { - if (pBtCoexist->boardInfo.btdmAntNum == 2) + if (halbtcoutsrc_IsCsrBtCoex(pBtCoexist) == _TRUE) + EXhalbtc8821aCsr2ant_HaltNotify(pBtCoexist); + else if (pBtCoexist->boardInfo.btdmAntNum == 2) EXhalbtc8821a2ant_HaltNotify(pBtCoexist); else if (pBtCoexist->boardInfo.btdmAntNum == 1) EXhalbtc8821a1ant_HaltNotify(pBtCoexist); @@ -2045,7 +2315,9 @@ void EXhalbtcoutsrc_PnpNotify(PBTC_COEXIST pBtCoexist, u8 pnpState) } else if (IS_HARDWARE_TYPE_8821(pBtCoexist->Adapter)) { - if (pBtCoexist->boardInfo.btdmAntNum == 1) + if (halbtcoutsrc_IsCsrBtCoex(pBtCoexist) == _TRUE) + EXhalbtc8821aCsr2ant_PnpNotify(pBtCoexist, pnpState); + else if (pBtCoexist->boardInfo.btdmAntNum == 1) EXhalbtc8821a1ant_PnpNotify(pBtCoexist,pnpState); else if(pBtCoexist->boardInfo.btdmAntNum == 2) EXhalbtc8821a2ant_PnpNotify(pBtCoexist,pnpState); @@ -2062,7 +2334,7 @@ void EXhalbtcoutsrc_PnpNotify(PBTC_COEXIST pBtCoexist, u8 pnpState) } } -void EXhalbtcoutsrc_CoexDmSwitch(PBTC_COEXIST pBtCoexist, BOOLEAN antInverse) +void EXhalbtcoutsrc_CoexDmSwitch(PBTC_COEXIST pBtCoexist) { if (!halbtcoutsrc_IsBtCoexistAvailable(pBtCoexist)) return; @@ -2076,7 +2348,7 @@ void EXhalbtcoutsrc_CoexDmSwitch(PBTC_COEXIST pBtCoexist, BOOLEAN antInverse) { pBtCoexist->bStopCoexDm = TRUE; EXhalbtc8723b1ant_CoexDmReset(pBtCoexist); - EXhalbtcoutsrc_SetAntNum(BT_COEX_ANT_TYPE_DETECTED, 2, antInverse); + EXhalbtcoutsrc_SetAntNum(BT_COEX_ANT_TYPE_DETECTED, 2); EXhalbtc8723b2ant_InitHwConfig(pBtCoexist, FALSE); EXhalbtc8723b2ant_InitCoexDm(pBtCoexist); pBtCoexist->bStopCoexDm = FALSE; @@ -2098,7 +2370,9 @@ void EXhalbtcoutsrc_Periodical(PBTC_COEXIST pBtCoexist) if (IS_HARDWARE_TYPE_8821(pBtCoexist->Adapter)) { - if (pBtCoexist->boardInfo.btdmAntNum == 2) + if (halbtcoutsrc_IsCsrBtCoex(pBtCoexist) == _TRUE) + EXhalbtc8821aCsr2ant_Periodical(pBtCoexist); + else if (pBtCoexist->boardInfo.btdmAntNum == 2) EXhalbtc8821a2ant_Periodical(pBtCoexist); else if (pBtCoexist->boardInfo.btdmAntNum == 1) { @@ -2271,11 +2545,12 @@ void EXhalbtcoutsrc_SetBtPatchVersion(u16 btHciVersion, u16 btPatchVersion) pBtCoexist->btInfo.btHciVer = btHciVersion; } +#if 0 void EXhalbtcoutsrc_SetBtExist(u8 bBtExist) { GLBtCoexist.boardInfo.bBtExist = bBtExist; } - +#endif void EXhalbtcoutsrc_SetChipType(u8 chipType) { switch(chipType) @@ -2305,13 +2580,13 @@ void EXhalbtcoutsrc_SetChipType(u8 chipType) } } -void EXhalbtcoutsrc_SetAntNum(u8 type, u8 antNum, BOOLEAN antInverse) +void EXhalbtcoutsrc_SetAntNum(u8 type, u8 antNum) { if (BT_COEX_ANT_TYPE_PG == type) { GLBtCoexist.boardInfo.pgAntNum = antNum; GLBtCoexist.boardInfo.btdmAntNum = antNum; - +#if 0 //The antenna position: Main (default) or Aux for pgAntNum=2 && btdmAntNum =1 //The antenna position should be determined by auto-detect mechanism // The following is assumed to main, and those must be modified if y auto-detect mechanism is ready @@ -2319,22 +2594,26 @@ void EXhalbtcoutsrc_SetAntNum(u8 type, u8 antNum, BOOLEAN antInverse) GLBtCoexist.boardInfo.btdmAntPos = BTC_ANTENNA_AT_MAIN_PORT; else GLBtCoexist.boardInfo.btdmAntPos = BTC_ANTENNA_AT_MAIN_PORT; +#endif } else if (BT_COEX_ANT_TYPE_ANTDIV == type) { GLBtCoexist.boardInfo.btdmAntNum = antNum; - GLBtCoexist.boardInfo.btdmAntPos = BTC_ANTENNA_AT_MAIN_PORT; + //GLBtCoexist.boardInfo.btdmAntPos = BTC_ANTENNA_AT_MAIN_PORT; } else if (BT_COEX_ANT_TYPE_DETECTED == type) { GLBtCoexist.boardInfo.btdmAntNum = antNum; - GLBtCoexist.boardInfo.btdmAntPos = BTC_ANTENNA_AT_MAIN_PORT; + //GLBtCoexist.boardInfo.btdmAntPos = BTC_ANTENNA_AT_MAIN_PORT; } +} - if (antInverse == _TRUE) - { - GLBtCoexist.boardInfo.btdmAntPos = BTC_ANTENNA_AT_AUX_PORT; - } +// +// Currently used by 8723b only, S0 or S1 +// +void EXhalbtcoutsrc_SetSingleAntPath(u8 singleAntPath) +{ + GLBtCoexist.boardInfo.singleAntPath = singleAntPath; } void EXhalbtcoutsrc_DisplayBtCoexInfo(PBTC_COEXIST pBtCoexist) @@ -2346,7 +2625,9 @@ void EXhalbtcoutsrc_DisplayBtCoexInfo(PBTC_COEXIST pBtCoexist) if (IS_HARDWARE_TYPE_8821(pBtCoexist->Adapter)) { - if (pBtCoexist->boardInfo.btdmAntNum == 2) + if (halbtcoutsrc_IsCsrBtCoex(pBtCoexist) == _TRUE) + EXhalbtc8821aCsr2ant_DisplayCoexInfo(pBtCoexist); + else if (pBtCoexist->boardInfo.btdmAntNum == 2) EXhalbtc8821a2ant_DisplayCoexInfo(pBtCoexist); else if (pBtCoexist->boardInfo.btdmAntNum == 1) EXhalbtc8821a1ant_DisplayCoexInfo(pBtCoexist); @@ -2457,7 +2738,7 @@ void hal_btcoex_SetBTCoexist(PADAPTER padapter, u8 bBtExist) pHalData = GET_HAL_DATA(padapter); pHalData->bt_coexist.bBtExist = bBtExist; - EXhalbtcoutsrc_SetBtExist(bBtExist); + //EXhalbtcoutsrc_SetBtExist(bBtExist); } /* @@ -2508,7 +2789,7 @@ u8 hal_btcoex_GetChipType(PADAPTER padapter) return pHalData->bt_coexist.btChipType; } -void hal_btcoex_SetPgAntNum(PADAPTER padapter, u8 antNum, BOOLEAN antInverse) +void hal_btcoex_SetPgAntNum(PADAPTER padapter, u8 antNum) { PHAL_DATA_TYPE pHalData; @@ -2516,7 +2797,7 @@ void hal_btcoex_SetPgAntNum(PADAPTER padapter, u8 antNum, BOOLEAN antInverse) pHalData = GET_HAL_DATA(padapter); pHalData->bt_coexist.btTotalAntNum = antNum; - EXhalbtcoutsrc_SetAntNum(BT_COEX_ANT_TYPE_PG, antNum, antInverse); + EXhalbtcoutsrc_SetAntNum(BT_COEX_ANT_TYPE_PG, antNum); } u8 hal_btcoex_GetPgAntNum(PADAPTER padapter) @@ -2529,6 +2810,11 @@ u8 hal_btcoex_GetPgAntNum(PADAPTER padapter) return pHalData->bt_coexist.btTotalAntNum; } +void hal_btcoex_SetSingleAntPath(PADAPTER padapter, u8 singleAntPath) +{ + EXhalbtcoutsrc_SetSingleAntPath(singleAntPath); +} + u8 hal_btcoex_Initialize(PADAPTER padapter) { u8 ret1; @@ -2542,6 +2828,16 @@ u8 hal_btcoex_Initialize(PADAPTER padapter) return ret2; } +void hal_btcoex_PowerOnSetting(PADAPTER padapter) +{ + EXhalbtcoutsrc_PowerOnSetting(&GLBtCoexist); +} + +void hal_btcoex_PreLoadFirmware(PADAPTER padapter) +{ + EXhalbtcoutsrc_PreLoadFirmware(&GLBtCoexist); +} + void hal_btcoex_InitHwConfig(PADAPTER padapter, u8 bWifiOnly) { if (!hal_btcoex_IsBtExist(padapter)) @@ -2695,13 +2991,15 @@ u8 hal_btcoex_LpsVal(PADAPTER padapter) u32 hal_btcoex_GetRaMask(PADAPTER padapter) { if (!hal_btcoex_IsBtExist(padapter)) - return 0; + return 0; if (GLBtCoexist.btInfo.bBtDisabled) - return 0; + return 0; - if (GLBtCoexist.boardInfo.btdmAntNum != 1) - return 0; + // Modify by YiWei , suggest by Cosa and Jenyu + // Remove the limit antenna number , because 2 antenna case (ex: 8192eu)also want to get BT coex report rate mask. + //if (GLBtCoexist.boardInfo.btdmAntNum != 1) + // return 0; return GLBtCoexist.btInfo.raMask; } @@ -2883,5 +3181,183 @@ u8 hal_btcoex_IsBtLinkExist(PADAPTER padapter) return _FALSE; } + +/* + * Description: + * Setting BT coex antenna isolation type . + * coex mechanisn/ spital stream/ best throughput + * anttype = 0 , PSTDMA / 2SS / 0.5T , bad isolation (<20dB) for 2,3 antenna + * anttype = 1 , PSTDMA / 1SS / 0.5T , normal isolaiton (>20dB) for 2 antenna + * anttype = 2 , TDMA / 2SS / T , normal isolaiton (>20dB) for 3 antenna + * anttype = 3 , no TDMA / 1SS / 0.5T , good isolation (>40dB) for 2 antenna + * anttype = 4 , no TDMA / 2SS / T , good isolation (>40dB) for 3 antenna + * wifi only throughput ~ T + * wifi/BT share one antenna with SPDT + */ +void hal_btcoex_SetAntIsolationType(PADAPTER padapter, u8 anttype) +{ + PHAL_DATA_TYPE pHalData; + + //DBG_871X("####%s , anttype = %d , %d \n", __FUNCTION__,anttype,__LINE__); + pHalData = GET_HAL_DATA(padapter); + + + pHalData->bt_coexist.btAntisolation= anttype; + +} + +#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE +int +hal_btcoex_ParseAntIsolationConfigFile( + PADAPTER Adapter, + char* buffer +) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + u32 i = 0 , j=0; + char *szLine, *ptmp; + int rtStatus = _SUCCESS; + char param_value_string[10]; + u8 param_value; + u8 anttype = 4; + + u8 ant_num=3, ant_distance=50; + + typedef struct ant_isolation + { + char *param_name; // antenna isolation config parameter name + u8 *value; // antenna isolation config parameter value + }ANT_ISOLATION; + + ANT_ISOLATION ant_isolation_param[]= { + {"ANT_NUMBER",&ant_num}, + {"ANT_DISTANCE",&ant_distance}, + {NULL,0} + }; + + + + //DBG_871X("===>Hal_ParseAntIsolationConfigFile()\n" ); + + ptmp = buffer; + for (szLine = GetLineFromBuffer(ptmp); szLine != NULL; szLine = GetLineFromBuffer(ptmp)) + { + // skip comment + if ( IsCommentString( szLine ) ) { + continue; + } + + //DBG_871X("%s : szLine = %s , strlen(szLine) = %d \n", __FUNCTION__,szLine,strlen(szLine)); + for ( j=0 ;ant_isolation_param[j].param_name != NULL ; j++ ) + { + if ( strstr(szLine,ant_isolation_param[j].param_name)!= NULL ) + { + i=0; + while ( i < strlen(szLine) ) + { + if (szLine[i] != '"') + ++i; + else + { + // skip only has one " + if( strpbrk(szLine, "\"") == strrchr(szLine, '"')) + { + DBG_871X("Fail to parse parameters , format error!\n"); + break; + } + _rtw_memset( ( PVOID ) param_value_string, 0, 10 ); + if ( ! ParseQualifiedString( szLine, &i, param_value_string, '"' , '"' ) ) { + DBG_871X("Fail to parse parameters \n"); + return _FAIL; + } + else + { + GetU1ByteIntegerFromStringInDecimal( param_value_string, ant_isolation_param[j].value ); + } + break; + } + } + } + } + } + + // YiWei 20140716 , for BT coex antenna isolation control + if ( ant_num==3 && ant_distance>=50) + { + pHalData->EEPROMBluetoothCoexist = 0; + anttype = 4; + } + else if ( ant_num==2 && ant_distance>=50 ) + { + anttype = 3; + } + else if ( ant_num==3 && ant_distance>=15 && ant_distance<50 ) + { + anttype = 2; + } + else if ( ant_num==2 && ant_distance>=15 && ant_distance<50 ) + { + anttype = 1; + } + else if ( (ant_num==2 && ant_distance<15) || (ant_num==3 && ant_distance<15)) + { + anttype = 0; + } + else + { + pHalData->EEPROMBluetoothCoexist = 1; + anttype = 1; + } + + hal_btcoex_SetAntIsolationType(Adapter, anttype); + + DBG_871X("%s : ant_num = %d \n", __FUNCTION__,ant_num); + DBG_871X("%s : ant_distance = %d \n", __FUNCTION__,ant_distance); + //DBG_871X("<===Hal_ParseAntIsolationConfigFile()\n"); + return rtStatus; +} + + +int +hal_btcoex_AntIsolationConfig_ParaFile( + IN PADAPTER Adapter, + IN char* pFileName +) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + int rlen = 0, rtStatus = _FAIL; + //char file_path[1024]; + + //if(!(Adapter->registrypriv.load_phy_file & LOAD_RF_TXPWR_LMT_PARA_FILE)) + // return rtStatus; + + _rtw_memset(pHalData->para_file_buf, 0, MAX_PARA_FILE_BUF_LEN); + + + rtw_merge_string(file_path, PATH_LENGTH_MAX, rtw_phy_file_path, pFileName); + + if (rtw_is_file_readable(file_path) == _TRUE) + { + rlen = rtw_retrive_from_file(file_path, pHalData->para_file_buf, MAX_PARA_FILE_BUF_LEN); + if (rlen > 0) + { + rtStatus = _SUCCESS; + } + } + + + if(rtStatus == _SUCCESS) + { + //DBG_871X("%s(): read %s ok\n", __FUNCTION__, pFileName); + rtStatus = hal_btcoex_ParseAntIsolationConfigFile( Adapter, pHalData->para_file_buf ); + } + else + { + DBG_871X("%s(): No File %s, Load from *** Array!\n", __FUNCTION__, pFileName); + } + + return rtStatus; +} +#endif // CONFIG_LOAD_PHY_PARA_FROM_FILE #endif // CONFIG_BT_COEXIST diff --git a/hal/hal_com.c b/hal/hal_com.c index 2f2072e..a5fbda2 100644 --- a/hal/hal_com.c +++ b/hal/hal_com.c @@ -20,10 +20,45 @@ #define _HAL_COM_C_ #include +#include "hal_com_h2c.h" #include "../hal/OUTSRC/odm_precomp.h" +#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE +char file_path[PATH_LENGTH_MAX]; +#endif + +u8 rtw_hal_data_init(_adapter *padapter) +{ + if(is_primary_adapter(padapter)) + { + padapter->hal_data_sz = sizeof(HAL_DATA_TYPE); + padapter->HalData = rtw_zvmalloc(padapter->hal_data_sz); + if(padapter->HalData == NULL){ + DBG_8192C("cant not alloc memory for HAL DATA \n"); + return _FAIL; + } + } + return _SUCCESS; +} + +void rtw_hal_data_deinit(_adapter *padapter) +{ + if(is_primary_adapter(padapter)) + { + if (padapter->HalData) + { + #ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE + phy_free_filebuf(padapter); + #endif + rtw_vmfree(padapter->HalData, padapter->hal_data_sz); + padapter->HalData = NULL; + padapter->hal_data_sz = 0; + } + } +} + void dump_chip_info(HAL_VERSION ChipVersion) { int cnt = 0; @@ -436,7 +471,7 @@ _TwoOutPipeMapping( // BK, BE, VI, VO, BCN, CMD,MGT,HIGH,HCCA //{ 0, 1, 0, 1, 0, 0, 0, 0, 0 }; - //0:H, 1:N + //0:ep_0 num, 1:ep_1 num pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[1];//VO pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[0];//VI @@ -454,7 +489,7 @@ _TwoOutPipeMapping( //BK, BE, VI, VO, BCN, CMD,MGT,HIGH,HCCA //{ 1, 1, 0, 0, 0, 0, 0, 0, 0 }; - //0:H, 1:N + //0:ep_0 num, 1:ep_1 num pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[0];//VO pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[0];//VI @@ -1016,42 +1051,124 @@ void SetHwReg(_adapter *adapter, u8 variable, u8 *val) _func_enter_; switch (variable) { - case HW_VAR_PORT_SWITCH: - hw_var_port_switch(adapter); - break; - case HW_VAR_DM_FLAG: - odm->SupportAbility = *((u32*)val); - break; - case HW_VAR_DM_FUNC_OP: - if (*((u8*)val) == _TRUE) { - /* save dm flag */ - odm->BK_SupportAbility = odm->SupportAbility; - } else { - /* restore dm flag */ - odm->SupportAbility = odm->BK_SupportAbility; + case HW_VAR_INITIAL_GAIN: + { + u32 rx_gain = ((u32 *)(val))[0]; + + if(rx_gain == 0xff){//restore rx gain + //ODM_Write_DIG(podmpriv,pDigTable->BackupIGValue); + odm_PauseDIG(odm, ODM_RESUME_DIG,rx_gain); + } + else{ + //pDigTable->BackupIGValue = pDigTable->CurIGValue; + //ODM_Write_DIG(podmpriv,rx_gain); + odm_PauseDIG(odm, ODM_PAUSE_DIG,rx_gain); + } + } + break; + case HW_VAR_PORT_SWITCH: + hw_var_port_switch(adapter); + break; + case HW_VAR_INIT_RTS_RATE: + { + u16 brate_cfg = *((u16*)val); + u8 rate_index = 0; + HAL_VERSION *hal_ver = &hal_data->VersionID; + + if (IS_81XXC(*hal_ver) ||IS_92D(*hal_ver) || IS_8723_SERIES(*hal_ver) || IS_8188E(*hal_ver)) { + + while (brate_cfg > 0x1) { + brate_cfg = (brate_cfg >> 1); + rate_index++; + } + rtw_write8(adapter, REG_INIRTS_RATE_SEL, rate_index); + } else { + rtw_warn_on(1); + } } - break; - case HW_VAR_DM_FUNC_SET: - if(*((u32*)val) == DYNAMIC_ALL_FUNC_ENABLE){ - struct dm_priv *dm = &hal_data->dmpriv; - dm->DMFlag = dm->InitDMFlag; - odm->SupportAbility = dm->InitODMFlag; - } else { - odm->SupportAbility |= *((u32 *)val); + break; + case HW_VAR_SEC_CFG: + { + #if defined(CONFIG_CONCURRENT_MODE) && !defined(DYNAMIC_CAMID_ALLOC) + // enable tx enc and rx dec engine, and no key search for MC/BC + rtw_write8(adapter, REG_SECCFG, SCR_NoSKMC|SCR_RxDecEnable|SCR_TxEncEnable); + #elif defined(DYNAMIC_CAMID_ALLOC) + u16 reg_scr; + + reg_scr = rtw_read16(adapter, REG_SECCFG); + rtw_write16(adapter, REG_SECCFG, reg_scr|SCR_CHK_KEYID|SCR_RxDecEnable|SCR_TxEncEnable); + #else + rtw_write8(adapter, REG_SECCFG, *((u8*)val)); + #endif } - break; - case HW_VAR_DM_FUNC_CLR: - /* - * input is already a mask to clear function - * don't invert it again! George,Lucas@20130513 - */ - odm->SupportAbility &= *((u32 *)val); - break; - default: - if (0) - DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" variable(%d) not defined!\n", - FUNC_ADPT_ARG(adapter), variable); - break; + break; + case HW_VAR_SEC_DK_CFG: + { + struct security_priv *sec = &adapter->securitypriv; + u8 reg_scr = rtw_read8(adapter, REG_SECCFG); + + if (val) /* Enable default key related setting */ + { + reg_scr |= SCR_TXBCUSEDK; + if (sec->dot11AuthAlgrthm != dot11AuthAlgrthm_8021X) + reg_scr |= (SCR_RxUseDK|SCR_TxUseDK); + } + else /* Disable default key related setting */ + { + reg_scr &= ~(SCR_RXBCUSEDK|SCR_TXBCUSEDK|SCR_RxUseDK|SCR_TxUseDK); + } + + rtw_write8(adapter, REG_SECCFG, reg_scr); + } + break; + case HW_VAR_DM_FLAG: + odm->SupportAbility = *((u32*)val); + break; + case HW_VAR_DM_FUNC_OP: + if (*((u8*)val) == _TRUE) { + /* save dm flag */ + odm->BK_SupportAbility = odm->SupportAbility; + } else { + /* restore dm flag */ + odm->SupportAbility = odm->BK_SupportAbility; + } + break; + case HW_VAR_DM_FUNC_SET: + if(*((u32*)val) == DYNAMIC_ALL_FUNC_ENABLE){ + struct dm_priv *dm = &hal_data->dmpriv; + dm->DMFlag = dm->InitDMFlag; + odm->SupportAbility = dm->InitODMFlag; + } else { + odm->SupportAbility |= *((u32 *)val); + } + break; + case HW_VAR_DM_FUNC_CLR: + /* + * input is already a mask to clear function + * don't invert it again! George,Lucas@20130513 + */ + odm->SupportAbility &= *((u32 *)val); + break; + case HW_VAR_ASIX_IOT: + // enable ASIX IOT function + if (*((u8*)val) == _TRUE) { + // 0xa2e[0]=0 (disable rake receiver) + rtw_write8(adapter, rCCK0_FalseAlarmReport+2, + rtw_read8(adapter, rCCK0_FalseAlarmReport+2) & ~(BIT0)); + // 0xa1c=0xa0 (reset channel estimation if signal quality is bad) + rtw_write8(adapter, rCCK0_DSPParameter2, 0xa0); + } else { + // restore reg:0xa2e, reg:0xa1c + rtw_write8(adapter, rCCK0_FalseAlarmReport+2, + rtw_read8(adapter, rCCK0_FalseAlarmReport+2)|(BIT0)); + rtw_write8(adapter, rCCK0_DSPParameter2, 0x00); + } + break; + default: + if (0) + DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" variable(%d) not defined!\n", + FUNC_ADPT_ARG(adapter), variable); + break; } _func_exit_; @@ -1175,6 +1292,9 @@ SetHalDefVar(_adapter *adapter, HAL_DEF_VARIABLE variable, void *value) case HAL_DEF_ANT_DETECT: hal_data->AntDetection = *((u8 *)value); break; + case HAL_DEF_DBG_DIS_PWT: + hal_data->bDisableTXPowerTraining = *((u8*)value); + break; default: DBG_871X_LEVEL(_drv_always_, "%s: [WARNING] HAL_DEF_VARIABLE(%d) not defined!\n", __FUNCTION__, variable); bResult = _FAIL; @@ -1231,6 +1351,9 @@ GetHalDefVar(_adapter *adapter, HAL_DEF_VARIABLE variable, void *value) case HAL_DEF_TX_PAGE_SIZE: *(( u32*)value) = PAGE_SIZE_128; break; + case HAL_DEF_DBG_DIS_PWT: + *(u8*)value = hal_data->bDisableTXPowerTraining; + break; default: DBG_871X_LEVEL(_drv_always_, "%s: [WARNING] HAL_DEF_VARIABLE(%d) not defined!\n", __FUNCTION__, variable); bResult = _FAIL; @@ -1240,6 +1363,97 @@ GetHalDefVar(_adapter *adapter, HAL_DEF_VARIABLE variable, void *value) return bResult; } +void GetHalODMVar( + PADAPTER Adapter, + HAL_ODM_VARIABLE eVariable, + PVOID pValue1, + PVOID pValue2) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + PDM_ODM_T podmpriv = &pHalData->odmpriv; + switch(eVariable){ +#if defined(CONFIG_SIGNAL_DISPLAY_DBM) && defined(CONFIG_BACKGROUND_NOISE_MONITOR) + case HAL_ODM_NOISE_MONITOR: + { + u8 chan = *(u8*)pValue1; + *(s16 *)pValue2 = pHalData->noise[chan]; + #ifdef DBG_NOISE_MONITOR + DBG_8192C("### Noise monitor chan(%d)-noise:%d (dBm) ###\n", + chan,pHalData->noise[chan]); + #endif + + } + break; +#endif//#ifdef CONFIG_BACKGROUND_NOISE_MONITOR + default: + break; + } +} + +void SetHalODMVar( + PADAPTER Adapter, + HAL_ODM_VARIABLE eVariable, + PVOID pValue1, + BOOLEAN bSet) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + PDM_ODM_T podmpriv = &pHalData->odmpriv; + //_irqL irqL; + switch(eVariable){ + case HAL_ODM_STA_INFO: + { + struct sta_info *psta = (struct sta_info *)pValue1; + if(bSet){ + DBG_8192C("### Set STA_(%d) info ###\n",psta->mac_id); + ODM_CmnInfoPtrArrayHook(podmpriv, ODM_CMNINFO_STA_STATUS,psta->mac_id,psta); + } + else{ + DBG_8192C("### Clean STA_(%d) info ###\n",psta->mac_id); + //_enter_critical_bh(&pHalData->odm_stainfo_lock, &irqL); + ODM_CmnInfoPtrArrayHook(podmpriv, ODM_CMNINFO_STA_STATUS,psta->mac_id,NULL); + + //_exit_critical_bh(&pHalData->odm_stainfo_lock, &irqL); + } + } + break; + case HAL_ODM_P2P_STATE: + ODM_CmnInfoUpdate(podmpriv,ODM_CMNINFO_WIFI_DIRECT,bSet); + break; + case HAL_ODM_WIFI_DISPLAY_STATE: + ODM_CmnInfoUpdate(podmpriv,ODM_CMNINFO_WIFI_DISPLAY,bSet); + break; + case HAL_ODM_REGULATION: + ODM_CmnInfoInit(podmpriv, ODM_CMNINFO_DOMAIN_CODE_2G, pHalData->Regulation2_4G); + ODM_CmnInfoInit(podmpriv, ODM_CMNINFO_DOMAIN_CODE_5G, pHalData->Regulation5G); + break; + #if defined(CONFIG_SIGNAL_DISPLAY_DBM) && defined(CONFIG_BACKGROUND_NOISE_MONITOR) + case HAL_ODM_NOISE_MONITOR: + { + struct noise_info *pinfo = (struct noise_info *)pValue1; + + #ifdef DBG_NOISE_MONITOR + DBG_8192C("### Noise monitor chan(%d)-bPauseDIG:%d,IGIValue:0x%02x,max_time:%d (ms) ###\n", + pinfo->chan,pinfo->bPauseDIG,pinfo->IGIValue,pinfo->max_time); + #endif + + pHalData->noise[pinfo->chan] = ODM_InbandNoise_Monitor(podmpriv,pinfo->bPauseDIG,pinfo->IGIValue,pinfo->max_time); + DBG_871X("chan_%d, noise = %d (dBm)\n",pinfo->chan,pHalData->noise[pinfo->chan]); + #ifdef DBG_NOISE_MONITOR + DBG_871X("noise_a = %d, noise_b = %d noise_all:%d \n", + podmpriv->noise_level.noise[ODM_RF_PATH_A], + podmpriv->noise_level.noise[ODM_RF_PATH_B], + podmpriv->noise_level.noise_all); + #endif + } + break; + #endif//#ifdef CONFIG_BACKGROUND_NOISE_MONITOR + + default: + break; + } +} + + BOOLEAN eqNByte( u8* str1, @@ -1512,18 +1726,17 @@ void rtw_hal_check_rxfifo_full(_adapter *adapter) //switch counter to RX fifo if(IS_81XXC(pHalData->VersionID) || IS_92D(pHalData->VersionID) || IS_8188E(pHalData->VersionID) || IS_8723_SERIES(pHalData->VersionID) - || IS_8812_SERIES(pHalData->VersionID) || IS_8821_SERIES(pHalData->VersionID)) + || IS_8812_SERIES(pHalData->VersionID) || IS_8821_SERIES(pHalData->VersionID) + || IS_8723B_SERIES(pHalData->VersionID) || IS_8192E(pHalData->VersionID)) { rtw_write8(adapter, REG_RXERR_RPT+3, rtw_read8(adapter, REG_RXERR_RPT+3)|0xa0); save_cnt = _TRUE; } - else if(IS_8723B_SERIES(pHalData->VersionID) || IS_8192E(pHalData->VersionID)) + else { - //printk("8723b or 8192e , MAC_667 set 0xf0\n"); - rtw_write8(adapter, REG_RXERR_RPT+3, rtw_read8(adapter, REG_RXERR_RPT+3)|0xf0); - save_cnt = _TRUE; + //todo: other chips } - //todo: other chips + if(save_cnt) { @@ -1560,7 +1773,7 @@ void linked_info_dump(_adapter *padapter,u8 benable) #endif // CONFIG_IPS #ifdef CONFIG_LPS - rtw_pm_set_lps(padapter, pwrctrlpriv->ips_org_mode); + rtw_pm_set_lps(padapter, pwrctrlpriv->org_power_mgnt ); #endif // CONFIG_LPS } padapter->bLinkInfoDump = benable ; @@ -1646,3 +1859,613 @@ void rtw_store_phy_info(_adapter *padapter, union recv_frame *prframe) } } #endif + +#ifdef CONFIG_EFUSE_CONFIG_FILE +int check_phy_efuse_tx_power_info_valid(PADAPTER padapter) { + EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter); + u8* pContent = pEEPROM->efuse_eeprom_data; + int index = 0; + u16 tx_index_offset = 0x0000; + + switch(padapter->chip_type) { + case RTL8723B: + tx_index_offset = EEPROM_TX_PWR_INX_8723B; + break; + case RTL8188E: + tx_index_offset = EEPROM_TX_PWR_INX_88E; + break; + case RTL8192E: + tx_index_offset = EEPROM_TX_PWR_INX_8192E; + break; + default: + tx_index_offset = 0x0010; + break; + } + for (index = 0 ; index < 12 ; index++) { + if (pContent[tx_index_offset + index] == 0xFF) { + return _FALSE; + } else { + DBG_871X("0x%02x ,", pContent[EEPROM_TX_PWR_INX_88E+index]); + } + } + DBG_871X("\n"); + return _TRUE; +} + +int check_phy_efuse_macaddr_info_valid(PADAPTER padapter) { + + u8 val = 0; + u16 addr_offset = 0x0000; + + switch(padapter->chip_type) { + case RTL8723B: + if (padapter->interface_type == RTW_USB) { + addr_offset = EEPROM_MAC_ADDR_8723BU; + DBG_871X("%s: interface is USB\n", __func__); + } else if (padapter->interface_type == RTW_SDIO) { + addr_offset = EEPROM_MAC_ADDR_8723BS; + DBG_871X("%s: interface is SDIO\n", __func__); + } else if (padapter->interface_type == RTW_PCIE) { + addr_offset = EEPROM_MAC_ADDR_8723BE; + DBG_871X("%s: interface is PCIE\n", __func__); + } else if (padapter->interface_type == RTW_GSPI) { + //addr_offset = EEPROM_MAC_ADDR_8723BS; + DBG_871X("%s: interface is GSPI\n", __func__); + } + break; + case RTL8188E: + if (padapter->interface_type == RTW_USB) { + addr_offset = EEPROM_MAC_ADDR_88EU; + DBG_871X("%s: interface is USB\n", __func__); + } else if (padapter->interface_type == RTW_SDIO) { + addr_offset = EEPROM_MAC_ADDR_88ES; + DBG_871X("%s: interface is SDIO\n", __func__); + } else if (padapter->interface_type == RTW_PCIE) { + addr_offset = EEPROM_MAC_ADDR_88EE; + DBG_871X("%s: interface is PCIE\n", __func__); + } else if (padapter->interface_type == RTW_GSPI) { + //addr_offset = EEPROM_MAC_ADDR_8723BS; + DBG_871X("%s: interface is GSPI\n", __func__); + } + break; + } + + if (addr_offset == 0x0000) { + DBG_871X("phy efuse MAC addr offset is 0!!\n"); + return _FALSE; + } else { + rtw_efuse_map_read(padapter, addr_offset, 1, &val); + } + + if (val == 0xFF) { + return _FALSE; + } else { + DBG_871X("phy efuse with valid MAC addr\n"); + return _TRUE; + } +} + +u32 Hal_readPGDataFromConfigFile( + PADAPTER padapter, + struct file *fp) +{ + u32 i; + mm_segment_t fs; + u8 temp[3]; + loff_t pos = 0; + EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter); + u8 *PROMContent = pEEPROM->efuse_eeprom_data; + + temp[2] = 0; // add end of string '\0' + + fs = get_fs(); + set_fs(KERNEL_DS); + + for (i = 0 ; i < HWSET_MAX_SIZE ; i++) { + vfs_read(fp, temp, 2, &pos); + PROMContent[i] = simple_strtoul(temp, NULL, 16); + if ((i % EFUSE_FILE_COLUMN_NUM) == (EFUSE_FILE_COLUMN_NUM - 1)) { + //Filter the lates space char. + vfs_read(fp, temp, 1, &pos); + if (strchr(temp, ' ') == NULL) { + pos--; + vfs_read(fp, temp, 2, &pos); + } + } else { + pos += 1; // Filter the space character + } + } + + set_fs(fs); + pEEPROM->bloadfile_fail_flag = _FALSE; + +#ifdef CONFIG_DEBUG + DBG_871X("Efuse configure file:\n"); + for (i=0; imac_addr, 0, ETH_ALEN); + + fs = get_fs(); + set_fs(KERNEL_DS); + + DBG_871X("wifi mac address:\n"); + vfs_read(fp, source_addr, 18, &pos); + source_addr[17] = ':'; + + head = end = source_addr; + for (i=0; imac_addr[i] = simple_strtoul(head, NULL, 16 ); + + if (end) { + end++; + head = end; + } + } + + set_fs(fs); + pEEPROM->bloadmac_fail_flag = _FALSE; + + if (rtw_check_invalid_mac_address(pEEPROM->mac_addr) == _TRUE) { +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)) + get_random_bytes(pEEPROM->mac_addr, ETH_ALEN); + pEEPROM->mac_addr[0] = 0x00; + pEEPROM->mac_addr[1] = 0xe0; + pEEPROM->mac_addr[2] = 0x4c; +#else + pEEPROM->mac_addr[0] = 0x00; + pEEPROM->mac_addr[1] = 0xe0; + pEEPROM->mac_addr[2] = 0x4c; + pEEPROM->mac_addr[3] = (u8)(curtime & 0xff) ; + pEEPROM->mac_addr[4] = (u8)((curtime>>8) & 0xff) ; + pEEPROM->mac_addr[5] = (u8)((curtime>>16) & 0xff) ; +#endif + DBG_871X("MAC Address from wifimac error is invalid, assign random MAC !!!\n"); + } + + DBG_871X("%s: Permanent Address = %02x-%02x-%02x-%02x-%02x-%02x\n", + __func__, pEEPROM->mac_addr[0], pEEPROM->mac_addr[1], + pEEPROM->mac_addr[2], pEEPROM->mac_addr[3], + pEEPROM->mac_addr[4], pEEPROM->mac_addr[5]); +} + +void Hal_GetPhyEfuseMACAddr(PADAPTER padapter, u8* mac_addr) { + int i = 0; + u16 addr_offset = 0x0000; + + switch(padapter->chip_type) { + case RTL8723B: + if (padapter->interface_type == RTW_USB) { + addr_offset = EEPROM_MAC_ADDR_8723BU; + DBG_871X("%s: interface is USB\n", __func__); + } else if (padapter->interface_type == RTW_SDIO) { + addr_offset = EEPROM_MAC_ADDR_8723BS; + DBG_871X("%s: interface is SDIO\n", __func__); + } else if (padapter->interface_type == RTW_PCIE) { + addr_offset = EEPROM_MAC_ADDR_8723BE; + DBG_871X("%s: interface is PCIE\n", __func__); + } else if (padapter->interface_type == RTW_GSPI){ + //addr_offset = EEPROM_MAC_ADDR_8723BS; + DBG_871X("%s: interface is GSPI\n", __func__); + } + break; + case RTL8188E: + if (padapter->interface_type == RTW_USB) { + addr_offset = EEPROM_MAC_ADDR_88EU; + DBG_871X("%s: interface is USB\n", __func__); + } else if (padapter->interface_type == RTW_SDIO) { + addr_offset = EEPROM_MAC_ADDR_88ES; + DBG_871X("%s: interface is SDIO\n", __func__); + } else if (padapter->interface_type == RTW_PCIE) { + addr_offset = EEPROM_MAC_ADDR_88EE; + DBG_871X("%s: interface is PCIE\n", __func__); + } else if (padapter->interface_type == RTW_GSPI){ + //addr_offset = EEPROM_MAC_ADDR_8723BS; + DBG_871X("%s: interface is GSPI\n", __func__); + } + break; + } + + rtw_efuse_map_read(padapter, addr_offset, ETH_ALEN, mac_addr); + + if (rtw_check_invalid_mac_address(mac_addr) == _TRUE) { +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)) + get_random_bytes(mac_addr, ETH_ALEN); + mac_addr[0] = 0x00; + mac_addr[1] = 0xe0; + mac_addr[2] = 0x4c; +#else + mac_addr[0] = 0x00; + mac_addr[1] = 0xe0; + mac_addr[2] = 0x4c; + mac_addr[3] = (u8)(curtime & 0xff) ; + mac_addr[4] = (u8)((curtime>>8) & 0xff) ; + mac_addr[5] = (u8)((curtime>>16) & 0xff) ; +#endif + DBG_871X("MAC Address from phy efuse error, assign random MAC !!!\n"); + } + + DBG_871X("%s: Permanent Address = %02x-%02x-%02x-%02x-%02x-%02x\n", + __func__, mac_addr[0], mac_addr[1], mac_addr[2], + mac_addr[3], mac_addr[4], mac_addr[5]); +} +#endif //CONFIG_EFUSE_CONFIG_FILE + +#ifdef CONFIG_RF_GAIN_OFFSET +u32 Array_kfreemap[] = { +0x08,0xe, +0x06,0xc, +0x04,0xa, +0x02,0x8, +0x00,0x6, +0x03,0x4, +0x05,0x2, +0x07,0x0, +0x09,0x0, +0x0c,0x0, +}; + +void rtw_bb_rf_gain_offset(_adapter *padapter) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); + u8 value = padapter->eeprompriv.EEPROMRFGainOffset; + u8 tmp = 0x3e; + u32 res,i=0; + u4Byte ArrayLen = sizeof(Array_kfreemap)/sizeof(u32); + pu4Byte Array = Array_kfreemap; + u4Byte v1=0,v2=0,GainValue,target=0; + //DBG_871X("+%s value: 0x%02x+\n", __func__, value); +#if defined(CONFIG_RTL8723A) + if (value & BIT0) { + DBG_871X("Offset RF Gain.\n"); + DBG_871X("Offset RF Gain. padapter->eeprompriv.EEPROMRFGainVal=0x%x\n",padapter->eeprompriv.EEPROMRFGainVal); + if(padapter->eeprompriv.EEPROMRFGainVal != 0xff){ + res = rtw_hal_read_rfreg(padapter, RF_PATH_A, 0xd, 0xffffffff); + DBG_871X("Offset RF Gain. reg 0xd=0x%x\n",res); + res &= 0xfff87fff; + + res |= (padapter->eeprompriv.EEPROMRFGainVal & 0x0f)<< 15; + DBG_871X("Offset RF Gain. reg 0xd=0x%x\n",res); + + rtw_hal_write_rfreg(padapter, RF_PATH_A, REG_RF_BB_GAIN_OFFSET_CCK, RF_GAIN_OFFSET_MASK, res); + + res = rtw_hal_read_rfreg(padapter, RF_PATH_A, 0xe, 0xffffffff); + DBG_871X("Offset RF Gain. reg 0xe=0x%x\n",res); + res &= 0xfffffff0; + + res |= (padapter->eeprompriv.EEPROMRFGainVal & 0x0f); + DBG_871X("Offset RF Gain. reg 0xe=0x%x\n",res); + + rtw_hal_write_rfreg(padapter, RF_PATH_A, REG_RF_BB_GAIN_OFFSET_OFDM, RF_GAIN_OFFSET_MASK, res); + } + else + { + DBG_871X("Offset RF Gain. padapter->eeprompriv.EEPROMRFGainVal=0x%x != 0xff, didn't run Kfree\n",padapter->eeprompriv.EEPROMRFGainVal); + } + } else { + DBG_871X("Using the default RF gain.\n"); + } +#elif defined(CONFIG_RTL8723B) + if (value & BIT4) { + DBG_871X("Offset RF Gain.\n"); + DBG_871X("Offset RF Gain. padapter->eeprompriv.EEPROMRFGainVal=0x%x\n",padapter->eeprompriv.EEPROMRFGainVal); + + if(padapter->eeprompriv.EEPROMRFGainVal != 0xff){ + + if(pHalData->ant_path == ODM_RF_PATH_A) { + GainValue=(padapter->eeprompriv.EEPROMRFGainVal & 0x0f); + + } else { + GainValue=(padapter->eeprompriv.EEPROMRFGainVal & 0xf0)>>4; + } + DBG_871X("Ant PATH_%d GainValue Offset = 0x%x\n",(pHalData->ant_path == ODM_RF_PATH_A) ? (ODM_RF_PATH_A) : (ODM_RF_PATH_B),GainValue); + + for (i = 0; i < ArrayLen; i += 2 ) + { + //DBG_871X("ArrayLen in =%d ,Array 1 =0x%x ,Array2 =0x%x \n",i,Array[i],Array[i]+1); + v1 = Array[i]; + v2 = Array[i+1]; + if ( v1 == GainValue ) { + DBG_871X("Offset RF Gain. got v1 =0x%x ,v2 =0x%x \n",v1,v2); + target=v2; + break; + } + } + DBG_871X("padapter->eeprompriv.EEPROMRFGainVal=0x%x ,Gain offset Target Value=0x%x\n",padapter->eeprompriv.EEPROMRFGainVal,target); + + res = rtw_hal_read_rfreg(padapter, RF_PATH_A, 0x7f, 0xffffffff); + DBG_871X("Offset RF Gain. before reg 0x7f=0x%08x\n",res); + PHY_SetRFReg(padapter, RF_PATH_A, REG_RF_BB_GAIN_OFFSET, BIT18|BIT17|BIT16|BIT15, target); + res = rtw_hal_read_rfreg(padapter, RF_PATH_A, 0x7f, 0xffffffff); + + DBG_871X("Offset RF Gain. After reg 0x7f=0x%08x\n",res); + + }else { + + DBG_871X("Offset RF Gain. padapter->eeprompriv.EEPROMRFGainVal=0x%x != 0xff, didn't run Kfree\n",padapter->eeprompriv.EEPROMRFGainVal); + } + } else { + DBG_871X("Using the default RF gain.\n"); + } + +#elif defined(CONFIG_RTL8188E) + if (value & BIT4) { + DBG_871X("8188ES Offset RF Gain.\n"); + DBG_871X("8188ES Offset RF Gain. EEPROMRFGainVal=0x%x\n", + padapter->eeprompriv.EEPROMRFGainVal); + + if (padapter->eeprompriv.EEPROMRFGainVal != 0xff) { + res = rtw_hal_read_rfreg(padapter, RF_PATH_A, + REG_RF_BB_GAIN_OFFSET, 0xffffffff); + + DBG_871X("Offset RF Gain. reg 0x55=0x%x\n",res); + res &= 0xfff87fff; + + res |= (padapter->eeprompriv.EEPROMRFGainVal & 0x0f) << 15; + DBG_871X("Offset RF Gain. res=0x%x\n",res); + + rtw_hal_write_rfreg(padapter, RF_PATH_A, + REG_RF_BB_GAIN_OFFSET, + RF_GAIN_OFFSET_MASK, res); + } else { + DBG_871X("Offset RF Gain. EEPROMRFGainVal=0x%x == 0xff, didn't run Kfree\n", + padapter->eeprompriv.EEPROMRFGainVal); + } + } else { + DBG_871X("Using the default RF gain.\n"); + } +#else + if (!(value & 0x01)) { + //DBG_871X("Offset RF Gain.\n"); + res = rtw_hal_read_rfreg(padapter, RF_PATH_A, REG_RF_BB_GAIN_OFFSET, 0xffffffff); + value &= tmp; + res = value << 14; + rtw_hal_write_rfreg(padapter, RF_PATH_A, REG_RF_BB_GAIN_OFFSET, RF_GAIN_OFFSET_MASK, res); + } else { + DBG_871X("Using the default RF gain.\n"); + } +#endif + +} +#endif //CONFIG_RF_GAIN_OFFSET + +//To avoid RX affect TX throughput +void dm_DynamicUsbTxAgg(_adapter *padapter, u8 from_timer) +{ + struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter); + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); +#ifdef CONFIG_USB_RX_AGGREGATION + if(IS_HARDWARE_TYPE_8821U(padapter) )//|| IS_HARDWARE_TYPE_8192EU(padapter)) + { + //This AGG_PH_TH only for UsbRxAggMode == USB_RX_AGG_USB + if((pHalData->UsbRxAggMode == USB_RX_AGG_USB) && (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)) + { + if(pdvobjpriv->traffic_stat.cur_tx_tp > 2 && pdvobjpriv->traffic_stat.cur_rx_tp < 30) + rtw_write16(padapter, REG_RXDMA_AGG_PG_TH,0x1010); + else + rtw_write16(padapter, REG_RXDMA_AGG_PG_TH,0x2005); //dmc agg th 20K + + //DBG_871X("TX_TP=%u, RX_TP=%u \n", pdvobjpriv->traffic_stat.cur_tx_tp, pdvobjpriv->traffic_stat.cur_rx_tp); + } + } +#endif +} + +//bus-agg check for SoftAP mode +inline u8 rtw_hal_busagg_qsel_check(_adapter *padapter,u8 pre_qsel,u8 next_qsel) +{ + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + u8 chk_rst = _SUCCESS; + + if(check_fwstate(pmlmepriv, WIFI_AP_STATE) != _TRUE) + return chk_rst; + + //if((pre_qsel == 0xFF)||(next_qsel== 0xFF)) + // return chk_rst; + + if( ((pre_qsel == QSLT_HIGH)||((next_qsel== QSLT_HIGH))) + && (pre_qsel != next_qsel )){ + //DBG_871X("### bus-agg break cause of qsel misatch, pre_qsel=0x%02x,next_qsel=0x%02x ###\n", + // pre_qsel,next_qsel); + chk_rst = _FAIL; + } + return chk_rst; +} + +/* + * Description: + * dump_TX_FIFO: This is only used to dump TX_FIFO for debug WoW mode offload + * contant. + * + * Input: + * adapter: adapter pointer. + * page_num: The max. page number that user want to dump. + * page_size: page size of each page. eg. 128 bytes, 256 bytes. + */ +void dump_TX_FIFO(_adapter* padapter, u8 page_num, u16 page_size){ + + int i; + u8 val = 0; + u8 base = 0; + u32 addr = 0; + u32 count = (page_size / 8); + + if (page_num <= 0) { + DBG_871X("!!%s: incorrect input page_num paramter!\n", __func__); + return; + } + + if (page_size < 128 || page_size > 256) { + DBG_871X("!!%s: incorrect input page_size paramter!\n", __func__); + return; + } + + DBG_871X("+%s+\n", __func__); + val = rtw_read8(padapter, 0x106); + rtw_write8(padapter, 0x106, 0x69); + DBG_871X("0x106: 0x%02x\n", val); + base = rtw_read8(padapter, 0x209); + DBG_871X("0x209: 0x%02x\n", base); + + addr = ((base) * page_size)/8; + for (i = 0 ; i < page_num * count ; i+=2) { + rtw_write32(padapter, 0x140, addr + i); + printk(" %08x %08x ", rtw_read32(padapter, 0x144), rtw_read32(padapter, 0x148)); + rtw_write32(padapter, 0x140, addr + i + 1); + printk(" %08x %08x \n", rtw_read32(padapter, 0x144), rtw_read32(padapter, 0x148)); + } +} + +#ifdef CONFIG_GPIO_API +u8 rtw_hal_get_gpio(_adapter* adapter, u8 gpio_num) +{ + u8 value; + u8 direction; + struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(adapter); + + rtw_ps_deny(adapter, PS_DENY_IOCTL); + + DBG_871X("rf_pwrstate=0x%02x\n", pwrpriv->rf_pwrstate); + LeaveAllPowerSaveModeDirect(adapter); + + /* Read GPIO Direction */ + direction = (rtw_read8(adapter,REG_GPIO_PIN_CTRL + 2) & BIT(gpio_num)) >> gpio_num; + + /* According the direction to read register value */ + if( direction ) + value = (rtw_read8(adapter, REG_GPIO_PIN_CTRL + 1)& BIT(gpio_num)) >> gpio_num; + else + value = (rtw_read8(adapter, REG_GPIO_PIN_CTRL)& BIT(gpio_num)) >> gpio_num; + + rtw_ps_deny_cancel(adapter, PS_DENY_IOCTL); + DBG_871X("%s direction=%d value=%d\n",__FUNCTION__,direction,value); + + return value; +} + +int rtw_hal_set_gpio_output_value(_adapter* adapter, u8 gpio_num, BOOLEAN isHigh) +{ + u8 direction = 0; + u8 res = -1; + if (IS_HARDWARE_TYPE_8188E(adapter)){ + /* Check GPIO is 4~7 */ + if( gpio_num > 7 || gpio_num < 4) + { + DBG_871X("%s The gpio number does not included 4~7.\n",__FUNCTION__); + return -1; + } + } + + rtw_ps_deny(adapter, PS_DENY_IOCTL); + + LeaveAllPowerSaveModeDirect(adapter); + + /* Read GPIO direction */ + direction = (rtw_read8(adapter,REG_GPIO_PIN_CTRL + 2) & BIT(gpio_num)) >> gpio_num; + + /* If GPIO is output direction, setting value. */ + if( direction ) + { + if(isHigh) + rtw_write8(adapter, REG_GPIO_PIN_CTRL + 1, rtw_read8(adapter, REG_GPIO_PIN_CTRL + 1) | BIT(gpio_num)); + else + rtw_write8(adapter, REG_GPIO_PIN_CTRL + 1, rtw_read8(adapter, REG_GPIO_PIN_CTRL + 1) & ~BIT(gpio_num)); + + DBG_871X("%s Set gpio %x[%d]=%d\n",__FUNCTION__,REG_GPIO_PIN_CTRL+1,gpio_num,isHigh ); + res = 0; + } + else + { + DBG_871X("%s The gpio is input,not be set!\n",__FUNCTION__); + res = -1; + } + + rtw_ps_deny_cancel(adapter, PS_DENY_IOCTL); + return res; +} + +int rtw_hal_config_gpio(_adapter* adapter, u8 gpio_num, BOOLEAN isOutput) +{ + if (IS_HARDWARE_TYPE_8188E(adapter)){ + if( gpio_num > 7 || gpio_num < 4) + { + DBG_871X("%s The gpio number does not included 4~7.\n",__FUNCTION__); + return -1; + } + } + + DBG_871X("%s gpio_num =%d direction=%d\n",__FUNCTION__,gpio_num,isOutput); + + rtw_ps_deny(adapter, PS_DENY_IOCTL); + + LeaveAllPowerSaveModeDirect(adapter); + + if( isOutput ) + { + rtw_write8(adapter, REG_GPIO_PIN_CTRL + 2, rtw_read8(adapter, REG_GPIO_PIN_CTRL + 2) | BIT(gpio_num)); + } + else + { + rtw_write8(adapter, REG_GPIO_PIN_CTRL + 2, rtw_read8(adapter, REG_GPIO_PIN_CTRL + 2) & ~BIT(gpio_num)); + } + + rtw_ps_deny_cancel(adapter, PS_DENY_IOCTL); + + return 0; +} + +#endif +void rtw_get_noise(_adapter* padapter) +{ +#if defined(CONFIG_SIGNAL_DISPLAY_DBM) && defined(CONFIG_BACKGROUND_NOISE_MONITOR) + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; + struct noise_info info; + if(rtw_linked_check(padapter)){ + info.bPauseDIG = _TRUE; + info.IGIValue = 0x1e; + info.max_time = 100;//ms + info.chan = pmlmeext->cur_channel ;//rtw_get_oper_ch(padapter); + rtw_ps_deny(padapter, PS_DENY_IOCTL); + LeaveAllPowerSaveModeDirect(padapter); + + rtw_hal_set_odm_var(padapter, HAL_ODM_NOISE_MONITOR,&info, _FALSE); + //ODM_InbandNoise_Monitor(podmpriv,_TRUE,0x20,100); + rtw_ps_deny_cancel(padapter, PS_DENY_IOCTL); + rtw_hal_get_odm_var(padapter, HAL_ODM_NOISE_MONITOR,&(info.chan), &(padapter->recvpriv.noise)); + #ifdef DBG_NOISE_MONITOR + DBG_871X("chan:%d,noise_level:%d\n",info.chan,padapter->recvpriv.noise); + #endif + } +#endif + +} diff --git a/hal/hal_com_phycfg.c b/hal/hal_com_phycfg.c index c0c65e4..4866324 100644 --- a/hal/hal_com_phycfg.c +++ b/hal/hal_com_phycfg.c @@ -404,7 +404,7 @@ PHY_GetRateSectionIndexOfTxPowerByRate( case rTxAGC_A_Rate54_24: index = 1; break; case rTxAGC_A_CCK1_Mcs32: index = 6; break; case rTxAGC_B_CCK11_A_CCK2_11: - if ( BitMask == 0xffffff00 ) + if ( BitMask == bMaskH3Bytes ) index = 7; else if ( BitMask == 0x000000ff ) index = 15; @@ -2341,7 +2341,7 @@ PHY_GetTxPowerIndex( u8 txPower = 0x3E; if (IS_HARDWARE_TYPE_8813A(pAdapter)) { -//#if (RTL8813A_SUPPORT==1) +//#if (RTL8814A_SUPPORT==1) // txPower = PHY_GetTxPowerIndex_8813A( pAdapter, PowerIndex, RFPath, Rate ); //#endif } @@ -2378,7 +2378,7 @@ PHY_SetTxPowerIndex( ) { if (IS_HARDWARE_TYPE_8813A(pAdapter)) { -//#if (RTL8813A_SUPPORT==1) +//#if (RTL8814A_SUPPORT==1) // PHY_SetTxPowerIndex_8813A( pAdapter, PowerIndex, RFPath, Rate ); //#endif } @@ -2410,7 +2410,9 @@ Hal_ChannelPlanToRegulation( IN u16 ChannelPlan ) { - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + DM_ODM_T *odm = &pHalData->odmpriv; + pHalData->Regulation2_4G = TXPWR_LMT_WW; pHalData->Regulation5G = TXPWR_LMT_WW; @@ -2570,15 +2572,13 @@ Hal_ChannelPlanToRegulation( default: break; } + + DBG_871X("%s ChannelPlan:0x%02x,Regulation(2_4G/5G):0x%02x,0x%02x\n", + __FUNCTION__,ChannelPlan,pHalData->Regulation2_4G,pHalData->Regulation5G); + } #ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE - -extern char *rtw_phy_file_path; -char file_path[PATH_LENGTH_MAX]; - -#define GetLineFromBuffer(buffer) strsep(&buffer, "\n") - int phy_ConfigMACWithParaFile( IN PADAPTER Adapter, @@ -4037,6 +4037,7 @@ PHY_ConfigRFWithPowerLimitTableParaFile( return rtStatus; } + void phy_free_filebuf(_adapter *padapter) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); @@ -4062,7 +4063,4 @@ void phy_free_filebuf(_adapter *padapter) } - #endif - - diff --git a/hal/hal_dm.c b/hal/hal_dm.c new file mode 100644 index 0000000..46dab54 --- /dev/null +++ b/hal/hal_dm.c @@ -0,0 +1,196 @@ +/****************************************************************************** + * + * Copyright(c) 2014 Realtek Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA + * + * + ******************************************************************************/ + +#include +#include + +// A mapping from HalData to ODM. +ODM_BOARD_TYPE_E boardType(u8 InterfaceSel) +{ + ODM_BOARD_TYPE_E board = ODM_BOARD_DEFAULT; + +#ifdef CONFIG_PCI_HCI + INTERFACE_SELECT_PCIE pcie = (INTERFACE_SELECT_PCIE)InterfaceSel; + switch (pcie) + { + case INTF_SEL0_SOLO_MINICARD: + board |= ODM_BOARD_MINICARD; + break; + case INTF_SEL1_BT_COMBO_MINICARD: + board |= ODM_BOARD_BT; + board |= ODM_BOARD_MINICARD; + break; + default: + board = ODM_BOARD_DEFAULT; + break; + } + +#elif defined(CONFIG_USB_HCI) + INTERFACE_SELECT_USB usb = (INTERFACE_SELECT_USB)InterfaceSel; + switch (usb) + { + case INTF_SEL1_USB_High_Power: + board |= ODM_BOARD_EXT_LNA; + board |= ODM_BOARD_EXT_PA; + break; + case INTF_SEL2_MINICARD: + board |= ODM_BOARD_MINICARD; + break; + case INTF_SEL4_USB_Combo: + board |= ODM_BOARD_BT; + break; + case INTF_SEL5_USB_Combo_MF: + board |= ODM_BOARD_BT; + break; + case INTF_SEL0_USB: + case INTF_SEL3_USB_Solo: + default: + board = ODM_BOARD_DEFAULT; + break; + } + +#endif + //DBG_871X("===> boardType(): (pHalData->InterfaceSel, pDM_Odm->BoardType) = (%d, %d)\n", InterfaceSel, board); + + return board; +} + +void Init_ODM_ComInfo(_adapter *adapter) +{ + struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); + PHAL_DATA_TYPE pHalData = GET_HAL_DATA(adapter); + EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(adapter); + struct dm_priv *pdmpriv = &pHalData->dmpriv; + PDM_ODM_T pDM_Odm = &(pHalData->odmpriv); + struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv; + struct mlme_priv *pmlmepriv = &adapter->mlmepriv; + struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(adapter); + int i; + + _rtw_memset(pDM_Odm,0,sizeof(*pDM_Odm)); + + pDM_Odm->Adapter = adapter; + + ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_PLATFORM, ODM_CE); + + if (adapter->interface_type == RTW_GSPI) + ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_INTERFACE, ODM_ITRF_SDIO); + else + ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_INTERFACE, adapter->interface_type); + + ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_MP_TEST_CHIP, IS_NORMAL_CHIP(pHalData->VersionID)); + + ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_PATCH_ID, pEEPROM->CustomerID); + + ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_BWIFI_TEST, adapter->registrypriv.wifi_spec); + + if (pHalData->rf_type == RF_1T1R) { + ODM_CmnInfoUpdate(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_1T1R); + } + else if (pHalData->rf_type == RF_2T2R){ + ODM_CmnInfoUpdate(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_2T2R); + } + else if (pHalData->rf_type == RF_1T2R){ + ODM_CmnInfoUpdate(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_1T2R); + } + +{ + //1 ======= BoardType: ODM_CMNINFO_BOARD_TYPE ======= + u8 odm_board_type = ODM_BOARD_DEFAULT; + + if (!IS_HARDWARE_TYPE_OLDER_THAN_8723A(adapter)) + { + if (pHalData->ExternalLNA_2G != 0) { + odm_board_type |= ODM_BOARD_EXT_LNA; + ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_EXT_LNA, 1); + } + if (pHalData->ExternalLNA_5G != 0) { + odm_board_type |= ODM_BOARD_EXT_LNA_5G; + ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_5G_EXT_LNA, 1); + } + if (pHalData->ExternalPA_2G != 0) { + odm_board_type |= ODM_BOARD_EXT_PA; + ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_EXT_PA, 1); + } + if (pHalData->ExternalPA_5G != 0) { + odm_board_type |= ODM_BOARD_EXT_PA_5G; + ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_5G_EXT_PA, 1); + } + if (pHalData->EEPROMBluetoothCoexist) + odm_board_type |= ODM_BOARD_BT; + + } else { + #ifdef CONFIG_USB_HCI + if (pHalData->InterfaceSel == INTF_SEL1_USB_High_Power + || pHalData->BoardType == BOARD_USB_High_PA /* This is legacy code for hal_data.BoardType */ + ) { + ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_EXT_LNA, 1); + ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_EXT_PA, 1); + } else + #endif + { + ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_EXT_PA, pHalData->ExternalPA_2G); + ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_EXT_LNA, pHalData->ExternalLNA_2G); + } + + odm_board_type = boardType(pHalData->InterfaceSel); + } + + ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_BOARD_TYPE, odm_board_type); + //1 ============== End of BoardType ============== +} + + ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_DOMAIN_CODE_2G, pHalData->Regulation2_4G); + ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_DOMAIN_CODE_5G, pHalData->Regulation5G); + + ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_GPA, pHalData->TypeGPA); + ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_APA, pHalData->TypeAPA); + ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_GLNA, pHalData->TypeGLNA); + ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_ALNA, pHalData->TypeALNA); + + ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_RFE_TYPE, pHalData->RFEType); + + ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_EXT_TRSW, 0); + + /* Pointer reference */ + ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_TX_UNI, &(dvobj->traffic_stat.tx_bytes)); + ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_RX_UNI, &(dvobj->traffic_stat.rx_bytes)); + ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_WM_MODE, &(pmlmeext->cur_wireless_mode)); + ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_BAND, &(pHalData->CurrentBandType)); + ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_FORCED_RATE, &(pHalData->ForcedDataRate)); + + ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_SEC_CHNL_OFFSET, &(pHalData->nCur40MhzPrimeSC)); + ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_SEC_MODE, &(adapter->securitypriv.dot11PrivacyAlgrthm)); + ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_BW, &(pHalData->CurrentChannelBW)); + ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_CHNL, &( pHalData->CurrentChannel)); + ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_NET_CLOSED, &(adapter->net_closed)); + ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_FORCED_IGI_LB, &(pHalData->u1ForcedIgiLb)); + + ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_SCAN, &(pmlmepriv->bScanInProcess)); + ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_POWER_SAVING, &(pwrctl->bpower_saving)); + + for(i=0; iHalFunc.init_default_value) padapter->HalFunc.init_default_value(padapter); + + rtw_init_hal_com_default_value(padapter); + + { + struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); + HAL_DATA_TYPE *hal_data = GET_HAL_DATA(padapter); + + /* hal_data..macid_num is ready here */ + dvobj->macid_ctl.num = rtw_min(hal_data->macid_num, MACID_NUM_SW_LIMIT); + } + } } void rtw_hal_free_data(_adapter *padapter) { + //free HAL Data + rtw_hal_data_deinit(padapter); + if (is_primary_adapter(padapter)) if(padapter->HalFunc.free_hal_data) padapter->HalFunc.free_hal_data(padapter); } -void rtw_hal_dm_init(_adapter *padapter) +void rtw_hal_dm_init(_adapter *padapter) { - if (is_primary_adapter(padapter)) + if (is_primary_adapter(padapter)) { + PHAL_DATA_TYPE pHalData = GET_HAL_DATA(padapter); + struct dm_priv *pdmpriv = &pHalData->dmpriv; + if(padapter->HalFunc.dm_init) padapter->HalFunc.dm_init(padapter); + + _rtw_spinlock_init(&pdmpriv->IQKSpinLock); + } } void rtw_hal_dm_deinit(_adapter *padapter) { - // cancel dm timer - if (is_primary_adapter(padapter)) + if (is_primary_adapter(padapter)) { + PHAL_DATA_TYPE pHalData = GET_HAL_DATA(padapter); + struct dm_priv *pdmpriv = &pHalData->dmpriv; + if(padapter->HalFunc.dm_deinit) padapter->HalFunc.dm_deinit(padapter); + + _rtw_spinlock_free(&pdmpriv->IQKSpinLock); + } } void rtw_hal_sw_led_init(_adapter *padapter) { @@ -153,26 +178,29 @@ uint rtw_hal_init(_adapter *padapter) rtw_hal_init_opmode(padapter); - for (i = 0; iiface_nums; i++) { - padapter = dvobj->padapters[i]; - padapter->hw_init_completed = _TRUE; - } + for (i = 0; iiface_nums; i++) + dvobj->padapters[i]->hw_init_completed = _TRUE; if (padapter->registrypriv.notch_filter == 1) rtw_hal_notch_filter(padapter, 1); rtw_hal_reset_security_engine(padapter); - rtw_sec_restore_wep_key(padapter); + + for (i = 0; iiface_nums; i++) + rtw_sec_restore_wep_key(dvobj->padapters[i]); rtw_led_control(padapter, LED_CTL_POWER_ON); init_hw_mlme_ext(padapter); + +#ifdef CONFIG_RF_GAIN_OFFSET + rtw_bb_rf_gain_offset(padapter); +#endif //CONFIG_RF_GAIN_OFFSET + } else{ - for (i = 0; iiface_nums; i++) { - padapter = dvobj->padapters[i]; - padapter->hw_init_completed = _FALSE; - } + for (i = 0; iiface_nums; i++) + dvobj->padapters[i]->hw_init_completed = _FALSE; DBG_871X("rtw_hal_init: hal__init fail\n"); } @@ -246,10 +274,10 @@ void rtw_hal_set_odm_var(_adapter *padapter, HAL_ODM_VARIABLE eVariable, PVOID p if(padapter->HalFunc.SetHalODMVarHandler) padapter->HalFunc.SetHalODMVarHandler(padapter,eVariable,pValue1,bSet); } -void rtw_hal_get_odm_var(_adapter *padapter, HAL_ODM_VARIABLE eVariable, PVOID pValue1,BOOLEAN bSet) +void rtw_hal_get_odm_var(_adapter *padapter, HAL_ODM_VARIABLE eVariable, PVOID pValue1,PVOID pValue2) { if(padapter->HalFunc.GetHalODMVarHandler) - padapter->HalFunc.GetHalODMVarHandler(padapter,eVariable,pValue1,bSet); + padapter->HalFunc.GetHalODMVarHandler(padapter,eVariable,pValue1,pValue2); } void rtw_hal_enable_interrupt(_adapter *padapter) @@ -480,20 +508,47 @@ s32 rtw_hal_interrupt_handler(_adapter *padapter) void rtw_hal_set_bwmode(_adapter *padapter, CHANNEL_WIDTH Bandwidth, u8 Offset) { + PHAL_DATA_TYPE pHalData = GET_HAL_DATA(padapter); + PDM_ODM_T pDM_Odm = &(pHalData->odmpriv); + if(padapter->HalFunc.set_bwmode_handler) + { + ODM_AcquireSpinLock( pDM_Odm, RT_IQK_SPINLOCK); + if(pDM_Odm->RFCalibrateInfo.bIQKInProgress == _TRUE) + DBG_871X_LEVEL(_drv_err_, "%s, %d, IQK may race condition\n", __func__,__LINE__); + ODM_ReleaseSpinLock( pDM_Odm, RT_IQK_SPINLOCK); padapter->HalFunc.set_bwmode_handler(padapter, Bandwidth, Offset); + } } void rtw_hal_set_chan(_adapter *padapter, u8 channel) { + PHAL_DATA_TYPE pHalData = GET_HAL_DATA(padapter); + PDM_ODM_T pDM_Odm = &(pHalData->odmpriv); + if(padapter->HalFunc.set_channel_handler) + { + ODM_AcquireSpinLock( pDM_Odm, RT_IQK_SPINLOCK); + if(pDM_Odm->RFCalibrateInfo.bIQKInProgress == _TRUE) + DBG_871X_LEVEL(_drv_err_, "%s, %d, IQK may race condition\n", __func__,__LINE__); + ODM_ReleaseSpinLock( pDM_Odm, RT_IQK_SPINLOCK); padapter->HalFunc.set_channel_handler(padapter, channel); + } } void rtw_hal_set_chnl_bw(_adapter *padapter, u8 channel, CHANNEL_WIDTH Bandwidth, u8 Offset40, u8 Offset80) { + PHAL_DATA_TYPE pHalData = GET_HAL_DATA(padapter); + PDM_ODM_T pDM_Odm = &(pHalData->odmpriv); + if(padapter->HalFunc.set_chnl_bw_handler) + { + ODM_AcquireSpinLock( pDM_Odm, RT_IQK_SPINLOCK); + if(pDM_Odm->RFCalibrateInfo.bIQKInProgress == _TRUE) + DBG_871X_LEVEL(_drv_err_, "%s, %d, IQK may race condition\n", __func__,__LINE__); + ODM_ReleaseSpinLock( pDM_Odm, RT_IQK_SPINLOCK); padapter->HalFunc.set_chnl_bw_handler(padapter, channel, Bandwidth, Offset40, Offset80); + } } void rtw_hal_set_tx_power_level(_adapter *padapter, u8 channel) @@ -704,37 +759,50 @@ s32 rtw_hal_is_disable_sw_channel_plan(PADAPTER padapter) return GET_HAL_DATA(padapter)->bDisableSWChannelPlan; } -s32 rtw_hal_macid_sleep(PADAPTER padapter, u32 macid) +s32 rtw_hal_macid_sleep(PADAPTER padapter, u8 macid) { + struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); + struct macid_ctl_t *macid_ctl = dvobj_to_macidctl(dvobj); u8 support; - support = _FALSE; rtw_hal_get_def_var(padapter, HAL_DEF_MACID_SLEEP, &support); if (_FALSE == support) return _FAIL; - rtw_hal_set_hwreg(padapter, HW_VAR_MACID_SLEEP, (u8*)&macid); + if (macid >= macid_ctl->num) { + DBG_871X_LEVEL(_drv_err_, FUNC_ADPT_FMT": Invalid macid(%u)\n", + FUNC_ADPT_ARG(padapter), macid); + return _FAIL; + } + + rtw_hal_set_hwreg(padapter, HW_VAR_MACID_SLEEP, &macid); return _SUCCESS; } -s32 rtw_hal_macid_wakeup(PADAPTER padapter, u32 macid) +s32 rtw_hal_macid_wakeup(PADAPTER padapter, u8 macid) { + struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); + struct macid_ctl_t *macid_ctl = dvobj_to_macidctl(dvobj); u8 support; - support = _FALSE; rtw_hal_get_def_var(padapter, HAL_DEF_MACID_SLEEP, &support); if (_FALSE == support) return _FAIL; - rtw_hal_set_hwreg(padapter, HW_VAR_MACID_WAKEUP, (u8*)&macid); + if (macid >= macid_ctl->num) { + DBG_871X_LEVEL(_drv_err_, FUNC_ADPT_FMT": Invalid macid(%u)\n", + FUNC_ADPT_ARG(padapter), macid); + return _FAIL; + } + + rtw_hal_set_hwreg(padapter, HW_VAR_MACID_WAKEUP, &macid); return _SUCCESS; } -#ifdef CONFIG_BT_COEXIST s32 rtw_hal_fill_h2c_cmd(PADAPTER padapter, u8 ElementID, u32 CmdLen, u8 *pCmdBuffer) { s32 ret = _FAIL; @@ -744,10 +812,9 @@ s32 rtw_hal_fill_h2c_cmd(PADAPTER padapter, u8 ElementID, u32 CmdLen, u8 *pCmdBu else { DBG_871X("%s: func[fill_h2c_cmd] not defined!\n", __FUNCTION__); + rtw_warn_on(1); } return ret; } -#endif // CONFIG_BT_COEXIST - diff --git a/hal/led/hal_usb_led.c b/hal/led/hal_usb_led.c index 7f17221..6706e01 100644 --- a/hal/led/hal_usb_led.c +++ b/hal/led/hal_usb_led.c @@ -1237,6 +1237,7 @@ SwLedBlink9( SwLedOff(Adapter, pLed); RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes)); } + //DBG_871X("%s, pLed->CurrLedState=%d, pLed->BlinkingLedState=%d \n", __FUNCTION__, pLed->CurrLedState, pLed->BlinkingLedState); switch(pLed->CurrLedState) @@ -1260,8 +1261,8 @@ SwLedBlink9( case LED_BLINK_StartToBlink: if( pLed->bLedOn ) { - pLed->BlinkingLedState = RTW_LED_OFF; - _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL); + pLed->BlinkingLedState = RTW_LED_OFF; + _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL); } else { @@ -1286,7 +1287,7 @@ SwLedBlink9( else if(check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) { pLed->bLedLinkBlinkInProgress = _TRUE; - pLed->CurrLedState = LED_BLINK_ALWAYS_ON; + pLed->CurrLedState = LED_BLINK_SLOWLY; _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA); RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState)); @@ -1336,8 +1337,7 @@ SwLedBlink9( } else { - pLed->bLedNoLinkBlinkInProgress = _TRUE; - pLed->CurrLedState = LED_BLINK_ALWAYS_ON; + pLed->CurrLedState = LED_BLINK_SLOWLY; if( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else @@ -3879,7 +3879,7 @@ SwLedControlMode9( PLED_USB pLed1 = &(ledpriv->SwLed1); PLED_USB pLed2 = &(ledpriv->SwLed2); BOOLEAN bWPSOverLap = _FALSE; - + //DBG_871X("LedAction=%d \n", LedAction); switch(LedAction) { case LED_CTL_START_TO_LINK: @@ -3980,7 +3980,7 @@ SwLedControlMode9( if(LedAction == LED_CTL_LINK) { pLed->BlinkingLedState = RTW_LED_ON; - pLed->CurrLedState = LED_BLINK_ALWAYS_ON; + pLed->CurrLedState = LED_BLINK_SLOWLY; } else { @@ -4068,7 +4068,7 @@ SwLedControlMode9( pLed2->CurrLedState = LED_BLINK_LINK_IN_PROCESS; pLed2->bLedWPSBlinkInProgress = _TRUE; - _set_timer(&(pLed2->BlinkTimer), 0); + _set_timer(&(pLed2->BlinkTimer), 500); break; diff --git a/hal/rtl8192e/rtl8192e_cmd.c b/hal/rtl8192e/rtl8192e_cmd.c index 30cb04d..0ef2dd5 100644 --- a/hal/rtl8192e/rtl8192e_cmd.c +++ b/hal/rtl8192e/rtl8192e_cmd.c @@ -65,7 +65,7 @@ static u8 _is_fw_read_cmd_down(_adapter* padapter, u8 msgbox_num) *|31 - 0 | *|ext_msg| ******************************************/ -static s32 FillH2CCmd_8192E(PADAPTER padapter, u8 ElementID, u32 CmdLen, u8 *pCmdBuffer) +s32 FillH2CCmd_8192E(PADAPTER padapter, u8 ElementID, u32 CmdLen, u8 *pCmdBuffer) { u8 h2c_box_num = 0; u32 msgbox_addr = 0; @@ -222,13 +222,30 @@ _func_enter_; H2CCommand[0] = macid; H2CCommand[1] = (raid & 0x1F) | (shortGIrate?0x80:0x00) ; H2CCommand[2] = (psta->bw_mode & 0x3); // LDPC_CAP,DISPT,DISRA +#ifdef CONFIG_INTEL_PROXIM + if(padapter->proximity.proxim_on ==_TRUE) + pHalData->bDisableTXPowerTraining = _FALSE; +#endif + //DisableTXPowerTraining + if(pHalData->bDisableTXPowerTraining){ + H2CCommand[2] |= BIT6; + DBG_871X("%s,Disable PWT by driver\n",__FUNCTION__); + } + else{ + PDM_ODM_T pDM_OutSrc = &pHalData->odmpriv; + + if(pDM_OutSrc->bDisablePowerTraining){ + H2CCommand[2] |= BIT6; + DBG_871X("%s,Disable PWT by DM\n",__FUNCTION__); + } + } H2CCommand[3] = (u8)(bitmap & 0x000000ff); H2CCommand[4] = (u8)((bitmap & 0x0000ff00) >>8); H2CCommand[5] = (u8)((bitmap & 0x00ff0000) >> 16); H2CCommand[6] = (u8)((bitmap & 0xff000000) >> 24); - DBG_871X("rtl8192e_set_raid_cmd, bitmap=0x%x, mac_id=0x%x, raid=0x%x, shortGIrate=%x\n", bitmap, macid, raid, shortGIrate); + DBG_871X("%s, bitmap=0x%x, mac_id=0x%x, raid=0x%x, shortGIrate=%x\n",__FUNCTION__, bitmap, macid, raid, shortGIrate); FillH2CCmd_8192E(padapter, H2C_8192E_RA_MASK, 7, H2CCommand); } @@ -256,9 +273,11 @@ void rtl8192e_Add_RateATid(PADAPTER pAdapter, u32 bitmap, u8* arg, u8 rssi_level void rtl8192e_set_FwPwrMode_cmd(PADAPTER padapter, u8 PSMode) { - u8 u1H2CSetPwrMode[6]={0}; + u8 u1H2CSetPwrMode[H2C_PWRMODE_LEN]={0}; struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); u8 Mode = 0, RLBM = 0, PowerState = 0, LPSAwakeIntvl = 2; + u8 pwrModeByte5=0; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); _func_enter_; @@ -290,12 +309,25 @@ _func_enter_; } if (Mode > PS_MODE_ACTIVE) { - PowerState = 0x00;// AllON(0x0C), RFON(0x04), RFOFF(0x00) +#ifdef CONFIG_BT_COEXIST + if (rtw_btcoex_IsBtControlLps(padapter) == _TRUE && (pHalData->EEPROMBluetoothCoexist == 1)) + { + PowerState = rtw_btcoex_RpwmVal(padapter); + pwrModeByte5 = rtw_btcoex_LpsVal(padapter); + + } + else +#endif // CONFIG_BT_COEXIST + { + PowerState = 0x00;// AllON(0x0C), RFON(0x04), RFOFF(0x00) + pwrModeByte5 = 0x40; + } #ifdef CONFIG_EXT_CLK Mode |= BIT(7);//supporting 26M XTAL CLK_Request feature. #endif //CONFIG_EXT_CLK } else { PowerState = 0x0C;// AllON(0x0C), RFON(0x04), RFOFF(0x00) + pwrModeByte5 = 0x40; } /* if(BT_1AntPowerSaveMode(Adapter) && (FW_PS_ACTIVE_MODE != Mode)) @@ -317,7 +349,7 @@ _func_enter_; SET_8192E_H2CCMD_PWRMODE_PARM_BCN_PASS_TIME(u1H2CSetPwrMode, LPSAwakeIntvl); // (WMM only)bAllQueueUAPSD - SET_8192E_H2CCMD_PWRMODE_PARM_ALL_QUEUE_UAPSD(u1H2CSetPwrMode, padapter->registrypriv.uapsd_enable); + SET_8192E_H2CCMD_PWRMODE_PARM_ALL_QUEUE_UAPSD(u1H2CSetPwrMode, padapter->registrypriv.uapsd_enable); /* if(PSMode == FW_PS_ACTIVE_MODE) { @@ -339,6 +371,7 @@ _func_enter_; // AllON(0x0C), RFON(0x04), RFOFF(0x00) SET_8192E_H2CCMD_PWRMODE_PARM_PWR_STATE(u1H2CSetPwrMode, PowerState); + SET_8192E_H2CCMD_PWRMODE_PARM_BYTE5(u1H2CSetPwrMode, pwrModeByte5); /* if(BT_1Ant(Adapter) && BT_IsBtCoexManualControl(Adapter)) @@ -346,6 +379,11 @@ _func_enter_; BT_RecordPwrMode(Adapter, &u1H2CSetPwrMode[0], 6); */ +#ifdef CONFIG_BT_COEXIST + if (pHalData->EEPROMBluetoothCoexist == 1) + rtw_btcoex_RecordPwrMode(padapter, u1H2CSetPwrMode, H2C_PWRMODE_LEN); +#endif // CONFIG_BT_COEXIST + FillH2CCmd_8192E(padapter, H2C_8192E_SETPWRMODE, sizeof(u1H2CSetPwrMode), (u8 *)&u1H2CSetPwrMode); //BT_DecExecPwrCmdCnt(Adapter); @@ -763,7 +801,9 @@ CheckFwRsvdPageContent( // TRUE: At the second time, we should send the first packet (default:beacon) // to Hw again and set the lengh in descriptor to the real beacon lengh. // 2009.10.15 by tynli. -#define RSVD_PKT_LEN_92E 3072 //12*256 + +#define PAGE_SIZE_92E 256 +#define RSVD_PKT_LEN_92E (TOTAL_RSVD_PAGE_NUMBER_8192E *PAGE_SIZE_92E) static void SetFwRsvdPagePkt(PADAPTER padapter, BOOLEAN bDLFinished) { @@ -809,13 +849,15 @@ static void SetFwRsvdPagePkt(PADAPTER padapter, BOOLEAN bDLFinished) // To reserved 4 pages for beacon buffer. 2010.06.24. if (PageNeed == 1) PageNeed += 1; +#ifdef CONFIG_2BCN_EN PageNeed += 2; +#endif PageNum += PageNeed; pHalData->FwRsvdPageStartOffset = PageNum; //printk("%s => BCN#1 PageNeed(%d) FwRsvdPageStartOffset(%d) \n",__FUNCTION__, PageNeed,pHalData->FwRsvdPageStartOffset); - BufIndex += PageNeed*256; + BufIndex += PageNeed*PAGE_SIZE_92E; //3 (2) ps-poll *1 page RsvdPageLoc.LocPsPoll = PageNum; @@ -825,7 +867,7 @@ static void SetFwRsvdPagePkt(PADAPTER padapter, BOOLEAN bDLFinished) PageNeed = (u8)PageNum_256(TxDescLen + PSPollLength); PageNum += PageNeed; //printk("%s => PS-POLL- PageNeed(%d)\n",__FUNCTION__, PageNeed); - BufIndex += PageNeed*256; + BufIndex += PageNeed*PAGE_SIZE_92E; //3 (3) null data * 1 page RsvdPageLoc.LocNullData = PageNum; @@ -840,7 +882,7 @@ static void SetFwRsvdPagePkt(PADAPTER padapter, BOOLEAN bDLFinished) PageNeed = (u8)PageNum_256(TxDescLen + NullDataLength); PageNum += PageNeed; //printk("%s => NULL data - PageNeed(%d)\n",__FUNCTION__, PageNeed); - BufIndex += PageNeed*256; + BufIndex += PageNeed*PAGE_SIZE_92E; //3 (4) probe response * 1page RsvdPageLoc.LocProbeRsp = PageNum; @@ -855,7 +897,7 @@ static void SetFwRsvdPagePkt(PADAPTER padapter, BOOLEAN bDLFinished) PageNeed = (u8)PageNum_256(TxDescLen + ProbeRspLength); PageNum += PageNeed; //printk("%s => PROB-RSP - PageNeed(%d)\n",__FUNCTION__, PageNeed); - BufIndex += PageNeed*256; + BufIndex += PageNeed*PAGE_SIZE_92E; //3 (5) Qos null data RsvdPageLoc.LocQosNull = PageNum; @@ -900,10 +942,14 @@ static void SetFwRsvdPagePkt(PADAPTER padapter, BOOLEAN bDLFinished) // update attribute pattrib = &pcmdframe->attrib; update_mgntframe_attrib(padapter, pattrib); - pattrib->qsel = 0x10; + pattrib->qsel = QSLT_BEACON; pattrib->pktlen = pattrib->last_txcmdsz = TotalPacketLen - TXDESC_OFFSET; +#ifdef CONFIG_PCI_HCI + dump_mgntframe(padapter, pcmdframe); +#else dump_mgntframe_and_wait(padapter, pcmdframe, 100); +#endif DBG_871X("%s: Set RSVD page location to Fw ,TotalPacketLen(%d), PageNum(%d)\n", __FUNCTION__,TotalPacketLen,PageNum); @@ -980,7 +1026,7 @@ static void rtl8192e_set_AP_FwRsvdPagePkt(PADAPTER padapter, u8 TxDescLen = TXDESC_SIZE, TxDescOffset = TXDESC_OFFSET; u8 TotalPageNum=0, CurtPktPageNum=0, RsvdPageNum=0; u8 currentip[4]; - u16 BufIndex, PageSize = 256; + u16 BufIndex, PageSize = PAGE_SIZE_92E; u32 TotalPacketLen = 0, MaxRsvdPageBufSize=0; RSVDPAGE_LOC RsvdPageLoc; #ifdef DBG_CONFIG_ERROR_DETECT @@ -998,7 +1044,7 @@ static void rtl8192e_set_AP_FwRsvdPagePkt(PADAPTER padapter, pmlmeext = &padapter->mlmeextpriv; pmlmeinfo = &pmlmeext->mlmext_info; pwrctl = adapter_to_pwrctl(padapter); - RsvdPageNum = 21; + RsvdPageNum = TOTAL_RSVD_PAGE_NUMBER_8192E; MaxRsvdPageBufSize = RsvdPageNum*PageSize; pcmdframe = rtw_alloc_cmdxmitframe(pxmitpriv); @@ -1061,7 +1107,7 @@ static void rtl8192e_set_AP_FwRsvdPagePkt(PADAPTER padapter, // update attribute pattrib = &pcmdframe->attrib; update_mgntframe_attrib(padapter, pattrib); - pattrib->qsel = 0x10; + pattrib->qsel = QSLT_BEACON; pattrib->pktlen = TotalPacketLen - TxDescOffset; pattrib->last_txcmdsz = TotalPacketLen - TxDescOffset; #ifdef CONFIG_PCI_HCI @@ -1665,6 +1711,120 @@ static void ConstructARPResponse( *pLength += 8; } } +#ifdef CONFIG_GTK_OL +static void ConstructGTKResponse( + PADAPTER padapter, + u8 *pframe, + u32 *pLength + ) +{ + struct rtw_ieee80211_hdr *pwlanhdr; + u16 *fctrl; + u32 pktlen; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct wlan_network *cur_network = &pmlmepriv->cur_network; + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + struct security_priv *psecuritypriv = &padapter->securitypriv; + static u8 LLCHeader[8] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00, 0x88, 0x8E}; + static u8 GTKbody_a[11] ={0x01, 0x03, 0x00, 0x5F, 0x02, 0x03, 0x12, 0x00, 0x10, 0x42, 0x0B}; + u8 *pGTKRspPkt = pframe; + u8 EncryptionHeadOverhead = 0; + //DBG_871X("%s:%d\n", __FUNCTION__, bForcePowerSave); + + pwlanhdr = (struct rtw_ieee80211_hdr*)pframe; + + fctrl = &pwlanhdr->frame_ctl; + *(fctrl) = 0; + + //------------------------------------------------------------------------- + // MAC Header. + //------------------------------------------------------------------------- + SetFrameType(fctrl, WIFI_DATA); + //SetFrameSubType(fctrl, 0); + SetToDs(fctrl); + _rtw_memcpy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); + _rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); + _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); + + SetSeqNum(pwlanhdr, 0); + SetDuration(pwlanhdr, 0); + +#ifdef CONFIG_WAPI_SUPPORT + *pLength = sMacHdrLng; +#else + *pLength = 24; +#endif //CONFIG_WAPI_SUPPORT + +//YJ,del,120503 +#if 0 + //------------------------------------------------------------------------- + // Qos Header: leave space for it if necessary. + //------------------------------------------------------------------------- + if(pStaQos->CurrentQosMode > QOS_DISABLE) + { + SET_80211_HDR_QOS_EN(pGTKRspPkt, 1); + PlatformZeroMemory(&(Buffer[*pLength]), sQoSCtlLng); + *pLength += sQoSCtlLng; + } +#endif //0 + //------------------------------------------------------------------------- + // Security Header: leave space for it if necessary. + //------------------------------------------------------------------------- + +#if 1 + switch (psecuritypriv->dot11PrivacyAlgrthm) + { + case _WEP40_: + case _WEP104_: + EncryptionHeadOverhead = 4; + break; + case _TKIP_: + EncryptionHeadOverhead = 8; + break; + case _AES_: + EncryptionHeadOverhead = 8; + break; +#ifdef CONFIG_WAPI_SUPPORT + case _SMS4_: + EncryptionHeadOverhead = 18; + break; +#endif //CONFIG_WAPI_SUPPORT + default: + EncryptionHeadOverhead = 0; + } + + if(EncryptionHeadOverhead > 0) + { + _rtw_memset(&(pframe[*pLength]), 0,EncryptionHeadOverhead); + *pLength += EncryptionHeadOverhead; + //SET_80211_HDR_WEP(pGTKRspPkt, 1); //Suggested by CCW. + //GTK's privacy bit is done by FW + //SetPrivacy(fctrl); + } +#endif //1 + //------------------------------------------------------------------------- + // Frame Body. + //------------------------------------------------------------------------- + pGTKRspPkt = (u8*)(pframe+ *pLength); + // LLC header + _rtw_memcpy(pGTKRspPkt, LLCHeader, 8); + *pLength += 8; + + // GTK element + pGTKRspPkt += 8; + + //GTK frame body after LLC, part 1 + _rtw_memcpy(pGTKRspPkt, GTKbody_a, 11); + *pLength += 11; + pGTKRspPkt += 11; + //GTK frame body after LLC, part 2 + _rtw_memset(&(pframe[*pLength]), 0, 88); + *pLength += 88; + pGTKRspPkt += 88; + +} +#endif //CONFIG_GTK_OL static void rtl8192e_set_FwRsvdPagePkt(PADAPTER padapter, BOOLEAN bDLFinished) { @@ -1682,7 +1842,7 @@ static void rtl8192e_set_FwRsvdPagePkt(PADAPTER padapter, BOOLEAN bDLFinished) u8 *ReservedPagePacket; u8 TxDescLen = TXDESC_SIZE, TxDescOffset = TXDESC_OFFSET; u8 TotalPageNum=0, CurtPktPageNum=0, RsvdPageNum=0; - u16 BufIndex, PageSize = 256; + u16 BufIndex, PageSize = PAGE_SIZE_92E; u32 TotalPacketLen, MaxRsvdPageBufSize=0; RSVDPAGE_LOC RsvdPageLoc; #ifdef CONFIG_WOWLAN @@ -1714,7 +1874,7 @@ static void rtl8192e_set_FwRsvdPagePkt(PADAPTER padapter, BOOLEAN bDLFinished) pwrctl = adapter_to_pwrctl(padapter); //RsvdPageNum = BCNQ_PAGE_NUM_8723B + WOWLAN_PAGE_NUM_8723B; - RsvdPageNum = 21; + RsvdPageNum = TOTAL_RSVD_PAGE_NUMBER_8192E; MaxRsvdPageBufSize = RsvdPageNum*PageSize; pcmdframe = rtw_alloc_cmdxmitframe(pxmitpriv); @@ -2078,7 +2238,7 @@ static void rtl8192e_set_FwRsvdPagePkt(PADAPTER padapter, BOOLEAN bDLFinished) // update attribute pattrib = &pcmdframe->attrib; update_mgntframe_attrib(padapter, pattrib); - pattrib->qsel = 0x10; + pattrib->qsel = QSLT_BEACON; pattrib->pktlen = pattrib->last_txcmdsz = TotalPacketLen - TxDescOffset; #ifdef CONFIG_PCI_HCI dump_mgntframe(padapter, pcmdframe); @@ -2290,7 +2450,7 @@ static void rtl8192e_set_FwWoWlanCtrl_Cmd(PADAPTER padapter, u8 bFuncEn) struct security_priv *psecpriv = &padapter->securitypriv; struct pwrctrl_priv *ppwrpriv = adapter_to_pwrctl(padapter); u8 u1H2CWoWlanCtrlParm[H2C_WOWLAN_LEN]={0}; - u8 discont_wake = 1, gpionum = 0, gpio_dur = 0, hw_unicast = 1, gpio_pulse_cnt=100; + u8 discont_wake = 1, gpionum = 0, gpio_dur = 0, hw_unicast = 0, gpio_pulse_cnt=100; u8 sdio_wakeup_enable = 0; u8 gpio_high_active = 0; //0: low active, 1: high active u8 magic_pkt = 1; @@ -2317,12 +2477,15 @@ static void rtl8192e_set_FwWoWlanCtrl_Cmd(PADAPTER padapter, u8 bFuncEn) SET_H2CCMD_WOWLAN_UNICAST_PKT_ENABLE(u1H2CWoWlanCtrlParm, hw_unicast); SET_H2CCMD_WOWLAN_ALL_PKT_DROP(u1H2CWoWlanCtrlParm, 0); SET_H2CCMD_WOWLAN_GPIO_ACTIVE(u1H2CWoWlanCtrlParm, gpio_high_active); +#ifndef CONFIG_GTK_OL + SET_H2CCMD_WOWLAN_REKEY_WAKE_UP(u1H2CWoWlanCtrlParm, 1); +#endif //!CONFIG_GTK_OL SET_H2CCMD_WOWLAN_DISCONNECT_WAKE_UP(u1H2CWoWlanCtrlParm, discont_wake); SET_H2CCMD_WOWLAN_GPIONUM(u1H2CWoWlanCtrlParm, gpionum); SET_H2CCMD_WOWLAN_DATAPIN_WAKE_UP(u1H2CWoWlanCtrlParm, sdio_wakeup_enable); SET_H2CCMD_WOWLAN_GPIO_DURATION(u1H2CWoWlanCtrlParm, gpio_dur); - //SET_H2CCMD_WOWLAN_GPIO_PULSE_EN(u1H2CWoWlanCtrlParm, 1); - //SET_H2CCMD_WOWLAN_GPIO_PULSE_COUNT(u1H2CWoWlanCtrlParm, 0x09); + SET_H2CCMD_WOWLAN_GPIO_PULSE_EN(u1H2CWoWlanCtrlParm, 1); + SET_H2CCMD_WOWLAN_GPIO_PULSE_COUNT(u1H2CWoWlanCtrlParm, 0x09); RT_PRINT_DATA(_module_hal_init_c_, _drv_always_, "u1H2CWoWlanCtrlParm:", u1H2CWoWlanCtrlParm, H2C_WOWLAN_LEN); DBG_871X("u1H2CWoWlanCtrlParm:%08x", (u32) u1H2CWoWlanCtrlParm[0]); @@ -2795,11 +2958,13 @@ C2HContentParsing8192E( //DBG_871X("[C2H], C2H_8192E_TX_REPORT!!\n"); C2HTxFeedbackHandler_8192E(Adapter, tmpBuf, c2hCmdLen); break; - +#ifdef CONFIG_BT_COEXIST case C2H_8192E_BT_INFO: //DBG_871X("[C2H], C2H_8192E_BT_INFO!!\n"); //BT_BtInfoNotify(Adapter, tmpBuf, c2hCmdLen); + rtw_btcoex_BtInfoNotify(Adapter, c2hCmdLen, tmpBuf); break; +#endif case C2H_8192E_BT_MP: //DBG_871X("[C2H], C2H_8192E_BT_MP!!\n"); @@ -2820,6 +2985,27 @@ C2HContentParsing8192E( } + +static inline void dump_c2h_packet(u8 *ptr , u8 length) +{ + int i; + u8 tmpBuf[8]; + + for(i=0; i16) { + DBG_871X("[C2H packet], c2hCmdId=0x%x, c2hCmdSeq=0x%x, c2hCmdLen=%d\n", c2hCmdId, c2hCmdSeq, c2hCmdLen); + rtw_warn_on(1); + } - C2HContentParsing8192E(Adapter, c2hCmdId, c2hCmdLen, tmpBuf); - //PlatformEFIOWrite1Byte(Adapter, REG_C2HEVT_CLEAR_8812, C2H_EVT_HOST_CLOSE); + if (c2hCmdId == C2H_8192E_BT_INFO) { + /* enqueue */ + if ((c2h_evt = (struct c2h_evt_hdr_88xx *)rtw_zmalloc(16)) != NULL) { + _rtw_memcpy(c2h_evt, Buffer, Length); + c2h_evt->plen = Length - 2; + //DBG_871X("-[C2H packet], id=0x%x, seq=0x%x, plen=%d\n", c2h_evt->id, c2h_evt->seq, c2h_evt->plen); + rtw_c2h_wk_cmd(Adapter, (u8 *)c2h_evt); + } + } + else +#endif /* CONFIG_BT_COEXIST */ + { + C2HContentParsing8192E(Adapter, c2hCmdId, c2hCmdLen, tmpBuf); + //PlatformEFIOWrite1Byte(Adapter, REG_C2HEVT_CLEAR_8812, C2H_EVT_HOST_CLOSE); + } } +s32 c2h_handler_8192e(PADAPTER padapter, u8 *buf) +{ + struct c2h_evt_hdr_88xx *c2h_evt = (struct c2h_evt_hdr_88xx *)buf; + s32 ret = _SUCCESS; + + if (c2h_evt == NULL) { + DBG_8192C("%s c2h_evt is NULL\n",__FUNCTION__); + ret = _FAIL; + goto exit; + } + + C2HContentParsing8192E(padapter, c2h_evt->id, c2h_evt->plen, c2h_evt->payload); + +exit: + return ret; +} + +#ifdef CONFIG_BT_COEXIST + +void ConstructBtNullFunctionData( + PADAPTER padapter, + u8 *pframe, + u32 *pLength, + u8 *StaAddr, + u8 bQoS, + u8 AC, + u8 bEosp, + u8 bForcePowerSave) +{ + struct rtw_ieee80211_hdr *pwlanhdr; + u16 *fctrl; + u32 pktlen; + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + u8 bssid[ETH_ALEN]; + + //DBG_871X("%s:%d\n", __FUNCTION__, bForcePowerSave); + + pwlanhdr = (struct rtw_ieee80211_hdr*)pframe; + + if (NULL == StaAddr) + { + _rtw_memcpy(bssid, myid(&padapter->eeprompriv), ETH_ALEN); + StaAddr = bssid; + } + + fctrl = &pwlanhdr->frame_ctl; + *(fctrl) = 0; + if (bForcePowerSave) + { + SetPwrMgt(fctrl); + } + + SetFrDs(fctrl); + _rtw_memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN); + _rtw_memcpy(pwlanhdr->addr2, myid(&padapter->eeprompriv), ETH_ALEN); + _rtw_memcpy(pwlanhdr->addr3, myid(&padapter->eeprompriv), ETH_ALEN); + + SetDuration(pwlanhdr, 0); + SetSeqNum(pwlanhdr, 0); + + if (bQoS == _TRUE) { + struct rtw_ieee80211_hdr_3addr_qos *pwlanqoshdr; + + SetFrameSubType(pframe, WIFI_QOS_DATA_NULL); + + pwlanqoshdr = (struct rtw_ieee80211_hdr_3addr_qos*)pframe; + SetPriority(&pwlanqoshdr->qc, AC); + SetEOSP(&pwlanqoshdr->qc, bEosp); + + pktlen = sizeof(struct rtw_ieee80211_hdr_3addr_qos); + } else { + SetFrameSubType(pframe, WIFI_DATA_NULL); + + pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); + } + + *pLength = pktlen; +} + +static void SetFwRsvdPagePkt_BTCoex(PADAPTER padapter) +{ + + PHAL_DATA_TYPE pHalData; + struct xmit_frame *pcmdframe; + struct pkt_attrib *pattrib; + struct xmit_priv *pxmitpriv; + struct mlme_ext_priv *pmlmeext; + struct mlme_ext_info *pmlmeinfo; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + u32 BeaconLength=0; + u32 BTQosNullLength=0; + u8 *ReservedPagePacket; + u8 TxDescLen = TXDESC_SIZE, TxDescOffset = TXDESC_OFFSET; + u8 TotalPageNum=0, CurtPktPageNum=0, RsvdPageNum=0; + u16 BufIndex, PageSize = 256; + u32 TotalPacketLen, MaxRsvdPageBufSize=0; + RSVDPAGE_LOC RsvdPageLoc; + + pHalData = GET_HAL_DATA(padapter); + pxmitpriv = &padapter->xmitpriv; + pmlmeext = &padapter->mlmeextpriv; + pmlmeinfo = &pmlmeext->mlmext_info; + + //RsvdPageNum = BCNQ_PAGE_NUM_8723B + WOWLAN_PAGE_NUM_8723B; + RsvdPageNum = RSVD_PAGE_NUM_8192E; + MaxRsvdPageBufSize = RsvdPageNum*PageSize; + + pcmdframe = rtw_alloc_cmdxmitframe(pxmitpriv); + if (pcmdframe == NULL) { + DBG_871X("%s: alloc ReservedPagePacket fail!\n", __FUNCTION__); + return; + } + + ReservedPagePacket = pcmdframe->buf_addr; + _rtw_memset(&RsvdPageLoc, 0, sizeof(RSVDPAGE_LOC)); + + //3 (1) beacon + BufIndex = TxDescOffset; + ConstructBeacon(padapter, &ReservedPagePacket[BufIndex], &BeaconLength); + + // When we count the first page size, we need to reserve description size for the RSVD + // packet, it will be filled in front of the packet in TXPKTBUF. + CurtPktPageNum = (u8)PageNum_256(TxDescLen + BeaconLength); + //If we don't add 1 more page, the WOWLAN function has a problem. Baron thinks it's a bug of firmware + if (CurtPktPageNum == 1) + { + CurtPktPageNum += 1; + } + TotalPageNum += CurtPktPageNum; + + BufIndex += (CurtPktPageNum*PageSize); + + // Jump to lastest page + if (BufIndex < (MaxRsvdPageBufSize - PageSize)) + { + BufIndex = TxDescOffset + (MaxRsvdPageBufSize - PageSize); + TotalPageNum = RSVD_PAGE_NUM_8192E-1; + } + + //3 (6) BT Qos null data + RsvdPageLoc.LocBTQosNull = TotalPageNum; + ConstructBtNullFunctionData( + padapter, + &ReservedPagePacket[BufIndex], + &BTQosNullLength, + NULL, + _TRUE, 0, 0, _FALSE); + rtl8192e_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], BTQosNullLength, _FALSE, _TRUE); + + //DBG_871X("%s(): HW_VAR_SET_TX_CMD: BT QOS NULL DATA %p %d\n", + // __FUNCTION__, &ReservedPagePacket[BufIndex-TxDescLen], (BTQosNullLength+TxDescLen)); + + CurtPktPageNum = (u8)PageNum_256(TxDescLen + BTQosNullLength); + + TotalPageNum += CurtPktPageNum; + + + TotalPacketLen = BufIndex + BTQosNullLength; + if(TotalPacketLen > MaxRsvdPageBufSize) + { + DBG_871X("%s(): ERROR: The rsvd page size is not enough!!TotalPacketLen %d, MaxRsvdPageBufSize %d\n",__FUNCTION__, + TotalPacketLen,MaxRsvdPageBufSize); + goto error; + } + + // update attribute + pattrib = &pcmdframe->attrib; + update_mgntframe_attrib(padapter, pattrib); + pattrib->qsel = QSLT_BEACON; + pattrib->pktlen = pattrib->last_txcmdsz = TotalPacketLen - TxDescOffset; +#ifdef CONFIG_PCI_HCI + dump_mgntframe(padapter, pcmdframe); +#else + dump_mgntframe_and_wait(padapter, pcmdframe, 100); +#endif + + + //DBG_871X("%s: Set RSVD page location to Fw ,TotalPacketLen(%d), TotalPageNum(%d)\n", __FUNCTION__,TotalPacketLen,TotalPageNum); + + rtl8192e_set_FwRsvdPage_cmd(padapter, &RsvdPageLoc); + rtl8192e_set_FwAoacRsvdPage_cmd(padapter, &RsvdPageLoc); + + return; + +error: + rtw_free_xmitframe(pxmitpriv, pcmdframe); +} + +void rtl8192e_download_BTCoex_AP_mode_rsvd_page(PADAPTER padapter) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + BOOLEAN bRecover = _FALSE; + BOOLEAN bcn_valid = _FALSE; + u8 DLBcnCount=0; + u32 poll = 0; + u8 val8; + + + DBG_8192C("+" FUNC_ADPT_FMT ": iface_type=%d fw_state=0x%08X\n", + FUNC_ADPT_ARG(padapter), get_iface_type(padapter), get_fwstate(&padapter->mlmepriv)); + +#ifdef CONFIG_DEBUG + if (check_fwstate(&padapter->mlmepriv, WIFI_AP_STATE) == _FALSE) + { + DBG_8192C(FUNC_ADPT_FMT ": [WARNING] not in AP mode!!\n", + FUNC_ADPT_ARG(padapter)); + } +#endif // CONFIG_DEBUG + + // We should set AID, correct TSF, HW seq enable before set JoinBssReport to Fw in 88/92C. + // Suggested by filen. Added by tynli. + rtw_write16(padapter, REG_BCN_PSR_RPT, (0xC000|pmlmeinfo->aid)); + + // set REG_CR bit 8 + val8 = rtw_read8(padapter, REG_CR+1); + val8 |= BIT(0); // ENSWBCN + rtw_write8(padapter, REG_CR+1, val8); + + // Disable Hw protection for a time which revserd for Hw sending beacon. + // Fix download reserved page packet fail that access collision with the protection time. + // 2010.05.11. Added by tynli. + val8 = rtw_read8(padapter, REG_BCN_CTRL); + val8 &= ~BIT(3); + val8 |= BIT(4); + rtw_write8(padapter, REG_BCN_CTRL, val8); + + // Set FWHW_TXQ_CTRL 0x422[6]=0 to tell Hw the packet is not a real beacon frame. + if (pHalData->RegFwHwTxQCtrl & BIT(6)) + bRecover = _TRUE; + + // To tell Hw the packet is not a real beacon frame. + pHalData->RegFwHwTxQCtrl &= ~BIT(6); + rtw_write8(padapter, REG_FWHW_TXQ_CTRL+2, pHalData->RegFwHwTxQCtrl); + + + // Clear beacon valid check bit. + rtw_hal_set_hwreg(padapter, HW_VAR_BCN_VALID, NULL); + rtw_hal_set_hwreg(padapter, HW_VAR_DL_BCN_SEL, NULL); + + DLBcnCount = 0; + poll = 0; + do + { + SetFwRsvdPagePkt_BTCoex(padapter); + DLBcnCount++; + do + { + rtw_yield_os(); + //rtw_mdelay_os(10); + // check rsvd page download OK. + rtw_hal_get_hwreg(padapter, HW_VAR_BCN_VALID, (u8*)(&bcn_valid)); + poll++; + } while(!bcn_valid && (poll%10)!=0 && !padapter->bSurpriseRemoved && !padapter->bDriverStopped); + + }while(!bcn_valid && DLBcnCount<=100 && !padapter->bSurpriseRemoved && !padapter->bDriverStopped); + + if(_TRUE == bcn_valid) + { + struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter); + pwrctl->fw_psmode_iface_id = padapter->iface_id; + DBG_871X(ADPT_FMT": DL RSVD page success! DLBcnCount:%u, poll:%u\n", + ADPT_ARG(padapter), DLBcnCount, poll); + } + else + { + DBG_871X(ADPT_FMT": DL RSVD page fail! DLBcnCount:%d, poll:%d\n", + ADPT_ARG(padapter), DLBcnCount, poll); + DBG_871X(ADPT_FMT": DL RSVD page fail! bSurpriseRemoved=%d\n", + ADPT_ARG(padapter), padapter->bSurpriseRemoved); + DBG_871X(ADPT_FMT": DL RSVD page fail! bDriverStopped=%d\n", + ADPT_ARG(padapter), padapter->bDriverStopped); + } + + // 2010.05.11. Added by tynli. + val8 = rtw_read8(padapter, REG_BCN_CTRL); + val8 |= BIT(3); + val8 &= ~BIT(4); + rtw_write8(padapter, REG_BCN_CTRL, val8); + + // To make sure that if there exists an adapter which would like to send beacon. + // If exists, the origianl value of 0x422[6] will be 1, we should check this to + // prevent from setting 0x422[6] to 0 after download reserved page, or it will cause + // the beacon cannot be sent by HW. + // 2010.06.23. Added by tynli. + if(bRecover) + { + pHalData->RegFwHwTxQCtrl |= BIT(6); + rtw_write8(padapter, REG_FWHW_TXQ_CTRL+2, pHalData->RegFwHwTxQCtrl); + } + + // Clear CR[8] or beacon packet will not be send to TxBuf anymore. + val8 = rtw_read8(padapter, REG_CR+1); + val8 &= ~BIT(0); // ~ENSWBCN + rtw_write8(padapter, REG_CR+1, val8); +} + +#endif // CONFIG_BT_COEXIST diff --git a/hal/rtl8192e/rtl8192e_dm.c b/hal/rtl8192e/rtl8192e_dm.c index e2eb201..fe1795a 100644 --- a/hal/rtl8192e/rtl8192e_dm.c +++ b/hal/rtl8192e/rtl8192e_dm.c @@ -234,94 +234,21 @@ dm_InitGPIOSetting( tmp1byte = rtw_read8(Adapter, REG_GPIO_MUXCFG); tmp1byte &= (GPIOSEL_GPIO | ~GPIOSEL_ENBT); -#ifdef CONFIG_BT_COEXIST - // UMB-B cut bug. We need to support the modification. - if (IS_81xxC_VENDOR_UMC_B_CUT(pHalData->VersionID) && - pHalData->bt_coexist.BT_Coexist) - { - tmp1byte |= (BIT5); - } -#endif rtw_write8(Adapter, REG_GPIO_MUXCFG, tmp1byte); } -// A mapping from HalData to ODM. -ODM_BOARD_TYPE_E boardType(u8 InterfaceSel) -{ - ODM_BOARD_TYPE_E board = ODM_BOARD_DEFAULT; - -#ifdef CONFIG_PCI_HCI - INTERFACE_SELECT_PCIE pcie = (INTERFACE_SELECT_PCIE)InterfaceSel; - switch (pcie) - { - case INTF_SEL0_SOLO_MINICARD: - board |= ODM_BOARD_MINICARD; - break; - case INTF_SEL1_BT_COMBO_MINICARD: - board |= ODM_BOARD_BT; - board |= ODM_BOARD_MINICARD; - break; - default: - board = ODM_BOARD_DEFAULT; - break; - } - -#elif defined(CONFIG_USB_HCI) - INTERFACE_SELECT_USB usb = (INTERFACE_SELECT_USB)InterfaceSel; - switch (usb) - { - case INTF_SEL1_USB_High_Power: - board |= ODM_BOARD_EXT_LNA; - board |= ODM_BOARD_EXT_PA; - break; - case INTF_SEL2_MINICARD: - board |= ODM_BOARD_MINICARD; - break; - case INTF_SEL4_USB_Combo: - board |= ODM_BOARD_BT; - break; - case INTF_SEL5_USB_Combo_MF: - board |= ODM_BOARD_BT; - break; - case INTF_SEL0_USB: - case INTF_SEL3_USB_Solo: - default: - board = ODM_BOARD_DEFAULT; - break; - } - -#endif - //DBG_871X("===> boardType(): (pHalData->InterfaceSel, pDM_Odm->BoardType) = (%d, %d)\n", InterfaceSel, board); - - return board; -} - //============================================================ // functions //============================================================ static void Init_ODM_ComInfo_8192e(PADAPTER Adapter) { - EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(Adapter); PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter); struct dm_priv *pdmpriv = &pHalData->dmpriv; PDM_ODM_T pDM_Odm = &(pHalData->odmpriv); u8 cut_ver,fab_ver; - u8 BoardType = ODM_BOARD_DEFAULT; - - // - // Init Value - // - _rtw_memset(pDM_Odm,0,sizeof(*pDM_Odm)); - - pDM_Odm->Adapter = Adapter; - - ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_PLATFORM,ODM_CE); - if (Adapter->interface_type == RTW_GSPI) - ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_INTERFACE,ODM_ITRF_SDIO); - else - ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_INTERFACE,Adapter->interface_type); + Init_ODM_ComInfo(Adapter); ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_IC_TYPE,ODM_RTL8192E); @@ -341,57 +268,6 @@ static void Init_ODM_ComInfo_8192e(PADAPTER Adapter) cut_ver = ODM_CUT_A; ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_CUT_VER,cut_ver); - ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_MP_TEST_CHIP,IS_NORMAL_CHIP(pHalData->VersionID)); - - //1 ======= BoardType: ODM_CMNINFO_BOARD_TYPE ======= -#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) - if(pHalData->InterfaceSel == INTF_SEL1_USB_High_Power) - { - ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_EXT_PA, 1); - ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_EXT_LNA, 1); - } - else - { - ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_EXT_PA, pHalData->ExternalPA_2G); - ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_EXT_LNA, 0); - } -#else - // PCIE no external PA now??? - ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_EXT_PA, 0); - ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_EXT_LNA, 0); -#endif - - if (pHalData->ExternalLNA_2G != 0) { - BoardType |= ODM_BOARD_EXT_LNA; - ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_EXT_LNA, 1); - } - - if (pHalData->ExternalPA_2G != 0) { - BoardType |= ODM_BOARD_EXT_PA; - ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_EXT_PA, 1); - } - - ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_BOARD_TYPE, BoardType); - - //1 ============== End of BoardType ============== - - ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_EXT_TRSW, 0); - - ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_PATCH_ID,pEEPROM->CustomerID); - // ODM_CMNINFO_BINHCT_TEST only for MP Team - ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_BWIFI_TEST,Adapter->registrypriv.wifi_spec); - - - if(pHalData->rf_type == RF_1T1R){ - ODM_CmnInfoUpdate(pDM_Odm,ODM_CMNINFO_RF_TYPE,ODM_1T1R); - } - else if(pHalData->rf_type == RF_2T2R){ - ODM_CmnInfoUpdate(pDM_Odm,ODM_CMNINFO_RF_TYPE,ODM_2T2R); - } - else if(pHalData->rf_type == RF_1T2R){ - ODM_CmnInfoUpdate(pDM_Odm,ODM_CMNINFO_RF_TYPE,ODM_1T2R); - } - ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_RF_ANTENNA_TYPE, pHalData->TRxAntDivType); #ifdef CONFIG_DISABLE_ODM @@ -409,13 +285,9 @@ static void Init_ODM_ComInfo_8192e(PADAPTER Adapter) } static void Update_ODM_ComInfo_8192e(PADAPTER Adapter) { - struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv; - struct mlme_priv *pmlmepriv = &Adapter->mlmepriv; - struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(Adapter); PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter); PDM_ODM_T pDM_Odm = &(pHalData->odmpriv); - struct dm_priv *pdmpriv = &pHalData->dmpriv; - int i; + struct dm_priv *pdmpriv = &pHalData->dmpriv; pdmpriv->InitODMFlag = 0 | ODM_BB_DIG @@ -425,14 +297,18 @@ static void Update_ODM_ComInfo_8192e(PADAPTER Adapter) | ODM_BB_RSSI_MONITOR //| ODM_BB_CCK_PD //| ODM_BB_PWR_SAVE + | ODM_BB_CFO_TRACKING | ODM_MAC_EDCA_TURBO | ODM_RF_CALIBRATION | ODM_RF_TX_PWR_TRACK -#ifdef CONFIG_ODM_ADAPTIVITY - | ODM_BB_ADAPTIVITY -#endif + | ODM_BB_PRIMARY_CCA + | ODM_BB_NHM_CNT +// | ODM_BB_PWR_TRAIN ; + if (rtw_odm_adaptivity_needed(Adapter) == _TRUE) + pdmpriv->InitODMFlag |= ODM_BB_ADAPTIVITY; + if(pHalData->AntDivCfg) pdmpriv->InitODMFlag |= ODM_BB_ANT_DIV; @@ -450,42 +326,8 @@ static void Update_ODM_ComInfo_8192e(PADAPTER Adapter) #endif//CONFIG_DISABLE_ODM ODM_CmnInfoUpdate(pDM_Odm,ODM_CMNINFO_ABILITY,pdmpriv->InitODMFlag); - - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_TX_UNI,&(Adapter->xmitpriv.tx_bytes)); - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_RX_UNI,&(Adapter->recvpriv.rx_bytes)); - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_WM_MODE,&(pmlmeext->cur_wireless_mode)); - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_BAND,&(pHalData->CurrentBandType)); - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_FORCED_RATE,&(pHalData->ForcedDataRate)); - - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_SEC_CHNL_OFFSET,&(pHalData->nCur40MhzPrimeSC)); - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_SEC_MODE,&(Adapter->securitypriv.dot11PrivacyAlgrthm)); - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_BW,&(pHalData->CurrentChannelBW )); - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_CHNL,&( pHalData->CurrentChannel)); - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_NET_CLOSED,&( Adapter->net_closed)); - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_MP_MODE,&(Adapter->registrypriv.mp_mode)); - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_FORCED_IGI_LB,&(pHalData->u1ForcedIgiLb)); - //================= only for 8192D ================= - - /* - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_DMSP_GET_VALUE,&(pDM_Odm->u1Byte_temp)); - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_BUDDY_ADAPTOR,&(pDM_Odm->PADAPTER_temp)); - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_DMSP_IS_MASTER,&(pDM_Odm->u1Byte_temp)); - //================= only for 8192D ================= - // driver havn't those variable now - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_BT_OPERATION,&(pDM_Odm->u1Byte_temp)); - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_BT_DISABLE_EDCA,&(pDM_Odm->u1Byte_temp)); - */ - - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_SCAN,&(pmlmepriv->bScanInProcess)); - ODM_CmnInfoHook(pDM_Odm,ODM_CMNINFO_POWER_SAVING,&(pwrctrlpriv->bpower_saving)); ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_RF_ANTENNA_TYPE, pHalData->TRxAntDivType); - - for(i=0; i< NUM_STA; i++) - { - //pDM_Odm->pODM_StaInfo[i] = NULL; - ODM_CmnInfoPtrArrayHook(pDM_Odm, ODM_CMNINFO_STA_STATUS,i,NULL); - } } void @@ -504,6 +346,7 @@ rtl8192e_InitHalDm( pdmpriv->DM_Type = DM_Type_ByDriver; pdmpriv->DMFlag = DYNAMIC_FUNC_DISABLE; + Update_ODM_ComInfo_8192e(Adapter); ODM_DMInit(pDM_Odm); @@ -577,6 +420,7 @@ rtl8192e_HalDmWatchDog( { u8 bLinked=_FALSE; u8 bsta_state=_FALSE; + u8 bBtDisabled = _TRUE; #ifdef CONFIG_DISABLE_ODM pHalData->odmpriv.SupportAbility = 0; #endif @@ -598,6 +442,14 @@ rtl8192e_HalDmWatchDog( ODM_CmnInfoUpdate(&pHalData->odmpriv ,ODM_CMNINFO_LINK, bLinked); ODM_CmnInfoUpdate(&pHalData->odmpriv ,ODM_CMNINFO_STATION_STATE, bsta_state); +#ifdef CONFIG_BT_COEXIST + bBtDisabled = rtw_btcoex_IsBtDisabled(Adapter); + ODM_CmnInfoUpdate(&pHalData->odmpriv, ODM_CMNINFO_BT_ENABLED, ((bBtDisabled == _TRUE)?_FALSE:_TRUE)); +#else + ODM_CmnInfoUpdate(&pHalData->odmpriv, ODM_CMNINFO_BT_ENABLED,_FALSE); +#endif // CONFIG_BT_COEXIST + + ODM_DMWatchdog(&pHalData->odmpriv); } @@ -619,11 +471,9 @@ void rtl8192e_init_dm_priv(IN PADAPTER Adapter) _rtw_memset(pdmpriv, 0, sizeof(struct dm_priv)); //_rtw_spinlock_init(&(pHalData->odm_stainfo_lock)); Init_ODM_ComInfo_8192e(Adapter); - //_init_timer(&(pdmpriv->SwAntennaSwitchTimer), Adapter->pnetdev , odm_SW_AntennaSwitchCallback, Adapter); ODM_InitAllTimers(podmpriv ); ODM_InitDebugSetting(podmpriv); - pHalData->RegRFPathS1 = 0; } void rtl8192e_deinit_dm_priv(IN PADAPTER Adapter) @@ -631,8 +481,7 @@ void rtl8192e_deinit_dm_priv(IN PADAPTER Adapter) PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter); struct dm_priv *pdmpriv = &pHalData->dmpriv; PDM_ODM_T podmpriv = &pHalData->odmpriv; - //_rtw_spinlock_free(&pHalData->odm_stainfo_lock); - //_cancel_timer_ex(&pdmpriv->SwAntennaSwitchTimer); + //_rtw_spinlock_free(&pHalData->odm_stainfo_lock); ODM_CancelAllTimers(podmpriv); } diff --git a/hal/rtl8192e/rtl8192e_hal_init.c b/hal/rtl8192e/rtl8192e_hal_init.c index 12b4782..f56a1e0 100644 --- a/hal/rtl8192e/rtl8192e_hal_init.c +++ b/hal/rtl8192e/rtl8192e_hal_init.c @@ -578,14 +578,14 @@ static s32 _LLTWrite(PADAPTER padapter, u32 address, u32 data) if (count <=0 ) { DBG_871X("Failed to polling write LLT done at address %d!\n", address); - status = _FAIL; + status = _FAIL; } return status; } u8 _LLTRead(PADAPTER padapter, u32 address) { - s32 count = 0; + s32 count = POLLING_LLT_THRESHOLD; u32 value = _LLT_INIT_ADDR(address) | _LLT_OP(_LLT_READ_ACCESS); u16 LLTReg = REG_LLT_INIT; @@ -598,12 +598,12 @@ u8 _LLTRead(PADAPTER padapter, u32 address) if (_LLT_NO_ACTIVE == _LLT_OP_VALUE(value)) { return (u8)value; } - - if (count > POLLING_LLT_THRESHOLD) { - RT_TRACE(_module_hal_init_c_, _drv_err_, ("Failed to polling read LLT done at address %d!\n", address)); - break; - } - } while (count++); + } while (--count); + + if (count <=0 ) { + RT_TRACE(_module_hal_init_c_, _drv_err_, ("Failed to polling read LLT done at address %d!\n", address)); + } + return 0xFF; } @@ -992,7 +992,6 @@ void _8051Reset8192E(PADAPTER padapter) DBG_871X("=====> _8051Reset8192E(): 8051 reset success .\n"); } -extern u8 g_fwdl_chksum_fail; static s32 polling_fwdl_chksum(_adapter *adapter, u32 min_cnt, u32 timeout_ms) { s32 ret = _FAIL; @@ -1013,11 +1012,8 @@ static s32 polling_fwdl_chksum(_adapter *adapter, u32 min_cnt, u32 timeout_ms) goto exit; } - if (g_fwdl_chksum_fail) { - DBG_871X("%s: fwdl test case: fwdl_chksum_fail\n", __FUNCTION__); - g_fwdl_chksum_fail--; + if (rtw_fwdl_test_trigger_chksum_fail()) goto exit; - } ret = _SUCCESS; @@ -1028,7 +1024,6 @@ exit: return ret; } -extern u8 g_fwdl_wintint_rdy_fail; static s32 _FWFreeToGo8192E(_adapter *adapter, u32 min_cnt, u32 timeout_ms) { s32 ret = _FAIL; @@ -1056,11 +1051,8 @@ static s32 _FWFreeToGo8192E(_adapter *adapter, u32 min_cnt, u32 timeout_ms) goto exit; } - if (g_fwdl_wintint_rdy_fail) { - DBG_871X("%s: fwdl test case: wintint_rdy_fail\n", __FUNCTION__); - g_fwdl_wintint_rdy_fail--; + if (rtw_fwdl_test_trigger_wintint_rdy_fail()) goto exit; - } ret = _SUCCESS; @@ -1264,14 +1256,11 @@ SetFwRelatedForWoWLAN8192E( static void rtl8192e_free_hal_data(PADAPTER padapter) { _func_enter_; - if (padapter->HalData) { - phy_free_filebuf(padapter); - rtw_vmfree(padapter->HalData, sizeof(HAL_DATA_TYPE)); - padapter->HalData = NULL; - } + _func_exit_; } + //=========================================================== // Efuse related code //=========================================================== @@ -1282,16 +1271,48 @@ Hal_EfuseParseBTCoexistInfo8192E( IN BOOLEAN AutoLoadFail ) { -#ifdef CONFIG_BT_COEXIST - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - pHalData->EEPROMBluetoothCoexist = 0; - pHalData->EEPROMBluetoothType = BT_CSR_BC8; - pHalData->EEPROMBluetoothAntNum = Ant_x2; - pHalData->EEPROMBluetoothAntIsolation = 1; - pHalData->EEPROMBluetoothRadioShared = BT_Radio_Shared; - BT_InitHalVars(Adapter); + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + u1Byte tempval; + if(!AutoLoadFail) + { + tempval = hwinfo[EEPROM_RF_BOARD_OPTION_8192E]; + if( ((tempval & 0xe0)>>5) == 0x1)// [7:5] + pHalData->EEPROMBluetoothCoexist = 1; + else + pHalData->EEPROMBluetoothCoexist = 0; + pHalData->EEPROMBluetoothType = BT_RTL8192E; + + tempval = hwinfo[EEPROM_RF_BT_SETTING_8192E]; + //pHalData->EEPROMBluetoothAntNum = (tempval&0x1); // bit [0] + pHalData->EEPROMBluetoothAntNum = Ant_x2; + } + else + { + pHalData->EEPROMBluetoothCoexist = 1; + pHalData->EEPROMBluetoothType = BT_RTL8192E; + pHalData->EEPROMBluetoothAntNum = Ant_x2; + } + +#ifdef CONFIG_BT_COEXIST +#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE + if (! hal_btcoex_AntIsolationConfig_ParaFile (Adapter , RTL8192E_WIFI_ANT_ISOLATION) ) #endif + { + //DBG_871X("%s : %s file read fail \n", __FUNCTION__,WIFI_ANT_ISOLATION_CONFIG_FILE); + pHalData->EEPROMBluetoothCoexist = 1; + hal_btcoex_SetAntIsolationType(Adapter, 1); + } + + rtw_btcoex_SetBTCoexist(Adapter, pHalData->EEPROMBluetoothCoexist); + rtw_btcoex_SetChipType(Adapter, pHalData->EEPROMBluetoothType); + rtw_btcoex_SetPGAntNum(Adapter, pHalData->EEPROMBluetoothAntNum==Ant_x2?2:1); + + DBG_871X("%s: %s BT-coex, wifi ant_num=%d\n", + __FUNCTION__, + pHalData->EEPROMBluetoothCoexist==_TRUE?"Enable":"Disable", + pHalData->EEPROMBluetoothAntNum==Ant_x2?2:1); +#endif // CONFIG_BT_COEXIST } void @@ -1762,8 +1783,6 @@ Hal_ReadChannelPlan8192E( , AutoLoadFail ); - Hal_ChannelPlanToRegulation(padapter, padapter->mlmepriv.ChannelPlan); - DBG_871X("mlmepriv.ChannelPlan = 0x%02x\n", padapter->mlmepriv.ChannelPlan); } @@ -1804,9 +1823,6 @@ Hal_ReadAntennaDiversity8192E( DBG_871X("SWAS: bHwAntDiv = %x, TRxAntDivType = %x\n", pHalData->AntDivCfg, pHalData->TRxAntDivType); } -#define GetRegAmplifierType2G(_Adapter) (_Adapter->registrypriv.AmplifierType_2G) -#define GetRegAmplifierType5G(_Adapter) (_Adapter->registrypriv.AmplifierType_5G) - VOID Hal_ReadPAType_8192E( IN PADAPTER Adapter, @@ -1818,21 +1834,26 @@ Hal_ReadPAType_8192E( if( ! AutoloadFail ) { - // PA Type - pHalData->PAType_2G = EF1Byte( *(u8*)&PROMContent[EEPROM_PA_TYPE_8192EU] ); - pHalData->PAType_5G = EF1Byte( *(u8*)&PROMContent[EEPROM_PA_TYPE_8192EU] ); - pHalData->LNAType_2G = EF1Byte( *(u8*)&PROMContent[EEPROM_LNA_TYPE_2G_8192EU] ); - pHalData->LNAType_5G = EF1Byte( *(u8*)&PROMContent[EEPROM_LNA_TYPE_5G_8192EU] ); - if (GetRegAmplifierType2G(Adapter) == 0) // AUTO { + // PA Type + pHalData->PAType_2G = EF1Byte( *(u8*)&PROMContent[EEPROM_PA_TYPE_8192EU] ); + //pHalData->PAType_5G = EF1Byte( *(u8*)&PROMContent[EEPROM_PA_TYPE_8192EU] ); + pHalData->LNAType_2G = EF1Byte( *(u8*)&PROMContent[EEPROM_LNA_TYPE_2G_8192EU] ); + //pHalData->LNAType_5G = EF1Byte( *(u8*)&PROMContent[EEPROM_LNA_TYPE_5G_8192EU] ); + + if(pHalData->PAType_2G == 0xFF ) + pHalData->PAType_2G = 0; + if(pHalData->LNAType_2G == 0xFF) + pHalData->LNAType_2G = 0; + pHalData->ExternalPA_2G = ((pHalData->PAType_2G & BIT5) && (pHalData->PAType_2G & BIT4)) ? 1 : 0; pHalData->ExternalLNA_2G = ((pHalData->LNAType_2G & BIT7) && (pHalData->LNAType_2G & BIT3)) ? 1 : 0; // 5G only now. } else { - pHalData->ExternalPA_2G =0; //(GetRegAmplifierType2G(Adapter)&ODM_BOARD_EXT_PA) ? 1 : 0; - pHalData->ExternalLNA_2G = 0;//(GetRegAmplifierType2G(Adapter)&ODM_BOARD_EXT_LNA) ? 1 : 0; + pHalData->ExternalPA_2G =(GetRegAmplifierType2G(Adapter)&ODM_BOARD_EXT_PA) ? 1 : 0; + pHalData->ExternalLNA_2G = (GetRegAmplifierType2G(Adapter)&ODM_BOARD_EXT_LNA) ? 1 : 0; } /* if (GetRegAmplifierType5G(Adapter) == 0) // AUTO @@ -1850,14 +1871,14 @@ Hal_ReadPAType_8192E( else { pHalData->ExternalPA_2G = EEPROM_Default_PAType; - pHalData->ExternalPA_5G = 0xFF; + pHalData->ExternalPA_5G = EEPROM_Default_PAType; pHalData->ExternalLNA_2G = EEPROM_Default_LNAType; - pHalData->ExternalLNA_5G = 0xFF; + pHalData->ExternalLNA_5G = EEPROM_Default_LNAType; if (GetRegAmplifierType2G(Adapter) == 0) // AUTO { - pHalData->ExternalPA_2G = 0; - pHalData->ExternalLNA_2G = 0; + pHalData->ExternalPA_2G = EEPROM_Default_PAType; + pHalData->ExternalLNA_2G = EEPROM_Default_LNAType; } else { @@ -1895,46 +1916,44 @@ Hal_EfusePowerSwitch8192E( { u8 tempval; u16 tmpV16; - #define REG_EFUSE_ACCESS_JAGUAR 0xCF - #define EFUSE_ACCESS_ON_JAGUAR 0x69 - #define EFUSE_ACCESS_OFF_JAGUAR 0x00 + u8 EFUSE_ACCESS_ON_8192E = 0x69; + u8 EFUSE_ACCESS_OFF_8192E = 0x00; + if (PwrState == _TRUE) { - rtw_write8(pAdapter, REG_EFUSE_ACCESS_JAGUAR, EFUSE_ACCESS_ON_JAGUAR); - - // 1.2V Power: From VDDON with Power Cut(0x0000h[15]), defualt valid - tmpV16 = rtw_read16(pAdapter,REG_SYS_ISO_CTRL); - if( ! (tmpV16 & PWC_EV12V ) ){ - tmpV16 |= PWC_EV12V ; - //rtw_write16(pAdapter,REG_SYS_ISO_CTRL,tmpV16); - } + rtw_write8(pAdapter, REG_EFUSE_ACCESS, EFUSE_ACCESS_ON_8192E); + // Reset: 0x0000h[28], default valid tmpV16 = rtw_read16(pAdapter,REG_SYS_FUNC_EN); if( !(tmpV16 & FEN_ELDR) ){ tmpV16 |= FEN_ELDR ; rtw_write16(pAdapter,REG_SYS_FUNC_EN,tmpV16); } - + // Clock: Gated(0x0008h[5]) 8M(0x0008h[1]) clock from ANA, default valid tmpV16 = rtw_read16(pAdapter,REG_SYS_CLKR); - if( (!(tmpV16 & LOADER_CLK_EN) ) ||(!(tmpV16 & ANA8M) ) ){ + if( (!(tmpV16 & LOADER_CLK_EN) ) ||(!(tmpV16 & ANA8M) ) ) + { tmpV16 |= (LOADER_CLK_EN |ANA8M ) ; rtw_write16(pAdapter,REG_SYS_CLKR,tmpV16); } + - if(bWrite == TRUE) + if(bWrite == _TRUE) { // Enable LDO 2.5V before read/write action - tempval = PlatformEFIORead1Byte(pAdapter, EFUSE_TEST+3); - tempval &= 0x0F; - tempval |= (VOLTAGE_V25 << 4); - PlatformEFIOWrite1Byte(pAdapter, EFUSE_TEST+3, (tempval | 0x80)); + tempval = rtw_read8(pAdapter, EFUSE_TEST+3); + tempval &= 0x07; //0x34[30:27] = 4¡¦1110 => LDOE25 voltage select to 2.25V Suggested by SD1 Jackie & DD -Tm_lin + //tempval |= (VOLTAGE_V25 << 4); + tempval |= 0x70; + rtw_write8(pAdapter, EFUSE_TEST+3, (tempval | 0x80)); } + } else - { - rtw_write8(pAdapter, REG_EFUSE_ACCESS_JAGUAR, EFUSE_ACCESS_OFF_JAGUAR); - + { + rtw_write8(pAdapter, REG_EFUSE_ACCESS, EFUSE_ACCESS_OFF_8192E); + if(bWrite == _TRUE){ // Disable LDO 2.5V after read/write action tempval = rtw_read8(pAdapter, EFUSE_TEST+3); @@ -2141,6 +2160,22 @@ Hal_EfuseReadEFuse8192E( } } + else{//deal with error offset,skip error data + DBG_871X_LEVEL(_drv_always_, "invalid offset:0x%02x \n",offset); + for(i=0; i= EFUSE_REAL_CONTENT_LEN_8192E) + break; + eFuse_Addr++; + efuse_utilized++; + if(eFuse_Addr >= EFUSE_REAL_CONTENT_LEN_8192E) + break; + } + } + } // Read next PG header ReadEFuseByte(Adapter, eFuse_Addr, rtemp8, bPseudoTest); @@ -3517,7 +3552,7 @@ static void hw_var_set_macaddr(PADAPTER Adapter, u8 variable, u8* val) for(idx = 0 ; idx < 6; idx++) { - rtw_write8(Adapter, (reg_macid+idx), val[idx]); + rtw_write8(GET_PRIMARY_ADAPTER(Adapter), (reg_macid+idx), val[idx]); } } @@ -3566,7 +3601,21 @@ static void hw_var_set_bcn_func(PADAPTER Adapter, u8 variable, u8* val) } else { - rtw_write8(Adapter, bcn_ctrl_reg, rtw_read8(Adapter, bcn_ctrl_reg)&(~(EN_BCN_FUNCTION | EN_TXBCN_RPT))); + //rtw_write8(Adapter, bcn_ctrl_reg, rtw_read8(Adapter, bcn_ctrl_reg)&(~(EN_BCN_FUNCTION | EN_TXBCN_RPT))); + u8 val8; + val8 = rtw_read8(Adapter, bcn_ctrl_reg); + val8 &= ~(EN_BCN_FUNCTION | EN_TXBCN_RPT); + +#ifdef CONFIG_BT_COEXIST + if (GET_HAL_DATA(Adapter)->EEPROMBluetoothCoexist == 1) + { + // Always enable port0 beacon function for PSTDMA + if (REG_BCN_CTRL == bcn_ctrl_reg) + val8 |= EN_BCN_FUNCTION; + } +#endif + + rtw_write8(Adapter, bcn_ctrl_reg, val8); } @@ -4091,8 +4140,20 @@ _BeaconFunctionEnable( VOID _InitBeaconParameters_8192E(IN PADAPTER Adapter) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + u16 val16; + u8 val8; - rtw_write16(Adapter, REG_BCN_CTRL, 0x1010); + val8 = DIS_TSF_UDT; + val16 = val8 | (val8 << 8); // port0 and port1 +#ifdef CONFIG_BT_COEXIST + if (pHalData->EEPROMBluetoothCoexist == 1) + { + // Enable prot0 beacon function for PSTDMA + val16 |= EN_BCN_FUNCTION; + } +#endif + rtw_write16(Adapter, REG_BCN_CTRL, val16); + //rtw_write16(Adapter, REG_BCN_CTRL, 0x1010); // TODO: Remove these magic number rtw_write16(Adapter, REG_TBTT_PROHIBIT,0x6404);// ms @@ -4283,32 +4344,36 @@ _func_enter_; hw_var_set_bssid(Adapter, variable, val); break; case HW_VAR_BASIC_RATE: - { - u16 BrateCfg = 0; - u8 RateIndex = 0; + { + struct mlme_ext_info *mlmext_info = &Adapter->mlmeextpriv.mlmext_info; + u16 input_b = 0, masked = 0, ioted = 0, BrateCfg = 0; + u16 rrsr_2g_force_mask = (RRSR_11M|RRSR_5_5M|RRSR_1M); + u16 rrsr_2g_allow_mask = (RRSR_24M|RRSR_12M|RRSR_6M|RRSR_CCK_RATES); - // 2007.01.16, by Emily - // Select RRSR (in Legacy-OFDM and CCK) - // For 8190, we select only 24M, 12M, 6M, 11M, 5.5M, 2M, and 1M from the Basic rate. - // We do not use other rates. - HalSetBrateCfg( Adapter, val, &BrateCfg ); - - //2011.03.30 add by Luke Lee - //CCK 2M ACK should be disabled for some BCM and Atheros AP IOT - //because CCK 2M has poor TXEVM - //CCK 5.5M & 11M ACK should be enabled for better performance + HalSetBrateCfg(Adapter, val, &BrateCfg); + input_b = BrateCfg; - pHalData->BasicRateSet = BrateCfg = (BrateCfg |0xd) & 0x15d; - BrateCfg |= 0x01; // default enable 1M ACK rate - - DBG_8192C(FUNC_ADPT_FMT" HW_VAR_BASIC_RATE: BrateCfg(%#x)\n", FUNC_ADPT_ARG(Adapter),BrateCfg); - - // Set RRSR rate table. - rtw_write8(Adapter, REG_RRSR, BrateCfg&0xff); - rtw_write8(Adapter, REG_RRSR+1, (BrateCfg>>8)&0xff); - rtw_write8(Adapter, REG_RRSR+2, rtw_read8(Adapter, REG_RRSR+2)&0xf0); - + /* apply force and allow mask */ + BrateCfg |= rrsr_2g_force_mask; + BrateCfg &= rrsr_2g_allow_mask; + masked = BrateCfg; + + /* IOT consideration */ + if (mlmext_info->assoc_AP_vendor == HT_IOT_PEER_CISCO) { + /* if peer is cisco and didn't use ofdm rate, we enable 6M ack */ + if((BrateCfg & (RRSR_24M|RRSR_12M|RRSR_6M)) == 0) + BrateCfg |= RRSR_6M; } + ioted = BrateCfg; + + pHalData->BasicRateSet = BrateCfg; + + DBG_8192C("HW_VAR_BASIC_RATE: %#x -> %#x -> %#x\n", input_b, masked, ioted); + + // Set RRSR rate table. + rtw_write16(Adapter, REG_RRSR, BrateCfg); + rtw_write8(Adapter, REG_RRSR+2, rtw_read8(Adapter, REG_RRSR+2)&0xf0); + } break; case HW_VAR_TXPAUSE: rtw_write8(Adapter, REG_TXPAUSE, *((u8 *)val)); @@ -4390,6 +4455,10 @@ _func_enter_; break; case HW_VAR_MLME_SITESURVEY: hw_var_set_mlme_sitesurvey(Adapter, variable, val); +#ifdef CONFIG_BT_COEXIST + if (pHalData->EEPROMBluetoothCoexist == 1) + rtw_btcoex_ScanNotify(Adapter, *val?_TRUE:_FALSE); +#endif // CONFIG_BT_COEXIST break; case HW_VAR_MLME_JOIN: #ifdef CONFIG_CONCURRENT_MODE @@ -4445,6 +4514,26 @@ _func_enter_; rtw_write16(Adapter, REG_RL, RetryLimit << RETRY_LIMIT_SHORT_SHIFT | RetryLimit << RETRY_LIMIT_LONG_SHIFT); } #endif +#ifdef CONFIG_BT_COEXIST + if (pHalData->EEPROMBluetoothCoexist == 1) + { + switch (*val) + { + case 0: + // prepare to join + rtw_btcoex_ConnectNotify(Adapter, _TRUE); + break; + case 1: + // joinbss_event callback when join res < 0 + rtw_btcoex_ConnectNotify(Adapter, _FALSE); + break; + case 2: + // sta add event callback +// rtw_btcoex_MediaStatusNotify(padapter, RT_MEDIA_CONNECT); + break; + } + } +#endif // CONFIG_BT_COEXIST break; case HW_VAR_ON_RCR_AM: @@ -4532,13 +4621,6 @@ _func_enter_; rtw_write8(Adapter, REG_TRXPTCL_CTL_8192E+2, regTmp); } break; - case HW_VAR_SEC_CFG: -#ifdef CONFIG_CONCURRENT_MODE - rtw_write8(Adapter, REG_SECCFG, 0x0c|BIT(5));// enable tx enc and rx dec engine, and no key search for MC/BC -#else - rtw_write8(Adapter, REG_SECCFG, *((u8 *)val)); -#endif - break; case HW_VAR_CAM_EMPTY_ENTRY: { u8 ucIndex = *((u8 *)val); @@ -4627,42 +4709,7 @@ _func_enter_; rtw_write8(Adapter, REG_ACMHWCTRL, AcmCtrl ); } break; - case HW_VAR_AMPDU_MIN_SPACE: - { - u8 MinSpacingToSet; - u8 SecMinSpace; - - MinSpacingToSet = *((u8 *)val); - pHalData->AMPDUDensity = MinSpacingToSet; - if(MinSpacingToSet <= 7) - { - switch(Adapter->securitypriv.dot11PrivacyAlgrthm) - { - case _NO_PRIVACY_: - case _AES_: - SecMinSpace = 0; - break; - - case _WEP40_: - case _WEP104_: - case _TKIP_: - case _TKIP_WTMIC_: - SecMinSpace = 6; - break; - default: - SecMinSpace = 7; - break; - } - - if(MinSpacingToSet < SecMinSpace){ - MinSpacingToSet = SecMinSpace; - } - - //RT_TRACE(COMP_MLME, DBG_LOUD, ("Set HW_VAR_AMPDU_MIN_SPACE: %#x\n", Adapter->MgntInfo.MinSpaceCfg)); - //rtw_write8(Adapter, REG_AMPDU_MIN_SPACE, (rtw_read8(Adapter, REG_AMPDU_MIN_SPACE) & 0xf8) | MinSpacingToSet); - } - } - break; + case HW_VAR_AMPDU_FACTOR: { u32 AMPDULen = (*(u8 *)val); @@ -4726,37 +4773,10 @@ _func_enter_; rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|(RCR_CBSSID_DATA)); break; #endif //CONFIG_TDLS - case HW_VAR_INITIAL_GAIN: - { - DIG_T *pDigTable = &podmpriv->DM_DigTable; - u32 rx_gain = ((u32 *)(val))[0]; - - if(rx_gain == 0xff){//restore rx gain - ODM_Write_DIG(podmpriv,pDigTable->BackupIGValue); - } - else{ - pDigTable->BackupIGValue = pDigTable->CurIGValue; - ODM_Write_DIG(podmpriv,rx_gain); - } - } - break; case HW_VAR_TRIGGER_GPIO_0: //rtl8192cu_trigger_gpio_0(Adapter); break; -#ifdef CONFIG_BT_COEXIST - case HW_VAR_BT_SET_COEXIST: - { - u8 bStart = (*(u8 *)val); - rtl8812_set_dm_bt_coexist(Adapter, bStart); - } - break; - case HW_VAR_BT_ISSUE_DELBA: - { - u8 dir = (*(u8 *)val); - rtl8812_issue_delete_ba(Adapter, dir); - } - break; -#endif + #ifdef CONFIG_SW_ANTENNA_DIVERSITY case HW_VAR_ANTENNA_DIVERSITY_LINK: @@ -4879,11 +4899,94 @@ _func_enter_; pHalData->bNeedIQK = _TRUE; break; + case HW_VAR_DL_RSVD_PAGE: +#ifdef CONFIG_BT_COEXIST + if (pHalData->EEPROMBluetoothCoexist == 1) + { + if (check_fwstate(&Adapter->mlmepriv, WIFI_AP_STATE) == _TRUE) + { + rtl8192e_download_BTCoex_AP_mode_rsvd_page(Adapter); + } + } +#endif // CONFIG_BT_COEXIST + break; case HW_VAR_APFM_ON_MAC: pHalData->bMacPwrCtrlOn = *val; DBG_8192C("%s: bMacPwrCtrlOn=%d\n", __FUNCTION__, pHalData->bMacPwrCtrlOn); break; - + + case HW_VAR_MACID_SLEEP: + { + u32 reg_macid_sleep; + u8 bit_shift; + u8 id = *(u8*)val; + u32 val32; + + if (id < 32) { + reg_macid_sleep = REG_MACID_SLEEP; + bit_shift = id; + } else if (id < 64) { + reg_macid_sleep = REG_MACID_SLEEP_1; + bit_shift = id-32; + } else if (id < 96) { + reg_macid_sleep = REG_MACID_SLEEP_2; + bit_shift = id-64; + } else if (id < 128) { + reg_macid_sleep = REG_MACID_SLEEP_3; + bit_shift = id-96; + } else { + rtw_warn_on(1); + break; + } + + val32 = rtw_read32(Adapter, reg_macid_sleep); + DBG_8192C(FUNC_ADPT_FMT ": [HW_VAR_MACID_SLEEP] macid=%d, org reg_0x%03x=0x%08X\n", + FUNC_ADPT_ARG(Adapter), id, reg_macid_sleep, val32); + + if (val32 & BIT(bit_shift)) + break; + + val32 |= BIT(bit_shift); + rtw_write32(Adapter, reg_macid_sleep, val32); + } + break; + + case HW_VAR_MACID_WAKEUP: + { + u32 reg_macid_sleep; + u8 bit_shift; + u8 id = *(u8*)val; + u32 val32; + + if (id < 32) { + reg_macid_sleep = REG_MACID_SLEEP; + bit_shift = id; + } else if (id < 64) { + reg_macid_sleep = REG_MACID_SLEEP_1; + bit_shift = id-32; + } else if (id < 96) { + reg_macid_sleep = REG_MACID_SLEEP_2; + bit_shift = id-64; + } else if (id < 128) { + reg_macid_sleep = REG_MACID_SLEEP_3; + bit_shift = id-96; + } else { + rtw_warn_on(1); + break; + } + + val32 = rtw_read32(Adapter, reg_macid_sleep); + //DBG_8192C(FUNC_ADPT_FMT ": [HW_VAR_MACID_WAKEUP] macid=%d, org reg_0x%03x=0x%08X\n", + // FUNC_ADPT_ARG(Adapter), id, reg_macid_sleep, val32); + + if (!(val32 & BIT(bit_shift))) + break; + + val32 &= ~BIT(bit_shift); + rtw_write32(Adapter, reg_macid_sleep, val32); + } + break; + default: SetHwReg(Adapter, variable, val); break; @@ -4892,6 +4995,73 @@ _func_enter_; _func_exit_; } +struct qinfo_92e { + u32 head:8; + u32 pkt_num:7; + u32 tail:8; + u32 ac:2; + u32 macid:7; +}; + +struct bcn_qinfo_92e { + u16 head:8; + u16 pkt_num:8; +}; + +void dump_qinfo_92e(void *sel, struct qinfo_92e *info, const char *tag) +{ + //if (info->pkt_num) + DBG_871X_SEL_NL(sel, "%shead:0x%02x, tail:0x%02x, pkt_num:%u, macid:%u, ac:%u\n" + , tag ? tag : "", info->head, info->tail, info->pkt_num, info->macid, info->ac + ); +} + +void dump_bcn_qinfo_92e(void *sel, struct bcn_qinfo_92e *info, const char *tag) +{ + //if (info->pkt_num) + DBG_871X_SEL_NL(sel, "%shead:0x%02x, pkt_num:%u\n" + , tag ? tag : "", info->head, info->pkt_num + ); +} + +void dump_mac_qinfo_92e(void *sel, _adapter *adapter) +{ + u32 q0_info; + u32 q1_info; + u32 q2_info; + u32 q3_info; + u32 q4_info; + u32 q5_info; + u32 q6_info; + u32 q7_info; + u32 mg_q_info; + u32 hi_q_info; + u16 bcn_q_info; + + q0_info = rtw_read32(adapter, REG_Q0_INFO); + q1_info = rtw_read32(adapter, REG_Q1_INFO); + q2_info = rtw_read32(adapter, REG_Q2_INFO); + q3_info = rtw_read32(adapter, REG_Q3_INFO); + q4_info = rtw_read32(adapter, REG_Q4_INFO); + q5_info = rtw_read32(adapter, REG_Q5_INFO); + q6_info = rtw_read32(adapter, REG_Q6_INFO); + q7_info = rtw_read32(adapter, REG_Q7_INFO); + mg_q_info = rtw_read32(adapter, REG_MGQ_INFO); + hi_q_info = rtw_read32(adapter, REG_HGQ_INFO); + bcn_q_info = rtw_read16(adapter, REG_BCNQ_INFO); + + dump_qinfo_92e(sel, (struct qinfo_92e *)&q0_info, "Q0 "); + dump_qinfo_92e(sel, (struct qinfo_92e *)&q1_info, "Q1 "); + dump_qinfo_92e(sel, (struct qinfo_92e *)&q2_info, "Q2 "); + dump_qinfo_92e(sel, (struct qinfo_92e *)&q3_info, "Q3 "); + dump_qinfo_92e(sel, (struct qinfo_92e *)&q4_info, "Q4 "); + dump_qinfo_92e(sel, (struct qinfo_92e *)&q5_info, "Q5 "); + dump_qinfo_92e(sel, (struct qinfo_92e *)&q6_info, "Q6 "); + dump_qinfo_92e(sel, (struct qinfo_92e *)&q7_info, "Q7 "); + dump_qinfo_92e(sel, (struct qinfo_92e *)&mg_q_info, "MG "); + dump_qinfo_92e(sel, (struct qinfo_92e *)&hi_q_info, "HI "); + dump_bcn_qinfo_92e(sel, (struct bcn_qinfo_92e *)&bcn_q_info, "BCN "); +} void GetHwReg8192E(PADAPTER Adapter, u8 variable, u8* val) { @@ -4949,7 +5119,7 @@ _func_enter_; *((u16 *)(val)) = pHalData->EfuseUsedBytes; break; case HW_VAR_CHK_HI_QUEUE_EMPTY: - //*val = ((rtw_read32(Adapter, REG_HGQ_INFORMATION)&0x00007f00)==0) ? _TRUE:_FALSE; + //*val = ((rtw_read32(Adapter, REG_HGQ_INFO)&0x00007f00)==0) ? _TRUE:_FALSE; *val = (rtw_read16(Adapter, REG_TXPKT_EMPTY)&BIT(10)) ? _TRUE:_FALSE; break; case HW_VAR_APFM_ON_MAC: @@ -4958,6 +5128,9 @@ _func_enter_; case HW_VAR_SYS_CLKR: *val = rtw_read8(Adapter, REG_SYS_CLKR); break; + case HW_VAR_DUMP_MAC_QUEUE_INFO: + dump_mac_qinfo_92e(val, Adapter); + break; default: GetHwReg(Adapter, variable, val); break; @@ -5105,6 +5278,10 @@ GetHalDefVar8192E( } break; + case HAL_DEF_MACID_SLEEP: + *(u8*)pValue = _TRUE; // support macid sleep + break; + default: bResult = GetHalDefVar(Adapter, eVariable, pValue); break; @@ -5119,14 +5296,13 @@ void rtl8192E_GetHalODMVar( PADAPTER Adapter, HAL_ODM_VARIABLE eVariable, PVOID pValue1, - BOOLEAN bSet) + PVOID pValue2) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); PDM_ODM_T podmpriv = &pHalData->odmpriv; - switch(eVariable){ - case HAL_ODM_STA_INFO: - break; + switch(eVariable){ default: + GetHalODMVar(Adapter,eVariable,pValue1,pValue2); break; } } @@ -5140,30 +5316,9 @@ void rtl8192E_SetHalODMVar( HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); PDM_ODM_T podmpriv = &pHalData->odmpriv; //_irqL irqL; - switch(eVariable){ - case HAL_ODM_STA_INFO: - { - struct sta_info *psta = (struct sta_info *)pValue1; - if(bSet){ - DBG_8192C("### Set STA_(%d) info\n",psta->mac_id); - ODM_CmnInfoPtrArrayHook(podmpriv, ODM_CMNINFO_STA_STATUS,psta->mac_id,psta); - } - else{ - DBG_8192C("### Clean STA_(%d) info\n",psta->mac_id); - //_enter_critical_bh(&pHalData->odm_stainfo_lock, &irqL); - ODM_CmnInfoPtrArrayHook(podmpriv, ODM_CMNINFO_STA_STATUS,psta->mac_id,NULL); - - //_exit_critical_bh(&pHalData->odm_stainfo_lock, &irqL); - } - } - break; - case HAL_ODM_P2P_STATE: - ODM_CmnInfoUpdate(podmpriv,ODM_CMNINFO_WIFI_DIRECT,bSet); - break; - case HAL_ODM_WIFI_DISPLAY_STATE: - ODM_CmnInfoUpdate(podmpriv,ODM_CMNINFO_WIFI_DISPLAY,bSet); - break; + switch(eVariable){ default: + SetHalODMVar(Adapter,eVariable,pValue1,bSet); break; } } @@ -5298,8 +5453,11 @@ void UpdateHalRAMask8192E(PADAPTER padapter, u32 mac_id, u8 rssi_level) mask &= rate_bitmap; #ifdef CONFIG_BT_COEXIST + if (pHalData->EEPROMBluetoothCoexist == 1) + { rate_bitmap = rtw_btcoex_GetRaMask(padapter); mask &= ~rate_bitmap; + } #endif // CONFIG_BT_COEXIST arg[0] = mac_id; @@ -5326,6 +5484,10 @@ void rtl8192e_init_default_value(_adapter * padapter) if(!pwrctrlpriv->bkeepfwalive) pHalData->LastHMEBoxNum = 0; + /* hal capability values */ + pHalData->macid_num = MACID_NUM_8192E; + pHalData->cam_entry_num = CAM_ENTRY_NUM_8192E; + //init dm default value pHalData->odmpriv.RFCalibrateInfo.bIQKInitialized = _FALSE; pHalData->odmpriv.RFCalibrateInfo.TM_Trigger = 0;//for IQK @@ -5389,6 +5551,70 @@ void rtl8192e_init_default_value(_adapter * padapter) _rtw_memset(pHalData->EfuseHal.fakeEfuseModifiedMap, 0xFF, EFUSE_MAX_MAP_LEN); } +#ifdef CONFIG_BT_COEXIST +void rtl8192e_combo_card_WifiOnlyHwInit(PADAPTER Adapter) +{ + u8 u1Tmp; + u16 u2Tmp; + u32 u4Tmp; + + DBG_871X("%s !\n", __FUNCTION__); + + //antenna fixed to wifi + rtw_write8(Adapter, 0x944, 0x24); + rtw_write32(Adapter, 0x930, 0x700700); + rtw_write8(Adapter, 0x92c, 0x04); +#ifdef CONFIG_USB_HCI + rtw_write32(Adapter, REG_PAD_CTRL1_8192E, 0x30430004); +#else + rtw_write32(Adapter, REG_PAD_CTRL1_8192E, 0x30030004); +#endif + // 0x4c[27][24]='00', Set Antenna to BB + u4Tmp = rtw_read32(Adapter, BIT_REG_LED_CFG_8192E); + u4Tmp &= ~BIT24; + u4Tmp &= ~BIT27; + rtw_write32(Adapter, BIT_REG_LED_CFG_8192E, u4Tmp); + + //coex. table + rtw_write32(Adapter , REG_BT_COEX_TABLE0_8192E, 0x55555555); + rtw_write32(Adapter , REG_BT_COEX_TABLE1_8192E, 0x55555555); + rtw_write32(Adapter , REG_BT_COEX_TABLE2_8192E, 0xffffff); + rtw_write32(Adapter , REG_BT_COEX_TABLE3_8192E, 0x3); + // coex parameters + rtw_write8(Adapter, REG_BT_STATISTICS_OTH_CTRL_8192E, 0x3); + // 0x790[5:0]=0x5 + u1Tmp = rtw_read8(Adapter, REG_TDMA_TIME_AND_RPT_SAM_SET_8192E); + u1Tmp &= 0xc0; + u1Tmp |= 0x5; + rtw_write8(Adapter, REG_TDMA_TIME_AND_RPT_SAM_SET_8192E, u1Tmp); + + // enable counter statistics + rtw_write8(Adapter, REG_BT_STATISTICS_CTRL_8192E, 0x4); + + // enable PTA + rtw_write8(Adapter, REG_GPIO_MUXCFG_8192E, 0x20); + // enable mailbox interface + u2Tmp = rtw_read16(Adapter, REG_GPIO_MUXCFG_8192E); + u2Tmp |= BIT9; + rtw_write16(Adapter, REG_GPIO_MUXCFG_8192E, u2Tmp); + + // enable PTA I2C mailbox + u1Tmp = rtw_read8(Adapter, REG_CR_8192E+1); + u1Tmp |= BIT4; + rtw_write8(Adapter, REG_CR_8192E+1, u1Tmp); + + // enable bt clock when wifi is disabled. + u1Tmp = rtw_read8(Adapter, REG_WLLPS_CTRL_8192E+3); + u1Tmp |= BIT0; + rtw_write8(Adapter, REG_WLLPS_CTRL_8192E+3, u1Tmp); + // enable bt clock when suspend. + u1Tmp = rtw_read8(Adapter, REG_SYS_PW_CTRL_8192E+3); + u1Tmp |= BIT0; + rtw_write8(Adapter, REG_SYS_PW_CTRL_8192E+3, u1Tmp); + +} +#endif //CONFIG_BT_COEXIST + void rtl8192e_set_hal_ops(struct hal_ops *pHalFunc) { pHalFunc->free_hal_data = &rtl8192e_free_hal_data; @@ -5445,9 +5671,10 @@ void rtl8192e_set_hal_ops(struct hal_ops *pHalFunc) pHalFunc->GetHalODMVarHandler = &rtl8192E_GetHalODMVar; pHalFunc->SetHalODMVarHandler = &rtl8192E_SetHalODMVar; //pHalFunc->hal_notch_filter = &hal_notch_filter_rtl8192E; - pHalFunc->UpdateRAMaskHandler = &UpdateHalRAMask8192E; - + pHalFunc->UpdateRAMaskHandler = &UpdateHalRAMask8192E; + + pHalFunc->c2h_handler = c2h_handler_8192e; + + pHalFunc->fill_h2c_cmd = FillH2CCmd_8192E; } - - diff --git a/hal/rtl8192e/rtl8192e_mp.c b/hal/rtl8192e/rtl8192e_mp.c index 96dece6..d697cb8 100644 --- a/hal/rtl8192e/rtl8192e_mp.c +++ b/hal/rtl8192e/rtl8192e_mp.c @@ -392,12 +392,12 @@ void Hal_SetCCKTxPower(PADAPTER pAdapter, u8 *TxPower) // rf-A cck tx power write_bbreg(pAdapter, rTxAGC_A_CCK1_Mcs32, bMaskByte1, TxPower[RF_PATH_A]); tmpval = (TxPower[RF_PATH_A]<<16) | (TxPower[RF_PATH_A]<<8) | TxPower[RF_PATH_A]; - write_bbreg(pAdapter, rTxAGC_B_CCK11_A_CCK2_11, 0xffffff00, tmpval); + write_bbreg(pAdapter, rTxAGC_B_CCK11_A_CCK2_11, bMaskH3Bytes, tmpval); // rf-B cck tx power write_bbreg(pAdapter, rTxAGC_B_CCK11_A_CCK2_11, bMaskByte0, TxPower[RF_PATH_B]); tmpval = (TxPower[RF_PATH_B]<<16) | (TxPower[RF_PATH_B]<<8) | TxPower[RF_PATH_B]; - write_bbreg(pAdapter, rTxAGC_B_CCK1_55_Mcs32, 0xffffff00, tmpval); + write_bbreg(pAdapter, rTxAGC_B_CCK1_55_Mcs32, bMaskH3Bytes, tmpval); RT_TRACE(_module_mp_, _drv_notice_, ("-SetCCKTxPower: A[0x%02x] B[0x%02x]\n", @@ -750,7 +750,6 @@ void Hal_TriggerRFThermalMeter(PADAPTER pAdapter) { PHY_SetRFReg(pAdapter, ODM_RF_PATH_A, RF_T_METER_8192E, BIT17 | BIT16, 0x03); - // RT_TRACE(_module_mp_,_drv_alert_, ("TriggerRFThermalMeter() finished.\n" )); } @@ -759,10 +758,9 @@ u8 Hal_ReadRFThermalMeter(PADAPTER pAdapter) u32 ThermalValue = 0; //ThermalValue = _read_rfreg(pAdapter, RF_PATH_A, RF_T_METER, 0x1F); // 0x24: RF Reg[4:0] - ThermalValue = (u1Byte)PHY_QueryRFReg(pAdapter, ODM_RF_PATH_A, RF_T_METER_8192E, 0xfc00); // 0x42: RF Reg[15:10] - DBG_871X("%s ThermalValue = 0x%x\n", __FUNCTION__,ThermalValue); - printk("%s ### REG_C80:0x%08x,REG_C88:0x%08x ####\n",__FUNCTION__, - rtw_read32(pAdapter,0xc80),rtw_read32(pAdapter,0xc88)); + ThermalValue = (u1Byte)PHY_QueryRFReg(pAdapter, ODM_RF_PATH_A, RF_T_METER_8192E, 0xfc00); // 0x42: RF Reg[15:10] + DBG_871X("%s ThermalValue = 0x%x\n", __FUNCTION__,ThermalValue); +// RT_TRACE(_module_mp_, _drv_alert_, ("ThermalValue = 0x%x\n", ThermalValue)); return (u8)ThermalValue; } @@ -875,6 +873,7 @@ void Hal_SetSingleToneTx(PADAPTER pAdapter, u8 bStart) } + void Hal_SetCarrierSuppressionTx(PADAPTER pAdapter, u8 bStart) { pAdapter->mppriv.MptCtx.bCarrierSuppression = bStart; diff --git a/hal/rtl8192e/rtl8192e_phycfg.c b/hal/rtl8192e/rtl8192e_phycfg.c index aa3cde5..ac4d662 100644 --- a/hal/rtl8192e/rtl8192e_phycfg.c +++ b/hal/rtl8192e/rtl8192e_phycfg.c @@ -196,7 +196,8 @@ phy_RFSerialWrite( //} // <20121026, Kordan> If 0x818 == 1, the second value written on the previous address. - PHY_SetBBReg(Adapter, ODM_AFE_SETTING, 0x20000, 0x0); + if (IS_HARDWARE_TYPE_8192EU(Adapter)) + PHY_SetBBReg(Adapter, ODM_AFE_SETTING, 0x20000, 0x0); Offset &= 0xff; @@ -1176,7 +1177,28 @@ phy_SpurCalibration_8192E( PHY_SetRFReg(Adapter, ODM_RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask, reg0x18); //restore chnl } - +#ifdef CONFIG_SPUR_CAL_NBI +// to eliminate the 2480MHz spur for 92E suggest by James +void +phy_SpurCalibration_8192E_NBI(PADAPTER Adapter) +{ + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + + //DbgPrint("===> %s CurrentChannelBW = %d, CurrentChannel = %d\n", __FUNCTION__,pHalData->CurrentChannelBW, pHalData->CurrentChannel); + if(pHalData->CurrentChannelBW == CHANNEL_WIDTH_20 &&( pHalData->CurrentChannel == 13 || pHalData->CurrentChannel == 14)){ + PHY_SetBBReg(Adapter, rOFDM0_RxDSP, BIT(9), 0x1); //enable notch filter + PHY_SetBBReg(Adapter, rOFDM1_IntfDet, BIT(8)|BIT(7)|BIT(6), 0x5); //intf_TH + } + else if(pHalData->CurrentChannelBW == CHANNEL_WIDTH_40 && pHalData->CurrentChannel == 11){ + PHY_SetBBReg(Adapter, rOFDM0_RxDSP, BIT(9), 0x1); //enable notch filter + PHY_SetBBReg(Adapter, rOFDM1_IntfDet, BIT(8)|BIT(7)|BIT(6), 0x5); //intf_TH + } + else{ + if(Adapter->registrypriv.notch_filter == 0) + PHY_SetBBReg(Adapter, rOFDM0_RxDSP, BIT(9), 0x0); //disable notch filter + } +} +#endif VOID phy_SwChnl8192E( IN PADAPTER pAdapter @@ -1190,22 +1212,9 @@ phy_SwChnl8192E( //RT_TRACE(COMP_MLME,DBG_LOUD,("phy_SwChnl8192E: return for PSEUDO \n")); return; } - pHalData->RfRegChnlVal[0] = ((pHalData->RfRegChnlVal[0] & 0xfffff00) | channelToSW ); - PHY_SetRFReg(pAdapter, RF_PATH_A, RF_CHNLBW, 0x3FF, pHalData->RfRegChnlVal[0] ); - PHY_SetRFReg(pAdapter, RF_PATH_B, RF_CHNLBW, 0x3FF, pHalData->RfRegChnlVal[0] ); - - -#if 0 //to do - // <20130422, VincentLan> A workaround to eliminate the 2480MHz spur for 92E - if (channelToSW == 13) - { - if (pMgntInfo->RegSpurCalMethod == 1)//if AFE == 40MHz,MAC REG_0X78 - phy_SpurCalibration_8192E(pAdapter, AFE_PHASE_SEL); - else - phy_SpurCalibration_8192E(pAdapter, PLL_RESET); - - } -#endif + //pHalData->RfRegChnlVal[0] = ((pHalData->RfRegChnlVal[0] & 0xfffff00) | channelToSW ); + PHY_SetRFReg(pAdapter, RF_PATH_A, RF_CHNLBW, 0x3FF,channelToSW ); + PHY_SetRFReg(pAdapter, RF_PATH_B, RF_CHNLBW, 0x3FF, channelToSW ); } @@ -1225,6 +1234,7 @@ phy_SwChnlAndSetBwMode8192E( pHalData->CurrentChannel, pHalData->bSetChnlBW, pHalData->CurrentChannelBW); + } if((Adapter->bDriverStopped) || (Adapter->bSurpriseRemoved)) @@ -1242,10 +1252,14 @@ phy_SwChnlAndSetBwMode8192E( { phy_PostSetBwMode8192E(Adapter); pHalData->bSetChnlBW = _FALSE; - } + } + +#ifdef CONFIG_SPUR_CAL_NBI + phy_SpurCalibration_8192E_NBI(Adapter); +#endif + PHY_SetTxPowerLevel8192E(Adapter, pHalData->CurrentChannel); - } VOID @@ -1275,7 +1289,7 @@ PHY_HandleSwChnlAndSetBW8192E( //check is swchnl or setbw if(!bSwitchChannel && !bSetBandWidth) { - DBG_871X("PHY_HandleSwChnlAndSetBW8812: not switch channel and not set bandwidth \n"); + DBG_871X("PHY_HandleSwChnlAndSetBW8192e: not switch channel and not set bandwidth \n"); return; } diff --git a/hal/rtl8192e/rtl8192e_rxdesc.c b/hal/rtl8192e/rtl8192e_rxdesc.c index dbae89b..56116bc 100644 --- a/hal/rtl8192e/rtl8192e_rxdesc.c +++ b/hal/rtl8192e/rtl8192e_rxdesc.c @@ -22,20 +22,6 @@ //#include #include - -static s32 translate2dbm(u8 signal_strength_idx) -{ - s32 signal_power; // in dBm. - - - // Translate to dBm (x=0.5y-95). - signal_power = (s32)((signal_strength_idx + 1) >> 1); - signal_power -= 95; - - return signal_power; -} - - static void process_rssi(_adapter *padapter,union recv_frame *prframe) { u32 last_rssi, tmp_val; @@ -78,10 +64,10 @@ static void process_rssi(_adapter *padapter,union recv_frame *prframe) if(padapter->recvpriv.is_signal_dbg) { padapter->recvpriv.signal_strength= padapter->recvpriv.signal_strength_dbg; - padapter->recvpriv.rssi=(s8)translate2dbm((u8)padapter->recvpriv.signal_strength_dbg); + padapter->recvpriv.rssi=(s8)translate_percentage_to_dbm(padapter->recvpriv.signal_strength_dbg); } else { padapter->recvpriv.signal_strength= tmp_val; - padapter->recvpriv.rssi=(s8)translate2dbm((u8)tmp_val); + padapter->recvpriv.rssi=(s8)translate_percentage_to_dbm(tmp_val); } RT_TRACE(_module_rtl871x_recv_c_,_drv_info_,("UI RSSI = %d, ui_rssi.TotalVal = %d, ui_rssi.TotalNum = %d\n", tmp_val, padapter->recvpriv.signal_strength_data.total_val,padapter->recvpriv.signal_strength_data.total_num)); @@ -251,6 +237,8 @@ void rtl8192e_query_rx_phy_status( !pattrib->icv_err && !pattrib->crc_err && _rtw_memcmp(get_hdr_bssid(wlanhdr), get_bssid(&padapter->mlmepriv), ETH_ALEN)); + pkt_info.bToSelf = ((!pattrib->icv_err) && (!pattrib->crc_err)) && (_rtw_memcmp(get_ra(wlanhdr), myid(&padapter->eeprompriv), ETH_ALEN)); + pkt_info.bPacketToSelf = pkt_info.bPacketMatchBSSID && (_rtw_memcmp(get_ra(wlanhdr), myid(&padapter->eeprompriv), ETH_ALEN)); pkt_info.bPacketBeacon = pkt_info.bPacketMatchBSSID && (GetFrameSubType(wlanhdr) == WIFI_BEACON); @@ -291,6 +279,7 @@ void rtl8192e_query_rx_phy_status( //_enter_critical_bh(&pHalData->odm_stainfo_lock, &irqL); ODM_PhyStatusQuery(&pHalData->odmpriv,pPHYInfo,pphy_status,&(pkt_info)); + if(psta) psta->rssi = pattrib->phy_info.RecvSignalPower; //_exit_critical_bh(&pHalData->odm_stainfo_lock, &irqL); precvframe->u.hdr.psta = NULL; diff --git a/hal/rtl8192e/usb/rtl8192eu_recv.c b/hal/rtl8192e/usb/rtl8192eu_recv.c index 852bbd6..0f4ff8a 100644 --- a/hal/rtl8192e/usb/rtl8192eu_recv.c +++ b/hal/rtl8192e/usb/rtl8192eu_recv.c @@ -77,9 +77,7 @@ int rtl8192eu_init_recv_priv(_adapter *padapter) //init recv_buf _rtw_init_queue(&precvpriv->free_recv_buf_queue); -#ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX _rtw_init_queue(&precvpriv->recv_buf_pending_queue); -#endif // CONFIG_USE_USB_BUFFER_ALLOC_RX precvpriv->pallocated_recv_buf = rtw_zmalloc(NR_RECVBUFF *sizeof(struct recv_buf) + 4); if(precvpriv->pallocated_recv_buf==NULL){ @@ -132,15 +130,23 @@ int rtl8192eu_init_recv_priv(_adapter *padapter) for(i=0; idev = padapter->pnetdev; - + +#ifndef CONFIG_PREALLOC_RX_SKB_BUFFER tmpaddr = (SIZE_PTR)pskb->data; alignment = tmpaddr & (RECVBUFF_ALIGN_SZ-1); skb_reserve(pskb, (RECVBUFF_ALIGN_SZ - alignment)); +#endif //! skb_queue_tail(&precvpriv->free_recv_skb_queue, pskb); } @@ -202,7 +208,24 @@ void rtl8192eu_free_recv_priv (_adapter *padapter) DBG_8192C(KERN_WARNING "free_recv_skb_queue not empty, %d\n", skb_queue_len(&precvpriv->free_recv_skb_queue)); } +#ifdef CONFIG_PREALLOC_RX_SKB_BUFFER + { + int i=0; + struct sk_buff *skb; + + while ((skb = skb_dequeue(&precvpriv->free_recv_skb_queue)) != NULL) + { + if(ifree_recv_skb_queue); +#endif //CONFIG_PREALLOC_RX_SKB_BUFFER #endif diff --git a/hal/rtl8192e/usb/rtl8192eu_xmit.c b/hal/rtl8192e/usb/rtl8192eu_xmit.c index 2bc73ba..13eb3d4 100644 --- a/hal/rtl8192e/usb/rtl8192eu_xmit.c +++ b/hal/rtl8192e/usb/rtl8192eu_xmit.c @@ -279,7 +279,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag SET_TX_DESC_AGG_ENABLE_92E(ptxdesc, 1); SET_TX_DESC_MAX_AGG_NUM_92E(ptxdesc, 0x1f); // Set A-MPDU aggregation. - SET_TX_DESC_AMPDU_DENSITY_92E(ptxdesc, pHalData->AMPDUDensity); + SET_TX_DESC_AMPDU_DENSITY_92E(ptxdesc, pattrib->ampdu_spacing); } else { SET_TX_DESC_BK_92E(ptxdesc, 1); } @@ -745,6 +745,9 @@ s32 rtl8192eu_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv pxmitframe = LIST_CONTAINOR(xmitframe_plist, struct xmit_frame, list); xmitframe_plist = get_next(xmitframe_plist); + if(_FAIL == rtw_hal_busagg_qsel_check(padapter,pfirstframe->attrib.qsel,pxmitframe->attrib.qsel)) + break; + pxmitframe->agg_num = 0; // not first frame of aggregation #ifdef CONFIG_TX_EARLY_MODE pxmitframe->pkt_offset = 1;// not first frame of aggregation,reserve offset for EM Info diff --git a/hal/rtl8192e/usb/usb_halinit.c b/hal/rtl8192e/usb/usb_halinit.c index bf57043..ee1dfc3 100644 --- a/hal/rtl8192e/usb/usb_halinit.c +++ b/hal/rtl8192e/usb/usb_halinit.c @@ -269,6 +269,7 @@ static u32 _InitPowerOn_8192EU(_adapter *padapter) { u16 value16; u32 value32; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); // HW Power on sequence u8 bMacPwrCtrlOn=_FALSE; @@ -282,6 +283,10 @@ static u32 _InitPowerOn_8192EU(_adapter *padapter) if(value32 & BIT_SPSLDO_SEL){ //LDO rtw_write8(padapter, REG_LDO_SWR_CTRL, 0xC3); + if( IS_B_CUT(pHalData->VersionID)){ + u32 voltage = (rtw_read32(padapter,0x14)& 0xFF0FFFFF )|(0x05<<20); + rtw_write32(padapter,0x14,voltage); + } } else { //SPS @@ -314,7 +319,7 @@ static u32 _InitPowerOn_8192EU(_adapter *padapter) bMacPwrCtrlOn = _TRUE; rtw_hal_set_hwreg(padapter, HW_VAR_APFM_ON_MAC, &bMacPwrCtrlOn); - + return _SUCCESS; } @@ -945,6 +950,8 @@ HalDetectSelectiveSuspendMode( } #endif } // HalDetectSelectiveSuspendMode + +#if 0 /*----------------------------------------------------------------------------- * Function: HwSuspendModeEnable92Cu() * @@ -1002,6 +1009,8 @@ HwSuspendModeEnable_8192EU( } } // HwSuspendModeEnable92Cu +#endif + rt_rf_power_state RfOnOffDetect(IN PADAPTER pAdapter ) { struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(pAdapter); @@ -1063,9 +1072,7 @@ u32 rtl8192eu_hal_init(PADAPTER Adapter) struct registry_priv *pregistrypriv = &Adapter->registrypriv; rt_rf_power_state eRfPowerStateToSet; -#ifdef CONFIG_BT_COEXIST - struct btcoexist_priv *pbtpriv = &(pHalData->bt_coexist); -#endif + u32 init_start_time = rtw_get_current_time(); @@ -1418,11 +1425,12 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MISC11); // rtw_write32(Adapter, REG_BAR_MODE_CTRL, 0x0201ffff); - if(pregistrypriv->wifi_spec) + if(pregistrypriv->wifi_spec){ rtw_write16(Adapter,REG_FAST_EDCA_CTRL ,0); - //Nav limit , suggest by scott - rtw_write8(Adapter, 0x652, 0x0); + //Nav limit , suggest by SD1-Pisa,disable NAV_UPPER function when wifi_spec=1 for Test item: 5.2.3 + rtw_write8(Adapter, REG_NAV_UPPER, 0x0); + } HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_INIT_HAL_DM); rtl8192e_InitHalDm(Adapter); @@ -1447,95 +1455,6 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_INIT_HAL_DM); // Added by tynli. 2010.03.30. pwrctrlpriv->rf_pwrstate = rf_on; -#if 0 //to do - RT_CLEAR_PS_LEVEL(pwrctrlpriv, RT_RF_OFF_LEVL_HALT_NIC); -#if 1 //Todo - // 20100326 Joseph: Copy from GPIOChangeRFWorkItemCallBack() function to check HW radio on/off. - // 20100329 Joseph: Revise and integrate the HW/SW radio off code in initialization. - - eRfPowerStateToSet = (rt_rf_power_state) RfOnOffDetect(Adapter); - pwrctrlpriv->rfoff_reason |= eRfPowerStateToSet==rf_on ? RF_CHANGE_BY_INIT : RF_CHANGE_BY_HW; - pwrctrlpriv->rfoff_reason |= (pwrctrlpriv->reg_rfoff) ? RF_CHANGE_BY_SW : 0; - - if(pwrctrlpriv->rfoff_reason&RF_CHANGE_BY_HW) - pwrctrlpriv->b_hw_radio_off = _TRUE; - - DBG_8192C("eRfPowerStateToSet=%d\n", eRfPowerStateToSet); - - if(pwrctrlpriv->reg_rfoff == _TRUE) - { // User disable RF via registry. - DBG_8192C("InitializeAdapter8192CU(): Turn off RF for RegRfOff.\n"); - //MgntActSet_RF_State(Adapter, rf_off, RF_CHANGE_BY_SW, _TRUE); - - // Those action will be discard in MgntActSet_RF_State because off the same state - //for(eRFPath = 0; eRFPath NumTotalRFPath; eRFPath++) - //PHY_SetRFReg(Adapter, eRFPath, 0x4, 0xC00, 0x0); - } - else if(pwrctrlpriv->rfoff_reason > RF_CHANGE_BY_PS) - { // H/W or S/W RF OFF before sleep. - DBG_8192C(" Turn off RF for RfOffReason(%x) ----------\n", pwrctrlpriv->rfoff_reason); - //pwrctrlpriv->rfoff_reason = RF_CHANGE_BY_INIT; - pwrctrlpriv->rf_pwrstate = rf_on; - //MgntActSet_RF_State(Adapter, rf_off, pwrctrlpriv->rfoff_reason, _TRUE); - } - else - { - // Perform GPIO polling to find out current RF state. added by Roger, 2010.04.09. - if(pHalData->BoardType == BOARD_MINICARD /*&& (Adapter->MgntInfo.PowerSaveControl.bGpioRfSw)*/) - { - DBG_8192C("InitializeAdapter8192CU(): RF=%d \n", eRfPowerStateToSet); - if (eRfPowerStateToSet == rf_off) - { - //MgntActSet_RF_State(Adapter, rf_off, RF_CHANGE_BY_HW, _TRUE); - pwrctrlpriv->b_hw_radio_off = _TRUE; - } - else - { - pwrctrlpriv->rf_pwrstate = rf_off; - pwrctrlpriv->rfoff_reason = RF_CHANGE_BY_INIT; - pwrctrlpriv->b_hw_radio_off = _FALSE; - //MgntActSet_RF_State(Adapter, rf_on, pwrctrlpriv->rfoff_reason, _TRUE); - } - } - else - { - pwrctrlpriv->rf_pwrstate = rf_off; - pwrctrlpriv->rfoff_reason = RF_CHANGE_BY_INIT; - //MgntActSet_RF_State(Adapter, rf_on, pwrctrlpriv->rfoff_reason, _TRUE); - } - - pwrctrlpriv->rfoff_reason = 0; - pwrctrlpriv->b_hw_radio_off = _FALSE; - pwrctrlpriv->rf_pwrstate = rf_on; - rtw_led_control(Adapter, LED_CTL_POWER_ON); - - } - - // 2010/-8/09 MH For power down module, we need to enable register block contrl reg at 0x1c. - // Then enable power down control bit of register 0x04 BIT4 and BIT15 as 1. - if(pHalData->pwrdown && eRfPowerStateToSet == rf_off) - { - // Enable register area 0x0-0xc. - rtw_write8(Adapter, REG_RSV_CTRL, 0x0); - - // - // We should configure HW PDn source for WiFi ONLY, and then - // our HW will be set in power-down mode if PDn source from all functions are configured. - // 2010.10.06. - // - //if(IS_HARDWARE_TYPE_8723AU(Adapter)) - //{ - // u1bTmp = rtw_read8(Adapter, REG_MULTI_FUNC_CTRL); - // rtw_write8(Adapter, REG_MULTI_FUNC_CTRL, (u1bTmp|WL_HWPDN_EN)); - //} - //else - //{ - rtw_write16(Adapter, REG_APS_FSMCO, 0x8812); - //} - } - //DrvIFIndicateCurrentPhyStatus(Adapter); // 2010/08/17 MH Disable to prevent BSOD. -#endif -#endif //0x4c6[3] 1: RTS BW = Data BW //0: RTS BW depends on CCA / secondary CCA result. @@ -1576,7 +1495,7 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_PW_TRACK); HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_LCK); //PHY_LCCalibrate_8192E((GET_HAL_DATA(Adapter)->odmpriv)); } - +} #ifdef CONFIG_HIGH_CHAN_SUPER_CALIBRATION rtw_hal_set_chnl_bw(Adapter, 13, CHANNEL_WIDTH_20, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HAL_PRIME_CHNL_OFFSET_DONT_CARE); @@ -1592,7 +1511,7 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_LCK); rtw_hal_set_chnl_bw(Adapter, Adapter->registrypriv.channel, CHANNEL_WIDTH_20, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HAL_PRIME_CHNL_OFFSET_DONT_CARE); #endif -} + HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MISC21); @@ -1601,8 +1520,21 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MISC21); // _InitPABias(Adapter); #ifdef CONFIG_BT_COEXIST -HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_BT_COEXIST); - //_InitBTCoexist(Adapter); + HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_BT_COEXIST); + + if ( pHalData->EEPROMBluetoothCoexist == 1) + { + // YiWei 20140624 , Fix 8192eu mailbox BT info no response issue reduce I2C clock rate to 156KHz (default 1.25Mhz) + rtw_write8(Adapter, rPMAC_TxPacketNum, rtw_read8(Adapter, rPMAC_TxPacketNum)|0x7); + + // Init BT hw config. + rtw_btcoex_HAL_Initialize(Adapter, _FALSE); + } + else + { + // In combo card run wifi only , must setting some hardware reg. + rtl8192e_combo_card_WifiOnlyHwInit(Adapter); + } #endif // 2010/08/23 MH According to Alfred's suggestion, we need to to prevent HW enter @@ -1733,21 +1665,9 @@ u32 rtl8192eu_hal_deinit(PADAPTER Adapter) HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); DBG_8192C("==> %s \n",__FUNCTION__); -#ifdef CONFIG_BT_COEXIST - if (BT_IsBtExist(Adapter)) - { - DBG_871X("BT module enable SIC\n"); - // Only under WIN7 we can support selective suspend and enter D3 state when system call halt adapter. - - //rtw_write16(Adapter, REG_GPIO_MUXCFG, rtw_read16(Adapter, REG_GPIO_MUXCFG)|BIT12); - // 2010/10/13 MH If we enable SIC in the position and then call _ResetDigitalProcedure1. in XP, - // the system will hang due to 8051 reset fail. - } - else -#endif - { - rtw_write16(Adapter, REG_GPIO_MUXCFG, rtw_read16(Adapter, REG_GPIO_MUXCFG)&(~BIT12)); - } + + rtw_write16(Adapter, REG_GPIO_MUXCFG, rtw_read16(Adapter, REG_GPIO_MUXCFG)&(~BIT12)); + if(pHalData->bSupportUSB3 == _TRUE) { @@ -2269,16 +2189,36 @@ _func_enter_; case HW_VAR_RXDMA_AGG_PG_TH: #ifdef CONFIG_USB_RX_AGGREGATION { + //threshold == 1 , Disable Rx-agg when AP is B/G mode or wifi_spec=1 to prevent bad TP. + u8 threshold = *((u8 *)val); - if( threshold == 0) - { + if( threshold == 0){ threshold = (pHalData->RegAcUsbDmaSize & 0x0F); } - rtw_write8(Adapter, REG_RXDMA_AGG_PG_TH, threshold); - //threshold == 1 ,disable RX AGG - if( (pHalData->UsbRxAggMode == USB_RX_AGG_USB) && (threshold == 1)) - rtw_write8(Adapter, REG_RXDMA_AGG_PG_TH+1, 0); + + #ifdef CONFIG_80211N_HT + { + // 2014-07-24 Fix WIFI Logo -5.2.4/5.2.9 - DT3 low TP issue + // Adjust RxAggrTimeout to close to zero disable RxAggr for RxAgg-USB mode, suggested by designer + // Timeout value is calculated by 34 / (2^n) + + struct mlme_priv *pmlmepriv = &Adapter->mlmepriv; + struct ht_priv *phtpriv = &pmlmepriv->htpriv; + + if(pHalData->UsbRxAggMode == USB_RX_AGG_USB){ + #if 1 + //BG mode || (wifi_spec=1 && BG mode Testbed) + if((threshold == 1) && (_FALSE == phtpriv->ht_option) ) + #else + //(wifi_spec=1 && BG mode Testbed) + if((Adapter->registrypriv.wifi_spec==1) && (_FALSE == phtpriv->ht_option) ) + #endif + rtw_write8(Adapter, REG_RXDMA_AGG_PG_TH+1, 0); + } + } + #endif//#ifdef CONFIG_80211N_HT + } #endif break; @@ -2358,6 +2298,7 @@ _func_enter_; pwrctl->wowlan_wake_reason = rtw_read8(Adapter, REG_WOWLAN_WAKE_REASON); DBG_871X_LEVEL(_drv_always_, "wowlan_wake_reason: 0x%02x\n", pwrctl->wowlan_wake_reason); + if (Adapter->intf_stop) Adapter->intf_stop(Adapter); @@ -2443,8 +2384,6 @@ _func_enter_; do { if ((rtw_read32(Adapter, REG_RXPKT_NUM)&RXDMA_IDLE)) { DBG_871X_LEVEL(_drv_always_, "RX_DMA_IDLE is true\n"); - if (Adapter->intf_stop) - Adapter->intf_stop(Adapter); break; } else { // If RX_DMA is not idle, receive one pkt from DMA @@ -2465,6 +2404,9 @@ _func_enter_; rtw_write8(Adapter, REG_WOWLAN_WAKE_REASON, 0); + if (Adapter->intf_stop) + Adapter->intf_stop(Adapter); + // Invoid SE0 reset signal during suspending rtw_write8(Adapter, REG_RSV_CTRL, 0x20); rtw_write8(Adapter, REG_RSV_CTRL, 0x60); @@ -2643,19 +2585,6 @@ void rtl8192eu_set_hal_ops(_adapter * padapter) _func_enter_; -#ifdef CONFIG_CONCURRENT_MODE - if(padapter->isprimary) -#endif //CONFIG_CONCURRENT_MODE - { - padapter->HalData = rtw_zvmalloc(sizeof(HAL_DATA_TYPE)); - if(padapter->HalData == NULL){ - DBG_8192C("cant not alloc memory for HAL DATA \n"); - } - } - - //_rtw_memset(padapter->HalData, 0, sizeof(HAL_DATA_TYPE)); - padapter->hal_data_sz = sizeof(HAL_DATA_TYPE); - pHalFunc->hal_power_on = _InitPowerOn_8192EU; pHalFunc->hal_power_off = hal_poweroff_8192eu; diff --git a/hal/rtl8192e/usb/usb_ops_linux.c b/hal/rtl8192e/usb/usb_ops_linux.c index 4bf4636..2b1228b 100644 --- a/hal/rtl8192e/usb/usb_ops_linux.c +++ b/hal/rtl8192e/usb/usb_ops_linux.c @@ -899,12 +899,17 @@ void rtl8192eu_recv_tasklet(void *priv) _pkt *pskb; _adapter *padapter = (_adapter*)priv; struct recv_priv *precvpriv = &padapter->recvpriv; + struct recv_buf *precvbuf = NULL; while (NULL != (pskb = skb_dequeue(&precvpriv->rx_skb_queue))) { if ((padapter->bDriverStopped == _TRUE)||(padapter->bSurpriseRemoved== _TRUE)) { DBG_8192C("recv_tasklet => bDriverStopped or bSurpriseRemoved \n"); +#ifdef CONFIG_PREALLOC_RX_SKB_BUFFER + if(rtw_free_skb_premem(pskb)!=0) +#endif //CONFIG_PREALLOC_RX_SKB_BUFFER + rtw_skb_free(pskb); break; } @@ -922,9 +927,12 @@ void rtl8192eu_recv_tasklet(void *priv) #else rtw_skb_free(pskb); #endif - + if (NULL != (precvbuf = rtw_dequeue_recvbuf(&precvpriv->recv_buf_pending_queue))) { + precvbuf->pskb = NULL; + precvbuf->reuse = _FALSE; + rtw_read_port(padapter, precvpriv->ff_hwaddr, 0, (unsigned char *)precvbuf); + } } - } @@ -984,8 +992,9 @@ static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs) precvbuf->transfer_len = purb->actual_length; skb_put(precvbuf->pskb, purb->actual_length); skb_queue_tail(&precvpriv->rx_skb_queue, precvbuf->pskb); - +#ifndef CONFIG_FIX_NR_BULKIN_BUFFER if (skb_queue_len(&precvpriv->rx_skb_queue)<=1) +#endif tasklet_schedule(&precvpriv->recv_tasklet); precvbuf->pskb = NULL; @@ -1083,14 +1092,17 @@ _func_enter_; //re-assign for linux based on skb if((precvbuf->reuse == _FALSE) || (precvbuf->pskb == NULL)) { +#ifndef CONFIG_FIX_NR_BULKIN_BUFFER precvbuf->pskb = rtw_skb_alloc(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ); - +#endif if(precvbuf->pskb == NULL) { - RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("init_recvbuf(): alloc_skb fail!\n")); - DBG_8192C("#### usb_read_port() alloc_skb fail!#####\n"); + if (0) + DBG_8192C("usb_read_port() enqueue precvbuf=%p \n", precvbuf); + //enqueue precvbuf and wait for free skb + rtw_enqueue_recvbuf(precvbuf, &precvpriv->recv_buf_pending_queue); return _FAIL; - } + } tmpaddr = (SIZE_PTR)precvbuf->pskb->data; alignment = tmpaddr & (RECVBUFF_ALIGN_SZ-1); diff --git a/include/Hal8188EPhyReg.h b/include/Hal8188EPhyReg.h index 763ccea..2ef34ed 100644 --- a/include/Hal8188EPhyReg.h +++ b/include/Hal8188EPhyReg.h @@ -1059,6 +1059,7 @@ #define bMaskHWord 0xffff0000 #define bMaskLWord 0x0000ffff #define bMaskDWord 0xffffffff +#define bMaskH3Bytes 0xffffff00 #define bMask12Bits 0xfff #define bMaskH4Bits 0xf0000000 #define bMaskOFDM_D 0xffc00000 diff --git a/include/Hal8192CPhyReg.h b/include/Hal8192CPhyReg.h index e4e977c..1c7cd5d 100644 --- a/include/Hal8192CPhyReg.h +++ b/include/Hal8192CPhyReg.h @@ -1082,6 +1082,7 @@ #define bMaskHWord 0xffff0000 #define bMaskLWord 0x0000ffff #define bMaskDWord 0xffffffff +#define bMaskH3Bytes 0xffffff00 #define bMask12Bits 0xfff #define bMaskH4Bits 0xf0000000 #define bMaskOFDM_D 0xffc00000 diff --git a/include/Hal8192DPhyReg.h b/include/Hal8192DPhyReg.h index fb32eac..b5af827 100644 --- a/include/Hal8192DPhyReg.h +++ b/include/Hal8192DPhyReg.h @@ -482,7 +482,7 @@ #define RF_TX_G3 0x22 // #define RF_TX_BB1 0x23 // - +#define RF_T_METER_92D 0x42 #define RF_T_METER 0x42 // #define RF_SYN_G1 0x25 // RF TX Power control @@ -1112,6 +1112,7 @@ #define bMaskHWord 0xffff0000 #define bMaskLWord 0x0000ffff #define bMaskDWord 0xffffffff +#define bMaskH3Bytes 0xffffff00 #define bMask12Bits 0xfff #define bMaskH4Bits 0xf0000000 #define bMaskOFDM_D 0xffc00000 diff --git a/include/Hal8192EPhyCfg.h b/include/Hal8192EPhyCfg.h index d76863b..e197f11 100644 --- a/include/Hal8192EPhyCfg.h +++ b/include/Hal8192EPhyCfg.h @@ -142,6 +142,13 @@ phy_SpurCalibration_8192E( IN PADAPTER Adapter, IN SPUR_CAL_METHOD Method ); + +#ifdef CONFIG_SPUR_CAL_NBI +void +phy_SpurCalibration_8192E_NBI( + IN PADAPTER Adapter +); +#endif // // BB/MAC/RF other monitor API // diff --git a/include/Hal8192EPhyReg.h b/include/Hal8192EPhyReg.h index 7df207b..02a3f86 100644 --- a/include/Hal8192EPhyReg.h +++ b/include/Hal8192EPhyReg.h @@ -425,9 +425,8 @@ #define RF_TX_BB1 0x23 // - -#define RF_T_METER_8192E 0x42 // -#define RF_T_METER_88E 0x42 +#define RF_T_METER_8192E 0x42 // +#define RF_T_METER_88E 0x42 // #define RF_T_METER 0x24 // //#endif @@ -1064,6 +1063,7 @@ #define bMaskHWord 0xffff0000 #define bMaskLWord 0x0000ffff #define bMaskDWord 0xffffffff +#define bMaskH3Bytes 0xffffff00 #define bMask12Bits 0xfff #define bMaskH4Bits 0xf0000000 #define bMaskOFDM_D 0xffc00000 diff --git a/include/Hal8812PhyReg.h b/include/Hal8812PhyReg.h index 5125e22..9297189 100644 --- a/include/Hal8812PhyReg.h +++ b/include/Hal8812PhyReg.h @@ -420,6 +420,8 @@ #define rFPGA0_AdDaClockEn 0x888 // enable ad/da clock1 for dual-phy #define rFPGA0_AnalogParameter4 0x88c #define rFPGA0_XB_LSSIReadBack 0x8a4 +#define rFPGA0_XCD_RFPara 0x8b4 + // // 4. Page9(0x900) // @@ -434,9 +436,11 @@ // #define rCCK0_System 0xa00 #define rCCK0_AFESetting 0xa04 // Disable init gain now // Select RX path by RSSI +#define rCCK0_DSPParameter2 0xa1c //SQ threshold #define rCCK0_TxFilter1 0xa20 #define rCCK0_TxFilter2 0xa24 #define rCCK0_DebugPort 0xa28 //debug port and Tx filter3 +#define rCCK0_FalseAlarmReport 0xa2c //0xa2d useless now 0xa30-a4f channel report // // PageB(0xB00) @@ -717,6 +721,7 @@ #define bMaskHWord 0xffff0000 #define bMaskLWord 0x0000ffff #define bMaskDWord 0xffffffff +#define bMaskH3Bytes 0xffffff00 #define bMask12Bits 0xfff #define bMaskH4Bits 0xf0000000 #define bMaskOFDM_D 0xffc00000 diff --git a/include/autoconf.h b/include/autoconf.h index 3ac7fd4..36199af 100644 --- a/include/autoconf.h +++ b/include/autoconf.h @@ -19,10 +19,7 @@ ******************************************************************************/ //***** temporarily flag ******* #define CONFIG_SINGLE_IMG - //#define CONFIG_DISABLE_ODM -//for FPGA VERIFICATION config -#define RTL8188E_FPGA_TRUE_PHY_VERIFICATION 0 //***** temporarily flag ******* /* @@ -50,7 +47,6 @@ /* * Internal General Config */ -//#define CONFIG_PWRCTRL //#define CONFIG_H2CLBK #define CONFIG_EMBEDDED_FWIMG @@ -73,8 +69,8 @@ //#define CONFIG_USB_INTERRUPT_IN_PIPE #endif -#define CONFIG_HIGH_CHAN_SUPER_CALIBRATION //#define CONFIG_DISABLE_MCS13TO15 1 // Disable MSC13-15 rates for more stable TX throughput with some 5G APs +#define CONFIG_HIGH_CHAN_SUPER_CALIBRATION #define CONFIG_IPS #ifdef CONFIG_IPS @@ -88,12 +84,6 @@ //#define CONFIG_LPS_LCLK #endif -#ifdef CONFIG_LPS_LCLK - #if defined(CONFIG_HIGH_CHAN_SUPER_CALIBRATION) - #undef CONFIG_HIGH_CHAN_SUPER_CALIBRATION - #endif -#endif - #ifdef CONFIG_LPS_LCLK #define CONFIG_XMIT_THREAD_MODE @@ -118,8 +108,6 @@ //#define CONFIG_TSF_RESET_OFFLOAD // For 2 PORT TSF SYNC. #endif -//#define CONFIG_IOL - #define CONFIG_AP_MODE #ifdef CONFIG_AP_MODE //#define CONFIG_INTERRUPT_BASED_TXBCN // Tx Beacon when driver BCN_OK ,BCN_ERR interrupt occurs @@ -173,7 +161,7 @@ #define CONFIG_SKB_COPY //for amsdu -#define CONFIG_LED +//#define CONFIG_LED #ifdef CONFIG_LED //#define CONFIG_SW_LED #ifdef CONFIG_SW_LED @@ -181,13 +169,14 @@ #endif #endif // CONFIG_LED +//#define CONFIG_IOL #ifdef CONFIG_IOL #define CONFIG_IOL_NEW_GENERATION #define CONFIG_IOL_READ_EFUSE_MAP //#define DBG_IOL_READ_EFUSE_MAP - #define CONFIG_IOL_LLT - #define CONFIG_IOL_EFUSE_PATCH - #define CONFIG_IOL_IOREG_CFG + //#define CONFIG_IOL_LLT + //#define CONFIG_IOL_EFUSE_PATCH + //#define CONFIG_IOL_IOREG_CFG //#define CONFIG_IOL_IOREG_CFG_DBG #endif @@ -203,14 +192,13 @@ #define CONFIG_LONG_DELAY_ISSUE #define CONFIG_NEW_SIGNAL_STAT_PROCESS //#define CONFIG_SIGNAL_DISPLAY_DBM //display RX signal with dbm +#ifdef CONFIG_SIGNAL_DISPLAY_DBM +//#define CONFIG_BACKGROUND_NOISE_MONITOR +#endif + #define RTW_NOTCH_FILTER 0 /* 0:Disable, 1:Enable, */ #define CONFIG_DEAUTH_BEFORE_CONNECT -#define CONFIG_BR_EXT 1 // Enable NAT2.5 support for STA mode interface with a L2 Bridge -#ifdef CONFIG_BR_EXT -#define CONFIG_BR_EXT_BRNAME "br0" -#endif // CONFIG_BR_EXT - #define CONFIG_TX_MCAST2UNI 1 // Support IP multicast->unicast //#define CONFIG_CHECK_AC_LIFETIME 1 // Check packet lifetime of 4 ACs. @@ -233,9 +221,12 @@ */ //#define CONFIG_USE_USB_BUFFER_ALLOC_TX // Trade-off: For TX path, improve stability on some platforms, but may cause performance degrade on other platforms. //#define CONFIG_USE_USB_BUFFER_ALLOC_RX // For RX path - #ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX #undef CONFIG_PREALLOC_RECV_SKB +#else + #ifdef CONFIG_PREALLOC_RECV_SKB +// #define CONFIG_FIX_NR_BULKIN_BUFFER // only use USB prealloc_recv_buffer, no use alloc_skb() + #endif #endif /* @@ -251,7 +242,9 @@ //#define CONFIG_USB_SUPPORT_ASYNC_VDN_REQ #define WAKEUP_GPIO_IDX 14 //WIFI Chip Side - +#ifdef CONFIG_WOWLAN +#define CONFIG_GTK_OL +#endif //CONFIG_WOWLAN /* * HAL Related Config */ @@ -307,16 +300,10 @@ -#ifdef CONFIG_PLATFORM_TI_DM365 -#define CONFIG_USE_USB_BUFFER_ALLOC_RX -#endif - - - /* * Outsource Related Config */ - +#define TESTCHIP_SUPPORT 0 #define RTL8192CE_SUPPORT 0 #define RTL8192CU_SUPPORT 0 #define RTL8192C_SUPPORT (RTL8192CE_SUPPORT|RTL8192CU_SUPPORT) @@ -329,32 +316,29 @@ #define RTL8723AS_SUPPORT 0 #define RTL8723AE_SUPPORT 0 #define RTL8723A_SUPPORT (RTL8723AU_SUPPORT|RTL8723AS_SUPPORT|RTL8723AE_SUPPORT) - #define RTL8723_FPGA_VERIFICATION 0 -#define RTL8188EE_SUPPORT 0 -#define RTL8188EU_SUPPORT 0 -#define RTL8188ES_SUPPORT 0 -#define RTL8188E_SUPPORT (RTL8188EE_SUPPORT|RTL8188EU_SUPPORT|RTL8188ES_SUPPORT) -#define TESTCHIP_SUPPORT 0 - -#define RTL8812E_SUPPORT 0 -#define RTL8812AU_SUPPORT 0 -#define RTL8812A_SUPPORT (RTL8812E_SUPPORT|RTL8812AU_SUPPORT) +#define RTL8188E_SUPPORT 0 +#define RTL8812A_SUPPORT 0 #define RTL8821A_SUPPORT 0 - #define RTL8723B_SUPPORT 0 - #define RTL8192E_SUPPORT 1 +#define RTL8814A_SUPPORT 0 -#define RTL8813A_SUPPORT 0 - -//#if (RTL8188E_SUPPORT==1) #define RATE_ADAPTIVE_SUPPORT 0 #define POWER_TRAINING_ACTIVE 0 -//#endif +#ifdef CONFIG_BT_COEXIST + // for ODM and outsrc BT-Coex + #define BT_30_SUPPORT 1 + #ifndef CONFIG_LPS + #define CONFIG_LPS // download reserved page to FW + #endif +#else // !CONFIG_BT_COEXIST + #define BT_30_SUPPORT 0 +#endif // !CONFIG_BT_COEXIST + #ifdef CONFIG_USB_TX_AGGREGATION //#define CONFIG_TX_EARLY_MODE @@ -364,6 +348,9 @@ #define RTL8192E_EARLY_MODE_PKT_NUM_10 0 #endif +//Try to handle the Beacon error found in some types of TP-LINK APs +#define CONFIG_ATTEMPT_TO_FIX_AP_BEACON_ERROR + #define CONFIG_80211D /* @@ -380,6 +367,7 @@ //#define DBG_CONFIG_ERROR_DETECT_INT //#define DBG_CONFIG_ERROR_RESET +//#define DBG_CMD_QUEUE //#define DBG_IO //#define DBG_DELAY_OS //#define DBG_MEM_ALLOC @@ -395,6 +383,7 @@ //#define DBG_RX_SIGNAL_DISPLAY_PROCESSING //#define DBG_RX_SIGNAL_DISPLAY_SSID_MONITORED "jeff-ap" #define DBG_RX_SIGNAL_DISPLAY_RAW_DATA +//#define DBG_NOISE_MONITOR //#define DBG_TX_POWER_IDX diff --git a/include/drv_conf.h b/include/drv_conf.h index 1b1aa72..09befee 100644 --- a/include/drv_conf.h +++ b/include/drv_conf.h @@ -46,6 +46,7 @@ #define CONFIG_SIGNAL_DISPLAY_DBM #endif +/* #if defined(CONFIG_HAS_EARLYSUSPEND) && defined (CONFIG_RESUME_IN_WORKQUEUE) #warning "You have CONFIG_HAS_EARLYSUSPEND enabled in your system, we disable CONFIG_RESUME_IN_WORKQUEUE automatically" #undef CONFIG_RESUME_IN_WORKQUEUE @@ -55,6 +56,7 @@ #warning "You have CONFIG_ANDROID_POWER enabled in your system, we disable CONFIG_RESUME_IN_WORKQUEUE automatically" #undef CONFIG_RESUME_IN_WORKQUEUE #endif +*/ #ifdef CONFIG_RESUME_IN_WORKQUEUE //this can be removed, because there is no case for this... #if !defined( CONFIG_WAKELOCK) && !defined(CONFIG_ANDROID_POWER) @@ -73,6 +75,34 @@ #define CONFIG_USB_VENDOR_REQ_MUTEX #endif +#define DYNAMIC_CAMID_ALLOC + +#ifndef CONFIG_RTW_HIQ_FILTER + #define CONFIG_RTW_HIQ_FILTER 1 +#endif + +#ifndef CONFIG_RTW_ADAPTIVITY_EN + #define CONFIG_RTW_ADAPTIVITY_EN 0 +#endif + +#ifndef CONFIG_RTW_ADAPTIVITY_MODE + #define CONFIG_RTW_ADAPTIVITY_MODE 0 +#endif + +#ifndef CONFIG_RTW_NHM_EN + #define CONFIG_RTW_NHM_EN 0 +#endif + +#ifndef CONFIG_RTW_AMPLIFIER_TYPE_2G + #define CONFIG_RTW_AMPLIFIER_TYPE_2G 0 +#endif + +#ifndef CONFIG_RTW_AMPLIFIER_TYPE_5G + #define CONFIG_RTW_AMPLIFIER_TYPE_5G 0 +#endif + +#define MACID_NUM_SW_LIMIT 32 +#define CAM_ENTRY_NUM_SW_LIMIT 32 //#include diff --git a/include/drv_types.h b/include/drv_types.h index d54e4b2..6135832 100644 --- a/include/drv_types.h +++ b/include/drv_types.h @@ -34,7 +34,10 @@ #include #include #include - +#ifdef CONFIG_ARP_KEEP_ALIVE +#include +#include +#endif #ifdef PLATFORM_OS_XP #include @@ -57,8 +60,6 @@ enum _NIC_VERSION { }; -#define CONFIG_SUSPEND_REFINE - typedef struct _ADAPTER _adapter, ADAPTER,*PADAPTER; #include @@ -93,6 +94,7 @@ typedef struct _ADAPTER _adapter, ADAPTER,*PADAPTER; #include #include #include +#include "../hal/hal_dm.h" #include #include #include @@ -112,6 +114,10 @@ typedef struct _ADAPTER _adapter, ADAPTER,*PADAPTER; #include #include +#ifdef CONFIG_PREALLOC_RX_SKB_BUFFER +#include +#endif + #ifdef CONFIG_P2P #include #endif // CONFIG_P2P @@ -248,7 +254,7 @@ struct registry_priv u8 low_power ; u8 wifi_spec;// !turbo_mode - + u8 special_rf_path; // 0: 2T2R ,1: only turn on path A 1T1R u8 channel_plan; #ifdef CONFIG_BT_COEXIST u8 btcoex; @@ -320,12 +326,28 @@ struct registry_priv u8 ext_iface_num;//primary/secondary iface is excluded #endif u8 qos_opt_enable; + + u8 hiq_filter; + u8 adaptivity_en; + u8 adaptivity_mode; + u8 nhm_en; }; //For registry parameters #define RGTRY_OFT(field) ((ULONG)FIELD_OFFSET(struct registry_priv,field)) #define RGTRY_SZ(field) sizeof(((struct registry_priv*) 0)->field) + +#define GetRegAmplifierType2G(_Adapter) (_Adapter->registrypriv.AmplifierType_2G) +#define GetRegAmplifierType5G(_Adapter) (_Adapter->registrypriv.AmplifierType_5G) + +#define GetRegTxBBSwing_2G(_Adapter) (_Adapter->registrypriv.TxBBSwing_2G) +#define GetRegTxBBSwing_5G(_Adapter) (_Adapter->registrypriv.TxBBSwing_5G) + +#define GetRegbENRFEType(_Adapter) (_Adapter->registrypriv.bEn_RFE) +#define GetRegRFEType(_Adapter) (_Adapter->registrypriv.RFE_Type) + + #define BSSID_OFT(field) ((ULONG)FIELD_OFFSET(WLAN_BSSID_EX,field)) #define BSSID_SZ(field) sizeof(((PWLAN_BSSID_EX) 0)->field) @@ -352,6 +374,8 @@ struct registry_priv #define GET_IFACE_NUMS(padapter) (((_adapter *)padapter)->dvobj->iface_nums) #define GET_ADAPTER(padapter, iface_id) (((_adapter *)padapter)->dvobj->padapters[iface_id]) +#define GetDefaultAdapter(padapter) padapter + enum _IFACE_ID { IFACE_ID0, //maping to PRIMARY_ADAPTER IFACE_ID1, //maping to SECONDARY_ADAPTER @@ -360,6 +384,131 @@ enum _IFACE_ID { IFACE_ID_MAX, }; +#ifdef CONFIG_DBG_COUNTER + +struct rx_logs { + u32 intf_rx; + u32 intf_rx_err_recvframe; + u32 intf_rx_err_skb; + u32 intf_rx_report; + u32 core_rx; + u32 core_rx_pre; + u32 core_rx_pre_ver_err; + u32 core_rx_pre_mgmt; + u32 core_rx_pre_mgmt_err_80211w; + u32 core_rx_pre_mgmt_err; + u32 core_rx_pre_ctrl; + u32 core_rx_pre_ctrl_err; + u32 core_rx_pre_data; + u32 core_rx_pre_data_wapi_seq_err; + u32 core_rx_pre_data_wapi_key_err; + u32 core_rx_pre_data_handled; + u32 core_rx_pre_data_err; + u32 core_rx_pre_data_unknown; + u32 core_rx_pre_unknown; + u32 core_rx_enqueue; + u32 core_rx_dequeue; + u32 core_rx_post; + u32 core_rx_post_decrypt; + u32 core_rx_post_decrypt_wep; + u32 core_rx_post_decrypt_tkip; + u32 core_rx_post_decrypt_aes; + u32 core_rx_post_decrypt_wapi; + u32 core_rx_post_decrypt_hw; + u32 core_rx_post_decrypt_unknown; + u32 core_rx_post_decrypt_err; + u32 core_rx_post_defrag_err; + u32 core_rx_post_portctrl_err; + u32 core_rx_post_indicate; + u32 core_rx_post_indicate_in_oder; + u32 core_rx_post_indicate_reoder; + u32 core_rx_post_indicate_err; + u32 os_indicate; + u32 os_indicate_ap_mcast; + u32 os_indicate_ap_forward; + u32 os_indicate_ap_self; + u32 os_indicate_err; + u32 os_netif_ok; + u32 os_netif_err; +}; + +struct tx_logs { + u32 os_tx; + u32 os_tx_err_up; + u32 os_tx_err_xmit; + u32 os_tx_m2u; + u32 os_tx_m2u_ignore_fw_linked; + u32 os_tx_m2u_ignore_self; + u32 os_tx_m2u_entry; + u32 os_tx_m2u_entry_err_xmit; + u32 os_tx_m2u_entry_err_skb; + u32 os_tx_m2u_stop; + u32 core_tx; + u32 core_tx_err_pxmitframe; + u32 core_tx_err_brtx; + u32 core_tx_upd_attrib; + u32 core_tx_upd_attrib_adhoc; + u32 core_tx_upd_attrib_sta; + u32 core_tx_upd_attrib_ap; + u32 core_tx_upd_attrib_unknown; + u32 core_tx_upd_attrib_dhcp; + u32 core_tx_upd_attrib_icmp; + u32 core_tx_upd_attrib_active; + u32 core_tx_upd_attrib_err_ucast_sta; + u32 core_tx_upd_attrib_err_ucast_ap_link; + u32 core_tx_upd_attrib_err_sta; + u32 core_tx_upd_attrib_err_link; + u32 core_tx_upd_attrib_err_sec; + u32 core_tx_ap_enqueue_warn_fwstate; + u32 core_tx_ap_enqueue_warn_sta; + u32 core_tx_ap_enqueue_warn_nosta; + u32 core_tx_ap_enqueue_warn_link; + u32 core_tx_ap_enqueue_warn_trigger; + u32 core_tx_ap_enqueue_mcast; + u32 core_tx_ap_enqueue_ucast; + u32 core_tx_ap_enqueue; + u32 intf_tx; + u32 intf_tx_pending_ac; + u32 intf_tx_pending_fw_under_survey; + u32 intf_tx_pending_fw_under_linking; + u32 intf_tx_pending_xmitbuf; + u32 intf_tx_enqueue; + u32 core_tx_enqueue; + u32 core_tx_enqueue_class; + u32 core_tx_enqueue_class_err_sta; + u32 core_tx_enqueue_class_err_nosta; + u32 core_tx_enqueue_class_err_fwlink; + u32 intf_tx_direct; + u32 intf_tx_direct_err_coalesce; + u32 intf_tx_dequeue; + u32 intf_tx_dequeue_err_coalesce; + u32 intf_tx_dump_xframe; + u32 intf_tx_dump_xframe_err_txdesc; + u32 intf_tx_dump_xframe_err_port; +}; + +struct int_logs { + u32 all; + u32 err; + u32 tbdok; + u32 tbder; + u32 bcnderr; + u32 bcndma; + u32 bcndma_e; + u32 rx; + u32 rx_rdu; + u32 rx_fovw; + u32 txfovw; + u32 mgntok; + u32 highdok; + u32 bkdok; + u32 bedok; + u32 vidok; + u32 vodok; +}; + +#endif // CONFIG_DBG_COUNTER + struct debug_priv { u32 dbg_sdio_free_irq_error_cnt; u32 dbg_sdio_alloc_irq_error_cnt; @@ -418,6 +567,11 @@ struct rtw_traffic_statistics { u32 cur_rx_tp; // Rx throughput in MBps. }; +struct cam_ctl_t { + _lock lock; + u64 bitmap; +}; + struct cam_entry_cache { u16 ctrl; u8 mac[ETH_ALEN]; @@ -429,6 +583,28 @@ struct cam_entry_cache { ((u8*)(x))[6],((u8*)(x))[7],((u8*)(x))[8],((u8*)(x))[9],((u8*)(x))[10],((u8*)(x))[11], \ ((u8*)(x))[12],((u8*)(x))[13],((u8*)(x))[14],((u8*)(x))[15] +struct macid_bmp { + u32 m0; +#if (MACID_NUM_SW_LIMIT > 32) + u32 m1; +#endif +#if (MACID_NUM_SW_LIMIT > 64) + u32 m2; +#endif +#if (MACID_NUM_SW_LIMIT > 96) + u32 m3; +#endif +}; + +struct macid_ctl_t { + _lock lock; + u8 num; + struct macid_bmp used; + struct macid_bmp bmc; + struct macid_bmp if_g[IFACE_ID_MAX]; + struct macid_bmp ch_g[2]; /* 2 ch concurrency */ +}; + struct dvobj_priv { /*-------- below is common data --------*/ @@ -439,11 +615,6 @@ struct dvobj_priv struct debug_priv drv_dbg; - //for local/global synchronization - // - _lock lock; - int macid[NUM_STA]; - _mutex hw_init_mutex; _mutex h2c_fwcmd_mutex; _mutex setch_mutex; @@ -460,7 +631,10 @@ struct dvobj_priv _adapter *padapters[IFACE_ID_MAX]; u8 iface_nums; // total number of ifaces used runtime - struct cam_entry_cache cam_cache[32]; + struct macid_ctl_t macid_ctl; + + struct cam_ctl_t cam_ctl; + struct cam_entry_cache cam_cache[TOTAL_CAM_ENTRY]; //For 92D, DMDP have 2 interface. u8 InterfaceNumber; @@ -587,6 +761,7 @@ struct dvobj_priv #define dvobj_to_pwrctl(dvobj) (&(dvobj->pwrctl_priv)) #define pwrctl_to_dvobj(pwrctl) container_of(pwrctl, struct dvobj_priv, pwrctl_priv) +#define dvobj_to_macidctl(dvobj) (&(dvobj->macid_ctl)) #ifdef PLATFORM_LINUX static struct device *dvobj_to_dev(struct dvobj_priv *dvobj) @@ -735,7 +910,9 @@ struct _ADAPTER{ u8 bDriverIsGoingToUnload; u8 init_adpt_in_progress; u8 bHaltInProgress; - +#ifdef CONFIG_GPIO_API + u8 pre_gpio_pin; +#endif _thread_hdl_ cmdThread; _thread_hdl_ evtThread; _thread_hdl_ xmitThread; @@ -869,9 +1046,21 @@ struct _ADAPTER{ PLOOPBACKDATA ploopback; #endif + //for debug purpose u8 fix_rate; - + u8 driver_vcs_en; //Enable=1, Disable=0 driver control vrtl_carrier_sense for tx + u8 driver_vcs_type;//force 0:disable VCS, 1:RTS-CTS, 2:CTS-to-self when vcs_en=1. + u8 driver_ampdu_spacing;//driver control AMPDU Density for peer sta's rx + u8 driver_rx_ampdu_factor;//0xff: disable drv ctrl, 0:8k, 1:16k, 2:32k, 3:64k; + u8 fix_ba_rxbuf_bz; /* 0~127, TODO:consider each sta and each TID */ + u8 driver_rx_ampdu_spacing; //driver control Rx AMPDU Density unsigned char in_cta_test; + +#ifdef CONFIG_DBG_COUNTER + struct rx_logs rx_logs; + struct tx_logs tx_logs; + struct int_logs int_logs; +#endif }; #define adapter_to_dvobj(adapter) (adapter->dvobj) @@ -928,6 +1117,11 @@ void rtw_dev_pno_debug(struct net_device *net); #endif //CONFIG_PNO_SET_DEBUG #endif //CONFIG_PNO_SUPPORT +#ifdef CONFIG_WOWLAN +int rtw_suspend_wow(_adapter *padapter); +int rtw_resume_process_wow(_adapter *padapter); +#endif + __inline static u8 *myid(struct eeprom_priv *peepriv) { return (peepriv->mac_addr); diff --git a/include/gspi_hal.h b/include/gspi_hal.h index efe1afb..77a16f5 100644 --- a/include/gspi_hal.h +++ b/include/gspi_hal.h @@ -21,7 +21,7 @@ #define __GSPI_HAL_H__ -void spi_int_dpc(PADAPTER padapter); +void spi_int_dpc(PADAPTER padapter, u32 sdio_hisr); void rtw_set_hal_ops(_adapter *padapter); #ifdef CONFIG_RTL8723A diff --git a/include/gspi_ops.h b/include/gspi_ops.h index 1e77ccc..c280503 100644 --- a/include/gspi_ops.h +++ b/include/gspi_ops.h @@ -156,6 +156,7 @@ void rtl8188es_set_hal_ops(PADAPTER padapter); #define set_hal_ops rtl8188es_set_hal_ops #endif extern void spi_set_chip_endian(PADAPTER padapter); +extern unsigned int spi_write8_endian(ADAPTER *Adapter, unsigned int addr, unsigned int buf, u32 big); extern void spi_set_intf_ops(_adapter *padapter,struct _io_ops *pops); extern void spi_set_chip_endian(PADAPTER padapter); extern void InitInterrupt8723ASdio(PADAPTER padapter); @@ -164,9 +165,6 @@ extern void EnableInterrupt8723ASdio(PADAPTER padapter); extern void DisableInterrupt8723ASdio(PADAPTER padapter); extern void spi_int_hdl(PADAPTER padapter); extern u8 HalQueryTxBufferStatus8723ASdio(PADAPTER padapter); -extern void InitInterrupt8188ESdio(PADAPTER padapter); -extern void EnableInterrupt8188ESdio(PADAPTER padapter); -extern void DisableInterrupt8188ESdio(PADAPTER padapter); #ifdef CONFIG_RTL8723B extern void InitInterrupt8723BSdio(PADAPTER padapter); extern void InitSysInterrupt8723BSdio(PADAPTER padapter); @@ -175,4 +173,18 @@ extern void DisableInterrupt8723BSdio(PADAPTER padapter); extern u8 HalQueryTxBufferStatus8723BSdio(PADAPTER padapter); #endif +#ifdef CONFIG_RTL8188E +extern void InitInterrupt8188EGspi(PADAPTER padapter); +extern void EnableInterrupt8188EGspi(PADAPTER padapter); +extern void DisableInterrupt8188EGspi(PADAPTER padapter); +extern void UpdateInterruptMask8188EGspi(PADAPTER padapter, u32 AddMSR, u32 RemoveMSR); +extern u8 HalQueryTxBufferStatus8189EGspi(PADAPTER padapter); +extern u8 HalQueryTxOQTBufferStatus8189EGspi(PADAPTER padapter); +extern void ClearInterrupt8188EGspi(PADAPTER padapter); +extern u8 CheckIPSStatus(PADAPTER padapter); +#endif // CONFIG_RTL8188E +#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) +extern u8 RecvOnePkt(PADAPTER padapter, u32 size); +#endif // CONFIG_WOWLAN + #endif //__GSPI_OPS_H__ diff --git a/include/hal_btcoex.h b/include/hal_btcoex.h index 4d2d948..84aa63a 100644 --- a/include/hal_btcoex.h +++ b/include/hal_btcoex.h @@ -30,6 +30,7 @@ typedef struct _BT_COEXIST u8 btTotalAntNum; u8 btChipType; u8 bInitlized; + u8 btAntisolation; } BT_COEXIST, *PBT_COEXIST; void DBG_BT_INFO(u8 *dbgmsg); @@ -39,10 +40,13 @@ u8 hal_btcoex_IsBtExist(PADAPTER padapter); u8 hal_btcoex_IsBtDisabled(PADAPTER); void hal_btcoex_SetChipType(PADAPTER padapter, u8 chipType); u8 hal_btcoex_GetChipType(PADAPTER padapter); -void hal_btcoex_SetPgAntNum(PADAPTER padapter, u8 antNum, BOOLEAN antInverse); +void hal_btcoex_SetPgAntNum(PADAPTER padapter, u8 antNum); u8 hal_btcoex_GetPgAntNum(PADAPTER padapter); +void hal_btcoex_SetSingleAntPath(PADAPTER padapter, u8 singleAntPath); u8 hal_btcoex_Initialize(PADAPTER padapter); +void hal_btcoex_PowerOnSetting(PADAPTER padapter); +void hal_btcoex_PreLoadFirmware(PADAPTER padapter); void hal_btcoex_InitHwConfig(PADAPTER padapter, u8 bWifiOnly); void hal_btcoex_IpsNotify(PADAPTER padapter, u8 type); @@ -74,6 +78,10 @@ void hal_btcoex_SetDBG(PADAPTER, u32 *pDbgModule); u32 hal_btcoex_GetDBG(PADAPTER, u8 *pStrBuf, u32 bufSize); u8 hal_btcoex_IncreaseScanDeviceNum(PADAPTER); u8 hal_btcoex_IsBtLinkExist(PADAPTER); - +void hal_btcoex_SetAntIsolationType(PADAPTER padapter, u8 anttype); +#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE +int hal_btcoex_AntIsolationConfig_ParaFile(IN PADAPTER Adapter,IN char* pFileName); +int hal_btcoex_ParseAntIsolationConfigFile(PADAPTER Adapter, char* buffer); +#endif // CONFIG_LOAD_PHY_PARA_FROM_FILE #endif // !__HAL_BTCOEX_H__ diff --git a/include/hal_com.h b/include/hal_com.h index 8b01a58..d5e843e 100644 --- a/include/hal_com.h +++ b/include/hal_com.h @@ -189,6 +189,17 @@ typedef enum _FIRMWARE_SOURCE { FW_SOURCE_HEADER_FILE = 1, //from header file } FIRMWARE_SOURCE, *PFIRMWARE_SOURCE; +// +// Queue Select Value in TxDesc +// +#define QSLT_BK 0x2//0x01 +#define QSLT_BE 0x0 +#define QSLT_VI 0x5//0x4 +#define QSLT_VO 0x7//0x6 +#define QSLT_BEACON 0x10 +#define QSLT_HIGH 0x11 +#define QSLT_MGNT 0x12 +#define QSLT_CMD 0x13 // BK, BE, VI, VO, HCCA, MANAGEMENT, COMMAND, HIGH, BEACON. //#define MAX_TX_QUEUE 9 @@ -204,6 +215,9 @@ typedef enum _FIRMWARE_SOURCE { #define PageNum(_Len, _Size) (u32)(((_Len)/(_Size)) + ((_Len)&((_Size) - 1) ? 1:0)) +u8 rtw_hal_data_init(_adapter *padapter); +void rtw_hal_data_deinit(_adapter *padapter); + void dump_chip_info(HAL_VERSION ChipVersion); u8 //return the final channel plan decision @@ -321,5 +335,56 @@ void rtw_get_raw_rssi_info(void *sel, _adapter *padapter); void rtw_store_phy_info(_adapter *padapter, union recv_frame *prframe); void rtw_dump_raw_rssi_info(_adapter *padapter); #endif + +#define HWSET_MAX_SIZE 512 +#ifdef CONFIG_EFUSE_CONFIG_FILE +#define EFUSE_FILE_COLUMN_NUM 16 +u32 Hal_readPGDataFromConfigFile(PADAPTER padapter, struct file *fp); +void Hal_ReadMACAddrFromFile(PADAPTER padapter, struct file *fp); +void Hal_GetPhyEfuseMACAddr(PADAPTER padapter, u8* mac_addr); +int check_phy_efuse_tx_power_info_valid(PADAPTER padapter); +int check_phy_efuse_macaddr_info_valid(PADAPTER padapter); +#endif //CONFIG_EFUSE_CONFIG_FILE + +#ifdef CONFIG_RF_GAIN_OFFSET +void rtw_bb_rf_gain_offset(_adapter *padapter); +#endif //CONFIG_RF_GAIN_OFFSET + +void dm_DynamicUsbTxAgg(_adapter *padapter, u8 from_timer); +u8 rtw_hal_busagg_qsel_check(_adapter *padapter,u8 pre_qsel,u8 next_qsel); +void GetHalODMVar( + PADAPTER Adapter, + HAL_ODM_VARIABLE eVariable, + PVOID pValue1, + PVOID pValue2); +void SetHalODMVar( + PADAPTER Adapter, + HAL_ODM_VARIABLE eVariable, + PVOID pValue1, + BOOLEAN bSet); + +#ifdef CONFIG_BACKGROUND_NOISE_MONITOR +struct noise_info +{ + u8 bPauseDIG; + u8 IGIValue; + u32 max_time;//ms + u8 chan; +}; +#endif +void rtw_get_noise(_adapter* padapter); + +#ifdef CONFIG_GPIO_API +u8 rtw_hal_get_gpio(_adapter* adapter, u8 gpio_num); +int rtw_hal_set_gpio_output_value(_adapter* adapter, u8 gpio_num, BOOLEAN isHigh); +int rtw_hal_config_gpio(_adapter* adapter, u8 gpio_num, BOOLEAN isOutput); +#endif + +#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE +extern char *rtw_phy_file_path; +extern char file_path[PATH_LENGTH_MAX]; +#define GetLineFromBuffer(buffer) strsep(&buffer, "\n") +#endif + #endif //__HAL_COMMON_H__ diff --git a/include/hal_com_h2c.h b/include/hal_com_h2c.h index c6ca8d2..00113e2 100644 --- a/include/hal_com_h2c.h +++ b/include/hal_com_h2c.h @@ -96,7 +96,7 @@ enum h2c_cmd{ #define H2C_PSTUNEPARAM_LEN 4 #define H2C_MACID_CFG_LEN 7 #define H2C_BTMP_OPER_LEN 4 -#define H2C_WOWLAN_LEN 4 +#define H2C_WOWLAN_LEN 5 #define H2C_REMOTE_WAKE_CTRL_LEN 3 #define H2C_AOAC_GLOBAL_INFO_LEN 2 #define H2C_AOAC_RSVDPAGE_LOC_LEN 7 @@ -221,8 +221,9 @@ enum h2c_cmd{ #define SET_H2CCMD_WOWLAN_GPIONUM(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE((__pH2CCmd)+1, 0, 7, __Value) #define SET_H2CCMD_WOWLAN_DATAPIN_WAKE_UP(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE((__pH2CCmd)+1, 7, 1, __Value) #define SET_H2CCMD_WOWLAN_GPIO_DURATION(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+2, 0, 8, __Value) -//#define SET_H2CCMD_WOWLAN_GPIO_PULSE_EN(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE((__pH2CCmd)+3, 0, 1, __Value) -#define SET_H2CCMD_WOWLAN_GPIO_PULSE_COUNT(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+3, 0, 8, __Value) +#define SET_H2CCMD_WOWLAN_GPIO_PULSE_EN(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE((__pH2CCmd)+3, 0, 1, __Value) +#define SET_H2CCMD_WOWLAN_GPIO_PULSE_COUNT(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+3, 1, 7, __Value) +#define SET_H2CCMD_WOWLAN_LOWPR_RX(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+4, 0, 1, __Value) // _REMOTE_WAKEUP_CMD_0x81 #define SET_H2CCMD_REMOTE_WAKECTRL_ENABLE(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE(__pH2CCmd, 0, 1, __Value) @@ -292,6 +293,7 @@ typedef struct _RSVDPAGE_LOC { #endif void dump_TX_FIFO(PADAPTER padapter, u8 page_num, u16 page_size); +u8 rtw_check_invalid_mac_address (u8 *mac_addr); #if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) void rtw_get_current_ip_address(PADAPTER padapter, u8 *pcurrentip); void rtw_get_sec_iv(PADAPTER padapter, u8*pcur_dot11txpn, u8 *StaAddr); diff --git a/include/hal_com_phycfg.h b/include/hal_com_phycfg.h index fcc6e3a..19276ea 100644 --- a/include/hal_com_phycfg.h +++ b/include/hal_com_phycfg.h @@ -285,8 +285,10 @@ int PHY_ConfigRFWithParaFile(IN PADAPTER Adapter, IN char* pFileName, IN u8 eRFP int PHY_ConfigRFWithTxPwrTrackParaFile(IN PADAPTER Adapter, IN char* pFileName); int PHY_ConfigRFWithPowerLimitTableParaFile(IN PADAPTER Adapter, IN char* pFileName); -#endif + void phy_free_filebuf(_adapter *padapter); +#endif //CONFIG_LOAD_PHY_PARA_FROM_FILE + #endif //__HAL_COMMON_H__ diff --git a/include/hal_com_reg.h b/include/hal_com_reg.h index cadd99d..6a0faf0 100644 --- a/include/hal_com_reg.h +++ b/include/hal_com_reg.h @@ -226,13 +226,22 @@ // 0x0400h ~ 0x047Fh Protocol Configuration // //----------------------------------------------------- -#define REG_VOQ_INFORMATION 0x0400 -#define REG_VIQ_INFORMATION 0x0404 -#define REG_BEQ_INFORMATION 0x0408 -#define REG_BKQ_INFORMATION 0x040C -#define REG_MGQ_INFORMATION 0x0410 -#define REG_HGQ_INFORMATION 0x0414 -#define REG_BCNQ_INFORMATION 0x0418 + +/* 92C, 92D */ +#define REG_VOQ_INFO 0x0400 +#define REG_VIQ_INFO 0x0404 +#define REG_BEQ_INFO 0x0408 +#define REG_BKQ_INFO 0x040C + +/* 88E, 8723A, 8812A, 8821A, 92E, 8723B */ +#define REG_Q0_INFO 0x400 +#define REG_Q1_INFO 0x404 +#define REG_Q2_INFO 0x408 +#define REG_Q3_INFO 0x40C + +#define REG_MGQ_INFO 0x0410 +#define REG_HGQ_INFO 0x0414 +#define REG_BCNQ_INFO 0x0418 #define REG_TXPKT_EMPTY 0x041A #define REG_CPU_MGQ_INFORMATION 0x041C #define REG_FWHW_TXQ_CTRL 0x0420 @@ -258,22 +267,44 @@ #define REG_FAST_EDCA_CTRL 0x0460 #define REG_RD_RESP_PKT_TH 0x0463 +/* 8723A, 8812A, 8821A, 92E, 8723B */ +#define REG_Q4_INFO 0x468 +#define REG_Q5_INFO 0x46C +#define REG_Q6_INFO 0x470 +#define REG_Q7_INFO 0x474 + #define REG_INIRTS_RATE_SEL 0x0480 #define REG_INIDATA_RATE_SEL 0x0484 +/* 8723B, 92E, 8812A, 8821A*/ +#define REG_MACID_SLEEP_3 0x0484 +#define REG_MACID_SLEEP_1 0x0488 + #define REG_POWER_STAGE1 0x04B4 #define REG_POWER_STAGE2 0x04B8 #define REG_PKT_VO_VI_LIFE_TIME 0x04C0 #define REG_PKT_BE_BK_LIFE_TIME 0x04C2 #define REG_STBC_SETTING 0x04C4 #define REG_QUEUE_CTRL 0x04C6 +#define REG_SINGLE_AMPDU_CTRL 0x04c7 #define REG_PROT_MODE_CTRL 0x04C8 #define REG_MAX_AGGR_NUM 0x04CA #define REG_RTS_MAX_AGGR_NUM 0x04CB #define REG_BAR_MODE_CTRL 0x04CC #define REG_RA_TRY_RATE_AGG_LMT 0x04CF -#define REG_EARLY_MODE_CONTROL 0x04D0 -#define REG_MACID_SLEEP 0x04D4 + +/* 8723A */ +#define REG_MACID_DROP 0x04D0 + +/* 88E */ +#define REG_EARLY_MODE_CONTROL 0x04D0 + +/* 8723B, 92E, 8812A, 8821A */ +#define REG_MACID_SLEEP_2 0x04D0 + +/* 8723A, 8723B, 92E, 8812A, 8821A */ +#define REG_MACID_SLEEP 0x04D4 + #define REG_NQOS_SEQ 0x04DC #define REG_QOS_SEQ 0x04DE #define REG_NEED_CPU_HANDLE 0x04E0 @@ -638,6 +669,9 @@ Default: 00b. #define RRSR_MCS6 BIT18 #define RRSR_MCS7 BIT19 +#define RRSR_CCK_RATES (RRSR_11M|RRSR_5_5M|RRSR_2M|RRSR_1M) +#define RRSR_OFDM_RATES (RRSR_54M|RRSR_48M|RRSR_36M|RRSR_24M|RRSR_18M|RRSR_12M|RRSR_9M|RRSR_6M) + // WOL bit information #define HAL92C_WOL_PTK_UPDATE_EVENT BIT0 #define HAL92C_WOL_GTK_UPDATE_EVENT BIT1 @@ -762,10 +796,6 @@ Default: 00b. #define CAM_READ 0x00000000 #define CAM_POLLINIG BIT31 -#define SCR_UseDK 0x01 -#define SCR_TxSecEnable 0x02 -#define SCR_RxSecEnable 0x04 - // // 10. Power Save Control Registers // @@ -1514,6 +1544,7 @@ Current IOREG MAP #define SCR_NoSKMC BIT(5) //No Key Search Multicast #define SCR_TXBCUSEDK BIT(6) // Force Tx Broadcast packets Use Default Key #define SCR_RXBCUSEDK BIT(7) // Force Rx Broadcast packets Use Default Key +#define SCR_CHK_KEYID BIT(8) //----------------------------------------------------- // @@ -1716,7 +1747,7 @@ Current IOREG MAP // General definitions //======================================================== -#define LAST_ENTRY_OF_TX_PKT_BUFFER_8188E 176 +#define LAST_ENTRY_OF_TX_PKT_BUFFER_8188E(__Adapter) ( IS_VENDOR_8188E_I_CUT_SERIES(__Adapter) ? 255 : 175 ) #define LAST_ENTRY_OF_TX_PKT_BUFFER_8812 255 #define LAST_ENTRY_OF_TX_PKT_BUFFER_8723B 255 #define LAST_ENTRY_OF_TX_PKT_BUFFER_8192C 255 diff --git a/include/hal_data.h b/include/hal_data.h index 2b7014d..9a48f13 100644 --- a/include/hal_data.h +++ b/include/hal_data.h @@ -30,7 +30,9 @@ #ifdef CONFIG_SDIO_HCI #include #endif - +#ifdef CONFIG_GSPI_HCI +#include +#endif // // For RTL8723 WiFi/BT/GPS multi-function configuration. 2010.10.06. // @@ -73,6 +75,22 @@ typedef enum _INTERFACE_SELECT_USB{ INTF_SEL5_USB_Combo_MF = 5, // USB WiFi+BT Multi-Function Combo, i.e., Proprietary layout(AS-VAU) which is the same as SDIO card } INTERFACE_SELECT_USB, *PINTERFACE_SELECT_USB; +#ifdef CONFIG_USB_HCI +//should be sync with INTERFACE_SELECT_USB +typedef enum _BOARD_TYPE_8192CUSB{ + BOARD_USB_DONGLE = 0, // USB dongle + BOARD_USB_High_PA = 1, // USB dongle with high power PA + BOARD_MINICARD = 2, // Minicard + BOARD_USB_SOLO = 3, // USB solo-Slim module + BOARD_USB_COMBO = 4, // USB Combo-Slim module +} BOARD_TYPE_8192CUSB, *PBOARD_TYPE_8192CUSB; + +#define SUPPORT_HW_RADIO_DETECT(pHalData) \ + (pHalData->BoardType == BOARD_MINICARD||\ + pHalData->BoardType == BOARD_USB_SOLO||\ + pHalData->BoardType == BOARD_USB_COMBO) +#endif + typedef enum _RT_AMPDU_BRUST_MODE{ RT_AMPDU_BRUST_NONE = 0, RT_AMPDU_BRUST_92D = 1, @@ -245,6 +263,7 @@ struct dm_priv // Add for Reading Initial Data Rate SEL Register 0x484 during watchdog. Using for fill tx desc. 2011.3.21 by Thomas u8 INIDATA_RATE[32]; + _lock IQKSpinLock; }; @@ -364,18 +383,18 @@ typedef struct hal_com_data u8 TxPwrLevelCck[RF_PATH_MAX_92C_88E][CHANNEL_MAX_NUMBER]; u8 TxPwrLevelHT40_1S[RF_PATH_MAX_92C_88E][CHANNEL_MAX_NUMBER]; // For HT 40MHZ pwr u8 TxPwrLevelHT40_2S[RF_PATH_MAX_92C_88E][CHANNEL_MAX_NUMBER]; // For HT 40MHZ pwr - u8 TxPwrHt20Diff[RF_PATH_MAX_92C_88E][CHANNEL_MAX_NUMBER];// HT 20<->40 Pwr diff + s8 TxPwrHt20Diff[RF_PATH_MAX_92C_88E][CHANNEL_MAX_NUMBER];// HT 20<->40 Pwr diff u8 TxPwrLegacyHtDiff[RF_PATH_MAX_92C_88E][CHANNEL_MAX_NUMBER];// For HT<->legacy pwr diff // Power Limit Table for 2.4G - u8 TxPwrLimit_2_4G[MAX_REGULATION_NUM] + s8 TxPwrLimit_2_4G[MAX_REGULATION_NUM] [MAX_2_4G_BANDWITH_NUM] [MAX_RATE_SECTION_NUM] [CHANNEL_MAX_NUMBER_2G] [MAX_RF_PATH_NUM]; // Power Limit Table for 5G - u8 TxPwrLimit_5G[MAX_REGULATION_NUM] + s8 TxPwrLimit_5G[MAX_REGULATION_NUM] [MAX_5G_BANDWITH_NUM] [MAX_RATE_SECTION_NUM] [CHANNEL_MAX_NUMBER_5G] @@ -461,13 +480,13 @@ typedef struct hal_com_data u8 RegReg542; u8 RegCR_1; u8 Reg837; - u8 RegRFPathS1; u16 RegRRSR; u8 CurAntenna; u8 AntDivCfg; u8 AntDetection; u8 TRxAntDivType; + u8 ant_path; //for 8723B s0/s1 selection u8 u1ForcedIgiLb; // forced IGI lower bound @@ -495,17 +514,17 @@ typedef struct hal_com_data u8 p2p_ps_offload; #endif - u8 AMPDUDensity; + //u8 AMPDUDensity; // Auto FSM to Turn On, include clock, isolation, power control for MAC only u8 bMacPwrCtrlOn; - + u8 bDisableTXPowerTraining; u8 RegIQKFWOffload; struct submit_ctx iqk_sctx; RT_AMPDU_BRUST AMPDUBurstMode; //92C maybe not use, but for compile successfully -#ifdef CONFIG_SDIO_HCI +#if defined (CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) // // For SDIO Interface HAL related // @@ -593,6 +612,8 @@ typedef struct hal_com_data u8 bInterruptMigration; u8 bDisableTxInt; + + u16 RxTag; #endif //CONFIG_PCI_HCI struct dm_priv dmpriv; @@ -678,6 +699,14 @@ typedef struct hal_com_data char *rf_tx_pwr_lmt; u32 rf_tx_pwr_lmt_len; #endif + +#ifdef CONFIG_BACKGROUND_NOISE_MONITOR + s16 noise[ODM_MAX_CHANNEL_NUM]; +#endif + + u8 macid_num; + u8 cam_entry_num; + } HAL_DATA_COMMON, *PHAL_DATA_COMMON; diff --git a/include/hal_gspi.h b/include/hal_gspi.h new file mode 100644 index 0000000..f5880e2 --- /dev/null +++ b/include/hal_gspi.h @@ -0,0 +1,32 @@ +/****************************************************************************** + * + * 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_GSPI_H_ +#define __HAL_GSPI_H_ + +#define ffaddr2deviceId(pdvobj, addr) (pdvobj->Queue2Pipe[addr]) + +u8 rtw_hal_gspi_max_txoqt_free_space(_adapter *padapter); +u8 rtw_hal_gspi_query_tx_freepage(_adapter *padapter, u8 PageIdx, u8 RequiredPageNum); +void rtw_hal_gspi_update_tx_freepage(_adapter *padapter, u8 PageIdx, u8 RequiredPageNum); +void rtw_hal_set_gspi_tx_max_length(PADAPTER padapter, u8 numHQ, u8 numNQ, u8 numLQ, u8 numPubQ); +u32 rtw_hal_get_gspi_tx_max_length(PADAPTER padapter, u8 queue_idx); + +#endif + diff --git a/include/hal_intf.h b/include/hal_intf.h index 340f9a6..0c526c1 100644 --- a/include/hal_intf.h +++ b/include/hal_intf.h @@ -65,6 +65,7 @@ typedef enum _HW_VARIABLES{ HW_VAR_RESP_SIFS, HW_VAR_ACK_PREAMBLE, HW_VAR_SEC_CFG, + HW_VAR_SEC_DK_CFG, HW_VAR_BCN_VALID, HW_VAR_RF_TYPE, HW_VAR_DM_FLAG, @@ -145,6 +146,8 @@ typedef enum _HW_VARIABLES{ HW_VAR_DL_RSVD_PAGE, HW_VAR_MACID_SLEEP, HW_VAR_MACID_WAKEUP, + HW_VAR_DUMP_MAC_QUEUE_INFO, + HW_VAR_ASIX_IOT, }HW_VARIABLES; typedef enum _HAL_DEF_VARIABLE{ @@ -180,12 +183,15 @@ typedef enum _HAL_DEF_VARIABLE{ HAL_DEF_PCI_ASPM_OSC, // Support for ASPM OSC, added by Roger, 2013.03.27. HAL_DEF_MACID_SLEEP, // Support for MACID sleep HAL_DEF_DBG_RX_INFO_DUMP, + HAL_DEF_DBG_DIS_PWT, //disable Tx power training or not. }HAL_DEF_VARIABLE; typedef enum _HAL_ODM_VARIABLE{ HAL_ODM_STA_INFO, HAL_ODM_P2P_STATE, HAL_ODM_WIFI_DISPLAY_STATE, + HAL_ODM_NOISE_MONITOR, + HAL_ODM_REGULATION, }HAL_ODM_VARIABLE; typedef enum _HAL_INTF_PS_FUNC{ @@ -252,7 +258,7 @@ struct hal_ops { u8 (*GetHalDefVarHandler)(_adapter *padapter, HAL_DEF_VARIABLE eVariable, PVOID pValue); u8 (*SetHalDefVarHandler)(_adapter *padapter, HAL_DEF_VARIABLE eVariable, PVOID pValue); - void (*GetHalODMVarHandler)(_adapter *padapter, HAL_ODM_VARIABLE eVariable, PVOID pValue1,BOOLEAN bSet); + void (*GetHalODMVarHandler)(_adapter *padapter, HAL_ODM_VARIABLE eVariable, PVOID pValue1,PVOID pValue2); void (*SetHalODMVarHandler)(_adapter *padapter, HAL_ODM_VARIABLE eVariable, PVOID pValue1,BOOLEAN bSet); void (*UpdateRAMaskHandler)(_adapter *padapter, u32 mac_id, u8 rssi_level); @@ -316,10 +322,7 @@ struct hal_ops { void (*hal_reset_security_engine)(_adapter * adapter); s32 (*c2h_handler)(_adapter *padapter, u8 *c2h_evt); c2h_id_filter c2h_id_filter_ccx; - -#ifdef CONFIG_BT_COEXIST s32 (*fill_h2c_cmd)(PADAPTER, u8 ElementID, u32 CmdLen, u8 *pCmdBuffer); -#endif // CONFIG_BT_COEXIST }; typedef enum _RT_EEPROM_TYPE{ @@ -393,6 +396,9 @@ typedef enum _HARDWARE_TYPE{ #define IS_HARDWARE_TYPE_8192D(_Adapter) \ (IS_HARDWARE_TYPE_8192DE(_Adapter) || IS_HARDWARE_TYPE_8192DU(_Adapter)) +#define IS_HARDWARE_TYPE_OLDER_THAN_8723A(_Adapter) \ +(IS_HARDWARE_TYPE_8192D(_Adapter) || IS_HARDWARE_TYPE_8192C(_Adapter)) + // // RTL8723A Series // @@ -411,6 +417,11 @@ typedef enum _HARDWARE_TYPE{ #define IS_HARDWARE_TYPE_8188E(_Adapter) \ (IS_HARDWARE_TYPE_8188EE(_Adapter) || IS_HARDWARE_TYPE_8188EU(_Adapter) || IS_HARDWARE_TYPE_8188ES(_Adapter)) + +#define IS_HARDWARE_TYPE_8188E_before(_Adapter) \ +(IS_HARDWARE_TYPE_8192C(_Adapter) ||IS_HARDWARE_TYPE_8192D(_Adapter) ||IS_HARDWARE_TYPE_8723A(_Adapter)) + + #define IS_HARDWARE_TYPE_OLDER_THAN_8812A(_Adapter) \ (IS_HARDWARE_TYPE_8192D(_Adapter) || IS_HARDWARE_TYPE_8192C(_Adapter) ||\ IS_HARDWARE_TYPE_8723AE(_Adapter) || IS_HARDWARE_TYPE_8723AU(_Adapter) || IS_HARDWARE_TYPE_8723AS(_Adapter) ||\ @@ -529,7 +540,7 @@ u8 rtw_hal_set_def_var(_adapter *padapter, HAL_DEF_VARIABLE eVariable, PVOID pVa u8 rtw_hal_get_def_var(_adapter *padapter, HAL_DEF_VARIABLE eVariable, PVOID pValue); void rtw_hal_set_odm_var(_adapter *padapter, HAL_ODM_VARIABLE eVariable, PVOID pValue1,BOOLEAN bSet); -void rtw_hal_get_odm_var(_adapter *padapter, HAL_ODM_VARIABLE eVariable, PVOID pValue1,BOOLEAN bSet); +void rtw_hal_get_odm_var(_adapter *padapter, HAL_ODM_VARIABLE eVariable, PVOID pValue1,PVOID pValue2); void rtw_hal_enable_interrupt(_adapter *padapter); void rtw_hal_disable_interrupt(_adapter *padapter); @@ -622,12 +633,10 @@ c2h_id_filter rtw_hal_c2h_id_filter_ccx(_adapter *adapter); s32 rtw_hal_is_disable_sw_channel_plan(PADAPTER padapter); -s32 rtw_hal_macid_sleep(PADAPTER padapter, u32 macid); -s32 rtw_hal_macid_wakeup(PADAPTER padapter, u32 macid); +s32 rtw_hal_macid_sleep(PADAPTER padapter, u8 macid); +s32 rtw_hal_macid_wakeup(PADAPTER padapter, u8 macid); -#ifdef CONFIG_BT_COEXIST s32 rtw_hal_fill_h2c_cmd(PADAPTER, u8 ElementID, u32 CmdLen, u8 *pCmdBuffer); -#endif // CONFIG_BT_COEXIST #endif //__HAL_INTF_H__ diff --git a/include/hal_pg.h b/include/hal_pg.h index 2019214..9d9911f 100644 --- a/include/hal_pg.h +++ b/include/hal_pg.h @@ -236,7 +236,7 @@ #define EEPROM_MAC_ADDR_88EU 0xD7 #define EEPROM_VID_88EU 0xD0 #define EEPROM_PID_88EU 0xD2 -#define EEPROM_USB_OPTIONAL_FUNCTION0 0xD4 //92EU is the same +#define EEPROM_USB_OPTIONAL_FUNCTION0 0xD4 //8192EU, 8812AU is the same #define EEPROM_USB_OPTIONAL_FUNCTION0_8811AU 0x104 // RTL88ES diff --git a/include/ieee80211.h b/include/ieee80211.h index fc293c4..5dfc421 100644 --- a/include/ieee80211.h +++ b/include/ieee80211.h @@ -1671,13 +1671,18 @@ u8 *rtw_get_wps_attr_content(u8 *wps_ie, uint wps_ielen, u16 target_attr_id ,u8 #define for_each_ie(ie, buf, buf_len) \ for (ie = (void*)buf; (((u8*)ie) - ((u8*)buf) + 1) < buf_len; ie = (void*)(((u8*)ie) + *(((u8*)ie)+1) + 2)) -void dump_ies(u8 *buf, u32 buf_len); -void dump_wps_ie(u8 *ie, u32 ie_len); +void dump_ies(void *sel, u8 *buf, u32 buf_len); + +#ifdef CONFIG_80211N_HT +void dump_ht_cap_ie_content(void *sel, u8 *buf, u32 buf_len); +#endif + +void dump_wps_ie(void *sel, u8 *ie, u32 ie_len); #ifdef CONFIG_P2P u32 rtw_get_p2p_merged_ies_len(u8 *in_ie, u32 in_len); int rtw_p2p_merge_ies(u8 *in_ie, u32 in_len, u8 *merge_ie); -void dump_p2p_ie(u8 *ie, u32 ie_len); +void dump_p2p_ie(void *sel, u8 *ie, u32 ie_len); u8 *rtw_get_p2p_ie(u8 *in_ie, int in_len, u8 *p2p_ie, uint *p2p_ielen); u8 *rtw_get_p2p_ie_from_scan_queue(u8 *in_ie, int in_len, u8 *p2p_ie, uint *p2p_ielen, u8 frame_type); u8 *rtw_get_p2p_attr(u8 *p2p_ie, uint p2p_ielen, u8 target_attr_id ,u8 *buf_attr, u32 *len_attr); @@ -1687,7 +1692,7 @@ void rtw_WLAN_BSSID_EX_remove_p2p_attr(WLAN_BSSID_EX *bss_ex, u8 attr_id); #endif #ifdef CONFIG_WFD -void dump_wfd_ie(u8 *ie, u32 ie_len); +void dump_wfd_ie(void *sel, u8 *ie, u32 ie_len); int rtw_get_wfd_ie(u8 *in_ie, int in_len, u8 *wfd_ie, uint *wfd_ielen); int rtw_get_wfd_ie_from_scan_queue(u8 *in_ie, int in_len, u8 *p2p_ie, uint *p2p_ielen, u8 frame_type); int rtw_get_wfd_attr_content(u8 *wfd_ie, uint wfd_ielen, u8 target_attr_id ,u8 *attr_content, uint *attr_contentlen); diff --git a/include/ioctl_cfg80211.h b/include/ioctl_cfg80211.h index 2cae2c5..7701116 100644 --- a/include/ioctl_cfg80211.h +++ b/include/ioctl_cfg80211.h @@ -117,6 +117,7 @@ void rtw_wdev_unregister(struct wireless_dev *wdev); void rtw_cfg80211_init_wiphy(_adapter *padapter); +void rtw_cfg80211_unlink_bss(_adapter *padapter, struct wlan_network *pnetwork); void rtw_cfg80211_surveydone_event_callback(_adapter *padapter); struct cfg80211_bss *rtw_cfg80211_inform_bss(_adapter *padapter, struct wlan_network *pnetwork); int rtw_cfg80211_check_bss(_adapter *padapter); @@ -143,8 +144,10 @@ bool rtw_cfg80211_pwr_mgmt(_adapter *adapter); #define rtw_cfg80211_rx_mgmt(adapter, freq, sig_dbm, buf, len, gfp) cfg80211_rx_mgmt((adapter)->pnetdev, freq, buf, len, gfp) #elif (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) #define rtw_cfg80211_rx_mgmt(adapter, freq, sig_dbm, buf, len, gfp) cfg80211_rx_mgmt((adapter)->pnetdev, freq, sig_dbm, buf, len, gfp) -#else +#elif (LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0)) #define rtw_cfg80211_rx_mgmt(adapter, freq, sig_dbm, buf, len, gfp) cfg80211_rx_mgmt((adapter)->rtw_wdev, freq, sig_dbm, buf, len, gfp) +#else +#define rtw_cfg80211_rx_mgmt(adapter, freq, sig_dbm, buf, len, gfp) cfg80211_rx_mgmt((adapter)->rtw_wdev, freq, sig_dbm, buf, len,0,gfp) #endif #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) && !defined(COMPAT_KERNEL_RELEASE) diff --git a/include/linux/wireless.h b/include/linux/wireless.h index 955ea8d..d79caeb 100644 --- a/include/linux/wireless.h +++ b/include/linux/wireless.h @@ -35,7 +35,13 @@ #endif /****************************** TYPES ******************************/ - +#ifdef CONFIG_COMPAT +struct compat_iw_point { + compat_caddr_t pointer; + __u16 length; + __u16 flags; +}; +#endif /* --------------------------- SUBTYPES --------------------------- */ /* * For all data larger than 16 octets, we need to use a diff --git a/include/osdep_intf.h b/include/osdep_intf.h index 7a61a13..d67d06c 100644 --- a/include/osdep_intf.h +++ b/include/osdep_intf.h @@ -129,11 +129,6 @@ extern int rtw_ioctl(struct ifnet * ifp, u_long cmd, caddr_t data); void rtw_ips_dev_unload(_adapter *padapter); -#ifdef CONFIG_RF_GAIN_OFFSET -void rtw_bb_rf_gain_offset(_adapter *padapter); -#endif //CONFIG_RF_GAIN_OFFSET - - #ifdef CONFIG_IPS int rtw_ips_pwr_up(_adapter *padapter); void rtw_ips_pwr_down(_adapter *padapter); @@ -155,11 +150,12 @@ void rtw_drv_free_vir_ifaces(struct dvobj_priv *dvobj); int rtw_drv_register_netdev(_adapter *padapter); void rtw_ndev_destructor(_nic_hdl ndev); -#ifdef CONFIG_SUSPEND_REFINE -int rtw_suspend_common(_adapter *padapter); -int rtw_resume_common(_adapter *padapter); +#ifdef CONFIG_ARP_KEEP_ALIVE +int rtw_gw_addr_query(_adapter *padapter); #endif +int rtw_suspend_common(_adapter *padapter); +int rtw_resume_common(_adapter *padapter); #endif //_OSDEP_INTF_H_ diff --git a/include/osdep_service.h b/include/osdep_service.h index 76026b9..29b0a02 100644 --- a/include/osdep_service.h +++ b/include/osdep_service.h @@ -252,7 +252,7 @@ void _rtw_usb_buffer_free(struct usb_device *dev, size_t size, void *addr, dma_a #endif /* CONFIG_USB_HCI */ #endif /* DBG_MEM_ALLOC */ -extern void* rtw_malloc2d(int h, int w, int size); +extern void* rtw_malloc2d(int h, int w, size_t size); extern void rtw_mfree2d(void *pbuf, int h, int w, int size); extern void _rtw_memcpy(void* dec, void* sour, u32 sz); @@ -474,6 +474,8 @@ __inline static u32 bitshift(u32 bitmask) return i; } +#define rtw_min(a, b) ((a>b)?b:a) + #ifndef MAC_FMT #define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x" #endif diff --git a/include/pci_hal.h b/include/pci_hal.h index 3180a4c..a37040b 100644 --- a/include/pci_hal.h +++ b/include/pci_hal.h @@ -36,6 +36,10 @@ void rtl8188ee_set_hal_ops(_adapter * padapter); void rtl8812ae_set_hal_ops(_adapter * padapter); #endif +#if defined(CONFIG_RTL8192E) +void rtl8192ee_set_hal_ops(_adapter * padapter); +#endif + #ifdef CONFIG_RTL8723B void rtl8723be_set_hal_ops(_adapter * padapter); #endif diff --git a/include/pci_ops.h b/include/pci_ops.h index 75de6de..cc2f45d 100644 --- a/include/pci_ops.h +++ b/include/pci_ops.h @@ -68,6 +68,16 @@ void rtl8812ae_prepare_bcn_tasklet(void *priv); void rtl8812ae_set_intf_ops(struct _io_ops *pops); #endif +#ifdef CONFIG_RTL8192E +u32 rtl8192ee_init_desc_ring(_adapter * padapter); +u32 rtl8192ee_free_desc_ring(_adapter * padapter); +void rtl8192ee_reset_desc_ring(_adapter * padapter); +void rtl8192ee_recv_tasklet(void *priv); +void rtl8192ee_prepare_bcn_tasklet(void *priv); +int rtl8192ee_interrupt(PADAPTER Adapter); +void rtl8192ee_set_intf_ops(struct _io_ops *pops); +#endif + #ifdef CONFIG_RTL8723B u32 rtl8723be_init_desc_ring(_adapter * padapter); u32 rtl8723be_free_desc_ring(_adapter * padapter); diff --git a/include/rtl8188e_cmd.h b/include/rtl8188e_cmd.h index cc417a2..218a263 100644 --- a/include/rtl8188e_cmd.h +++ b/include/rtl8188e_cmd.h @@ -65,7 +65,7 @@ typedef enum _RTL8188E_H2C_CMD_ID //Class DM H2C_DM_MACID_CFG =0x40, H2C_DM_TXBF =0x41, - + H2C_RSSI_REPORT =0x42, //Class BT H2C_BT_COEX_MASK =0x60, H2C_BT_COEX_GPIO_MODE =0x61, @@ -142,8 +142,9 @@ typedef struct _RSVDPAGE_LOC_88E { void rtl8188e_set_FwPwrMode_cmd(PADAPTER padapter, u8 Mode); void rtl8188e_set_FwJoinBssReport_cmd(PADAPTER padapter, u8 mstatus); u8 rtl8188e_set_rssi_cmd(PADAPTER padapter, u8 *param); -u8 rtl8188e_set_raid_cmd(PADAPTER padapter, u32 mask); +u8 rtl8188e_set_raid_cmd(_adapter*padapter, u32 bitmap, u8* arg); void rtl8188e_Add_RateATid(PADAPTER padapter, u32 bitmap, u8* arg, u8 rssi_level); +s32 FillH2CCmd_88E(PADAPTER padapter, u8 ElementID, u32 CmdLen, u8 *pCmdBuffer); //u8 rtl8192c_set_FwSelectSuspend_cmd(PADAPTER padapter, u8 bfwpoll, u16 period); diff --git a/include/rtl8188e_hal.h b/include/rtl8188e_hal.h index 3b605e7..61433ae 100644 --- a/include/rtl8188e_hal.h +++ b/include/rtl8188e_hal.h @@ -80,13 +80,15 @@ #if 1 // download firmware related data structure +#define MAX_FW_8188E_SIZE 0x8000 //32768,32k / 16384,16k + #define FW_8188E_SIZE 0x4000 //16384,16k +#define FW_8188E_SIZE_2 0x8000 //32768,32k + #define FW_8188E_START_ADDRESS 0x1000 #define FW_8188E_END_ADDRESS 0x1FFF //0x5FFF - - #define IS_FW_HEADER_EXIST_88E(_pFwHdr) ((le16_to_cpu(_pFwHdr->Signature)&0xFFF0) == 0x88E0) typedef struct _RT_FIRMWARE_8188E { @@ -94,7 +96,7 @@ typedef struct _RT_FIRMWARE_8188E { #ifdef CONFIG_EMBEDDED_FWIMG u8* szFwBuffer; #else - u8 szFwBuffer[FW_8188E_SIZE]; + u8 szFwBuffer[MAX_FW_8188E_SIZE]; #endif u32 ulFwLength; } RT_FIRMWARE_8188E, *PRT_FIRMWARE_8188E; @@ -140,8 +142,8 @@ typedef struct _RT_8188E_FIRMWARE_HDR #define BCN_DMA_ATIME_INT_TIME_8188E 0x02 -#define MAX_RX_DMA_BUFFER_SIZE_88E 0x2400 //9k for 88E nornal chip , //MaxRxBuff=10k-max(TxReportSize(64*8), WOLPattern(16*24)) -//#define MAX_RX_DMA_BUFFER_SIZE_88E(__Adapter) ((!IS_VENDOR_8188E_I_CUT_SERIES(__Adapter))?0x2400:0x3C00) +//#define MAX_RX_DMA_BUFFER_SIZE_88E 0x2400 //9k for 88E nornal chip , //MaxRxBuff=10k-max(TxReportSize(64*8), WOLPattern(16*24)) +#define MAX_RX_DMA_BUFFER_SIZE_88E(__Adapter) ((!IS_VENDOR_8188E_I_CUT_SERIES(__Adapter))?0x2400:0x3C00) #define MAX_TX_REPORT_BUFFER_SIZE 0x0400 // 1k @@ -161,17 +163,17 @@ typedef struct _RT_8188E_FIRMWARE_HDR #define WOWLAN_PAGE_NUM_88E 0x00 #endif -#define TX_TOTAL_PAGE_NUMBER_88E (0xB0 - BCNQ_PAGE_NUM_88E - WOWLAN_PAGE_NUM_88E) -#define TX_PAGE_BOUNDARY_88E (TX_TOTAL_PAGE_NUMBER_88E + 1) +#define TX_TOTAL_PAGE_NUMBER_88E(_Adapter) ( (IS_VENDOR_8188E_I_CUT_SERIES(_Adapter)?0x100:0xB0) - BCNQ_PAGE_NUM_88E - WOWLAN_PAGE_NUM_88E) +#define TX_PAGE_BOUNDARY_88E(_Adapter) (TX_TOTAL_PAGE_NUMBER_88E(_Adapter) + 1) -#define WMM_NORMAL_TX_TOTAL_PAGE_NUMBER_88E TX_TOTAL_PAGE_NUMBER_88E -#define WMM_NORMAL_TX_PAGE_BOUNDARY_88E (WMM_NORMAL_TX_TOTAL_PAGE_NUMBER_88E + 1) +#define WMM_NORMAL_TX_TOTAL_PAGE_NUMBER_88E(_Adapter) TX_TOTAL_PAGE_NUMBER_88E(_Adapter) +#define WMM_NORMAL_TX_PAGE_BOUNDARY_88E(_Adapter) (WMM_NORMAL_TX_TOTAL_PAGE_NUMBER_88E(_Adapter) + 1) // For Normal Chip Setting // (HPQ + LPQ + NPQ + PUBQ) shall be TX_TOTAL_PAGE_NUMBER_8723B -#define NORMAL_PAGE_NUM_HPQ_88E 0x00 -#define NORMAL_PAGE_NUM_LPQ_88E 0x09 -#define NORMAL_PAGE_NUM_NPQ_88E 0x00 +#define NORMAL_PAGE_NUM_HPQ_88E 0x10 +#define NORMAL_PAGE_NUM_LPQ_88E 0x10 +#define NORMAL_PAGE_NUM_NPQ_88E 0x10 // Note: For Normal Chip Setting, modify later #define WMM_NORMAL_PAGE_NUM_HPQ_88E 0x29 @@ -208,8 +210,6 @@ typedef struct _RT_8188E_FIRMWARE_HDR // #define EFUSE_OOB_PROTECT_BYTES 15 // PG data exclude header, dummy 6 bytes frome CP test and reserved 1byte. -#define HWSET_MAX_SIZE_88E 512 - #define EFUSE_REAL_CONTENT_LEN_88E 256 #define EFUSE_MAP_LEN_88E 512 #define EFUSE_MAX_SECTION_88E 64 @@ -279,6 +279,12 @@ void Hal_DetectWoWMode(PADAPTER pAdapter); //void rtl8723a_ReadBluetoothCoexistInfo(PADAPTER padapter, u8 *PROMContent, BOOLEAN AutoloadFail); void Hal_InitChannelPlan(PADAPTER padapter); +#ifdef CONFIG_RF_GAIN_OFFSET +void Hal_ReadRFGainOffset(PADAPTER pAdapter,u8* hwinfo,BOOLEAN AutoLoadFail); +#endif //CONFIG_RF_GAIN_OFFSET + +void rtl8188e_init_default_value(_adapter *adapter); + void rtl8188e_set_hal_ops(struct hal_ops *pHalFunc); // register diff --git a/include/rtl8188e_led.h b/include/rtl8188e_led.h index c5e3800..4b05994 100644 --- a/include/rtl8188e_led.h +++ b/include/rtl8188e_led.h @@ -32,7 +32,7 @@ void rtl8188eu_DeInitSwLeds(PADAPTER padapter); void rtl8188ee_InitSwLeds(PADAPTER padapter); void rtl8188ee_DeInitSwLeds(PADAPTER padapter); #endif -#ifdef CONFIG_SDIO_HCI +#if defined (CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) void rtl8188es_InitSwLeds(PADAPTER padapter); void rtl8188es_DeInitSwLeds(PADAPTER padapter); #endif diff --git a/include/rtl8188e_recv.h b/include/rtl8188e_recv.h index df6e59f..5d4e628 100644 --- a/include/rtl8188e_recv.h +++ b/include/rtl8188e_recv.h @@ -109,7 +109,7 @@ typedef struct rxreport_8188e } RXREPORT, *PRXREPORT; -#ifdef CONFIG_SDIO_HCI +#if defined (CONFIG_SDIO_HCI)||defined(CONFIG_GSPI_HCI) s32 rtl8188es_init_recv_priv(PADAPTER padapter); void rtl8188es_free_recv_priv(PADAPTER padapter); void rtl8188es_recv_hdl(PADAPTER padapter, struct recv_buf *precvbuf); diff --git a/include/rtl8188e_spec.h b/include/rtl8188e_spec.h index 0fb93b5..287efee 100644 --- a/include/rtl8188e_spec.h +++ b/include/rtl8188e_spec.h @@ -49,6 +49,8 @@ #define REG_HISRE_88E 0x00BC //RTL8188E #define REG_MACID_NO_LINK_0 0x0484 #define REG_MACID_NO_LINK_1 0x0488 +#define REG_MACID_PAUSE_0 0x048c +#define REG_MACID_PAUSE_1 0x0490 //----------------------------------------------------- // @@ -99,6 +101,11 @@ // 0x0600h ~ 0x07FFh WMAC Configuration // //----------------------------------------------------- +#ifdef CONFIG_RF_GAIN_OFFSET +#define EEPROM_RF_GAIN_OFFSET 0xC1 +#define EEPROM_RF_GAIN_VAL 0xF6 +#define EEPROM_THERMAL_OFFSET 0xF5 +#endif //CONFIG_RF_GAIN_OFFSET //---------------------------------------------------------------------------- // 88E Driver Initialization Offload REG_FDHM0(Offset 0x88, 8 bits) //---------------------------------------------------------------------------- @@ -140,6 +147,8 @@ // General definitions //======================================================== +#define MACID_NUM_88E 64 +#define CAM_ENTRY_NUM_88E 32 //---------------------------------------------------------------------------- // 8192C EEPROM/EFUSE share register definition. @@ -148,5 +157,5 @@ #define EFUSE_ACCESS_ON 0x69 // For RTL8723 only. #define EFUSE_ACCESS_OFF 0x00 // For RTL8723 only. -#endif //__RTL8188E_SPEC_H__ +#endif /* __RTL8188E_SPEC_H__ */ diff --git a/include/rtl8188e_xmit.h b/include/rtl8188e_xmit.h index 3a711c1..8d7ccef 100644 --- a/include/rtl8188e_xmit.h +++ b/include/rtl8188e_xmit.h @@ -21,17 +21,7 @@ #define __RTL8188E_XMIT_H__ -// -// Queue Select Value in TxDesc -// -#define QSLT_BK 0x2//0x01 -#define QSLT_BE 0x0 -#define QSLT_VI 0x5//0x4 -#define QSLT_VO 0x7//0x6 -#define QSLT_BEACON 0x10 -#define QSLT_HIGH 0x11 -#define QSLT_MGNT 0x12 -#define QSLT_CMD 0x13 + //For 88e early mode #define SET_EARLYMODE_PKTNUM(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 0, 3, __Value) @@ -249,8 +239,11 @@ struct txrpt_ccx_88e { #define txrpt_ccx_sw_88e(txrpt_ccx) ((txrpt_ccx)->sw0 + ((txrpt_ccx)->sw1<<8)) #define txrpt_ccx_qtime_88e(txrpt_ccx) ((txrpt_ccx)->ccx_qtime0+((txrpt_ccx)->ccx_qtime1<<8)) -void rtl8188e_fill_fake_txdesc(PADAPTER padapter,u8*pDesc,u32 BufferLen,u8 IsPsPoll,u8 IsBTQosNull); -#ifdef CONFIG_SDIO_HCI +#define SET_TX_DESC_SEC_TYPE_8188E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 22, 2, __Value) + +void rtl8188e_fill_fake_txdesc(PADAPTER padapter,u8*pDesc,u32 BufferLen, + u8 IsPsPoll,u8 IsBTQosNull, u8 bDataFrame); +#if defined(CONFIG_SDIO_HCI)||defined (CONFIG_GSPI_HCI) s32 rtl8188es_init_xmit_priv(PADAPTER padapter); void rtl8188es_free_xmit_priv(PADAPTER padapter); s32 rtl8188es_hal_xmit(PADAPTER padapter, struct xmit_frame *pxmitframe); @@ -278,10 +271,10 @@ s32 rtl8188eu_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv #ifdef CONFIG_PCI_HCI s32 rtl8188ee_init_xmit_priv(PADAPTER padapter); void rtl8188ee_free_xmit_priv(PADAPTER padapter); -struct xmit_buf *rtl8188ee_dequeue_xmitbuf(struct rtw_tx_ring *ring); void rtl8188ee_xmitframe_resume(_adapter *padapter); s32 rtl8188ee_hal_xmit(PADAPTER padapter, struct xmit_frame *pxmitframe); s32 rtl8188ee_mgnt_xmit(PADAPTER padapter, struct xmit_frame *pmgntframe); +s32 rtl8188ee_hal_xmitframe_enqueue(_adapter *padapter, struct xmit_frame *pxmitframe); void rtl8188ee_xmit_tasklet(void *priv); #endif diff --git a/include/rtl8192c_cmd.h b/include/rtl8192c_cmd.h index 4febe67..3f254d6 100644 --- a/include/rtl8192c_cmd.h +++ b/include/rtl8192c_cmd.h @@ -78,6 +78,7 @@ u8 rtl8192c_set_rssi_cmd(_adapter*padapter, u8 *param); void rtl8192c_set_raid_cmd(_adapter*padapter, u32 mask, u8* arg); void rtl8192c_Add_RateATid(PADAPTER pAdapter, u32 bitmap, u8* arg, u8 rssi_level); u8 rtl8192c_set_FwSelectSuspend_cmd(_adapter*padapter,u8 bfwpoll, u16 period); +int rtl8192c_FillH2CCmd(_adapter* padapter, u8 ElementID, u32 CmdLen, u8* pCmdBuffer); #ifdef CONFIG_P2P void rtl8192c_set_p2p_ps_offload_cmd(_adapter* padapter, u8 p2p_ps_state); #endif //CONFIG_P2P diff --git a/include/rtl8192c_hal.h b/include/rtl8192c_hal.h index 795e396..83f448e 100644 --- a/include/rtl8192c_hal.h +++ b/include/rtl8192c_hal.h @@ -402,8 +402,9 @@ void rtl8192c_EfuseParseChnlPlan(PADAPTER padapter, u8 *hwinfo, BOOLEAN AutoLoad HAL_VERSION rtl8192c_ReadChipVersion(IN PADAPTER Adapter); void rtl8192c_ReadBluetoothCoexistInfo(PADAPTER Adapter, u8 *PROMContent, BOOLEAN AutoloadFail); -//void rtl8192c_free_hal_data(_adapter * padapter); + VOID rtl8192c_EfuseParseIDCode(PADAPTER pAdapter, u8 *hwinfo); +void rtl8192c_init_default_value(_adapter *adapter); void rtl8192c_set_hal_ops(struct hal_ops *pHalFunc); s32 c2h_id_filter_ccx_8192c(u8 *buf); diff --git a/include/rtl8192c_recv.h b/include/rtl8192c_recv.h index 85716b4..ad4d370 100644 --- a/include/rtl8192c_recv.h +++ b/include/rtl8192c_recv.h @@ -26,6 +26,7 @@ #if defined(CONFIG_USB_HCI) +#ifndef MAX_RECVBUF_SZ #ifdef PLATFORM_OS_CE #define MAX_RECVBUF_SZ (8192+1024) // 8K+1k #else @@ -43,6 +44,7 @@ #define MAX_RECVBUF_SZ (4000) // about 4K #endif #endif +#endif //!MAX_RECVBUF_SZ #elif defined(CONFIG_PCI_HCI) //#ifndef CONFIG_MINIMAL_MEMORY_USAGE @@ -52,7 +54,7 @@ //#endif -#elif defined(CONFIG_SDIO_HCI) +#elif defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) #define MAX_RECVBUF_SZ (10240) diff --git a/include/rtl8192c_spec.h b/include/rtl8192c_spec.h index 040651f..80927de 100644 --- a/include/rtl8192c_spec.h +++ b/include/rtl8192c_spec.h @@ -109,26 +109,8 @@ // // Interface type. // -#endif - -#ifdef CONFIG_USB_HCI - -//should be renamed and moved to another file -typedef enum _BOARD_TYPE_8192CUSB{ - BOARD_USB_DONGLE = 0, // USB dongle - BOARD_USB_High_PA = 1, // USB dongle with high power PA - BOARD_MINICARD = 2, // Minicard - BOARD_USB_SOLO = 3, // USB solo-Slim module - BOARD_USB_COMBO = 4, // USB Combo-Slim module -} BOARD_TYPE_8192CUSB, *PBOARD_TYPE_8192CUSB; - -#define SUPPORT_HW_RADIO_DETECT(pHalData) (pHalData->BoardType == BOARD_MINICARD||\ - pHalData->BoardType == BOARD_USB_SOLO||\ - pHalData->BoardType == BOARD_USB_COMBO) - #endif - #define EFUSE_ACCESS_ON 0x69 // For RTL8723 only. #define EFUSE_ACCESS_OFF 0x00 // For RTL8723 only. @@ -136,8 +118,10 @@ typedef enum _BOARD_TYPE_8192CUSB{ // General definitions //======================================================== +#define MACID_NUM_92C 32 +#define CAM_ENTRY_NUM_92C 32 #include "basic_types.h" -#endif +#endif /* __RTL8192C_SPEC_H__ */ diff --git a/include/rtl8192c_xmit.h b/include/rtl8192c_xmit.h index c488471..c1108eb 100644 --- a/include/rtl8192c_xmit.h +++ b/include/rtl8192c_xmit.h @@ -61,17 +61,7 @@ //OFFSET 20 #define SGI BIT(6) -// -// Queue Select Value in TxDesc -// -#define QSLT_BK 0x2//0x01 -#define QSLT_BE 0x0 -#define QSLT_VI 0x5//0x4 -#define QSLT_VO 0x7//0x6 -#define QSLT_BEACON 0x10 -#define QSLT_HIGH 0x11 -#define QSLT_MGNT 0x12 -#define QSLT_CMD 0x13 + struct txrpt_ccx_8192c { /* offset 0 */ diff --git a/include/rtl8192d_cmd.h b/include/rtl8192d_cmd.h index d0d22b3..deb03a0 100644 --- a/include/rtl8192d_cmd.h +++ b/include/rtl8192d_cmd.h @@ -53,13 +53,13 @@ // Fisrt constructed by tynli. 2009.10.09. typedef enum _RTL8192D_H2C_CMD { - H2C_AP_OFFLOAD = 0, /*0*/ + H2C_92D_AP_OFFLOAD = 0, /*0*/ H2C_SETPWRMODE = 1, /*1*/ H2C_JOINBSSRPT = 2, /*2*/ H2C_RSVDPAGE = 3, H2C_RSSI_REPORT = 5, H2C_RA_MASK = 6, - H2C_P2P_PS_OFFLOAD = 8, + H2C_92D_P2P_PS_OFFLOAD = 8, H2C_MAC_MODE_SEL = 9, H2C_PWRM=15, H2C_P2P_PS_CTW_CMD = 24, @@ -76,7 +76,7 @@ struct cmd_msg_parm { }; -void FillH2CCmd92D(_adapter* padapter, u8 ElementID, u32 CmdLen, u8* pCmdBuffer); +int FillH2CCmd92D(_adapter* padapter, u8 ElementID, u32 CmdLen, u8* pCmdBuffer); // host message to firmware cmd void rtl8192d_set_FwPwrMode_cmd(_adapter*padapter, u8 Mode); diff --git a/include/rtl8192d_hal.h b/include/rtl8192d_hal.h index b9779d5..7a650a0 100644 --- a/include/rtl8192d_hal.h +++ b/include/rtl8192d_hal.h @@ -401,6 +401,7 @@ BOOLEAN PHY_CheckPowerOffFor8192D(PADAPTER Adapter); VOID PHY_SetPowerOnFor8192D(PADAPTER Adapter); //void PHY_ConfigMacPhyMode92D(PADAPTER Adapter); void rtl8192d_free_hal_data(_adapter * padapter); +void rtl8192d_init_default_value(_adapter *adapter); void rtl8192d_set_hal_ops(struct hal_ops *pHalFunc); void SetHwReg8192D(_adapter *adapter, u8 variable, u8 *val); diff --git a/include/rtl8192d_recv.h b/include/rtl8192d_recv.h index eff00fe..8ebdfdf 100644 --- a/include/rtl8192d_recv.h +++ b/include/rtl8192d_recv.h @@ -27,6 +27,7 @@ #if defined(CONFIG_USB_HCI) +#ifndef MAX_RECVBUF_SZ #ifdef PLATFORM_OS_CE #define MAX_RECVBUF_SZ (8192+1024) // 8K+1k #else @@ -43,6 +44,7 @@ #define MAX_RECVBUF_SZ (4000) // about 4K #endif #endif +#endif //!MAX_RECVBUF_SZ #elif defined(CONFIG_PCI_HCI) //#ifndef CONFIG_MINIMAL_MEMORY_USAGE diff --git a/include/rtl8192d_spec.h b/include/rtl8192d_spec.h index f1184a6..b316b7c 100644 --- a/include/rtl8192d_spec.h +++ b/include/rtl8192d_spec.h @@ -109,7 +109,10 @@ // General definitions //======================================================== +#define MACID_NUM_92D 32 +#define CAM_ENTRY_NUM_92D 32 + #include "basic_types.h" -#endif +#endif /* __RTL8192D_SPEC_H__ */ diff --git a/include/rtl8192d_xmit.h b/include/rtl8192d_xmit.h index bddc338..8add5a1 100644 --- a/include/rtl8192d_xmit.h +++ b/include/rtl8192d_xmit.h @@ -61,17 +61,7 @@ //OFFSET 20 #define SGI BIT(6) -// -// Queue Select Value in TxDesc -// -#define QSLT_BK 0x2//0x01 -#define QSLT_BE 0x0 -#define QSLT_VI 0x5//0x4 -#define QSLT_VO 0x7//0x6 -#define QSLT_BEACON 0x10 -#define QSLT_HIGH 0x11 -#define QSLT_MGNT 0x12 -#define QSLT_CMD 0x13 + //Because we open EM for normal case, we just always insert 2*8 bytes.by wl #ifdef USB_PACKET_OFFSET_SZ diff --git a/include/rtl8192e_cmd.h b/include/rtl8192e_cmd.h index f765795..dfbe8e7 100644 --- a/include/rtl8192e_cmd.h +++ b/include/rtl8192e_cmd.h @@ -138,9 +138,12 @@ void rtl8192e_set_FwJoinBssReport_cmd(PADAPTER padapter, u8 mstatus); u8 rtl8192e_set_rssi_cmd(PADAPTER padapter, u8 *param); void rtl8192e_set_raid_cmd(PADAPTER padapter, u32 bitmap, u8* arg); void rtl8192e_Add_RateATid(PADAPTER padapter, u32 bitmap, u8 *arg, u8 rssi_level); +s32 FillH2CCmd_8192E(PADAPTER padapter, u8 ElementID, u32 CmdLen, u8 *pCmdBuffer); //u8 rtl8192c_set_FwSelectSuspend_cmd(PADAPTER padapter, u8 bfwpoll, u16 period); - - +s32 c2h_handler_8192e(PADAPTER padapter, u8 *buf); +#ifdef CONFIG_BT_COEXIST +void rtl8192e_download_BTCoex_AP_mode_rsvd_page(PADAPTER padapter); +#endif // CONFIG_BT_COEXIST #ifdef CONFIG_P2P_PS void rtl8192e_set_p2p_ps_offload_cmd(PADAPTER padapter, u8 p2p_ps_state); //void rtl8723a_set_p2p_ps_offload_cmd(PADAPTER padapter, u8 p2p_ps_state); diff --git a/include/rtl8192e_hal.h b/include/rtl8192e_hal.h index b7a7de0..cc5294c 100644 --- a/include/rtl8192e_hal.h +++ b/include/rtl8192e_hal.h @@ -59,7 +59,8 @@ #define RTL8192E_PHY_MACREG "rtl8192e/MAC_REG.txt" #define RTL8192E_PHY_REG_PG "rtl8192e/PHY_REG_PG.txt" #define RTL8192E_PHY_REG_MP "rtl8192e/PHY_REG_MP.txt" - #define RTL8192E_TXPWR_LMT "rtl8192e/TXPWR_LMT.txt" + #define RTL8192E_TXPWR_LMT "rtl8192e/TXPWR_LMT.txt" + #define RTL8192E_WIFI_ANT_ISOLATION "rtl8192e/wifi_ant_isolation.txt" //--------------------------------------------------------------------- // RTL8192E Power Configuration CMDs for PCIe interface @@ -135,17 +136,38 @@ typedef struct _RT_FIRMWARE_8192E { #define MAX_RX_DMA_BUFFER_SIZE_8192E 0x3d00 //0x3E80 //0x3FFF // RX 16K reserved for WOW ? -#define TX_TOTAL_PAGE_NUMBER_8192E 243 //0x00~0xF3 totoal pages: F4 +//For General Reserved Page Number(Beacon Queue is reserved page) +//if (CONFIG_2BCN_EN) Beacon:4, PS-Poll:1, Null Data:1,Prob Rsp:1,Qos Null Data:1 +//Beacon:2, PS-Poll:1, Null Data:1,Prob Rsp:1,Qos Null Data:1 +#define RSVD_PAGE_NUM_8192E 0x08 +//For WoWLan , more reserved page +//ARP Rsp:1, RWC:1, GTK Info:1,GTK RSP:2,GTK EXT MEM:2, PNO: 6 +#ifdef CONFIG_WOWLAN +#define WOWLAN_PAGE_NUM_8192E 0x07 +#else +#define WOWLAN_PAGE_NUM_8192E 0x00 +#endif + +#ifdef CONFIG_PNO_SUPPORT +#undef WOWLAN_PAGE_NUM_8192E +#define WOWLAN_PAGE_NUM_8192E 0x0d +#endif + +#define TOTAL_RSVD_PAGE_NUMBER_8192E (RSVD_PAGE_NUM_8192E+WOWLAN_PAGE_NUM_8192E) +#define TX_TOTAL_PAGE_NUMBER_8192E (0x100 - TOTAL_RSVD_PAGE_NUMBER_8192E) + +#define TX_PAGE_BOUNDARY_8192E TX_TOTAL_PAGE_NUMBER_8192E + -#define TX_PAGE_BOUNDARY_8192E (TX_TOTAL_PAGE_NUMBER_8192E + 1)//0xF4 ~0xFF ,Rserved 12 pages for BCN/PS-POLL.. #define TX_PAGE_LOAD_FW_BOUNDARY_8192E 0x47 //0xA5 #define TX_PAGE_BOUNDARY_WOWLAN_8192E 0xE0 // For Normal Chip Setting // (HPQ + LPQ + NPQ + PUBQ) shall be TX_TOTAL_PAGE_NUMBER_92C -#define NORMAL_PAGE_NUM_LPQ_8192E 0x0C -#define NORMAL_PAGE_NUM_HPQ_8192E 0x08 -#define NORMAL_PAGE_NUM_NPQ_8192E 0x00 + +#define NORMAL_PAGE_NUM_HPQ_8192E 0x10 +#define NORMAL_PAGE_NUM_LPQ_8192E 0x10 +#define NORMAL_PAGE_NUM_NPQ_8192E 0x10 #define NORMAL_PAGE_NUM_EPQ_8192E 0x00 @@ -159,6 +181,11 @@ typedef struct _RT_FIRMWARE_8192E { // Chip specific //------------------------------------------------------------------------- +// pic buffer descriptor +#define RTL8192EE_SEG_NUM TX_BUFFER_SEG_NUM +#define TX_DESC_NUM_92E 128 +#define RX_DESC_NUM_92E 128 + //------------------------------------------------------------------------- // Channel Plan //------------------------------------------------------------------------- @@ -202,8 +229,6 @@ typedef struct _RT_FIRMWARE_8192E { //#define RT_IS_FUNC_DISABLED(__pAdapter, __FuncBits) ( (__pAdapter)->DisabledFunctions & (__FuncBits) ) -#define GetDefaultAdapter(padapter) padapter - // rtl8812_hal_init.c void _8051Reset8192E(PADAPTER padapter); s32 FirmwareDownload8192E(PADAPTER Adapter, BOOLEAN bUsedWoWLANFw); @@ -280,5 +305,16 @@ void SetBcnCtrlReg(PADAPTER padapter, u8 SetBits, u8 ClearBits); void rtl8192e_start_thread(_adapter *padapter); void rtl8192e_stop_thread(_adapter *padapter); + +#ifdef CONFIG_PCI_HCI +BOOLEAN InterruptRecognized8192EE(PADAPTER Adapter); +u16 get_txdesc_buf_addr(u16 ff_hwaddr); +#endif + + +#ifdef CONFIG_BT_COEXIST +void rtl8192e_combo_card_WifiOnlyHwInit(PADAPTER Adapter); +#endif + #endif //__RTL8192E_HAL_H__ diff --git a/include/rtl8192e_recv.h b/include/rtl8192e_recv.h index a840484..4dc9769 100644 --- a/include/rtl8192e_recv.h +++ b/include/rtl8192e_recv.h @@ -22,19 +22,25 @@ #if defined(CONFIG_USB_HCI) +#ifndef MAX_RECVBUF_SZ #ifdef PLATFORM_OS_CE #define MAX_RECVBUF_SZ (8192+1024) // 8K+1k #else #ifdef CONFIG_MINIMAL_MEMORY_USAGE #define MAX_RECVBUF_SZ (4000) // about 4K #else + #ifdef CONFIG_PLATFORM_MSTAR + #define MAX_RECVBUF_SZ (8192) // 8K + #else #define MAX_RECVBUF_SZ (32768) // 32k + #endif //#define MAX_RECVBUF_SZ (20480) //20K //#define MAX_RECVBUF_SZ (10240) //10K //#define MAX_RECVBUF_SZ (16384) // 16k - 92E RX BUF :16K //#define MAX_RECVBUF_SZ (8192+1024) // 8K+1k #endif #endif +#endif //!MAX_RECVBUF_SZ #elif defined(CONFIG_PCI_HCI) //#ifndef CONFIG_MINIMAL_MEMORY_USAGE @@ -55,7 +61,28 @@ #define Rx_Smooth_Factor (20) //============= +// [1] Rx Buffer Descriptor (for PCIE) buffer descriptor architecture +//DWORD 0 +#define SET_RX_BUFFER_DESC_DATA_LENGTH_92E(__pRxStatusDesc, __Value) SET_BITS_TO_LE_4BYTE( __pRxStatusDesc, 0, 14, __Value) +#define SET_RX_BUFFER_DESC_LS_92E(__pRxStatusDesc,__Value) SET_BITS_TO_LE_4BYTE( __pRxStatusDesc, 15, 1, __Value) +#define SET_RX_BUFFER_DESC_FS_92E(__pRxStatusDesc, __Value) SET_BITS_TO_LE_4BYTE( __pRxStatusDesc, 16, 1, __Value) +#define SET_RX_BUFFER_DESC_TOTAL_LENGTH_92E(__pRxStatusDesc, __Value) SET_BITS_TO_LE_4BYTE( __pRxStatusDesc, 16, 15, __Value) +#define GET_RX_BUFFER_DESC_OWN_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 31, 1) +#define GET_RX_BUFFER_DESC_LS_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 15, 1) +#define GET_RX_BUFFER_DESC_FS_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 16, 1) +#define GET_RX_BUFFER_DESC_TOTAL_LENGTH_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 16, 15) + + +//DWORD 1 +#define SET_RX_BUFFER_PHYSICAL_LOW_92E(__pRxStatusDesc, __Value) SET_BITS_TO_LE_4BYTE( __pRxStatusDesc+4, 0, 32, __Value) +#define GET_RX_BUFFER_PHYSICAL_LOW_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 0, 32) + +//DWORD 2 +#define SET_RX_BUFFER_PHYSICAL_HIGH_92E(__pRxStatusDesc, __Value) SET_BITS_TO_LE_4BYTE( __pRxStatusDesc+8, 0, 32, __Value) + +//============= +// [2] Rx Descriptor //DWORD 0 #define GET_RX_STATUS_DESC_PKT_LEN_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 0, 14) #define GET_RX_STATUS_DESC_CRC32_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 14, 1) @@ -67,6 +94,12 @@ #define GET_RX_STATUS_DESC_PHY_STATUS_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 26, 1) #define GET_RX_STATUS_DESC_SWDEC_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 27, 1) #define GET_RX_STATUS_DESC_EOR_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 30, 1) +#define GET_RX_STATUS_DESC_OWN_92E(__pRxStatusDesc) LE_BITS_TO_4BYTE( __pRxStatusDesc, 31, 1) + + +#define SET_RX_STATUS_DESC_PKT_LEN_92E(__pRxStatusDesc, __Value) SET_BITS_TO_LE_4BYTE( __pRxStatusDesc, 0, 14, __Value) +#define SET_RX_STATUS_DESC_EOR_92E(__pRxStatusDesc, __Value) SET_BITS_TO_LE_4BYTE( __pRxStatusDesc, 30, 1, __Value) +#define SET_RX_STATUS_DESC_OWN_92E(__pRxStatusDesc, __Value) SET_BITS_TO_LE_4BYTE( __pRxStatusDesc, 31, 1, __Value) //DWORD 1 #define GET_RX_STATUS_DESC_MACID_92E(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+4, 0, 7) @@ -116,8 +149,6 @@ #define GET_RX_STATUS_DESC_BUFF_ADDR_92E(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+24, 0, 32) #define GET_RX_STATUS_DESC_BUFF_ADDR64_92E(__pRxDesc) LE_BITS_TO_4BYTE(__pRxDesc+28, 0, 32) -#define SET_RX_STATUS_DESC_BUFF_ADDR_92E(__pRxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pRxDesc+24, 0, 32, __Value) - #ifdef CONFIG_SDIO_HCI s32 rtl8812s_init_recv_priv(PADAPTER padapter); diff --git a/include/rtl8192e_spec.h b/include/rtl8192e_spec.h index c3f9316..ad9dd59 100644 --- a/include/rtl8192e_spec.h +++ b/include/rtl8192e_spec.h @@ -35,6 +35,8 @@ // 0x0000h ~ 0x00FFh System Configuration // //----------------------------------------------------- +#define REG_SYS_SWR_CTRL1_8192E 0x0010 // 1 Byte +#define REG_SYS_SWR_CTRL2_8192E 0x0014 // 1 Byte #define REG_AFE_CTRL1_8192E 0x0024 #define REG_AFE_CTRL2_8192E 0x0028 #define REG_AFE_CTRL3_8192E 0x002c @@ -79,6 +81,8 @@ // 0x0200h ~ 0x027Fh TXDMA Configuration // //----------------------------------------------------- +#define REG_DWBCN0_CTRL 0x0208 +#define REG_DWBCN1_CTRL 0x0228 //----------------------------------------------------- // @@ -98,7 +102,62 @@ // 0x0300h ~ 0x03FFh PCIe // //----------------------------------------------------- -#define REG_PCIE_MULTIFET_CTRL_8192E 0x036A //PCIE Multi-Fethc Control +#define REG_PCIE_CTRL_REG_8192E 0x0300 +#define REG_INT_MIG_8192E 0x0304 // Interrupt Migration +#define REG_BCNQ_TXBD_DESA_8192E 0x0308 // TX Beacon Descriptor Address +#define REG_MGQ_TXBD_DESA_8192E 0x0310 // TX Manage Queue Descriptor Address +#define REG_VOQ_TXBD_DESA_8192E 0x0318 // TX VO Queue Descriptor Address +#define REG_VIQ_TXBD_DESA_8192E 0x0320 // TX VI Queue Descriptor Address +#define REG_BEQ_TXBD_DESA_8192E 0x0328 // TX BE Queue Descriptor Address +#define REG_BKQ_TXBD_DESA_8192E 0x0330 // TX BK Queue Descriptor Address +#define REG_RXQ_RXBD_DESA_8192E 0x0338 // RX Queue Descriptor Address +#define REG_HI0Q_TXBD_DESA_8192E 0x0340 +#define REG_HI1Q_TXBD_DESA_8192E 0x0348 +#define REG_HI2Q_TXBD_DESA_8192E 0x0350 +#define REG_HI3Q_TXBD_DESA_8192E 0x0358 +#define REG_HI4Q_TXBD_DESA_8192E 0x0360 +#define REG_HI5Q_TXBD_DESA_8192E 0x0368 +#define REG_HI6Q_TXBD_DESA_8192E 0x0370 +#define REG_HI7Q_TXBD_DESA_8192E 0x0378 +#define REG_MGQ_TXBD_NUM_8192E 0x0380 +#define REG_RX_RXBD_NUM_8192E 0x0382 +#define REG_VOQ_TXBD_NUM_8192E 0x0384 +#define REG_VIQ_TXBD_NUM_8192E 0x0386 +#define REG_BEQ_TXBD_NUM_8192E 0x0388 +#define REG_BKQ_TXBD_NUM_8192E 0x038A +#define REG_HI0Q_TXBD_NUM_8192E 0x038C +#define REG_HI1Q_TXBD_NUM_8192E 0x038E +#define REG_HI2Q_TXBD_NUM_8192E 0x0390 +#define REG_HI3Q_TXBD_NUM_8192E 0x0392 +#define REG_HI4Q_TXBD_NUM_8192E 0x0394 +#define REG_HI5Q_TXBD_NUM_8192E 0x0396 +#define REG_HI6Q_TXBD_NUM_8192E 0x0398 +#define REG_HI7Q_TXBD_NUM_8192E 0x039A +#define REG_TSFTIMER_HCI_8192E 0x039C + +//Read Write Point +#define REG_VOQ_TXBD_IDX_8192E 0x03A0 +#define REG_VIQ_TXBD_IDX_8192E 0x03A4 +#define REG_BEQ_TXBD_IDX_8192E 0x03A8 +#define REG_BKQ_TXBD_IDX_8192E 0x03AC +#define REG_MGQ_TXBD_IDX_8192E 0x03B0 +#define REG_RXQ_TXBD_IDX_8192E 0x03B4 +#define REG_HI0Q_TXBD_IDX_8192E 0x03B8 +#define REG_HI1Q_TXBD_IDX_8192E 0x03BC +#define REG_HI2Q_TXBD_IDX_8192E 0x03C0 +#define REG_HI3Q_TXBD_IDX_8192E 0x03C4 +#define REG_HI4Q_TXBD_IDX_8192E 0x03C8 +#define REG_HI5Q_TXBD_IDX_8192E 0x03CC +#define REG_HI6Q_TXBD_IDX_8192E 0x03D0 +#define REG_HI7Q_TXBD_IDX_8192E 0x03D4 + +#define REG_PCIE_HCPWM_8192EE 0x03D8 // ?????? +#define REG_PCIE_HRPWM_8192EE 0x03DC //PCIe RPWM // ?????? +#define REG_DBI_WDATA_V1_8192E 0x03E8 +#define REG_DBI_RDATA_V1_8192E 0x03EC +#define REG_DBI_FLAG_V1_8192E 0x03F0 +#define REG_MDIO_V1_8192E 0x3F4 +#define REG_PCIE_MIX_CFG_8192E 0x3F8 //----------------------------------------------------- // @@ -106,14 +165,18 @@ // //----------------------------------------------------- #define REG_TXBF_CTRL_8192E 0x042C +#define REG_ARFR0_8192E 0x0444 #define REG_ARFR1_8192E 0x044C #define REG_CCK_CHECK_8192E 0x0454 #define REG_AMPDU_MAX_TIME_8192E 0x0456 #define REG_BCNQ1_BDNY_8192E 0x0457 #define REG_AMPDU_MAX_LENGTH_8192E 0x0458 +#define REG_WMAC_LBK_BUF_HD_8192E 0x045D #define REG_NDPA_OPT_CTRL_8192E 0x045F #define REG_DATA_SC_8192E 0x0483 +#define REG_ARFR2_8192E 0x048C +#define REG_ARFR3_8192E 0x0494 #define REG_TXRPT_START_OFFSET 0x04AC #define REG_AMPDU_BURST_MODE_8192E 0x04BC #define REG_HT_SINGLE_AMPDU_8192E 0x04C7 @@ -246,8 +309,12 @@ #define AcmHw_ViqStatus_8192E BIT(6) #define AcmHw_BeqStatus_8192E BIT(7) +//======================================================== +// General definitions +//======================================================== - +#define MACID_NUM_8192E 128 +#define CAM_ENTRY_NUM_8192E 64 #endif //__RTL8192E_SPEC_H__ diff --git a/include/rtl8192e_xmit.h b/include/rtl8192e_xmit.h index 200a111..2e397a3 100644 --- a/include/rtl8192e_xmit.h +++ b/include/rtl8192e_xmit.h @@ -127,17 +127,7 @@ typedef struct txdescriptor_8192e u32 mcs15_sgi_max_len:4; }TXDESC_8192E, *PTXDESC_8192E; -// -// Queue Select Value in TxDesc -// -#define QSLT_BK 0x2//0x01 -#define QSLT_BE 0x0 -#define QSLT_VI 0x5//0x4 -#define QSLT_VO 0x7//0x6 -#define QSLT_BEACON 0x10 -#define QSLT_HIGH 0x11 -#define QSLT_MGNT 0x12 -#define QSLT_CMD 0x13 + //For 88e early mode #define SET_EARLYMODE_PKTNUM(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 0, 3, __Value) @@ -207,16 +197,48 @@ typedef struct txdescriptor_8192e #define USB_TXAGG_NUM_SHT 24 +//=====Tx Desc Buffer content -//=====Desc content +// config element for each tx buffer +/* +#define SET_TXBUFFER_DESC_LEN_WITH_OFFSET(__pTxDesc, __Offset, __Valeu) SET_BITS_TO_LE_4BYTE(__pTxDesc+(__Offset*16), 0, 16, __Valeu) +#define SET_TXBUFFER_DESC_AMSDU_WITH_OFFSET(__pTxDesc, __Offset, __Valeu) SET_BITS_TO_LE_4BYTE(__pTxDesc+(__Offset*16), 31, 1, __Valeu) +#define SET_TXBUFFER_DESC_ADD_LOW_WITH_OFFSET(__pTxDesc, __Offset, __Valeu) SET_BITS_TO_LE_4BYTE(__pTxDesc+(__Offset*16)+4, 0, 32, __Valeu) +#define SET_TXBUFFER_DESC_ADD_HIGT_WITH_OFFSET(__pTxDesc, __Offset, __Valeu) SET_BITS_TO_LE_4BYTE(__pTxDesc+(__Offset*16)+8, 0, 32, __Valeu) +*/ +#define SET_TXBUFFER_DESC_LEN_WITH_OFFSET(__pTxDesc, __Offset, __Valeu) SET_BITS_TO_LE_4BYTE(__pTxDesc+(__Offset*8), 0, 16, __Valeu) +#define SET_TXBUFFER_DESC_AMSDU_WITH_OFFSET(__pTxDesc, __Offset, __Valeu) SET_BITS_TO_LE_4BYTE(__pTxDesc+(__Offset*8), 31, 1, __Valeu) +#define SET_TXBUFFER_DESC_ADD_LOW_WITH_OFFSET(__pTxDesc, __Offset, __Valeu) SET_BITS_TO_LE_4BYTE(__pTxDesc+(__Offset*8)+4, 0, 32, __Valeu) +#define SET_TXBUFFER_DESC_ADD_HIGT_WITH_OFFSET(__pTxDesc, __Offset, __Valeu) SET_BITS_TO_LE_4BYTE(__pTxDesc+(__Offset*16)+8, 0, 32, __Valeu) + + +// Dword 0 +#define SET_TX_BUFF_DESC_LEN_0_92E(__pTxDesc, __Valeu) SET_BITS_TO_LE_4BYTE(__pTxDesc, 0, 14, __Valeu) +#define SET_TX_BUFF_DESC_PSB_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 16, 15, __Value) +#define SET_TX_BUFF_DESC_OWN_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 31, 1, __Value) +// Dword 1 +#define SET_TX_BUFF_DESC_ADDR_LOW_0_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 0, 32, __Value) +#define GET_TX_DESC_TX_BUFFER_ADDRESS_92E(__pTxDesc) LE_BITS_TO_4BYTE(__pTxDesc+4, 0,32) + + +// Dword 2 +#define SET_TX_BUFF_DESC_ADDR_HIGH_0_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 0, 32, __Value) +// Dword 3, RESERVED + + +//=====Tx Desc content // Dword 0 #define SET_TX_DESC_PKT_SIZE_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 0, 16, __Value) #define SET_TX_DESC_OFFSET_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 16, 8, __Value) #define SET_TX_DESC_BMC_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 24, 1, __Value) #define SET_TX_DESC_HTC_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 25, 1, __Value) +#define SET_TX_DESC_LAST_SEG_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 26, 1, __Value) +#define SET_TX_DESC_FIRST_SEG_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 27, 1, __Value) #define SET_TX_DESC_LINIP_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 28, 1, __Value) #define SET_TX_DESC_NO_ACM_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 29, 1, __Value) #define SET_TX_DESC_GF_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 30, 1, __Value) +#define SET_TX_DESC_OWN_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc, 31, 1, __Value) +#define GET_TX_DESC_OWN_92E(__pTxDesc) LE_BITS_TO_4BYTE(__pTxDesc, 31, 1) // Dword 1 #define SET_TX_DESC_MACID_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 0, 7, __Value) @@ -324,13 +346,8 @@ typedef struct txdescriptor_8192e #define SET_TX_DESC_TXBF_PATH_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+36, 11, 1, __Value) #define SET_TX_DESC_SEQ_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+36, 12, 12, __Value) #define SET_TX_DESC_FINAL_DATA_RATE_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+36, 24, 8, __Value) -// Dword 10 -#define SET_TX_DESC_TX_BUFFER_ADDRESS_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+40, 0, 32, __Value) -// Dword 11 -#define SET_TX_DESC_NEXT_DESC_ADDRESS_92E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+48, 0, 32, __Value) - #define SET_EARLYMODE_PKTNUM_92E(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 0, 4, __Value) #define SET_EARLYMODE_LEN0_92E(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 4, 15, __Value) #define SET_EARLYMODE_LEN1_1_92E(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 19, 13, __Value) @@ -358,6 +375,7 @@ s32 rtl8192eu_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv s32 rtl8192ee_init_xmit_priv(PADAPTER padapter); void rtl8192ee_free_xmit_priv(PADAPTER padapter); struct xmit_buf *rtl8192ee_dequeue_xmitbuf(struct rtw_tx_ring *ring); +s32 rtl8192ee_hal_xmitframe_enqueue(_adapter *padapter, struct xmit_frame *pxmitframe); void rtl8192ee_xmitframe_resume(_adapter *padapter); s32 rtl8192ee_hal_xmit(PADAPTER padapter, struct xmit_frame *pxmitframe); s32 rtl8192ee_mgnt_xmit(PADAPTER padapter, struct xmit_frame *pmgntframe); diff --git a/include/rtl8723a_cmd.h b/include/rtl8723a_cmd.h index 43523d4..ced4a49 100644 --- a/include/rtl8723a_cmd.h +++ b/include/rtl8723a_cmd.h @@ -21,7 +21,7 @@ #define __RTL8723A_CMD_H__ -#define H2C_BT_FW_PATCH_LEN 3 +#define H2C_8723A_BT_FW_PATCH_LEN 3 #define H2C_BT_PWR_FORCE_LEN 3 enum cmd_msg_element_id @@ -49,11 +49,11 @@ enum cmd_msg_element_id BT_PTA_MANAGER_UPDATE_ENABLE_EID = 38, DAC_SWING_VALUE_EID = 41, TRADITIONAL_TDMA_EN_EID = 51, - H2C_BT_FW_PATCH = 54, + H2C_8723A_BT_FW_PATCH = 54, B_TYPE_TDMA_EID = 58, SCAN_EN_EID = 59, LOWPWR_LPS_EID = 71, - H2C_RESET_TSF = 75, + H2C_8723A_RESET_TSF = 75, MAX_CMDMSG_EID }; diff --git a/include/rtl8723a_hal.h b/include/rtl8723a_hal.h index 13c6861..1f8586e 100644 --- a/include/rtl8723a_hal.h +++ b/include/rtl8723a_hal.h @@ -155,13 +155,6 @@ typedef struct _RT_FIRMWARE_8723A { u8 szFwBuffer[FW_8723A_SIZE]; #endif u32 ulFwLength; - -#ifdef CONFIG_EMBEDDED_FWIMG - u8* szBTFwBuffer; -#else - u8 szBTFwBuffer[FW_8723A_SIZE]; -#endif - u32 ulBTFwLength; } RT_FIRMWARE_8723A, *PRT_FIRMWARE_8723A; // @@ -448,6 +441,7 @@ void Hal_InitChannelPlan(PADAPTER padapter); void rtl8723a_set_hal_ops(struct hal_ops *pHalFunc); void SetHwReg8723A(PADAPTER padapter, u8 variable, u8 *val); void GetHwReg8723A(PADAPTER padapter, u8 variable, u8 *val); +u8 GetHalDefVar8723A(PADAPTER Adapter, HAL_DEF_VARIABLE eVariable, PVOID pValue); #ifdef CONFIG_BT_COEXIST void rtl8723a_SingleDualAntennaDetection(PADAPTER padapter); #endif diff --git a/include/rtl8723a_spec.h b/include/rtl8723a_spec.h index 6f67856..de2c28e 100644 --- a/include/rtl8723a_spec.h +++ b/include/rtl8723a_spec.h @@ -98,6 +98,8 @@ // General definitions //============================================================================ +#define MACID_NUM_8723A 32 +#define CAM_ENTRY_NUM_8723A 32 -#endif +#endif /* __RTL8723A_SPEC_H__ */ diff --git a/include/rtl8723a_xmit.h b/include/rtl8723a_xmit.h index a4bc48d..0613b87 100644 --- a/include/rtl8723a_xmit.h +++ b/include/rtl8723a_xmit.h @@ -48,7 +48,7 @@ //OFFSET 8 #define AGG_EN BIT(29) - +#define AMPDU_DENSITY_SHT 20 //OFFSET 12 #define SEQ_SHT 16 diff --git a/include/rtl8723b_cmd.h b/include/rtl8723b_cmd.h index 79a1261..2c7ff87 100644 --- a/include/rtl8723b_cmd.h +++ b/include/rtl8723b_cmd.h @@ -361,5 +361,5 @@ u8 rtl8723b_reset_tsf(_adapter *padapter, u8 reset_port); #endif // CONFIG_TSF_RESET_OFFLOAD s32 FillH2CCmd8723B(PADAPTER padapter, u8 ElementID, u32 CmdLen, u8 *pCmdBuffer); -#define FillH2CCmd FillH2CCmd8723B #endif + diff --git a/include/rtl8723b_hal.h b/include/rtl8723b_hal.h index d7a99a4..ed8c4bb 100644 --- a/include/rtl8723b_hal.h +++ b/include/rtl8723b_hal.h @@ -82,14 +82,6 @@ typedef struct _RT_FIRMWARE { u8 szFwBuffer[FW_8723B_SIZE]; #endif u32 ulFwLength; - -#ifdef CONFIG_EMBEDDED_FWIMG - u8* szBTFwBuffer; - u8 myBTFwBuffer[FW_8723B_SIZE]; -#else - u8 szBTFwBuffer[FW_8723B_SIZE]; -#endif - u32 ulBTFwLength; } RT_FIRMWARE_8723B, *PRT_FIRMWARE_8723B; // @@ -133,7 +125,11 @@ typedef struct _RT_8723B_FIRMWARE_HDR #define PAGE_SIZE_RX_8723B 8 #define RX_DMA_SIZE_8723B 0x4000 // 16K +#ifdef CONFIG_FW_C2H_DEBUG +#define RX_DMA_RESERVED_SIZE_8723B 0x100 // 256B, reserved for c2h debug message +#else #define RX_DMA_RESERVED_SIZE_8723B 0x80 // 128B, reserved for tx report +#endif #define RX_DMA_BOUNDARY_8723B (RX_DMA_SIZE_8723B - RX_DMA_RESERVED_SIZE_8723B - 1) @@ -164,7 +160,7 @@ typedef struct _RT_8723B_FIRMWARE_HDR #ifdef CONFIG_PNO_SUPPORT #undef WOWLAN_PAGE_NUM_8723B -#define WOWLAN_PAGE_NUM_8723B 0x0d +#define WOWLAN_PAGE_NUM_8723B 0x15 #endif #ifdef CONFIG_AP_WOWLAN @@ -231,6 +227,9 @@ typedef enum _C2H_EVT C2H_8723B_BT_INFO = 9, C2H_HW_INFO_EXCH = 10, C2H_8723B_BT_MP_INFO = 11, +#ifdef CONFIG_FW_C2H_DEBUG + C2H_8723B_FW_DEBUG = 0xff, +#endif //CONFIG_FW_C2H_DEBUG MAX_C2HEVENT } C2H_EVT; @@ -320,6 +319,9 @@ void HalSetOutPutGPIO(PADAPTER padapter, u8 index, u8 OutPutValue); int FirmwareDownloadBT(IN PADAPTER Adapter, PRT_MP_FIRMWARE pFirmware); void CCX_FwC2HTxRpt_8723b(PADAPTER padapter, u8 *pdata, u8 len); +#ifdef CONFIG_FW_C2H_DEBUG +void Debug_FwC2H_8723b(PADAPTER padapter, u8 *pdata, u8 len); +#endif //CONFIG_FW_C2H_DEBUG s32 c2h_id_filter_ccx_8723b(u8 *buf); s32 c2h_handler_8723b(PADAPTER padapter, u8 *pC2hEvent); u8 MRateToHwRate8723B(u8 rate); diff --git a/include/rtl8723b_spec.h b/include/rtl8723b_spec.h index b1fba0f..aa4bc2c 100644 --- a/include/rtl8723b_spec.h +++ b/include/rtl8723b_spec.h @@ -278,16 +278,12 @@ #define RT_AC_INT_MASKS (IMR_VIDOK_8723B | IMR_VODOK_8723B | IMR_BEDOK_8723B|IMR_BKDOK_8723B) #endif -#endif +//======================================================== +// General definitions +//======================================================== -#ifdef CONFIG_USB_HCI -//should be renamed and moved to another file -typedef enum _BOARD_TYPE_8192CUSB{ - BOARD_USB_DONGLE = 0, // USB dongle - BOARD_USB_High_PA = 1, // USB dongle with high power PA - BOARD_MINICARD = 2, // Minicard - BOARD_USB_SOLO = 3, // USB solo-Slim module - BOARD_USB_COMBO = 4, // USB Combo-Slim module -} BOARD_TYPE_8723BUSB, *PBOARD_TYPE_8723BUSB; +#define MACID_NUM_8723B 128 +#define CAM_ENTRY_NUM_8723B 64 + +#endif /* __RTL8723B_SPEC_H__ */ -#endif diff --git a/include/rtl8723b_xmit.h b/include/rtl8723b_xmit.h index 2de6a68..2b2bc5c 100644 --- a/include/rtl8723b_xmit.h +++ b/include/rtl8723b_xmit.h @@ -20,17 +20,6 @@ #ifndef __RTL8723B_XMIT_H__ #define __RTL8723B_XMIT_H__ -// -// Queue Select Value in TxDesc -// -#define QSLT_BK 0x2//0x01 -#define QSLT_BE 0x0 -#define QSLT_VI 0x5//0x4 -#define QSLT_VO 0x7//0x6 -#define QSLT_BEACON 0x10 -#define QSLT_HIGH 0x11 -#define QSLT_MGNT 0x12 -#define QSLT_CMD 0x13 #define MAX_TID (15) diff --git a/include/rtl8812a_cmd.h b/include/rtl8812a_cmd.h index 0dfc257..596d6fe 100644 --- a/include/rtl8812a_cmd.h +++ b/include/rtl8812a_cmd.h @@ -41,6 +41,7 @@ typedef enum _RTL8812_H2C_CMD H2C_8812_RA_MASK = 0x40, H2C_8812_TxBF = 0x41, H2C_8812_RSSI_REPORT = 0x42, + H2C_8812_IQ_CALIBRATION = 0x45, H2C_8812_BT_FW_PATCH = 0x6a, @@ -134,6 +135,7 @@ u8 rtl8812_set_rssi_cmd(PADAPTER padapter, u8 *param); void rtl8812_set_raid_cmd(PADAPTER padapter, u32 bitmap, u8* arg); void rtl8812_Add_RateATid(PADAPTER padapter, u32 bitmap, u8* arg, u8 rssi_level); void rtl8812_set_wowlan_cmd(_adapter* padapter, u8 enable); +s32 FillH2CCmd_8812(PADAPTER padapter, u8 ElementID, u32 CmdLen, u8 *pCmdBuffer); #ifdef CONFIG_P2P_PS void rtl8812_set_p2p_ps_offload_cmd(PADAPTER padapter, u8 p2p_ps_state); diff --git a/include/rtl8812a_hal.h b/include/rtl8812a_hal.h index 79718ee..7985687 100644 --- a/include/rtl8812a_hal.h +++ b/include/rtl8812a_hal.h @@ -271,17 +271,6 @@ typedef enum _TX_PWR_PERCENTAGE{ //#define RT_IS_FUNC_DISABLED(__pAdapter, __FuncBits) ( (__pAdapter)->DisabledFunctions & (__FuncBits) ) -#define GetRegTxBBSwing_2G(_Adapter) (_Adapter->registrypriv.TxBBSwing_2G) -#define GetRegTxBBSwing_5G(_Adapter) (_Adapter->registrypriv.TxBBSwing_5G) - -#define GetRegAmplifierType2G(_Adapter) (_Adapter->registrypriv.AmplifierType_2G) -#define GetRegAmplifierType5G(_Adapter) (_Adapter->registrypriv.AmplifierType_5G) - -#define GetRegbENRFEType(_Adapter) (_Adapter->registrypriv.bEn_RFE) -#define GetRegRFEType(_Adapter) (_Adapter->registrypriv.RFE_Type) - -#define GetDefaultAdapter(padapter) padapter - // rtl8812_hal_init.c void _8051Reset8812(PADAPTER padapter); s32 FirmwareDownload8812(PADAPTER Adapter, BOOLEAN bUsedWoWLANFw); diff --git a/include/rtl8812a_recv.h b/include/rtl8812a_recv.h index d1c2029..1ad222d 100644 --- a/include/rtl8812a_recv.h +++ b/include/rtl8812a_recv.h @@ -22,11 +22,16 @@ #if defined(CONFIG_USB_HCI) +#ifndef MAX_RECVBUF_SZ #ifdef PLATFORM_OS_CE #define MAX_RECVBUF_SZ (8192+1024) // 8K+1k #else #ifndef CONFIG_MINIMAL_MEMORY_USAGE + #ifdef CONFIG_PLATFORM_MSTAR + #define MAX_RECVBUF_SZ (8192) // 8K + #else #define MAX_RECVBUF_SZ (32768) // 32k + #endif //#define MAX_RECVBUF_SZ (24576) // 24k //#define MAX_RECVBUF_SZ (20480) //20K //#define MAX_RECVBUF_SZ (10240) //10K @@ -36,6 +41,7 @@ #define MAX_RECVBUF_SZ (4000) // about 4K #endif #endif +#endif //!MAX_RECVBUF_SZ #elif defined(CONFIG_PCI_HCI) //#ifndef CONFIG_MINIMAL_MEMORY_USAGE diff --git a/include/rtl8812a_spec.h b/include/rtl8812a_spec.h index f1e266f..c18ab7e 100644 --- a/include/rtl8812a_spec.h +++ b/include/rtl8812a_spec.h @@ -244,9 +244,16 @@ #define AcmHw_ViqStatus_8812 BIT(6) #define AcmHw_BeqStatus_8812 BIT(7) -#endif //__RTL8188E_SPEC_H__ +//======================================================== +// General definitions +//======================================================== + +#define MACID_NUM_8812A 128 +#define CAM_ENTRY_NUM_8812A 64 + +#endif /* __RTL8812A_SPEC_H__ */ #ifdef CONFIG_RTL8821A #include "rtl8821a_spec.h" -#endif // CONFIG_RTL8821A +#endif /* CONFIG_RTL8821A */ diff --git a/include/rtl8812a_xmit.h b/include/rtl8812a_xmit.h index cc87890..42e1a88 100644 --- a/include/rtl8812a_xmit.h +++ b/include/rtl8812a_xmit.h @@ -20,17 +20,6 @@ #ifndef __RTL8812A_XMIT_H__ #define __RTL8812A_XMIT_H__ -// -// Queue Select Value in TxDesc -// -#define QSLT_BK 0x2//0x01 -#define QSLT_BE 0x0 -#define QSLT_VI 0x5//0x4 -#define QSLT_VO 0x7//0x6 -#define QSLT_BEACON 0x10 -#define QSLT_HIGH 0x11 -#define QSLT_MGNT 0x12 -#define QSLT_CMD 0x13 //For 88e early mode #define SET_EARLYMODE_PKTNUM(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 0, 3, __Value) @@ -331,7 +320,7 @@ typedef struct txdescriptor_8812 void rtl8812a_cal_txdesc_chksum(u8 *ptxdesc); -void rtl8812a_fill_fake_txdesc(PADAPTER padapter,u8*pDesc,u32 BufferLen,u8 IsPsPoll,u8 IsBTQosNull); +void rtl8812a_fill_fake_txdesc(PADAPTER padapter,u8*pDesc,u32 BufferLen,u8 IsPsPoll,u8 IsBTQosNull, u8 bDataFrame); void rtl8812a_fill_txdesc_sectype(struct pkt_attrib *pattrib, u8 *ptxdesc); void rtl8812a_fill_txdesc_vcs(PADAPTER padapter, struct pkt_attrib *pattrib, u8 *ptxdesc); void rtl8812a_fill_txdesc_phy(PADAPTER padapter, struct pkt_attrib *pattrib, u8 *ptxdesc); diff --git a/include/rtl8821a_spec.h b/include/rtl8821a_spec.h index a6fe31b..6f99b8e 100644 --- a/include/rtl8821a_spec.h +++ b/include/rtl8821a_spec.h @@ -92,6 +92,12 @@ // Regsiter Bit and Content definition //============================================================ +//======================================================== +// General definitions +//======================================================== -#endif // __RTL8821A_SPEC_H__ +#define MACID_NUM_8821A 128 +#define CAM_ENTRY_NUM_8821A 64 + +#endif /* __RTL8821A_SPEC_H__ */ diff --git a/include/rtw_android.h b/include/rtw_android.h index a4c4e0d..5c2c49f 100644 --- a/include/rtw_android.h +++ b/include/rtw_android.h @@ -45,6 +45,9 @@ enum ANDROID_WIFI_CMD { ANDROID_WIFI_CMD_P2P_GET_NOA, ANDROID_WIFI_CMD_P2P_SET_PS, ANDROID_WIFI_CMD_SET_AP_WPS_P2P_IE, + + ANDROID_WIFI_CMD_MIRACAST, + #ifdef CONFIG_PNO_SUPPORT ANDROID_WIFI_CMD_PNOSSIDCLR_SET, ANDROID_WIFI_CMD_PNOSETUP_SET, diff --git a/include/rtw_ap.h b/include/rtw_ap.h index dccd5fa..ed8598f 100644 --- a/include/rtw_ap.h +++ b/include/rtw_ap.h @@ -33,7 +33,8 @@ void free_mlme_ap_info(_adapter *padapter); //void update_BCNTIM(_adapter *padapter); void rtw_add_bcn_ie(_adapter *padapter, WLAN_BSSID_EX *pnetwork, u8 index, u8 *data, u8 len); void rtw_remove_bcn_ie(_adapter *padapter, WLAN_BSSID_EX *pnetwork, u8 index); -void update_beacon(_adapter *padapter, u8 ie_id, u8 *oui, u8 tx); +void _update_beacon(_adapter *padapter, u8 ie_id, u8 *oui, u8 tx, const char *tag); +#define update_beacon(adapter, ie_id, oui, tx) _update_beacon((adapter), (ie_id), (oui), (tx), __func__) void add_RATid(_adapter *padapter, struct sta_info *psta, u8 rssi_level); void expire_timeout_chk(_adapter *padapter); void update_sta_info_apmode(_adapter *padapter, struct sta_info *psta); diff --git a/include/rtw_bt_mp.h b/include/rtw_bt_mp.h index 7a1fa0d..9ede51a 100644 --- a/include/rtw_bt_mp.h +++ b/include/rtw_bt_mp.h @@ -75,7 +75,7 @@ typedef enum _MP_BT_PAYLOAD_TYPE{ MP_BT_PAYLOAD_ALL_0 = 2, MP_BT_PAYLOAD_11110000 = 3, MP_BT_PAYLOAD_PRBS9 = 4, - MP_BT_PAYLOAD_MAX + MP_BT_PAYLOAD_MAX = 8, }MP_BT_PAYLOAD_TYPE,*PMP_BT_PAYLOAD_TYPE; diff --git a/include/rtw_btcoex.h b/include/rtw_btcoex.h index 23da49c..e7b2fa0 100644 --- a/include/rtw_btcoex.h +++ b/include/rtw_btcoex.h @@ -29,6 +29,8 @@ #define PACKET_EAPOL 3 void rtw_btcoex_Initialize(PADAPTER); +void rtw_btcoex_PowerOnSetting(PADAPTER padapter); +void rtw_btcoex_PreLoadFirmware(PADAPTER padapter); void rtw_btcoex_HAL_Initialize(PADAPTER padapter, u8 bWifiOnly); void rtw_btcoex_IpsNotify(PADAPTER, u8 type); void rtw_btcoex_LpsNotify(PADAPTER, u8 type); @@ -54,8 +56,9 @@ u8 rtw_btcoex_RpwmVal(PADAPTER); u8 rtw_btcoex_LpsVal(PADAPTER); void rtw_btcoex_SetBTCoexist(PADAPTER, u8 bBtExist); void rtw_btcoex_SetChipType(PADAPTER, u8 chipType); -void rtw_btcoex_SetPGAntNum(PADAPTER, u8 antNum, u8 antInverse); +void rtw_btcoex_SetPGAntNum(PADAPTER, u8 antNum); u8 rtw_btcoex_GetPGAntNum(PADAPTER); +void rtw_btcoex_SetSingleAntPath(PADAPTER padapter, u8 singleAntPath); u32 rtw_btcoex_GetRaMask(PADAPTER); void rtw_btcoex_RecordPwrMode(PADAPTER, u8 *pCmdBuf, u8 cmdLen); void rtw_btcoex_DisplayBtCoexInfo(PADAPTER, u8 *pbuf, u32 bufsize); diff --git a/include/rtw_cmd.h b/include/rtw_cmd.h index ae1ace1..bdb20dd 100644 --- a/include/rtw_cmd.h +++ b/include/rtw_cmd.h @@ -69,7 +69,8 @@ u32 cmd_issued_cnt; u32 cmd_done_cnt; u32 rsp_cnt; - u8 cmdthd_running; + ATOMIC_T cmdthd_running; + //u8 cmdthd_running; u8 stop_req; _adapter *padapter; _mutex sctx_mutex; @@ -221,6 +222,7 @@ enum rtw_drvextra_cmd_id DM_RA_MSK_WK_CID, //add for STA update RAMask when bandwith change. BEAMFORMING_WK_CID, LPS_CHANGE_DTIM_CID, + BTINFO_WK_CID, MAX_WK_CID }; @@ -386,7 +388,7 @@ when shared key ==> algorithm/keyid struct set_stakey_parm { u8 addr[ETH_ALEN]; u8 algorithm; - u8 id;// currently for erasing cam entry if algorithm == _NO_PRIVACY_ + u8 keyid; u8 key[16]; }; @@ -950,6 +952,14 @@ struct TDLSoption_param u8 option; }; +/*H2C Handler index: 64 */ +struct RunInThread_param +{ + void (*func)(void*); + void *context; +}; + + #define GEN_CMD_CODE(cmd) cmd ## _CMD_ @@ -982,8 +992,11 @@ extern u8 rtw_createbss_cmd(_adapter *padapter); extern u8 rtw_createbss_cmd_ex(_adapter *padapter, unsigned char *pbss, unsigned int sz); u8 rtw_startbss_cmd(_adapter *padapter, int flags); extern u8 rtw_setphy_cmd(_adapter *padapter, u8 modem, u8 ch); -extern u8 rtw_setstakey_cmd(_adapter *padapter, u8 *psta, u8 unicast_key, bool enqueue); -extern u8 rtw_clearstakey_cmd(_adapter *padapter, u8 *psta, u8 entry, u8 enqueue); + +struct sta_info; +extern u8 rtw_setstakey_cmd(_adapter *padapter, struct sta_info *sta, u8 unicast_key, bool enqueue); +extern u8 rtw_clearstakey_cmd(_adapter *padapter, struct sta_info *sta, u8 enqueue); + extern u8 rtw_joinbss_cmd(_adapter *padapter, struct wlan_network* pnetwork); u8 rtw_disassoc_cmd(_adapter *padapter, u32 deauth_timeout_ms, bool enqueue); extern u8 rtw_setopmode_cmd(_adapter *padapter, NDIS_802_11_NETWORK_INFRASTRUCTURE networktype, bool enqueue); @@ -1027,6 +1040,10 @@ extern u8 rtw_ps_cmd(_adapter*padapter); u8 rtw_chk_hi_queue_cmd(_adapter*padapter); #endif +#ifdef CONFIG_BT_COEXIST +u8 rtw_btinfo_cmd(PADAPTER padapter, u8 *pbuf, u16 length); +#endif + u8 rtw_set_ch_cmd(_adapter*padapter, u8 ch, u8 bw, u8 ch_offset, u8 enqueue); extern u8 rtw_set_chplan_cmd(_adapter*padapter, u8 chplan, u8 enqueue, u8 swconfig); extern u8 rtw_led_blink_cmd(_adapter*padapter, PVOID pLed); @@ -1039,6 +1056,8 @@ extern u8 rtw_c2h_packet_wk_cmd(PADAPTER padapter, u8 *pbuf, u16 length); extern u8 rtw_c2h_wk_cmd(PADAPTER padapter, u8 *c2h_evt); //#endif +u8 rtw_run_in_thread_cmd(PADAPTER padapter, void (*func)(void*), void* context); + u8 rtw_drvextra_cmd_hdl(_adapter *padapter, unsigned char *pbuf); extern void rtw_survey_cmd_callback(_adapter *padapter, struct cmd_obj *pcmd); @@ -1132,7 +1151,9 @@ enum rtw_h2c_cmd GEN_CMD_CODE(_SetChannelSwitch), /*61*/ GEN_CMD_CODE(_TDLS), /*62*/ GEN_CMD_CODE(_ChkBMCSleepq), /*63*/ - + + GEN_CMD_CODE(_RunInThreadCMD), /*64*/ + MAX_H2CCMD }; @@ -1215,6 +1236,8 @@ struct _cmd_callback rtw_cmd_callback[] = {GEN_CMD_CODE(_SetChannelSwitch), NULL},/*61*/ {GEN_CMD_CODE(_TDLS), NULL},/*62*/ {GEN_CMD_CODE(_ChkBMCSleepq), NULL}, /*63*/ + + {GEN_CMD_CODE(_RunInThreadCMD), NULL},/*64*/ }; #endif diff --git a/include/rtw_debug.h b/include/rtw_debug.h index 09490bc..2e0bcfe 100644 --- a/include/rtw_debug.h +++ b/include/rtw_debug.h @@ -194,6 +194,8 @@ extern void rtl871x_cedbg(const char *fmt, ...); #if defined(_dbgdump) +#define DBG_871X_EXP(level, EXP) do { if (level <= GlobalDebugLevel) EXP; } while (0) + /* with driver-defined prefix */ #undef DBG_871X_LEVEL #define DBG_871X_LEVEL(level, fmt, arg...) \ @@ -317,6 +319,12 @@ extern void rtl871x_cedbg(const char *fmt, ...); #endif /* defined(_dbgdump) */ #endif /* CONFIG_DEBUG_RTL871X */ +#ifdef CONFIG_DBG_COUNTER +#define DBG_COUNTER(counter) counter++ +#else +#define DBG_COUNTER(counter) +#endif + void dump_drv_version(void *sel); void dump_log_level(void *sel); @@ -328,6 +336,11 @@ void mac_reg_dump(void *sel, _adapter *adapter); void bb_reg_dump(void *sel, _adapter *adapter); void rf_reg_dump(void *sel, _adapter *adapter); +bool rtw_fwdl_test_trigger_chksum_fail(void); +bool rtw_fwdl_test_trigger_wintint_rdy_fail(void); + +u32 rtw_get_wait_hiq_empty_ms(void); + #ifdef CONFIG_PROC_DEBUG ssize_t proc_set_write_reg(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data); int proc_get_read_reg(struct seq_file *m, void *v); @@ -351,7 +364,11 @@ int proc_get_ap_info(struct seq_file *m, void *v); int proc_get_adapter_state(struct seq_file *m, void *v); int proc_get_trx_info(struct seq_file *m, void *v); int proc_get_rate_ctl(struct seq_file *m, void *v); +int proc_get_wifi_spec(struct seq_file *m, void *v); ssize_t proc_set_rate_ctl(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data); +int proc_get_dis_pwt(struct seq_file *m, void *v); +ssize_t proc_set_dis_pwt(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data); + int proc_get_suspend_resume_info(struct seq_file *m, void *v); ssize_t proc_set_fwdl_test_case(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data); @@ -389,14 +406,24 @@ ssize_t proc_set_rx_ampdu(struct file *file, const char __user *buffer, size_t c int proc_get_rx_stbc(struct seq_file *m, void *v); ssize_t proc_set_rx_stbc(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data); + + +int proc_get_rx_ampdu_factor(struct seq_file *m, void *v); +ssize_t proc_set_rx_ampdu_factor(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data); + +int proc_get_rx_ampdu_density(struct seq_file *m, void *v); +ssize_t proc_set_rx_ampdu_density(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data); + +int proc_get_tx_ampdu_density(struct seq_file *m, void *v); +ssize_t proc_set_tx_ampdu_density(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data); #endif /* CONFIG_80211N_HT */ int proc_get_en_fwps(struct seq_file *m, void *v); ssize_t proc_set_en_fwps(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data); //int proc_get_two_path_rssi(struct seq_file *m, void *v); -int proc_get_rssi_disp(struct seq_file *m, void *v); -ssize_t proc_set_rssi_disp(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data); +//int proc_get_rssi_disp(struct seq_file *m, void *v); +//ssize_t proc_set_rssi_disp(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data); #ifdef CONFIG_BT_COEXIST int proc_get_btcoex_dbg(struct seq_file *m, void *v); @@ -417,6 +444,20 @@ ssize_t proc_set_odm_dbg_level(struct file *file, const char __user *buffer, siz int proc_get_odm_adaptivity(struct seq_file *m, void *v); ssize_t proc_set_odm_adaptivity(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data); +#ifdef CONFIG_DBG_COUNTER +int proc_get_rx_logs(struct seq_file *m, void *v); +int proc_get_tx_logs(struct seq_file *m, void *v); +int proc_get_int_logs(struct seq_file *m, void *v); +#endif + +#ifdef CONFIG_PCI_HCI +int proc_get_rx_ring(struct seq_file *m, void *v); +int proc_get_tx_ring(struct seq_file *m, void *v); +#endif + +int proc_get_new_bcn_max(struct seq_file *m, void *v); +ssize_t proc_set_new_bcn_max(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data); + #endif /* CONFIG_PROC_DEBUG */ #endif //__RTW_DEBUG_H__ diff --git a/include/rtw_eeprom.h b/include/rtw_eeprom.h index 2c0b919..7705adc 100644 --- a/include/rtw_eeprom.h +++ b/include/rtw_eeprom.h @@ -124,8 +124,8 @@ struct eeprom_priv u8 adjuseVoltageVal; #ifdef CONFIG_RF_GAIN_OFFSET - u8 EEPROMRFGainOffset; - u8 EEPROMRFGainVal; + u8 EEPROMRFGainOffset; + u8 EEPROMRFGainVal; #endif //CONFIG_RF_GAIN_OFFSET #ifdef CONFIG_SDIO_HCI diff --git a/include/rtw_ht.h b/include/rtw_ht.h index fb9948a..84b3bfb 100644 --- a/include/rtw_ht.h +++ b/include/rtw_ht.h @@ -32,6 +32,8 @@ struct ht_priv u32 tx_amsdu_maxlen; // 1: 8k, 0:4k ; default:8k, for tx u32 rx_ampdu_maxlen; //for rx reordering ctrl win_sz, updated when join_callback. + u8 rx_ampdu_min_spacing; + u8 ch_offset;//PRIME_CHNL_OFFSET u8 sgi_20m; u8 sgi_40m; @@ -94,29 +96,74 @@ typedef enum _RT_HT_INF1_CAP{ //------------------------------------------------------------ // The HT Control field //------------------------------------------------------------ -#define SET_HT_CTRL_CSI_STEERING(_pEleStart, _val) SET_BITS_TO_LE_1BYTE((_pEleStart)+2, 6, 2, _val) -#define SET_HT_CTRL_NDP_ANNOUNCEMENT(_pEleStart, _val) SET_BITS_TO_LE_1BYTE((_pEleStart)+3, 0, 1, _val) -#define GET_HT_CTRL_NDP_ANNOUNCEMENT(_pEleStart) LE_BITS_TO_1BYTE((_pEleStart)+3, 0, 1) +#define SET_HT_CTRL_CSI_STEERING(_pEleStart, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_pEleStart))+2, 6, 2, _val) +#define SET_HT_CTRL_NDP_ANNOUNCEMENT(_pEleStart, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_pEleStart))+3, 0, 1, _val) +#define GET_HT_CTRL_NDP_ANNOUNCEMENT(_pEleStart) LE_BITS_TO_1BYTE(((u8*)(_pEleStart))+3, 0, 1) // 20/40 BSS Coexist -#define SET_EXT_CAPABILITY_ELE_BSS_COEXIST(_pEleStart, _val) SET_BITS_TO_LE_1BYTE((_pEleStart), 0, 1, _val) -#define GET_EXT_CAPABILITY_ELE_BSS_COEXIST(_pEleStart) LE_BITS_TO_1BYTE((_pEleStart), 0, 1) +#define SET_EXT_CAPABILITY_ELE_BSS_COEXIST(_pEleStart, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_pEleStart)), 0, 1, _val) +#define GET_EXT_CAPABILITY_ELE_BSS_COEXIST(_pEleStart) LE_BITS_TO_1BYTE(((u8*)(_pEleStart)), 0, 1) +/* HT Capabilities Info field */ +#define HT_CAP_ELE_CAP_INFO(_pEleStart) ((u8*)(_pEleStart)) +#define GET_HT_CAP_ELE_LDPC_CAP(_pEleStart) LE_BITS_TO_1BYTE(((u8*)(_pEleStart)), 0, 1) +#define GET_HT_CAP_ELE_CHL_WIDTH(_pEleStart) LE_BITS_TO_1BYTE(((u8*)(_pEleStart)), 1, 1) +#define GET_HT_CAP_ELE_SM_PS(_pEleStart) LE_BITS_TO_1BYTE(((u8*)(_pEleStart)), 2, 2) +#define GET_HT_CAP_ELE_GREENFIELD(_pEleStart) LE_BITS_TO_1BYTE(((u8*)(_pEleStart)), 4, 1) +#define GET_HT_CAP_ELE_SHORT_GI20M(_pEleStart) LE_BITS_TO_1BYTE(((u8*)(_pEleStart)), 5, 1) +#define GET_HT_CAP_ELE_SHORT_GI40M(_pEleStart) LE_BITS_TO_1BYTE(((u8*)(_pEleStart)), 6, 1) +#define GET_HT_CAP_ELE_TX_STBC(_pEleStart) LE_BITS_TO_1BYTE(((u8*)(_pEleStart)), 7, 1) +#define GET_HT_CAP_ELE_RX_STBC(_pEleStart) LE_BITS_TO_1BYTE(((u8*)(_pEleStart))+1, 0, 2) +#define GET_HT_CAP_ELE_DELAYED_BA(_pEleStart) LE_BITS_TO_1BYTE(((u8*)(_pEleStart))+1, 2, 1) +#define GET_HT_CAP_ELE_MAX_AMSDU_LENGTH(_pEleStart) LE_BITS_TO_1BYTE(((u8*)(_pEleStart))+1, 3, 1) +#define GET_HT_CAP_ELE_DSSS_CCK_40M(_pEleStart) LE_BITS_TO_1BYTE(((u8*)(_pEleStart))+1, 4, 1) +#define GET_HT_CAP_ELE_FORTY_INTOLERANT(_pEleStart) LE_BITS_TO_1BYTE(((u8*)(_pEleStart))+1, 6, 1) +#define GET_HT_CAP_ELE_LSIG_TXOP_PROTECT(_pEleStart) LE_BITS_TO_1BYTE(((u8*)(_pEleStart))+1, 7, 1) -#define GET_HT_CAPABILITY_ELE_LDPC_CAP(_pEleStart) LE_BITS_TO_1BYTE(_pEleStart, 0, 1) -#define GET_HT_CAPABILITY_ELE_TX_STBC(_pEleStart) LE_BITS_TO_1BYTE(_pEleStart, 7, 1) +#define SET_HT_CAP_ELE_FORTY_INTOLERANT(_pEleStart, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_pEleStart))+1, 6, 1, _val) -#define GET_HT_CAPABILITY_ELE_RX_STBC(_pEleStart) LE_BITS_TO_1BYTE((_pEleStart)+1, 0, 2) +/* A-MPDU Parameters field */ +#define HT_CAP_ELE_AMPDU_PARA(_pEleStart) (((u8*)(_pEleStart))+2) +#define GET_HT_CAP_ELE_MAX_AMPDU_LEN_EXP(_pEleStart) LE_BITS_TO_1BYTE(((u8*)(_pEleStart))+2, 0, 2) +#define GET_HT_CAP_ELE_MIN_MPDU_S_SPACE(_pEleStart) LE_BITS_TO_1BYTE(((u8*)(_pEleStart))+2, 2, 3) + +#define HT_AMPDU_PARA_FMT "%02x " \ + "MAX AMPDU len:%u bytes, MIN MPDU Start Spacing:%u" + +#define HT_AMPDU_PARA_ARG(x) \ + *((u8*)(x)) \ + , (1 << (13+GET_HT_CAP_ELE_MAX_AMPDU_LEN_EXP(((u8*)x)-2)))-1 \ + , GET_HT_CAP_ELE_MIN_MPDU_S_SPACE(((u8*)x)-2) + +/* Supported MCS Set field */ +#define HT_CAP_ELE_SUP_MCS_SET(_pEleStart) (((u8*)(_pEleStart))+3) +#define HT_CAP_ELE_RX_MCS_MAP(_pEleStart) HT_CAP_ELE_SUP_MCS_SET(_pEleStart) +#define GET_HT_CAP_ELE_RX_HIGHEST_DATA_RATE(_pEleStart) LE_BITS_TO_2BYTE(((u8*)(_pEleStart))+13, 0, 10) +#define GET_HT_CAP_ELE_TX_MCS_DEF(_pEleStart) LE_BITS_TO_1BYTE(((u8*)(_pEleStart))+15, 0, 1) +#define GET_HT_CAP_ELE_TRX_MCS_NEQ(_pEleStart) LE_BITS_TO_1BYTE(((u8*)(_pEleStart))+15, 1, 1) +#define GET_HT_CAP_ELE_TX_MAX_SS(_pEleStart) LE_BITS_TO_1BYTE(((u8*)(_pEleStart))+15, 2, 2) +#define GET_HT_CAP_ELE_TX_UEQM(_pEleStart) LE_BITS_TO_1BYTE(((u8*)(_pEleStart))+15, 4, 1) + +#define HT_SUP_MCS_SET_FMT "%02x %02x %02x %02x %02x%02x%02x%02x%02x%02x" \ + /* "\n%02x%02x%02x%02x%02x%02x" */\ + " %uMbps %s%s%s" +#define HT_SUP_MCS_SET_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5], \ + ((u8*)(x))[6],((u8*)(x))[7],((u8*)(x))[8],((u8*)(x))[9] \ + /*,((u8*)(x))[10],((u8*)(x))[11], ((u8*)(x))[12],((u8*)(x))[13],((u8*)(x))[14],((u8*)(x))[15] */\ + , GET_HT_CAP_ELE_RX_HIGHEST_DATA_RATE(((u8*)x)-3) \ + , GET_HT_CAP_ELE_TX_MCS_DEF(((u8*)x)-3) ? "TX_MCS_DEF " : "" \ + , GET_HT_CAP_ELE_TRX_MCS_NEQ(((u8*)x)-3) ? "TRX_MCS_NEQ " : "" \ + , GET_HT_CAP_ELE_TX_UEQM(((u8*)x)-3) ? "TX_UEQM " : "" //TXBF Capabilities -#define SET_HT_CAP_TXBF_RECEIVE_NDP_CAP(_pEleStart, _val) SET_BITS_TO_LE_4BYTE( ((u8 *)(_pEleStart))+21, 3, 1, ((u8)_val) ) -#define SET_HT_CAP_TXBF_TRANSMIT_NDP_CAP(_pEleStart, _val) SET_BITS_TO_LE_4BYTE( ((u8 *)(_pEleStart))+21, 4, 1, ((u8)_val) ) -#define SET_HT_CAP_TXBF_EXPLICIT_COMP_STEERING_CAP(_pEleStart, _val) SET_BITS_TO_LE_4BYTE( ((u8 *)(_pEleStart))+21, 10, 1, ((u8)_val) ) -#define SET_HT_CAP_TXBF_EXPLICIT_COMP_FEEDBACK_CAP(_pEleStart, _val) SET_BITS_TO_LE_4BYTE( ((u8 *)(_pEleStart))+21, 15, 2, ((u8)_val) ) +#define SET_HT_CAP_TXBF_RECEIVE_NDP_CAP(_pEleStart, _val) SET_BITS_TO_LE_4BYTE( ((u8*)(_pEleStart))+21, 3, 1, ((u8)_val) ) +#define SET_HT_CAP_TXBF_TRANSMIT_NDP_CAP(_pEleStart, _val) SET_BITS_TO_LE_4BYTE( ((u8*)(_pEleStart))+21, 4, 1, ((u8)_val) ) +#define SET_HT_CAP_TXBF_EXPLICIT_COMP_STEERING_CAP(_pEleStart, _val) SET_BITS_TO_LE_4BYTE( ((u8*)(_pEleStart))+21, 10, 1, ((u8)_val) ) +#define SET_HT_CAP_TXBF_EXPLICIT_COMP_FEEDBACK_CAP(_pEleStart, _val) SET_BITS_TO_LE_4BYTE( ((u8*)(_pEleStart))+21, 15, 2, ((u8)_val) ) #define SET_HT_CAP_TXBF_COMP_STEERING_NUM_ANTENNAS(_pEleStart, _val) SET_BITS_TO_LE_4BYTE( ((u8 *)(_pEleStart))+21, 23, 2, ((u8)_val) ) -#define GET_HT_CAP_TXBF_EXPLICIT_COMP_STEERING_CAP(_pEleStart) LE_BITS_TO_4BYTE((_pEleStart)+21, 10, 1) -#define GET_HT_CAP_TXBF_EXPLICIT_COMP_FEEDBACK_CAP(_pEleStart) LE_BITS_TO_4BYTE((_pEleStart)+21, 15, 2) +#define GET_HT_CAP_TXBF_EXPLICIT_COMP_STEERING_CAP(_pEleStart) LE_BITS_TO_4BYTE(((u8*)(_pEleStart))+21, 10, 1) +#define GET_HT_CAP_TXBF_EXPLICIT_COMP_FEEDBACK_CAP(_pEleStart) LE_BITS_TO_4BYTE(((u8*)(_pEleStart))+21, 15, 2) #endif //_RTL871X_HT_H_ diff --git a/include/rtw_io.h b/include/rtw_io.h index 10b2147..bad0acc 100644 --- a/include/rtw_io.h +++ b/include/rtw_io.h @@ -312,6 +312,11 @@ struct reg_protocol_wt { #define MAX_CONTINUAL_IO_ERR SD_IO_TRY_CNT #endif +#ifdef CONFIG_GSPI_HCI +#define SD_IO_TRY_CNT (8) +#define MAX_CONTINUAL_IO_ERR SD_IO_TRY_CNT +#endif + int rtw_inc_and_chk_continual_io_error(struct dvobj_priv *dvobj); void rtw_reset_continual_io_error(struct dvobj_priv *dvobj); diff --git a/include/rtw_mem.h b/include/rtw_mem.h new file mode 100644 index 0000000..5283d77 --- /dev/null +++ b/include/rtw_mem.h @@ -0,0 +1,38 @@ +/****************************************************************************** + * + * 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 __RTW_MEM_H__ +#define __RTW_MEM_H__ + +#include +#include +#include + + +#ifndef MAX_RECVBUF_SZ +#define MAX_RECVBUF_SZ (32768-RECVBUFF_ALIGN_SZ) // 32k +#endif + +struct u8* rtw_alloc_revcbuf_premem(void); +struct sk_buff *rtw_alloc_skb_premem(void); +int rtw_free_skb_premem(struct sk_buff *pskb); + + +#endif //__RTW_MEM_H__ + diff --git a/include/rtw_mlme.h b/include/rtw_mlme.h index bd96442..7e3174c 100644 --- a/include/rtw_mlme.h +++ b/include/rtw_mlme.h @@ -254,6 +254,7 @@ struct cfg80211_wifidirect_info{ struct ieee80211_channel remain_on_ch_channel; enum nl80211_channel_type remain_on_ch_type; u64 remain_on_ch_cookie; + bool not_indic_ro_ch_exp; bool is_ro_ch; u32 last_ro_ch_time; /* this will be updated at the beginning and end of ro_ch */ }; @@ -401,6 +402,18 @@ enum { RTW_ROAM_ACTIVE = BIT2, }; +struct beacon_keys { + u8 ssid[IW_ESSID_MAX_SIZE]; + u32 ssid_len; + u8 bcn_channel; + u16 ht_cap_info; + u8 ht_info_infos_0_sco; // bit0 & bit1 in infos[0] is second channel offset + int encryp_protocol; + int pairwise_cipher; + int group_cipher; + int is_8021x; +}; + struct mlme_priv { _lock lock; @@ -431,6 +444,12 @@ struct mlme_priv { struct wlan_network cur_network; struct wlan_network *cur_network_scanned; + + // bcn check info + struct beacon_keys cur_beacon_keys; // save current beacon keys + struct beacon_keys new_beacon_keys; // save new beacon keys + u8 new_beacon_cnts; // if new_beacon_cnts >= threshold, ap beacon is changed + #ifdef CONFIG_ARP_KEEP_ALIVE // for arp offload keep alive u8 gw_mac_addr[6]; @@ -619,6 +638,8 @@ struct mlme_priv { u8 scanning_via_buddy_intf; #endif +// u8 NumOfBcnInfoChkFail; +// u32 timeBcnInfoChkStart; }; #define rtw_mlme_set_auto_scan_int(adapter, ms) \ diff --git a/include/rtw_mlme_ext.h b/include/rtw_mlme_ext.h index d309605..166503f 100644 --- a/include/rtw_mlme_ext.h +++ b/include/rtw_mlme_ext.h @@ -104,6 +104,15 @@ #define _48M_RATE_ 10 #define _54M_RATE_ 11 +/******************************************************** +MCS rate definitions +*********************************************************/ +#define MCS_RATE_1R (0x000000ff) +#define MCS_RATE_2R (0x0000ffff) +#define MCS_RATE_3R (0x00ffffff) +#define MCS_RATE_4R (0xffffffff) +#define MCS_RATE_2R_13TO15_OFF (0x00001fff) + extern unsigned char RTW_WPA_OUI[]; extern unsigned char WMM_OUI[]; @@ -187,6 +196,7 @@ typedef enum _RT_CHANNEL_DOMAIN RT_CHANNEL_DOMAIN_FCC1_FCC9 = 0x55, RT_CHANNEL_DOMAIN_WORLD_ETSI13 = 0x56, RT_CHANNEL_DOMAIN_FCC1_FCC10 = 0x57, + RT_CHANNEL_DOMAIN_WORLD_MKK4 = 0x58, //===== Add new channel plan above this line===============// RT_CHANNEL_DOMAIN_MAX, RT_CHANNEL_DOMAIN_REALTEK_DEFINE = 0x7F, @@ -239,11 +249,15 @@ typedef enum _RT_CHANNEL_DOMAIN_5G RT_CHANNEL_DOMAIN_5G_FCC9 = 0x1D, //(w/o Weather radar) RT_CHANNEL_DOMAIN_5G_ETSI13 = 0x1E, //(w/o Weather radar) RT_CHANNEL_DOMAIN_5G_FCC10 = 0x1F, //Argentina (w/o Weather radar) + RT_CHANNEL_DOMAIN_5G_KCC2 = 0x20, //Korea 5G + RT_CHANNEL_DOMAIN_5G_FCC11 = 0x21, //US/Canada + RT_CHANNEL_DOMAIN_5G_NCC5 = 0x22, //Taiwan + RT_CHANNEL_DOMAIN_5G_MKK4 = 0x23, //Japan W52 //===== Add new channel plan above this line===============// //===== Driver Self Defined =====// - RT_CHANNEL_DOMAIN_5G_FCC = 0x20, - RT_CHANNEL_DOMAIN_5G_JAPAN_NO_DFS = 0x21, - RT_CHANNEL_DOMAIN_5G_FCC4_NO_DFS = 0x22, + RT_CHANNEL_DOMAIN_5G_FCC = 0x30, + RT_CHANNEL_DOMAIN_5G_JAPAN_NO_DFS = 0x31, + RT_CHANNEL_DOMAIN_5G_FCC4_NO_DFS = 0x32, RT_CHANNEL_DOMAIN_5G_MAX, }RT_CHANNEL_DOMAIN_5G, *PRT_CHANNEL_DOMAIN_5G; @@ -553,6 +567,9 @@ struct mlme_ext_priv struct p2p_channels channel_list; unsigned char basicrate[NumRates]; unsigned char datarate[NumRates]; +#ifdef CONFIG_80211N_HT + unsigned char default_supported_mcs_set[16]; +#endif struct ss_res sitesurvey_res; struct mlme_ext_info mlmext_info;//for sta/adhoc mode, including current scanning/connecting/connected related info. @@ -600,6 +617,7 @@ struct mlme_ext_priv }; +void init_mlme_default_rate_set(_adapter* padapter); int init_mlme_ext_priv(_adapter* padapter); int init_hw_mlme_ext(_adapter *padapter); void free_mlme_ext_priv (struct mlme_ext_priv *pmlmeext); @@ -615,6 +633,7 @@ unsigned char networktype_to_raid_ex(_adapter *adapter, struct sta_info *psta); u8 judge_network_type(_adapter *padapter, unsigned char *rate, int ratelen); void get_rate_set(_adapter *padapter, unsigned char *pbssrate, int *bssrate_len); +void set_mcs_rate_by_mask(u8 *mcs_set, u32 mask); void UpdateBrateTbl(_adapter *padapter,u8 *mBratesOS); void UpdateBrateTblForSoftAP(u8 *bssrateset, u32 bssratelen); void change_band_update_ie(_adapter *padapter, WLAN_BSSID_EX *pnetwork); @@ -697,8 +716,11 @@ void ERP_IE_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE); void VCS_update(_adapter *padapter, struct sta_info *psta); void update_ldpc_stbc_cap(struct sta_info *psta); -void update_beacon_info(_adapter *padapter, u8 *pframe, uint len, struct sta_info *psta); +int rtw_get_bcn_keys(ADAPTER *Adapter, u8 *pframe, u32 packet_len, + struct beacon_keys *recv_beacon); +void rtw_dump_bcn_keys(struct beacon_keys *recv_beacon); int rtw_check_bcn_info(ADAPTER *Adapter, u8 *pframe, u32 packet_len); +void update_beacon_info(_adapter *padapter, u8 *pframe, uint len, struct sta_info *psta); #ifdef CONFIG_DFS void process_csa_ie(_adapter *padapter, u8 *pframe, uint len); #endif //CONFIG_DFS @@ -725,10 +747,24 @@ unsigned int is_ap_in_tkip(_adapter *padapter); unsigned int is_ap_in_wep(_adapter *padapter); unsigned int should_forbid_n_rate(_adapter * padapter); -extern uint rtw_get_camid(uint macid); -extern void rtw_alloc_macid(_adapter *padapter, struct sta_info *psta); -extern void rtw_release_macid(_adapter *padapter, struct sta_info *psta); -extern u8 rtw_search_max_mac_id(_adapter *padapter); +s16 rtw_get_camid(_adapter *adapter, struct sta_info* sta, s16 kid); +s16 rtw_camid_search(_adapter *adapter, u8 *addr, s16 kid); +s16 rtw_camid_alloc(_adapter *adapter, struct sta_info *sta, u8 kid); +void rtw_camid_free(_adapter *adapter, u8 cam_id); + +struct macid_bmp; +struct macid_ctl_t; +void dump_macid_map(void *sel, struct macid_bmp *map, u8 max_num); +bool rtw_macid_is_set(struct macid_bmp *map, u8 id); +bool rtw_macid_is_used(struct macid_ctl_t *macid_ctl, u8 id); +bool rtw_macid_is_bmc(struct macid_ctl_t *macid_ctl, u8 id); +s8 rtw_macid_get_if_g(struct macid_ctl_t *macid_ctl, u8 id); +s8 rtw_macid_get_ch_g(struct macid_ctl_t *macid_ctl, u8 id); +void rtw_alloc_macid(_adapter *padapter, struct sta_info *psta); +void rtw_release_macid(_adapter *padapter, struct sta_info *psta); +u8 rtw_search_max_mac_id(_adapter *padapter); +void rtw_macid_ctl_init(struct macid_ctl_t *macid_ctl); +void rtw_macid_ctl_deinit(struct macid_ctl_t *macid_ctl); void report_join_res(_adapter *padapter, int res); void report_survey_event(_adapter *padapter, union recv_frame *precv_frame); @@ -775,6 +811,8 @@ void issue_action_BA(_adapter *padapter, unsigned char *raddr, unsigned char act #ifdef CONFIG_IEEE80211W void issue_action_SA_Query(_adapter *padapter, unsigned char *raddr, unsigned char action, unsigned short tid); #endif //CONFIG_IEEE80211W +int issue_action_SM_PS(_adapter *padapter , unsigned char *raddr , u8 NewMimoPsMode); +int issue_action_SM_PS_wait_ack(_adapter *padapter, unsigned char *raddr, u8 NewMimoPsMode, int try_cnt, int wait_ms); unsigned int send_delba(_adapter *padapter, u8 initiator, u8 *addr); unsigned int send_beacon(_adapter *padapter); @@ -855,6 +893,7 @@ extern void correct_TSF(_adapter *padapter, struct mlme_ext_priv *pmlmeext); extern void adaptive_early_32k(struct mlme_ext_priv *pmlmeext, u8 *pframe, uint len); extern u8 traffic_status_watchdog(_adapter *padapter, u8 from_timer); + #ifdef CONFIG_CONCURRENT_MODE sint check_buddy_mlmeinfo_state(_adapter *padapter, u32 state); void concurrent_chk_joinbss_done(_adapter *padapter, int join_res); @@ -914,6 +953,7 @@ u8 set_chplan_hdl(_adapter *padapter, unsigned char *pbuf); u8 led_blink_hdl(_adapter *padapter, unsigned char *pbuf); u8 set_csa_hdl(_adapter *padapter, unsigned char *pbuf); //Kurt: Handling DFS channel switch announcement ie. u8 tdls_hdl(_adapter *padapter, unsigned char *pbuf); +u8 run_in_thread_hdl(_adapter *padapter, u8 *pbuf); #define GEN_DRV_CMD_HANDLER(size, cmd) {size, &cmd ## _hdl}, @@ -990,6 +1030,7 @@ struct cmd_hdl wlancmds[] = GEN_MLME_EXT_HANDLER(sizeof(struct SetChannelSwitch_param), set_csa_hdl) /*61*/ GEN_MLME_EXT_HANDLER(sizeof(struct TDLSoption_param), tdls_hdl) /*62*/ GEN_MLME_EXT_HANDLER(0, chk_bmc_sleepq_hdl) /*63*/ + GEN_MLME_EXT_HANDLER(sizeof(struct RunInThread_param), run_in_thread_hdl) /*64*/ }; #endif diff --git a/include/rtw_mp.h b/include/rtw_mp.h index 8167898..e5f1141 100644 --- a/include/rtw_mp.h +++ b/include/rtw_mp.h @@ -53,6 +53,7 @@ #define MPT_GET_THERMAL_METER 33 #endif +#define RTWPRIV_VER_INFO 1 #define MAX_MP_XMITBUF_SZ 2048 #define NR_MP_XMITFRAME 8 @@ -347,6 +348,10 @@ enum { CTA_TEST, MP_DISABLE_BT_COEXIST, MP_PwrCtlDM, + MP_GETVER, +#ifdef CONFIG_WOWLAN + MP_WOW_ENABLE, +#endif #ifdef CONFIG_AP_WOWLAN MP_AP_WOW_ENABLE, #endif @@ -379,7 +384,7 @@ struct mp_priv u32 rx_pktcount_filter_out; u32 rx_crcerrpktcount; u32 rx_pktloss; - + BOOLEAN rx_bindicatePkt; struct recv_stat rxstat; //RF/BB relative @@ -471,14 +476,6 @@ typedef struct _MP_FIRMWARE { u8 szFwBuffer[0x8000]; #endif u32 ulFwLength; - -#ifdef CONFIG_EMBEDDED_FWIMG - u8* szBTFwBuffer; - u8 myBTFwBuffer[0x8000]; -#else - u8 szBTFwBuffer[0x8000]; -#endif - u32 ulBTFwLength; } RT_MP_FIRMWARE, *PRT_MP_FIRMWARE; @@ -568,27 +565,63 @@ typedef enum _MPT_RATE_INDEX MPT_RATE_MCS13, MPT_RATE_MCS14, MPT_RATE_MCS15, /* 27 */ + MPT_RATE_MCS16, + MPT_RATE_MCS17, // #29 + MPT_RATE_MCS18, + MPT_RATE_MCS19, + MPT_RATE_MCS20, + MPT_RATE_MCS21, + MPT_RATE_MCS22, // #34 + MPT_RATE_MCS23, + MPT_RATE_MCS24, + MPT_RATE_MCS25, + MPT_RATE_MCS26, + MPT_RATE_MCS27, // #39 + MPT_RATE_MCS28, // #40 + MPT_RATE_MCS29, // #41 + MPT_RATE_MCS30, // #42 + MPT_RATE_MCS31, // #43 /* VHT rate. Total: 20*/ - MPT_RATE_VHT1SS_MCS0 = 100,// To reserve MCS16~MCS31, the index starts from #100. - MPT_RATE_VHT1SS_MCS1, // #101 + MPT_RATE_VHT1SS_MCS0,// #44 + MPT_RATE_VHT1SS_MCS1, // # MPT_RATE_VHT1SS_MCS2, MPT_RATE_VHT1SS_MCS3, MPT_RATE_VHT1SS_MCS4, MPT_RATE_VHT1SS_MCS5, - MPT_RATE_VHT1SS_MCS6, // #106 + MPT_RATE_VHT1SS_MCS6, // # MPT_RATE_VHT1SS_MCS7, MPT_RATE_VHT1SS_MCS8, - MPT_RATE_VHT1SS_MCS9, - MPT_RATE_VHT2SS_MCS0, - MPT_RATE_VHT2SS_MCS1, // #111 + MPT_RATE_VHT1SS_MCS9, //#53 + MPT_RATE_VHT2SS_MCS0, //#54 + MPT_RATE_VHT2SS_MCS1, MPT_RATE_VHT2SS_MCS2, MPT_RATE_VHT2SS_MCS3, MPT_RATE_VHT2SS_MCS4, MPT_RATE_VHT2SS_MCS5, - MPT_RATE_VHT2SS_MCS6, // #116 + MPT_RATE_VHT2SS_MCS6, MPT_RATE_VHT2SS_MCS7, MPT_RATE_VHT2SS_MCS8, - MPT_RATE_VHT2SS_MCS9, + MPT_RATE_VHT2SS_MCS9, //#63 + MPT_RATE_VHT3SS_MCS0, + MPT_RATE_VHT3SS_MCS1, + MPT_RATE_VHT3SS_MCS2, + MPT_RATE_VHT3SS_MCS3, + MPT_RATE_VHT3SS_MCS4, + MPT_RATE_VHT3SS_MCS5, + MPT_RATE_VHT3SS_MCS6, // #126 + MPT_RATE_VHT3SS_MCS7, + MPT_RATE_VHT3SS_MCS8, + MPT_RATE_VHT3SS_MCS9, + MPT_RATE_VHT4SS_MCS0, + MPT_RATE_VHT4SS_MCS1, // #131 + MPT_RATE_VHT4SS_MCS2, + MPT_RATE_VHT4SS_MCS3, + MPT_RATE_VHT4SS_MCS4, + MPT_RATE_VHT4SS_MCS5, + MPT_RATE_VHT4SS_MCS6, // #136 + MPT_RATE_VHT4SS_MCS7, + MPT_RATE_VHT4SS_MCS8, + MPT_RATE_VHT4SS_MCS9, MPT_RATE_LAST }MPT_RATE_E, *PMPT_RATE_E; @@ -681,6 +714,9 @@ typedef enum _MPT_TXPWR_DEF{ #elif defined(CONFIG_RTL8723B) #define REG_RF_BB_GAIN_OFFSET 0x7f #define RF_GAIN_OFFSET_MASK 0xfffff +#elif defined(CONFIG_RTL8188E) + #define REG_RF_BB_GAIN_OFFSET 0x55 + #define RF_GAIN_OFFSET_MASK 0xfffff #else #define REG_RF_BB_GAIN_OFFSET 0x55 #define RF_GAIN_OFFSET_MASK 0xfffff @@ -783,11 +819,12 @@ extern u8 Hal_ReadRFThermalMeter(PADAPTER pAdapter); extern void Hal_SetCCKContinuousTx(PADAPTER pAdapter, u8 bStart); extern void Hal_SetOFDMContinuousTx(PADAPTER pAdapter, u8 bStart); extern void Hal_ProSetCrystalCap (PADAPTER pAdapter , u32 CrystalCapVal); -extern void _rtw_mp_xmit_priv(struct xmit_priv *pxmitpriv); +//extern void _rtw_mp_xmit_priv(struct xmit_priv *pxmitpriv); extern void MP_PHY_SetRFPathSwitch(PADAPTER pAdapter ,BOOLEAN bMain); extern ULONG mpt_ProQueryCalTxPower(PADAPTER pAdapter,u8 RfPath); extern void MPT_PwrCtlDM(PADAPTER padapter, u32 bstart); extern u8 MptToMgntRate(u32 MptRateIdx); +extern u8 rtw_mpRateParseFunc(PADAPTER pAdapter, u8 *targetStr); #endif //_RTW_MP_H_ diff --git a/include/rtw_mp_phy_regdef.h b/include/rtw_mp_phy_regdef.h index 781bb82..340015c 100644 --- a/include/rtw_mp_phy_regdef.h +++ b/include/rtw_mp_phy_regdef.h @@ -1014,11 +1014,12 @@ #define bMaskByte1 0xff00 #define bMaskByte2 0xff0000 #define bMaskByte3 0xff000000 -#define bMaskHWord 0xffff0000 +#define bMaskHWord 0xffff0000 #define bMaskLWord 0x0000ffff -#define bMaskDWord 0xffffffff -#define bMaskH4Bits 0xf0000000 -#define bMaskOFDM_D 0xffc00000 +#define bMaskDWord 0xffffffff +#define bMaskH4Bits 0xf0000000 +#define bMaskH3Bytes 0xffffff00 +#define bMaskOFDM_D 0xffc00000 #define bMaskCCK 0x3f3f3f3f #define bMask12Bits 0xfff diff --git a/include/rtw_odm.h b/include/rtw_odm.h index 50edd01..660a730 100644 --- a/include/rtw_odm.h +++ b/include/rtw_odm.h @@ -21,7 +21,7 @@ #define __RTW_ODM_H__ #include - +#include "../hal/OUTSRC/odm_types.h" /* * This file provides utilities/wrappers for rtw driver to use ODM */ @@ -34,9 +34,12 @@ void rtw_odm_dbg_level_set(_adapter *adapter, u32 level); void rtw_odm_ability_msg(void *sel, _adapter *adapter); void rtw_odm_ability_set(_adapter *adapter, u32 ability); +bool rtw_odm_adaptivity_needed(_adapter *adapter); void rtw_odm_adaptivity_parm_msg(void *sel,_adapter *adapter); void rtw_odm_adaptivity_parm_set(_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_get_perpkt_rssi(void *sel, _adapter *adapter); +void rtw_odm_acquirespinlock(_adapter *adapter, RT_SPINLOCK_TYPE type); +void rtw_odm_releasespinlock(_adapter *adapter, RT_SPINLOCK_TYPE type); #endif // __RTW_ODM_H__ diff --git a/include/rtw_pwrctrl.h b/include/rtw_pwrctrl.h index a843e30..006fb47 100644 --- a/include/rtw_pwrctrl.h +++ b/include/rtw_pwrctrl.h @@ -63,7 +63,8 @@ enum Power_Mgnt #ifdef CONFIG_PNO_SUPPORT #define MAX_PNO_LIST_COUNT 16 -#define MAX_SCAN_LIST_COUNT 14 //2.4G only +#define MAX_SCAN_LIST_COUNT 14 //2.4G only +#define MAX_HIDDEN_AP 8 //8 hidden AP #endif /* @@ -205,13 +206,15 @@ typedef enum _PS_DENY_REASON typedef struct pno_nlo_info { u32 fast_scan_period; //Fast scan period - u32 ssid_num; //number of entry + u8 ssid_num; //number of entry + u8 hidden_ssid_num; u32 slow_scan_period; //slow scan period u32 fast_scan_iterations; //Fast scan iterations u8 ssid_length[MAX_PNO_LIST_COUNT]; //SSID Length Array u8 ssid_cipher_info[MAX_PNO_LIST_COUNT]; //Cipher information for security u8 ssid_channel_info[MAX_PNO_LIST_COUNT]; //channel information -}pno_nlo_info_t; + u8 loc_probe_req[MAX_HIDDEN_AP]; //loc_probeReq +}pno_nlo_info_t; typedef struct pno_ssid { u32 SSID_len; @@ -324,6 +327,7 @@ struct pwrctrl_priv u8 wowlan_pno_enable; #ifdef CONFIG_PNO_SUPPORT u8 pno_in_resume; + u8 pno_inited; pno_nlo_info_t *pnlo_info; pno_scan_info_t *pscan_info; pno_ssid_list_t *pno_ssid_list; @@ -402,8 +406,6 @@ extern void cpwm_int_hdl(PADAPTER padapter, struct reportpwrstate_parm *preportp extern void LPS_Leave_check(PADAPTER padapter); #endif -extern void rtw_set_ps_mode(PADAPTER padapter, u8 ps_mode, u8 smart_ps, u8 bcn_ant_mode, const char *msg); -extern void rtw_set_rpwm(_adapter * padapter, u8 val8); extern void LeaveAllPowerSaveMode(PADAPTER Adapter); extern void LeaveAllPowerSaveModeDirect(PADAPTER Adapter); #ifdef CONFIG_IPS @@ -429,7 +431,9 @@ int rtw_fw_ps_state(PADAPTER padapter); s32 LPS_RF_ON_check(PADAPTER padapter, u32 delay_ms); void LPS_Enter(PADAPTER padapter, const char *msg); void LPS_Leave(PADAPTER padapter, const char *msg); -void traffic_check_for_leave_lps(PADAPTER padapter, u8 tx, u32 tx_packets); +void traffic_check_for_leave_lps(PADAPTER padapter, u8 tx, u32 tx_packets); +void rtw_set_ps_mode(PADAPTER padapter, u8 ps_mode, u8 smart_ps, u8 bcn_ant_mode, const char *msg); +void rtw_set_rpwm(_adapter * padapter, u8 val8); #endif #ifdef CONFIG_RESUME_IN_WORKQUEUE diff --git a/include/rtw_recv.h b/include/rtw_recv.h index 271a787..ce01eb1 100644 --- a/include/rtw_recv.h +++ b/include/rtw_recv.h @@ -206,8 +206,8 @@ struct rx_raw_rssi u8 mimo_singal_strength[4];// in 0~100 index u8 mimo_singal_quality[4]; - s8 ofdm_pwr[4]; - u8 ofdm_snr[4]; + s8 ofdm_pwr[4]; + u8 ofdm_snr[4]; }; #endif @@ -278,7 +278,16 @@ struct rx_pkt_attrib { #define RECVBUFF_ALIGN_SZ 8 +#if defined (CONFIG_RTL8192E) + #ifdef CONFIG_PCI_HCI + #define RXDESC_SIZE 16 + #define RX_WIFI_INFO_SIZE 24 + #else + #define RXDESC_SIZE 24 + #endif +#else #define RXDESC_SIZE 24 +#endif #define RXDESC_OFFSET RXDESC_SIZE struct recv_stat @@ -287,10 +296,13 @@ struct recv_stat unsigned int rxdw1; +#if !(defined(CONFIG_RTL8192E) && defined(CONFIG_PCI_HCI)) //exclude 8192ee unsigned int rxdw2; unsigned int rxdw3; +#endif +#ifndef BUF_DESC_ARCH unsigned int rxdw4; unsigned int rxdw5; @@ -300,6 +312,7 @@ struct recv_stat unsigned int rxdw7; #endif +#endif //if BUF_DESC_ARCH is defined, rx_buf_desc occupy 4 double words }; #define EOR BIT(30) @@ -397,9 +410,6 @@ struct recv_priv struct ifqueue rx_indicate_queue; #endif // CONFIG_RX_INDICATE_QUEUE -#ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX - _queue recv_buf_pending_queue; -#endif // CONFIG_USE_USB_BUFFER_ALLOC_RX #endif //defined(PLATFORM_LINUX) || defined(PLATFORM_FREEBSD) u8 *pallocated_recv_buf; @@ -407,7 +417,7 @@ struct recv_priv _queue free_recv_buf_queue; u32 free_recv_buf_queue_cnt; -#if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) +#if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) || defined(CONFIG_USB_HCI) _queue recv_buf_pending_queue; #endif @@ -429,7 +439,7 @@ struct recv_priv struct rx_raw_rssi raw_rssi_info; #endif //s8 rxpwdb; - u8 noise; + s16 noise; //int RxSNRdB[2]; //s8 RxRssi[2]; //int FalseAlmCnt_all; @@ -825,9 +835,14 @@ __inline static s32 translate_percentage_to_dbm(u32 SignalStrengthIndex) { s32 SignalPower; // in dBm. +#ifdef CONFIG_SKIP_SIGNAL_SCALE_MAPPING + // Translate to dBm (x=y-100) + SignalPower = SignalStrengthIndex - 100; +#else // Translate to dBm (x=0.5y-95). SignalPower = (s32)((SignalStrengthIndex + 1) >> 1); SignalPower -= 95; +#endif return SignalPower; } diff --git a/include/rtw_security.h b/include/rtw_security.h index f89e643..00b08fd 100644 --- a/include/rtw_security.h +++ b/include/rtw_security.h @@ -209,6 +209,30 @@ struct security_priv //u8 szCapability[256]; // For WPA2-PSK using zero-config, by Annie, 2005-09-20. u8 bWepDefaultKeyIdxSet; + +#define DBG_SW_SEC_CNT +#ifdef DBG_SW_SEC_CNT + u64 wep_sw_enc_cnt_bc; + u64 wep_sw_enc_cnt_mc; + u64 wep_sw_enc_cnt_uc; + u64 wep_sw_dec_cnt_bc; + u64 wep_sw_dec_cnt_mc; + u64 wep_sw_dec_cnt_uc; + + u64 tkip_sw_enc_cnt_bc; + u64 tkip_sw_enc_cnt_mc; + u64 tkip_sw_enc_cnt_uc; + u64 tkip_sw_dec_cnt_bc; + u64 tkip_sw_dec_cnt_mc; + u64 tkip_sw_dec_cnt_uc; + + u64 aes_sw_enc_cnt_bc; + u64 aes_sw_enc_cnt_mc; + u64 aes_sw_enc_cnt_uc; + u64 aes_sw_dec_cnt_bc; + u64 aes_sw_dec_cnt_mc; + u64 aes_sw_dec_cnt_uc; +#endif /* DBG_SW_SEC_CNT */ }; struct sha256_state { diff --git a/include/rtw_version.h b/include/rtw_version.h index c4547d1..c7c5732 100644 --- a/include/rtw_version.h +++ b/include/rtw_version.h @@ -1 +1 @@ -#define DRIVERVERSION "v4.3.1.1_11320.20140505" +#define DRIVERVERSION "v4.3.8_12406.20140929" diff --git a/include/rtw_wifi_regd.h b/include/rtw_wifi_regd.h index 46cba1b..aea6365 100644 --- a/include/rtw_wifi_regd.h +++ b/include/rtw_wifi_regd.h @@ -19,10 +19,8 @@ enum country_code_type_t { COUNTRY_CODE_MAX }; -int rtw_regd_init(_adapter *padapter, - int (*reg_notifier)(struct wiphy *wiphy, - struct regulatory_request *request)); -int rtw_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request); +int rtw_regd_init(_adapter *padapter); +void rtw_reg_notify_by_driver(_adapter *adapter); +#endif /* __RTW_WIFI_REGD_H__ */ -#endif diff --git a/include/rtw_xmit.h b/include/rtw_xmit.h index 363ee61..6bf0e4a 100644 --- a/include/rtw_xmit.h +++ b/include/rtw_xmit.h @@ -77,9 +77,14 @@ // xmit extension buff defination #define MAX_XMIT_EXTBUF_SZ (1536) -#define NR_XMIT_EXTBUFF (32) -#define MAX_CMDBUF_SZ (4096) +#ifdef CONFIG_SINGLE_XMIT_BUF +#define NR_XMIT_EXTBUFF (1) +#else +#define NR_XMIT_EXTBUFF (32) +#endif + +#define MAX_CMDBUF_SZ (5120) //(4096) #define MAX_NUMBLKS (1) @@ -144,8 +149,24 @@ do{\ #define HWXMIT_ENTRY 4 -#if defined(CONFIG_RTL8812A) || defined(CONFIG_RTL8821A)|| defined(CONFIG_RTL8192E) || defined(CONFIG_RTL8723B) +// For Buffer Descriptor ring architecture +#ifdef BUF_DESC_ARCH +#if defined (CONFIG_RTL8192E) +#define TX_BUFFER_SEG_NUM 1 // 0:2 seg, 1: 4 seg, 2: 8 seg. +#endif +#endif + +#if defined(CONFIG_RTL8812A) || defined(CONFIG_RTL8821A)|| defined(CONFIG_RTL8723B) #define TXDESC_SIZE 40 +//8192EE_TODO +#elif defined (CONFIG_RTL8192E) // this section is defined for buffer descriptor ring architecture + #ifdef CONFIG_PCI_HCI + #define TXDESC_SIZE ((TX_BUFFER_SEG_NUM ==0)?16: ((TX_BUFFER_SEG_NUM ==1)? 32:64) ) + #define TX_WIFI_INFO_SIZE 40 + #else //USB or SDIO + #define TXDESC_SIZE 40 + #endif +//8192EE_TODO #else #define TXDESC_SIZE 32 #endif @@ -169,9 +190,13 @@ do{\ #endif #ifdef CONFIG_PCI_HCI +#if defined(CONFIG_RTL8192E) // this section is defined for buffer descriptor ring architecture +#define TXDESC_OFFSET TX_WIFI_INFO_SIZE +#else #define TXDESC_OFFSET 0 +#endif #define TX_DESC_NEXT_DESC_OFFSET (TXDESC_SIZE + 8) -#endif +#endif //CONFIG_PCI_HCI enum TXDESC_SC{ SC_DONT_CARE = 0x00, @@ -186,6 +211,20 @@ enum TXDESC_SC{ #define TXDESC_40_BYTES #endif +#if defined(CONFIG_RTL8192E) && defined(CONFIG_PCI_HCI) //8192ee +//8192EE_TODO +struct tx_desc +{ + unsigned int txdw0; + unsigned int txdw1; + unsigned int txdw2; + unsigned int txdw3; + unsigned int txdw4; + unsigned int txdw5; + unsigned int txdw6; + unsigned int txdw7; +}; +#else struct tx_desc { unsigned int txdw0; @@ -216,7 +255,7 @@ struct tx_desc unsigned int txdw15; #endif }; - +#endif union txdesc { struct tx_desc txdesc; @@ -227,12 +266,13 @@ union txdesc { #define PCI_MAX_TX_QUEUE_COUNT 8 struct rtw_tx_ring { + unsigned char qid; struct tx_desc *desc; - dma_addr_t dma; - unsigned int idx; - unsigned int entries; - _queue queue; - u32 qlen; + dma_addr_t dma; + unsigned int idx; + unsigned int entries; + _queue queue; + u32 qlen; }; #endif @@ -331,6 +371,7 @@ struct pkt_attrib u8 ch_offset;//PRIME_CHNL_OFFSET u8 sgi;//short GI u8 ampdu_en;//tx ampdu enable + u8 ampdu_spacing; //ampdu_min_spacing for peer sta's rx u8 mdata;//more data bit u8 pctrl;//per packet txdesc control enable u8 triggered;//for ap mode handling Power Saving sta @@ -491,6 +532,10 @@ struct xmit_buf #endif #endif +#ifdef CONFIG_PCI_HCI + struct tx_desc *desc; +#endif + #if defined(DBG_XMIT_BUF )|| defined(DBG_XMIT_BUF_EXT) u8 no; #endif @@ -587,6 +632,12 @@ struct agg_pkt_info{ u16 pkt_len; }; +enum cmdbuf_type { + CMDBUF_BEACON = 0x00, + CMDBUF_RSVD, + CMDBUF_MAX +}; + struct xmit_priv { _lock lock; @@ -674,7 +725,7 @@ struct xmit_priv { #endif #endif -#ifdef CONFIG_SDIO_HCI +#if defined (CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) #ifdef CONFIG_SDIO_TX_TASKLET #ifdef PLATFORM_LINUX struct tasklet_struct xmit_tasklet; @@ -697,7 +748,7 @@ struct xmit_priv { u8 *pxmit_extbuf; uint free_xmit_extbuf_cnt; - struct xmit_buf pcmd_xmitbuf; + struct xmit_buf pcmd_xmitbuf[CMDBUF_MAX]; u16 nqos_ssn; #ifdef CONFIG_TX_EARLY_MODE @@ -720,9 +771,10 @@ struct xmit_priv { _lock lock_sctx; }; -extern struct xmit_frame *rtw_alloc_cmdxmitframe(struct xmit_priv *pxmitpriv); -extern struct xmit_buf *rtw_alloc_cmd_xmitbuf(struct xmit_priv *pxmitpriv); -extern s32 rtw_free_cmd_xmitbuf(struct xmit_priv *pxmitpriv); +extern struct xmit_frame *__rtw_alloc_cmdxmitframe(struct xmit_priv *pxmitpriv, + enum cmdbuf_type buf_type); +#define rtw_alloc_cmdxmitframe(p) __rtw_alloc_cmdxmitframe(p, CMDBUF_RSVD) +#define rtw_alloc_bcnxmitframe(p) __rtw_alloc_cmdxmitframe(p, CMDBUF_BEACON) extern struct xmit_buf *rtw_alloc_xmitbuf_ext(struct xmit_priv *pxmitpriv); extern s32 rtw_free_xmitbuf_ext(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf); @@ -733,7 +785,7 @@ extern s32 rtw_free_xmitbuf(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitb void rtw_count_tx_stats(_adapter *padapter, struct xmit_frame *pxmitframe, int sz); extern void rtw_update_protection(_adapter *padapter, u8 *ie, uint ie_len); static s32 update_attrib_sec_info(_adapter *padapter, struct pkt_attrib *pattrib, struct sta_info *psta); -static void update_attrib_phy_info(struct pkt_attrib *pattrib, struct sta_info *psta); +static void update_attrib_phy_info(_adapter *padapter, struct pkt_attrib *pattrib, struct sta_info *psta); extern s32 rtw_make_wlanhdr(_adapter *padapter, u8 *hdr, struct pkt_attrib *pattrib); extern s32 rtw_put_snap(u8 *data, u16 h_proto); @@ -776,7 +828,7 @@ void rtw_free_hwxmits(_adapter *padapter); s32 rtw_xmit(_adapter *padapter, _pkt **pkt); - +bool xmitframe_hiq_filter(struct xmit_frame *xmitframe); #if defined(CONFIG_AP_MODE) || defined(CONFIG_TDLS) sint xmitframe_enqueue_for_sleeping_sta(_adapter *padapter, struct xmit_frame *pxmitframe); void stop_sta_xmit(_adapter *padapter, struct sta_info *psta); diff --git a/include/xmit_osdep.h b/include/xmit_osdep.h index 79d0a88..d489ebf 100644 --- a/include/xmit_osdep.h +++ b/include/xmit_osdep.h @@ -92,5 +92,9 @@ extern sint rtw_endofpktfile (struct pkt_file *pfile); extern void rtw_os_pkt_complete(_adapter *padapter, _pkt *pkt); extern void rtw_os_xmit_complete(_adapter *padapter, struct xmit_frame *pxframe); +void rtw_os_wake_queue_at_free_stainfo(_adapter *padapter, int *qcnt_freed); + +void dump_os_queue(void *sel, _adapter *padapter); + #endif //__XMIT_OSDEP_H_ diff --git a/os_dep/linux/custom_gpio_linux.c b/os_dep/linux/custom_gpio_linux.c index 46ae1d1..45606cd 100644 --- a/os_dep/linux/custom_gpio_linux.c +++ b/os_dep/linux/custom_gpio_linux.c @@ -277,7 +277,42 @@ void rtw_wifi_gpio_wlan_ctrl(int onoff) } #endif //ANDROID_2X -#else // !CONFIG_PLATFORM_SPRD +#elif defined(CONFIG_PLATFORM_ARM_RK3066) +#include + +#define GPIO_WIFI_IRQ RK30_PIN2_PC2 +extern unsigned int oob_irq; +int rtw_wifi_gpio_init(void) +{ +#ifdef CONFIG_GSPI_HCI + if (GPIO_WIFI_IRQ > 0) { + rk30_mux_api_set(GPIO2C2_LCDC1DATA18_SMCBLSN1_HSADCDATA5_NAME, GPIO2C_GPIO2C2);//jacky_test + gpio_request(GPIO_WIFI_IRQ, "oob_irq"); + gpio_direction_input(GPIO_WIFI_IRQ); + + oob_irq = gpio_to_irq(GPIO_WIFI_IRQ); + + DBG_8192C("%s oob_irq:%d\n", __func__, oob_irq); + } +#endif + return 0; +} + + +int rtw_wifi_gpio_deinit(void) +{ +#ifdef CONFIG_GSPI_HCI + if (GPIO_WIFI_IRQ > 0) + gpio_free(GPIO_WIFI_IRQ); +#endif + return 0; +} + +void rtw_wifi_gpio_wlan_ctrl(int onoff) +{ +} + +#else int rtw_wifi_gpio_init(void) { diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index 5f7a315..e9c1b8a 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -28,7 +28,7 @@ #define RTW_MAX_MGMT_TX_CNT (8) #define RTW_SCAN_IE_LEN_MAX 2304 -#define RTW_MAX_REMAIN_ON_CHANNEL_DURATION 3000 //ms +#define RTW_MAX_REMAIN_ON_CHANNEL_DURATION 5000 //ms #define RTW_MAX_NUM_PMKIDS 4 #define RTW_CH_MAX_2G_CHANNEL 14 /* Max channel in 2G band */ @@ -53,6 +53,12 @@ #endif +#ifdef CONFIG_PLATFORM_ARM_SUN8I +#define BUSY_TRAFFIC_SCAN_DENY_PERIOD 8000 +#else +#define BUSY_TRAFFIC_SCAN_DENY_PERIOD 12000 +#endif + static const u32 rtw_cipher_suites[] = { WLAN_CIPHER_SUITE_WEP40, WLAN_CIPHER_SUITE_WEP104, @@ -350,6 +356,19 @@ static int rtw_ieee80211_channel_to_frequency(int chan, int band) } } +static u64 rtw_get_systime_us(void) +{ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) + struct timespec ts; + get_monotonic_boottime(&ts); + return ((u64)ts.tv_sec*1000000) + ts.tv_nsec / 1000; +#else + struct timeval tv; + do_gettimeofday(&tv); + return ((u64)tv.tv_sec*1000000) + tv.tv_usec; +#endif +} + #define MAX_BSSINFO_LEN 1000 struct cfg80211_bss *rtw_cfg80211_inform_bss(_adapter *padapter, struct wlan_network *pnetwork) { @@ -364,7 +383,10 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(_adapter *padapter, struct wlan_net u8 *notify_ie; size_t notify_ielen; s32 notify_signal; - u8 buf[MAX_BSSINFO_LEN], *pbuf; + //u8 buf[MAX_BSSINFO_LEN]; + + u8 *pbuf; + size_t buf_size = MAX_BSSINFO_LEN; size_t len,bssinf_len=0; struct rtw_ieee80211_hdr *pwlanhdr; unsigned short *fctrl; @@ -374,12 +396,17 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(_adapter *padapter, struct wlan_net struct wiphy *wiphy = wdev->wiphy; struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - + pbuf = rtw_zmalloc(buf_size); + if(pbuf == NULL){ + DBG_871X("%s pbuf allocate failed !! \n",__FUNCTION__); + return bss; + } + //DBG_8192C("%s\n", __func__); bssinf_len = pnetwork->network.IELength+sizeof (struct rtw_ieee80211_hdr_3addr); - if(bssinf_len > MAX_BSSINFO_LEN){ - DBG_871X("%s IE Length too long > %d byte \n",__FUNCTION__,MAX_BSSINFO_LEN); + if(bssinf_len > buf_size){ + DBG_871X("%s IE Length too long > %zu byte \n",__FUNCTION__,buf_size); goto exit; } @@ -481,13 +508,14 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(_adapter *padapter, struct wlan_net notify_channel = ieee80211_get_channel(wiphy, freq); - //rtw_get_timestampe_from_ie() - notify_timestamp = jiffies_to_msecs(jiffies)*1000; /* uSec */ + if (0) + notify_timestamp = le64_to_cpu(*(u64*)rtw_get_timestampe_from_ie(pnetwork->network.IEs)); + else + notify_timestamp = rtw_get_systime_us(); notify_interval = le16_to_cpu(*(u16*)rtw_get_beacon_interval_from_ie(pnetwork->network.IEs)); notify_capability = le16_to_cpu(*(u16*)rtw_get_capability_from_ie(pnetwork->network.IEs)); - notify_ie = pnetwork->network.IEs+_FIXED_IE_LENGTH_; notify_ielen = pnetwork->network.IELength-_FIXED_IE_LENGTH_; @@ -505,10 +533,10 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(_adapter *padapter, struct wlan_net DBG_8192C("Capability: %X\n", notify_capability); DBG_8192C("Beacon interval: %d\n", notify_interval); DBG_8192C("Signal: %d\n", notify_signal); - DBG_8192C("notify_timestamp: %#018llx\n", notify_timestamp); + DBG_8192C("notify_timestamp: %llu\n", notify_timestamp); #endif - pbuf = buf; + //pbuf = buf; pwlanhdr = (struct rtw_ieee80211_hdr *)pbuf; fctrl = &(pwlanhdr->frame_ctl); @@ -529,11 +557,12 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(_adapter *padapter, struct wlan_net _rtw_memcpy(pwlanhdr->addr3, pnetwork->network.MacAddress, ETH_ALEN); - pbuf += sizeof(struct rtw_ieee80211_hdr_3addr); + //pbuf += sizeof(struct rtw_ieee80211_hdr_3addr); len = sizeof (struct rtw_ieee80211_hdr_3addr); - - _rtw_memcpy(pbuf, pnetwork->network.IEs, pnetwork->network.IELength); - len += pnetwork->network.IELength; + _rtw_memcpy((pbuf+len), pnetwork->network.IEs, pnetwork->network.IELength); + *((u64*)(pbuf+len)) = cpu_to_le64(notify_timestamp); + + len += pnetwork->network.IELength; //#ifdef CONFIG_P2P //if(rtw_get_p2p_ie(pnetwork->network.IEs+12, pnetwork->network.IELength-12, NULL, NULL)) @@ -541,10 +570,9 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(_adapter *padapter, struct wlan_net // DBG_8192C("%s, got p2p_ie\n", __func__); //} //#endif - #if 1 - bss = cfg80211_inform_bss_frame(wiphy, notify_channel, (struct ieee80211_mgmt *)buf, + bss = cfg80211_inform_bss_frame(wiphy, notify_channel, (struct ieee80211_mgmt *)pbuf, len, notify_signal, GFP_ATOMIC); #else @@ -594,8 +622,10 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(_adapter *padapter, struct wlan_net #else cfg80211_put_bss(bss); #endif - -exit: + +exit: + if(pbuf) + rtw_mfree(pbuf, buf_size); return bss; } @@ -626,7 +656,7 @@ int rtw_cfg80211_check_bss(_adapter *padapter) pnetwork->MacAddress, pnetwork->Ssid.Ssid, pnetwork->Ssid.SsidLength, WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS); - + #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) cfg80211_put_bss(padapter->rtw_wdev->wiphy, bss); #else @@ -642,6 +672,11 @@ void rtw_cfg80211_ibss_indicate_connect(_adapter *padapter) struct wlan_network *cur_network = &(pmlmepriv->cur_network); struct wireless_dev *pwdev = padapter->rtw_wdev; struct cfg80211_bss *bss = NULL; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) + struct wiphy *wiphy = pwdev->wiphy; + int freq = (int)cur_network->network.Configuration.DSConfig; + struct ieee80211_channel *chan; +#endif DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter)); if (pwdev->iftype != NL80211_IFTYPE_ADHOC) @@ -693,7 +728,12 @@ void rtw_cfg80211_ibss_indicate_connect(_adapter *padapter) DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" BSS not found !!\n", FUNC_ADPT_ARG(padapter)); } //notify cfg80211 that device joined an IBSS +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) + chan = ieee80211_get_channel(wiphy, freq); + cfg80211_ibss_joined(padapter->pnetdev, cur_network->network.MacAddress, chan, GFP_ATOMIC); +#else cfg80211_ibss_joined(padapter->pnetdev, cur_network->network.MacAddress, GFP_ATOMIC); +#endif } void rtw_cfg80211_indicate_connect(_adapter *padapter) @@ -792,14 +832,18 @@ check_bss: } else { + #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE) DBG_8192C("pwdev->sme_state(b)=%d\n", pwdev->sme_state); + #endif cfg80211_connect_result(padapter->pnetdev, cur_network->network.MacAddress , pmlmepriv->assoc_req+sizeof(struct rtw_ieee80211_hdr_3addr)+2 , pmlmepriv->assoc_req_len-sizeof(struct rtw_ieee80211_hdr_3addr)-2 , pmlmepriv->assoc_rsp+sizeof(struct rtw_ieee80211_hdr_3addr)+6 , pmlmepriv->assoc_rsp_len-sizeof(struct rtw_ieee80211_hdr_3addr)-6 , WLAN_STATUS_SUCCESS, GFP_ATOMIC); + #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE) DBG_8192C("pwdev->sme_state(a)=%d\n", pwdev->sme_state); + #endif } } @@ -838,6 +882,7 @@ void rtw_cfg80211_indicate_disconnect(_adapter *padapter) #endif //CONFIG_P2P if (!padapter->mlmepriv.not_indic_disco) { + #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE) DBG_8192C("pwdev->sme_state(b)=%d\n", pwdev->sme_state); if(pwdev->sme_state==CFG80211_SME_CONNECTING) @@ -849,6 +894,14 @@ void rtw_cfg80211_indicate_disconnect(_adapter *padapter) //DBG_8192C("pwdev->sme_state=%d\n", pwdev->sme_state); DBG_8192C("pwdev->sme_state(a)=%d\n", pwdev->sme_state); + #else + + if(check_fwstate(&padapter->mlmepriv, _FW_LINKED)) + cfg80211_disconnected(padapter->pnetdev, 0, NULL, 0, GFP_ATOMIC); + else + cfg80211_connect_result(padapter->pnetdev, NULL, NULL, 0, NULL, 0, + WLAN_STATUS_UNSPECIFIED_FAILURE, GFP_ATOMIC/*GFP_KERNEL*/); + #endif } } @@ -1280,7 +1333,7 @@ _func_enter_; //DEBUG_ERR((" param->u.crypt.key_len=%d\n",param->u.crypt.key_len)); DBG_871X(" ~~~~set sta key:unicastkey\n"); - rtw_setstakey_cmd(padapter, (unsigned char *)psta, _TRUE, _TRUE); + rtw_setstakey_cmd(padapter, psta, _TRUE, _TRUE); } else//group key { @@ -1294,14 +1347,7 @@ _func_enter_; DBG_871X(" ~~~~set sta key:groupkey\n"); padapter->securitypriv.dot118021XGrpKeyid = param->u.crypt.idx; -#ifdef CONFIG_CONCURRENT_MODE - if (padapter->adapter_type == PRIMARY_ADAPTER) - rtw_set_key(padapter,&padapter->securitypriv,param->u.crypt.idx, 1, _TRUE); - else - DBG_871X_LEVEL(_drv_always_, "second interface do not set cam.\n"); -#else rtw_set_key(padapter,&padapter->securitypriv,param->u.crypt.idx, 1, _TRUE); -#endif } #ifdef CONFIG_IEEE80211W else if(strcmp(param->u.crypt.alg, "BIP") == 0) @@ -1525,13 +1571,13 @@ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev, if (params->seq_len && params->seq) { - _rtw_memcpy(param->u.crypt.seq, params->seq, params->seq_len); + _rtw_memcpy(param->u.crypt.seq, (u8 *)params->seq, params->seq_len); } if(params->key_len && params->key) { param->u.crypt.key_len = params->key_len; - _rtw_memcpy(param->u.crypt.key, params->key, params->key_len); + _rtw_memcpy(param->u.crypt.key, (u8 *)params->key, params->key_len); } if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _TRUE) @@ -1547,6 +1593,12 @@ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev, ret = rtw_cfg80211_ap_set_encryption(ndev, param, param_len); #endif } + else if(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == _TRUE + || check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == _TRUE) + { + //DBG_8192C("@@@@@@@@@@ fw_state=0x%x, iftype=%d\n", pmlmepriv->fw_state, rtw_wdev->iftype); + ret = rtw_cfg80211_set_encryption(ndev, param, param_len); + } else { DBG_8192C("error! fw_state=0x%x, iftype=%d\n", pmlmepriv->fw_state, rtw_wdev->iftype); @@ -1659,8 +1711,13 @@ static int cfg80211_rtw_set_default_key(struct wiphy *wiphy, } static int cfg80211_rtw_get_station(struct wiphy *wiphy, - struct net_device *ndev, - u8 *mac, struct station_info *sinfo) + struct net_device *ndev, +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)) + u8 *mac, +#else + const u8 *mac, +#endif + struct station_info *sinfo) { int ret = 0; _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev); @@ -1676,7 +1733,7 @@ static int cfg80211_rtw_get_station(struct wiphy *wiphy, goto exit; } - psta = rtw_get_stainfo(pstapriv, mac); + psta = rtw_get_stainfo(pstapriv, (u8 *)mac); if (psta == NULL) { DBG_8192C("%s, sta_info is null\n", __func__); ret = -ENOENT; @@ -1694,7 +1751,7 @@ static int cfg80211_rtw_get_station(struct wiphy *wiphy, { struct wlan_network *cur_network = &(pmlmepriv->cur_network); - if (_rtw_memcmp(mac, cur_network->network.MacAddress, ETH_ALEN) == _FALSE) { + if (_rtw_memcmp((u8 *)mac, cur_network->network.MacAddress, ETH_ALEN) == _FALSE) { DBG_871X("%s, mismatch bssid="MAC_FMT"\n", __func__, MAC_ARG(cur_network->network.MacAddress)); ret = -ENOENT; goto exit; @@ -1903,6 +1960,30 @@ void rtw_cfg80211_indicate_scan_done(_adapter *adapter, bool aborted) _exit_critical_bh(&pwdev_priv->scan_req_lock, &irqL); } +void rtw_cfg80211_unlink_bss(_adapter *padapter, struct wlan_network *pnetwork) +{ + struct wireless_dev *pwdev = padapter->rtw_wdev; + struct wiphy *wiphy = pwdev->wiphy; + struct cfg80211_bss *bss = NULL; + WLAN_BSSID_EX select_network = pnetwork->network; + + bss = cfg80211_get_bss(wiphy, NULL/*notify_channel*/, + select_network.MacAddress, select_network.Ssid.Ssid, + select_network.Ssid.SsidLength, 0/*WLAN_CAPABILITY_ESS*/, + 0/*WLAN_CAPABILITY_ESS*/); + + if (bss) { + cfg80211_unlink_bss(wiphy, bss); + DBG_8192C("%s(): cfg80211_unlink %s!! () ",__func__,select_network.Ssid.Ssid ); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) + cfg80211_put_bss(padapter->rtw_wdev->wiphy, bss); +#else + cfg80211_put_bss(bss); +#endif + } + return; +} + void rtw_cfg80211_surveydone_event_callback(_adapter *padapter) { _irqL irqL; @@ -1943,7 +2024,16 @@ void rtw_cfg80211_surveydone_event_callback(_adapter *padapter) //ev=translate_scan(padapter, a, pnetwork, ev, stop); rtw_cfg80211_inform_bss(padapter, pnetwork); } - + /* //check ralink testbed RSN IE length + { + if(_rtw_memcmp(pnetwork->network.Ssid.Ssid, "Ralink_11n_AP",13)) + { + uint ie_len=0; + u8 *p=NULL; + p = rtw_get_ie(pnetwork->network.IEs + _BEACON_IE_OFFSET_, _RSN_IE_2_, &ie_len, (pnetwork->network.IELength - _BEACON_IE_OFFSET_)); + DBG_871X("ie_len=%d\n", ie_len); + } + }*/ plist = get_next(plist); } @@ -2235,7 +2325,7 @@ if (padapter->registrypriv.mp_mode == 1) passtime = rtw_get_passing_time_ms(lastscantime); lastscantime = rtw_get_current_time(); - if (passtime > 12000) + if (passtime > BUSY_TRAFFIC_SCAN_DENY_PERIOD) #endif { DBG_871X("%s: bBusyTraffic == _TRUE\n", __FUNCTION__); @@ -2259,7 +2349,7 @@ if (padapter->registrypriv.mp_mode == 1) passtime = rtw_get_passing_time_ms(buddylastscantime); buddylastscantime = rtw_get_current_time(); - if ((passtime > 12000) + if ((passtime > BUSY_TRAFFIC_SCAN_DENY_PERIOD) //#ifdef CONFIG_P2P // ||(!rtw_p2p_chk_state(&padapter->wdinfo, P2P_STATE_NONE)) //#endif //CONFIG_P2P @@ -2302,18 +2392,15 @@ if (padapter->registrypriv.mp_mode == 1) #endif /* CONFIG_CONCURRENT_MODE */ #ifdef CONFIG_P2P - if( pwdinfo->driver_interface == DRIVER_CFG80211 ) + if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE) && !rtw_p2p_chk_state(pwdinfo, P2P_STATE_IDLE)) { - if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE) && !rtw_p2p_chk_state(pwdinfo, P2P_STATE_IDLE)) - { - rtw_p2p_set_state(pwdinfo, P2P_STATE_FIND_PHASE_SEARCH); - rtw_free_network_queue(padapter, _TRUE); + rtw_p2p_set_state(pwdinfo, P2P_STATE_FIND_PHASE_SEARCH); + rtw_free_network_queue(padapter, _TRUE); - if(social_channel == 0) - rtw_p2p_findphase_ex_set(pwdinfo, P2P_FINDPHASE_EX_NONE); - else - rtw_p2p_findphase_ex_set(pwdinfo, P2P_FINDPHASE_EX_SOCIAL_LAST); - } + if(social_channel == 0) + rtw_p2p_findphase_ex_set(pwdinfo, P2P_FINDPHASE_EX_NONE); + else + rtw_p2p_findphase_ex_set(pwdinfo, P2P_FINDPHASE_EX_SOCIAL_LAST); } #endif //CONFIG_P2P @@ -2849,7 +2936,7 @@ static int cfg80211_rtw_join_ibss(struct wiphy *wiphy, struct net_device *ndev, _rtw_memset(&ndis_ssid, 0, sizeof(NDIS_802_11_SSID)); ndis_ssid.SsidLength = params->ssid_len; - _rtw_memcpy(ndis_ssid.Ssid, params->ssid, params->ssid_len); + _rtw_memcpy(ndis_ssid.Ssid, (u8 *)params->ssid, params->ssid_len); //DBG_8192C("ssid=%s, len=%zu\n", ndis_ssid.Ssid, params->ssid_len); @@ -2994,7 +3081,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev, _rtw_memset(&ndis_ssid, 0, sizeof(NDIS_802_11_SSID)); ndis_ssid.SsidLength = sme->ssid_len; - _rtw_memcpy(ndis_ssid.Ssid, sme->ssid, sme->ssid_len); + _rtw_memcpy(ndis_ssid.Ssid, (u8 *)sme->ssid, sme->ssid_len); DBG_8192C("ssid=%s, len=%zu\n", ndis_ssid.Ssid, sme->ssid_len); @@ -3048,7 +3135,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev, DBG_8192C("%s, ie_len=%zu\n", __func__, sme->ie_len); - ret = rtw_cfg80211_set_wpa_ie(padapter, sme->ie, sme->ie_len); + ret = rtw_cfg80211_set_wpa_ie(padapter, (u8 *)sme->ie, sme->ie_len); if (ret < 0) goto exit; @@ -3144,7 +3231,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev, //rtw_set_802_11_encryption_mode(padapter, padapter->securitypriv.ndisencryptstatus); - if (rtw_set_802_11_connect(padapter, sme->bssid, &ndis_ssid) == _FALSE) { + if (rtw_set_802_11_connect(padapter, (u8 *)sme->bssid, &ndis_ssid) == _FALSE) { ret = -1; goto exit; } @@ -3278,26 +3365,33 @@ static int cfg80211_rtw_set_pmksa(struct wiphy *wiphy, { u8 index,blInserted = _FALSE; _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev); + struct mlme_priv *mlme = &padapter->mlmepriv; struct security_priv *psecuritypriv = &padapter->securitypriv; u8 strZeroMacAddress[ ETH_ALEN ] = { 0x00 }; - DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); + DBG_871X(FUNC_NDEV_FMT" "MAC_FMT" "KEY_FMT"\n", FUNC_NDEV_ARG(ndev) + , MAC_ARG(pmksa->bssid), KEY_ARG(pmksa->pmkid)); - if ( _rtw_memcmp( pmksa->bssid, strZeroMacAddress, ETH_ALEN ) == _TRUE ) + if ( _rtw_memcmp((u8 *)pmksa->bssid, strZeroMacAddress, ETH_ALEN ) == _TRUE ) { return -EINVAL; } + if (check_fwstate(mlme, _FW_LINKED) == _FALSE) { + DBG_871X(FUNC_NDEV_FMT" not set pmksa cause not in linked state\n", FUNC_NDEV_ARG(ndev)); + return -EINVAL; + } + blInserted = _FALSE; //overwrite PMKID for(index=0 ; indexPMKIDList[index].Bssid, pmksa->bssid, ETH_ALEN) ==_TRUE ) + if( _rtw_memcmp(psecuritypriv->PMKIDList[index].Bssid, (u8 *)pmksa->bssid, ETH_ALEN) ==_TRUE ) { // BSSID is matched, the same AP => rewrite with new PMKID. DBG_871X(FUNC_NDEV_FMT" BSSID exists in the PMKList.\n", FUNC_NDEV_ARG(ndev)); - _rtw_memcpy( psecuritypriv->PMKIDList[index].PMKID, pmksa->pmkid, WLAN_PMKID_LEN); + _rtw_memcpy( psecuritypriv->PMKIDList[index].PMKID, (u8 *)pmksa->pmkid, WLAN_PMKID_LEN); psecuritypriv->PMKIDList[index].bUsed = _TRUE; psecuritypriv->PMKIDIndex = index+1; blInserted = _TRUE; @@ -3311,8 +3405,8 @@ static int cfg80211_rtw_set_pmksa(struct wiphy *wiphy, DBG_871X(FUNC_NDEV_FMT" Use the new entry index = %d for this PMKID.\n", FUNC_NDEV_ARG(ndev), psecuritypriv->PMKIDIndex ); - _rtw_memcpy(psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].Bssid, pmksa->bssid, ETH_ALEN); - _rtw_memcpy(psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].PMKID, pmksa->pmkid, WLAN_PMKID_LEN); + _rtw_memcpy(psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].Bssid, (u8 *)pmksa->bssid, ETH_ALEN); + _rtw_memcpy(psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].PMKID, (u8 *)pmksa->pmkid, WLAN_PMKID_LEN); psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].bUsed = _TRUE; psecuritypriv->PMKIDIndex++ ; @@ -3333,16 +3427,18 @@ static int cfg80211_rtw_del_pmksa(struct wiphy *wiphy, _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev); struct security_priv *psecuritypriv = &padapter->securitypriv; - DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); + DBG_871X(FUNC_NDEV_FMT" "MAC_FMT" "KEY_FMT"\n", FUNC_NDEV_ARG(ndev) + , MAC_ARG(pmksa->bssid), KEY_ARG(pmksa->pmkid)); for(index=0 ; indexPMKIDList[index].Bssid, pmksa->bssid, ETH_ALEN) ==_TRUE ) + if( _rtw_memcmp(psecuritypriv->PMKIDList[index].Bssid, (u8 *)pmksa->bssid, ETH_ALEN) ==_TRUE ) { // BSSID is matched, the same AP => Remove this PMKID information and reset it. - _rtw_memset( psecuritypriv->PMKIDList[index].Bssid, 0x00, ETH_ALEN ); - _rtw_memset( psecuritypriv->PMKIDList[index].PMKID, 0x00, WLAN_PMKID_LEN ); + _rtw_memset(psecuritypriv->PMKIDList[index].Bssid, 0x00, ETH_ALEN ); + _rtw_memset(psecuritypriv->PMKIDList[index].PMKID, 0x00, WLAN_PMKID_LEN ); psecuritypriv->PMKIDList[index].bUsed = _FALSE; bMatched = _TRUE; + DBG_871X(FUNC_NDEV_FMT" clear id:%hhu\n", FUNC_NDEV_ARG(ndev), index); break; } } @@ -4027,7 +4123,7 @@ static int cfg80211_rtw_start_ap(struct wiphy *wiphy, struct net_device *ndev, WLAN_BSSID_EX *pbss_network_ext = &adapter->mlmeextpriv.mlmext_info.network; if(0) - DBG_871X(FUNC_ADPT_FMT" ssid:(%s,%d), from ie:(%s,%d)\n", FUNC_ADPT_ARG(adapter), + DBG_871X(FUNC_ADPT_FMT" ssid:(%s,%zu), from ie:(%s,%d)\n", FUNC_ADPT_ARG(adapter), settings->ssid, settings->ssid_len, pbss_network->Ssid.Ssid, pbss_network->Ssid.SsidLength); @@ -4067,7 +4163,12 @@ static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev) #endif //(LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) static int cfg80211_rtw_add_station(struct wiphy *wiphy, struct net_device *ndev, - u8 *mac, struct station_parameters *params) +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)) + u8 *mac, +#else + const u8 *mac, +#endif + struct station_parameters *params) { DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); @@ -4075,7 +4176,12 @@ static int cfg80211_rtw_add_station(struct wiphy *wiphy, struct net_device *ndev } static int cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *ndev, - u8 *mac) +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)) + u8 *mac +#else + const u8 *mac +#endif + ) { int ret=0; _irqL irqL; @@ -4129,7 +4235,7 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *ndev plist = get_next(plist); - if(_rtw_memcmp(mac, psta->hwaddr, ETH_ALEN)) + if(_rtw_memcmp((u8 *)mac, psta->hwaddr, ETH_ALEN)) { if(psta->dot8021xalg == 1 && psta->bpairwise_key_installed == _FALSE) { @@ -4166,21 +4272,65 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *ndev } static int cfg80211_rtw_change_station(struct wiphy *wiphy, struct net_device *ndev, - u8 *mac, struct station_parameters *params) +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)) + u8 *mac, +#else + const u8 *mac, +#endif + struct station_parameters *params) { DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); return 0; } +struct sta_info *rtw_sta_info_get_by_idx(const int idx, struct sta_priv *pstapriv) + +{ + _list *phead, *plist; + struct sta_info *psta = NULL; + int i = 0; + + phead = &pstapriv->asoc_list; + plist = get_next(phead); + + //check asoc_queue + while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) + { + if(idx == i) psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list); + plist = get_next(plist); + i++; + } + return psta; +} + static int cfg80211_rtw_dump_station(struct wiphy *wiphy, struct net_device *ndev, int idx, u8 *mac, struct station_info *sinfo) { + + int ret = 0; + _irqL irqL; + _adapter *padapter = (_adapter *)rtw_netdev_priv(ndev); + struct sta_info *psta = NULL; + struct sta_priv *pstapriv = &padapter->stapriv; DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); - //TODO: dump scanned queue - - return -ENOENT; + _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); + psta = rtw_sta_info_get_by_idx(idx, pstapriv); + _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); + if(NULL == psta) + { + DBG_871X("Station is not found\n"); + ret = -ENOENT; + goto exit; + } + _rtw_memcpy(mac, psta->hwaddr, ETH_ALEN); + sinfo->filled = 0; + sinfo->filled |= STATION_INFO_SIGNAL; + sinfo->signal = psta->rssi; + +exit: + return ret; } static int cfg80211_rtw_change_bss(struct wiphy *wiphy, struct net_device *ndev, @@ -4588,7 +4738,8 @@ static s32 cfg80211_rtw_remain_on_channel(struct wiphy *wiphy, struct mlme_ext_priv *pmlmeext; struct wifidirect_info *pwdinfo; struct cfg80211_wifidirect_info *pcfg80211_wdinfo; - + u8 is_p2p_find = _FALSE; + if (ndev == NULL) { return -EINVAL; } @@ -4598,20 +4749,21 @@ static s32 cfg80211_rtw_remain_on_channel(struct wiphy *wiphy, pmlmeext = &padapter->mlmeextpriv; pwdinfo = &padapter->wdinfo; pcfg80211_wdinfo = &padapter->cfg80211_wdinfo; - + #ifdef CONFIG_CONCURRENT_MODE + is_p2p_find=(duration < (pwdinfo->ext_listen_interval))? _TRUE : _FALSE; + #endif DBG_871X(FUNC_ADPT_FMT" ch:%u duration:%d\n", FUNC_ADPT_ARG(padapter), remain_ch, duration); if(pcfg80211_wdinfo->is_ro_ch == _TRUE) { + pcfg80211_wdinfo->not_indic_ro_ch_exp = _TRUE; DBG_8192C("%s, cancel ro ch timer\n", __func__); - _cancel_timer_ex(&padapter->cfg80211_wdinfo.remain_on_ch_timer); - -#ifdef CONFIG_CONCURRENT_MODE - ATOMIC_SET(&pwdev_priv->ro_ch_to, 1); -#endif //CONFIG_CONCURRENT_MODE - + #ifdef CONFIG_CONCURRENT_MODE + ATOMIC_SET(&pwdev_priv->ro_ch_to, 1); + #endif //CONFIG_CONCURRENT_MODE p2p_protocol_wk_hdl(padapter, P2P_RO_CH_WK); + pcfg80211_wdinfo->not_indic_ro_ch_exp = _FALSE; } pcfg80211_wdinfo->is_ro_ch = _TRUE; @@ -4630,7 +4782,7 @@ static s32 cfg80211_rtw_remain_on_channel(struct wiphy *wiphy, rtw_scan_abort(padapter); #ifdef CONFIG_CONCURRENT_MODE - if(rtw_buddy_adapter_up(padapter)) + if ((rtw_buddy_adapter_up(padapter)) && is_p2p_find) //don't scan_abort during p2p_listen. rtw_scan_abort(padapter->pbuddy_adapter); #endif //CONFIG_CONCURRENT_MODE @@ -4671,10 +4823,13 @@ static s32 cfg80211_rtw_remain_on_channel(struct wiphy *wiphy, #ifdef CONFIG_CONCURRENT_MODE - if(check_buddy_fwstate(padapter, _FW_LINKED) && - (durationext_listen_interval)) + if (check_buddy_fwstate(padapter, _FW_LINKED)) { - duration = duration + pwdinfo->ext_listen_interval; + if (is_p2p_find) // p2p_find , duration<1000 + duration = duration + pwdinfo->ext_listen_interval; + else // p2p_listen, duration=5000 + duration = pwdinfo->ext_listen_interval + + (pwdinfo->ext_listen_interval/4); } #endif @@ -4792,12 +4947,14 @@ static s32 cfg80211_rtw_cancel_remain_on_channel(struct wiphy *wiphy, DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter)); if (pcfg80211_wdinfo->is_ro_ch == _TRUE) { + pcfg80211_wdinfo->not_indic_ro_ch_exp = _TRUE; DBG_8192C("%s, cancel ro ch timer\n", __func__); _cancel_timer_ex(&padapter->cfg80211_wdinfo.remain_on_ch_timer); #ifdef CONFIG_CONCURRENT_MODE ATOMIC_SET(&pwdev_priv->ro_ch_to, 1); #endif p2p_protocol_wk_hdl(padapter, P2P_RO_CH_WK); + pcfg80211_wdinfo->not_indic_ro_ch_exp = _FALSE; } #if 0 @@ -4994,30 +5151,43 @@ static int cfg80211_rtw_mgmt_tx(struct wiphy *wiphy, #else struct net_device *ndev, #endif +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0)) || defined(COMPAT_KERNEL_RELEASE) struct ieee80211_channel *chan, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE) + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE) bool offchan, -#endif -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) + #endif + #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) enum nl80211_channel_type channel_type, #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) bool channel_type_valid, #endif -#endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE) + #endif + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE) unsigned int wait, -#endif + #endif const u8 *buf, size_t len, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) bool no_cck, -#endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) + #endif + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) bool dont_wait_for_ack, + #endif +#else + struct cfg80211_mgmt_tx_params *params, #endif u64 *cookie) { #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) struct net_device *ndev = wdev_to_ndev(wdev); +#endif +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) || defined(COMPAT_KERNEL_RELEASE) + struct ieee80211_channel *chan = params->chan; + bool offchan = params->offchan; + unsigned int wait = params->wait; + const u8 *buf = params->buf; + size_t len = params->len; + bool no_cck = params->no_cck; + bool dont_wait_for_ack = params->dont_wait_for_ack; #endif int ret = 0; int tx_ret; @@ -5295,7 +5465,6 @@ static int cfg80211_rtw_tdls_oper(struct wiphy *wiphy, } #endif /* CONFIG_TDLS */ - #if defined(CONFIG_PNO_SUPPORT) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0)) static int cfg80211_rtw_sched_scan_start(struct wiphy *wiphy, struct net_device *dev, @@ -5314,7 +5483,7 @@ static int cfg80211_rtw_sched_scan_start(struct wiphy *wiphy, check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE || check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == _TRUE) { DBG_871X("%s: device is busy.\n", __func__); - return -EBUSY; + rtw_scan_abort(padapter); } if (request == NULL) { @@ -5800,7 +5969,7 @@ void rtw_cfg80211_init_wiphy(_adapter *padapter) } /* init regulary domain */ - rtw_regd_init(padapter, rtw_reg_notifier); + rtw_regd_init(padapter); /* copy mac_addr to wiphy */ _rtw_memcpy(wiphy->perm_addr, padapter->eeprompriv.mac_addr, ETH_ALEN); @@ -5895,7 +6064,11 @@ static void rtw_cfg80211_preinit_wiphy(_adapter *padapter, struct wiphy *wiphy) #endif #if defined(CONFIG_PM) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)) +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)) wiphy->wowlan = wowlan_stub; +#else + wiphy->wowlan = &wowlan_stub; +#endif #endif #if defined(CONFIG_TDLS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) diff --git a/os_dep/linux/ioctl_linux.c b/os_dep/linux/ioctl_linux.c index 43ffba3..81510e1 100644 --- a/os_dep/linux/ioctl_linux.c +++ b/os_dep/linux/ioctl_linux.c @@ -40,6 +40,10 @@ #define iwe_stream_add_point(a, b, c, d, e) iwe_stream_add_point(b, c, d, e) #endif +#ifdef CONFIG_80211N_HT +extern int rtw_ht_enable; +#endif + #define RTL_IOCTL_WPA_SUPPLICANT SIOCIWFIRSTPRIV+30 @@ -300,28 +304,12 @@ uint rtw_is_cckratesonly_included(u8 *rate) } */ -static char *translate_scan(_adapter *padapter, +static int search_p2p_wfd_ie(_adapter *padapter, struct iw_request_info* info, struct wlan_network *pnetwork, char *start, char *stop) { - struct iw_event iwe; - u16 cap; - u32 ht_ielen = 0, vht_ielen = 0; - char custom[MAX_CUSTOM_LEN]; - char *p; - u16 max_rate=0, rate, ht_cap=_FALSE, vht_cap = _FALSE; - u32 i = 0; - char *current_val; - long rssi; - u8 bw_40MHz=0, short_GI=0, bw_160MHz=0, vht_highest_rate = 0; - u16 mcs_rate=0, vht_data_rate=0; - u8 ie_offset = (pnetwork->network.Reserved[0] == 2? 0:12); - struct registry_priv *pregpriv = &padapter->registrypriv; #ifdef CONFIG_P2P struct wifidirect_info *pwdinfo = &padapter->wdinfo; -#endif //CONFIG_P2P - -#ifdef CONFIG_P2P #ifdef CONFIG_WFD if ( SCAN_RESULT_ALL == pwdinfo->wfd_info->scan_result_type ) { @@ -353,7 +341,7 @@ static char *translate_scan(_adapter *padapter, if ( blnGotP2PIE == _FALSE ) { - return start; + return _FALSE; } } @@ -397,12 +385,547 @@ static char *translate_scan(_adapter *padapter, if ( blnGotWFD == _FALSE ) { - return start; + return _FALSE; } } #endif // CONFIG_WFD #endif //CONFIG_P2P + return _TRUE; +} + static inline char *iwe_stream_mac_addr_proess(_adapter *padapter, + struct iw_request_info* info, struct wlan_network *pnetwork, + char *start, char *stop,struct iw_event *iwe) +{ + /* AP MAC address */ + iwe->cmd = SIOCGIWAP; + iwe->u.ap_addr.sa_family = ARPHRD_ETHER; + + _rtw_memcpy(iwe->u.ap_addr.sa_data, pnetwork->network.MacAddress, ETH_ALEN); + start = iwe_stream_add_event(info, start, stop, iwe, IW_EV_ADDR_LEN); + return start; +} + static inline char * iwe_stream_essid_proess(_adapter *padapter, + struct iw_request_info* info, struct wlan_network *pnetwork, + char *start, char *stop,struct iw_event *iwe) +{ + + /* Add the ESSID */ + iwe->cmd = SIOCGIWESSID; + iwe->u.data.flags = 1; + iwe->u.data.length = min((u16)pnetwork->network.Ssid.SsidLength, (u16)32); + start = iwe_stream_add_point(info, start, stop, iwe, pnetwork->network.Ssid.Ssid); + return start; +} + + static inline char * iwe_stream_chan_process(_adapter *padapter, + struct iw_request_info* info, struct wlan_network *pnetwork, + char *start, char *stop,struct iw_event *iwe) +{ + if(pnetwork->network.Configuration.DSConfig<1 /*|| pnetwork->network.Configuration.DSConfig>14*/) + pnetwork->network.Configuration.DSConfig = 1; + + /* Add frequency/channel */ + iwe->cmd = SIOCGIWFREQ; + iwe->u.freq.m = rtw_ch2freq(pnetwork->network.Configuration.DSConfig) * 100000; + iwe->u.freq.e = 1; + iwe->u.freq.i = pnetwork->network.Configuration.DSConfig; + start = iwe_stream_add_event(info, start, stop, iwe, IW_EV_FREQ_LEN); + return start; +} + static inline char * iwe_stream_mode_process(_adapter *padapter, + struct iw_request_info* info, struct wlan_network *pnetwork, + char *start, char *stop,struct iw_event *iwe,u16 cap) +{ + /* Add mode */ + if(cap & (WLAN_CAPABILITY_IBSS |WLAN_CAPABILITY_BSS)){ + iwe->cmd = SIOCGIWMODE; + if (cap & WLAN_CAPABILITY_BSS) + iwe->u.mode = IW_MODE_MASTER; + else + iwe->u.mode = IW_MODE_ADHOC; + + start = iwe_stream_add_event(info, start, stop, iwe, IW_EV_UINT_LEN); + } + return start; + } + static inline char * iwe_stream_encryption_process(_adapter *padapter, + struct iw_request_info* info, struct wlan_network *pnetwork, + char *start, char *stop,struct iw_event *iwe,u16 cap) +{ + + /* Add encryption capability */ + iwe->cmd = SIOCGIWENCODE; + if (cap & WLAN_CAPABILITY_PRIVACY) + iwe->u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; + else + iwe->u.data.flags = IW_ENCODE_DISABLED; + iwe->u.data.length = 0; + start = iwe_stream_add_point(info, start, stop, iwe, pnetwork->network.Ssid.Ssid); + return start; + +} + + static inline char * iwe_stream_protocol_process(_adapter *padapter, + struct iw_request_info* info, struct wlan_network *pnetwork, + char *start, char *stop,struct iw_event *iwe) + { + u16 ht_cap=_FALSE,vht_cap = _FALSE; + u32 ht_ielen = 0, vht_ielen = 0; + char *p; + u8 ie_offset = (pnetwork->network.Reserved[0] == 2? 0:12);// Probe Request + + //parsing HT_CAP_IE + p = rtw_get_ie(&pnetwork->network.IEs[ie_offset], _HT_CAPABILITY_IE_, &ht_ielen, pnetwork->network.IELength-ie_offset); + if(p && ht_ielen>0) + ht_cap = _TRUE; + + #ifdef CONFIG_80211AC_VHT + //parsing VHT_CAP_IE + p = rtw_get_ie(&pnetwork->network.IEs[ie_offset], EID_VHTCapability, &vht_ielen, pnetwork->network.IELength-ie_offset); + if(p && vht_ielen>0) + vht_cap = _TRUE; + #endif + /* Add the protocol name */ + iwe->cmd = SIOCGIWNAME; + if ((rtw_is_cckratesonly_included((u8*)&pnetwork->network.SupportedRates)) == _TRUE) + { + if(ht_cap == _TRUE) + snprintf(iwe->u.name, IFNAMSIZ, "IEEE 802.11bn"); + else + snprintf(iwe->u.name, IFNAMSIZ, "IEEE 802.11b"); + } + else if ((rtw_is_cckrates_included((u8*)&pnetwork->network.SupportedRates)) == _TRUE) + { + if(ht_cap == _TRUE) + snprintf(iwe->u.name, IFNAMSIZ, "IEEE 802.11bgn"); + else + snprintf(iwe->u.name, IFNAMSIZ, "IEEE 802.11bg"); + } + else + { + if(pnetwork->network.Configuration.DSConfig > 14) + { + #ifdef CONFIG_80211AC_VHT + if(vht_cap == _TRUE){ + snprintf(iwe->u.name, IFNAMSIZ, "IEEE 802.11AC"); + } + else + #endif + { + if(ht_cap == _TRUE) + snprintf(iwe->u.name, IFNAMSIZ, "IEEE 802.11an"); + else + snprintf(iwe->u.name, IFNAMSIZ, "IEEE 802.11a"); + } + } + else + { + if(ht_cap == _TRUE) + snprintf(iwe->u.name, IFNAMSIZ, "IEEE 802.11gn"); + else + snprintf(iwe->u.name, IFNAMSIZ, "IEEE 802.11g"); + } + } + start = iwe_stream_add_event(info, start, stop, iwe, IW_EV_CHAR_LEN); + return start; + } + + static inline char * iwe_stream_rate_process(_adapter *padapter, + struct iw_request_info* info, struct wlan_network *pnetwork, + char *start, char *stop,struct iw_event *iwe) +{ + u32 ht_ielen = 0, vht_ielen = 0; + char *p; + u16 max_rate=0, rate, ht_cap=_FALSE, vht_cap = _FALSE; + u32 i = 0; + u8 bw_40MHz=0, short_GI=0, bw_160MHz=0, vht_highest_rate = 0; + u16 mcs_rate=0, vht_data_rate=0; + char custom[MAX_CUSTOM_LEN]={0}; + u8 ie_offset = (pnetwork->network.Reserved[0] == 2? 0:12);// Probe Request + + //parsing HT_CAP_IE + p = rtw_get_ie(&pnetwork->network.IEs[ie_offset], _HT_CAPABILITY_IE_, &ht_ielen, pnetwork->network.IELength-ie_offset); + if(p && ht_ielen>0) + { + struct rtw_ieee80211_ht_cap *pht_capie; + ht_cap = _TRUE; + pht_capie = (struct rtw_ieee80211_ht_cap *)(p+2); + _rtw_memcpy(&mcs_rate , pht_capie->supp_mcs_set, 2); + bw_40MHz = (pht_capie->cap_info&IEEE80211_HT_CAP_SUP_WIDTH) ? 1:0; + short_GI = (pht_capie->cap_info&(IEEE80211_HT_CAP_SGI_20|IEEE80211_HT_CAP_SGI_40)) ? 1:0; + } + +#ifdef CONFIG_80211AC_VHT + //parsing VHT_CAP_IE + p = rtw_get_ie(&pnetwork->network.IEs[ie_offset], EID_VHTCapability, &vht_ielen, pnetwork->network.IELength-ie_offset); + if(p && vht_ielen>0) + { + u8 mcs_map[2]; + + vht_cap = _TRUE; + bw_160MHz = GET_VHT_CAPABILITY_ELE_CHL_WIDTH(p+2); + if(bw_160MHz) + short_GI = GET_VHT_CAPABILITY_ELE_SHORT_GI160M(p+2); + else + short_GI = GET_VHT_CAPABILITY_ELE_SHORT_GI80M(p+2); + + _rtw_memcpy(mcs_map, GET_VHT_CAPABILITY_ELE_TX_MCS(p+2), 2); + + vht_highest_rate = rtw_get_vht_highest_rate(mcs_map); + vht_data_rate = rtw_vht_mcs_to_data_rate(CHANNEL_WIDTH_80, short_GI, vht_highest_rate); + } +#endif + + /*Add basic and extended rates */ + p = custom; + p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), " Rates (Mb/s): "); + while(pnetwork->network.SupportedRates[i]!=0) + { + rate = pnetwork->network.SupportedRates[i]&0x7F; + if (rate > max_rate) + max_rate = rate; + p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), + "%d%s ", rate >> 1, (rate & 1) ? ".5" : ""); + i++; + } +#ifdef CONFIG_80211AC_VHT + if(vht_cap == _TRUE) { + max_rate = vht_data_rate; + } + else +#endif + if(ht_cap == _TRUE) + { + if(mcs_rate&0x8000)//MCS15 + { + max_rate = (bw_40MHz) ? ((short_GI)?300:270):((short_GI)?144:130); + + } + else if(mcs_rate&0x0080)//MCS7 + { + max_rate = (bw_40MHz) ? ((short_GI)?150:135):((short_GI)?72:65); + } + else//default MCS7 + { + //DBG_871X("wx_get_scan, mcs_rate_bitmap=0x%x\n", mcs_rate); + max_rate = (bw_40MHz) ? ((short_GI)?150:135):((short_GI)?72:65); + } + + max_rate = max_rate*2;//Mbps/2; + } + + iwe->cmd = SIOCGIWRATE; + iwe->u.bitrate.fixed = iwe->u.bitrate.disabled = 0; + iwe->u.bitrate.value = max_rate * 500000; + start =iwe_stream_add_event(info, start, stop, iwe, IW_EV_PARAM_LEN); + return start ; +} + +static inline char * iwe_stream_wpa_wpa2_process(_adapter *padapter, + struct iw_request_info* info, struct wlan_network *pnetwork, + char *start, char *stop,struct iw_event *iwe) +{ + int buf_size = MAX_WPA_IE_LEN*2; + //u8 pbuf[buf_size]={0}; + u8 *pbuf = rtw_zmalloc(buf_size); + + u8 wpa_ie[255]={0},rsn_ie[255]={0}; + u16 i, wpa_len=0,rsn_len=0; + u8 *p; + sint out_len=0; + + + if(pbuf){ + p=pbuf; + + //parsing WPA/WPA2 IE + if (pnetwork->network.Reserved[0] != 2) // Probe Request + { + out_len=rtw_get_sec_ie(pnetwork->network.IEs ,pnetwork->network.IELength,rsn_ie,&rsn_len,wpa_ie,&wpa_len); + RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("rtw_wx_get_scan: ssid=%s\n",pnetwork->network.Ssid.Ssid)); + RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("rtw_wx_get_scan: wpa_len=%d rsn_len=%d\n",wpa_len,rsn_len)); + + if (wpa_len > 0){ + + _rtw_memset(pbuf, 0, buf_size); + p += sprintf(p, "wpa_ie="); + for (i = 0; i < wpa_len; i++) { + p += sprintf(p, "%02x", wpa_ie[i]); + } + + if (wpa_len > 100) { + printk("-----------------Len %d----------------\n", wpa_len); + for (i = 0; i < wpa_len; i++) { + printk("%02x ", wpa_ie[i]); + } + printk("\n"); + printk("-----------------Len %d----------------\n", wpa_len); + } + + _rtw_memset(iwe, 0, sizeof(*iwe)); + iwe->cmd = IWEVCUSTOM; + iwe->u.data.length = strlen(pbuf); + start = iwe_stream_add_point(info, start, stop, iwe,pbuf); + + _rtw_memset(iwe, 0, sizeof(*iwe)); + iwe->cmd =IWEVGENIE; + iwe->u.data.length = wpa_len; + start = iwe_stream_add_point(info, start, stop, iwe, wpa_ie); + } + if (rsn_len > 0){ + + _rtw_memset(pbuf, 0, buf_size); + p += sprintf(p, "rsn_ie="); + for (i = 0; i < rsn_len; i++) { + p += sprintf(p, "%02x", rsn_ie[i]); + } + _rtw_memset(iwe, 0, sizeof(*iwe)); + iwe->cmd = IWEVCUSTOM; + iwe->u.data.length = strlen(pbuf); + start = iwe_stream_add_point(info, start, stop, iwe,pbuf); + + _rtw_memset(iwe, 0, sizeof(*iwe)); + iwe->cmd =IWEVGENIE; + iwe->u.data.length = rsn_len; + start = iwe_stream_add_point(info, start, stop, iwe, rsn_ie); + } + } + + rtw_mfree(pbuf, buf_size); + } + return start; +} + +static inline char * iwe_stream_wps_process(_adapter *padapter, + struct iw_request_info* info, struct wlan_network *pnetwork, + char *start, char *stop,struct iw_event *iwe) +{ + //parsing WPS IE + uint cnt = 0,total_ielen; + u8 *wpsie_ptr=NULL; + uint wps_ielen = 0; + u8 ie_offset = (pnetwork->network.Reserved[0] == 2? 0:12); + + u8 *ie_ptr = pnetwork->network.IEs + ie_offset; + total_ielen= pnetwork->network.IELength - ie_offset; + + if (pnetwork->network.Reserved[0] == 2) // Probe Request + { + ie_ptr = pnetwork->network.IEs; + total_ielen = pnetwork->network.IELength; + } + else // Beacon or Probe Respones + { + ie_ptr = pnetwork->network.IEs + _FIXED_IE_LENGTH_; + total_ielen = pnetwork->network.IELength - _FIXED_IE_LENGTH_; + } + while(cnt < total_ielen) + { + if(rtw_is_wps_ie(&ie_ptr[cnt], &wps_ielen) && (wps_ielen>2)) + { + wpsie_ptr = &ie_ptr[cnt]; + iwe->cmd =IWEVGENIE; + iwe->u.data.length = (u16)wps_ielen; + start = iwe_stream_add_point(info, start, stop,iwe, wpsie_ptr); + } + cnt+=ie_ptr[cnt+1]+2; //goto next + } + return start; +} + +static inline char * iwe_stream_wapi_process(_adapter *padapter, + struct iw_request_info* info, struct wlan_network *pnetwork, + char *start, char *stop,struct iw_event *iwe) +{ +#ifdef CONFIG_WAPI_SUPPORT + char *p; + + if (pnetwork->network.Reserved[0] != 2) // Probe Request + { + sint out_len_wapi=0; + /* here use static for stack size */ + static u8 buf_wapi[MAX_WAPI_IE_LEN*2]={0}; + static u8 wapi_ie[MAX_WAPI_IE_LEN]={0}; + u16 wapi_len=0; + u16 i; + + out_len_wapi=rtw_get_wapi_ie(pnetwork->network.IEs ,pnetwork->network.IELength,wapi_ie,&wapi_len); + RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("rtw_wx_get_scan: ssid=%s\n",pnetwork->network.Ssid.Ssid)); + RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("rtw_wx_get_scan: wapi_len=%d \n",wapi_len)); + + DBG_871X("rtw_wx_get_scan: %s ",pnetwork->network.Ssid.Ssid); + DBG_871X("rtw_wx_get_scan: ssid = %d ",wapi_len); + + + if (wapi_len > 0) + { + p=buf_wapi; + //_rtw_memset(buf_wapi, 0, MAX_WAPI_IE_LEN*2); + p += sprintf(p, "wapi_ie="); + for (i = 0; i < wapi_len; i++) { + p += sprintf(p, "%02x", wapi_ie[i]); + } + + _rtw_memset(iwe, 0, sizeof(*iwe)); + iwe->cmd = IWEVCUSTOM; + iwe->u.data.length = strlen(buf_wapi); + start = iwe_stream_add_point(info, start, stop, iwe,buf_wapi); + + _rtw_memset(iwe, 0, sizeof(*iwe)); + iwe->cmd =IWEVGENIE; + iwe->u.data.length = wapi_len; + start = iwe_stream_add_point(info, start, stop, iwe, wapi_ie); + } + } +#endif//#ifdef CONFIG_WAPI_SUPPORT + return start; +} + +static inline char * iwe_stream_rssi_process(_adapter *padapter, + struct iw_request_info* info, struct wlan_network *pnetwork, + char *start, char *stop,struct iw_event *iwe) +{ + u8 ss, sq; + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + + /* Add quality statistics */ + iwe->cmd = IWEVQUAL; + iwe->u.qual.updated = IW_QUAL_QUAL_UPDATED | IW_QUAL_LEVEL_UPDATED + #if defined(CONFIG_SIGNAL_DISPLAY_DBM) && defined(CONFIG_BACKGROUND_NOISE_MONITOR) + | IW_QUAL_NOISE_UPDATED + #else + | IW_QUAL_NOISE_INVALID + #endif + #ifdef CONFIG_SIGNAL_DISPLAY_DBM + | IW_QUAL_DBM + #endif + ; + + if ( check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE && + is_same_network(&pmlmepriv->cur_network.network, &pnetwork->network, 0)){ + ss = padapter->recvpriv.signal_strength; + sq = padapter->recvpriv.signal_qual; + } else { + ss = pnetwork->network.PhyInfo.SignalStrength; + sq = pnetwork->network.PhyInfo.SignalQuality; + } + + + #ifdef CONFIG_SIGNAL_DISPLAY_DBM + iwe->u.qual.level = (u8) translate_percentage_to_dbm(ss);//dbm + #else + #ifdef CONFIG_SKIP_SIGNAL_SCALE_MAPPING + { + /* Do signal scale mapping when using percentage as the unit of signal strength, since the scale mapping is skipped in odm */ + + HAL_DATA_TYPE *pHal = GET_HAL_DATA(padapter); + + iwe->u.qual.level = (u8)odm_SignalScaleMapping(&pHal->odmpriv, ss); + } + #else + iwe->u.qual.level = (u8)ss;//% + #endif + #endif + + iwe->u.qual.qual = (u8)sq; // signal quality + + #ifdef CONFIG_PLATFORM_ROCKCHIPS + iwe->u.qual.noise = -100; // noise level suggest by zhf@rockchips + #else + #if defined(CONFIG_SIGNAL_DISPLAY_DBM) && defined(CONFIG_BACKGROUND_NOISE_MONITOR) + { + s16 tmp_noise=0; + rtw_hal_get_odm_var(padapter, HAL_ODM_NOISE_MONITOR,&(pnetwork->network.Configuration.DSConfig), &(tmp_noise)); + iwe->u.qual.noise = tmp_noise ; + } + #else + iwe->u.qual.noise = 0; // noise level + #endif + #endif //CONFIG_PLATFORM_ROCKCHIPS + + //DBG_871X("iqual=%d, ilevel=%d, inoise=%d, iupdated=%d\n", iwe.u.qual.qual, iwe.u.qual.level , iwe.u.qual.noise, iwe.u.qual.updated); + + start = iwe_stream_add_event(info, start, stop, iwe, IW_EV_QUAL_LEN); + return start; +} + +static inline char * iwe_stream_net_rsv_process(_adapter *padapter, + struct iw_request_info* info, struct wlan_network *pnetwork, + char *start, char *stop,struct iw_event *iwe) +{ + u8 buf[32] = {0}; + u8 * p,*pos; + int len; + p = buf; + pos = pnetwork->network.Reserved; + + p += sprintf(p, "fm=%02X%02X", pos[1], pos[0]); + _rtw_memset(iwe, 0, sizeof(*iwe)); + iwe->cmd = IWEVCUSTOM; + iwe->u.data.length = strlen(buf); + start = iwe_stream_add_point(info, start, stop,iwe, buf); + return start; +} + +#if 1 +static char *translate_scan(_adapter *padapter, + struct iw_request_info* info, struct wlan_network *pnetwork, + char *start, char *stop) +{ + struct iw_event iwe; + u16 cap = 0; + _rtw_memset(&iwe, 0, sizeof(iwe)); + + if(_FALSE == search_p2p_wfd_ie(padapter,info,pnetwork,start,stop)) + return start; + + start = iwe_stream_mac_addr_proess(padapter,info,pnetwork,start,stop,&iwe); + start = iwe_stream_essid_proess(padapter,info,pnetwork,start,stop,&iwe); + start = iwe_stream_protocol_process(padapter,info,pnetwork,start,stop,&iwe); + if (pnetwork->network.Reserved[0] == 2) // Probe Request + { + cap = 0; + } + else + { + _rtw_memcpy((u8 *)&cap, rtw_get_capability_from_ie(pnetwork->network.IEs), 2); + cap = le16_to_cpu(cap); + } + + start = iwe_stream_mode_process(padapter,info,pnetwork,start,stop,&iwe,cap); + start = iwe_stream_chan_process(padapter,info,pnetwork,start,stop,&iwe); + start = iwe_stream_encryption_process(padapter,info,pnetwork,start,stop,&iwe,cap); + start = iwe_stream_rate_process(padapter,info,pnetwork,start,stop,&iwe); + start = iwe_stream_wpa_wpa2_process(padapter,info,pnetwork,start,stop,&iwe); + start = iwe_stream_wps_process(padapter,info,pnetwork,start,stop,&iwe); + start = iwe_stream_wapi_process(padapter,info,pnetwork,start,stop,&iwe); + start = iwe_stream_rssi_process(padapter,info,pnetwork,start,stop,&iwe); + start = iwe_stream_net_rsv_process(padapter,info,pnetwork,start,stop,&iwe); + + return start; +} +#else +static char *translate_scan(_adapter *padapter, + struct iw_request_info* info, struct wlan_network *pnetwork, + char *start, char *stop) +{ + struct iw_event iwe; + u16 cap; + u32 ht_ielen = 0, vht_ielen = 0; + char custom[MAX_CUSTOM_LEN]; + char *p; + u16 max_rate=0, rate, ht_cap=_FALSE, vht_cap = _FALSE; + u32 i = 0; + char *current_val; + long rssi; + u8 bw_40MHz=0, short_GI=0, bw_160MHz=0, vht_highest_rate = 0; + u16 mcs_rate=0, vht_data_rate=0; + u8 ie_offset = (pnetwork->network.Reserved[0] == 2? 0:12); + struct registry_priv *pregpriv = &padapter->registrypriv; + + if(_FALSE == search_p2p_wfd_ie(padapter,info,pnetwork,start,stop)) + return start; /* AP MAC address */ iwe.cmd = SIOCGIWAP; @@ -410,7 +933,7 @@ static char *translate_scan(_adapter *padapter, _rtw_memcpy(iwe.u.ap_addr.sa_data, pnetwork->network.MacAddress, ETH_ALEN); start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_ADDR_LEN); - + /* Add the ESSID */ iwe.cmd = SIOCGIWESSID; iwe.u.data.flags = 1; @@ -718,7 +1241,12 @@ static char *translate_scan(_adapter *padapter, /* Add quality statistics */ iwe.cmd = IWEVQUAL; - iwe.u.qual.updated = IW_QUAL_QUAL_UPDATED | IW_QUAL_LEVEL_UPDATED | IW_QUAL_NOISE_INVALID + iwe.u.qual.updated = IW_QUAL_QUAL_UPDATED | IW_QUAL_LEVEL_UPDATED + #if defined(CONFIG_SIGNAL_DISPLAY_DBM) && defined(CONFIG_BACKGROUND_NOISE_MONITOR) + | IW_QUAL_NOISE_UPDATED + #else + | IW_QUAL_NOISE_INVALID + #endif #ifdef CONFIG_SIGNAL_DISPLAY_DBM | IW_QUAL_DBM #endif @@ -737,15 +1265,33 @@ static char *translate_scan(_adapter *padapter, #ifdef CONFIG_SIGNAL_DISPLAY_DBM iwe.u.qual.level = (u8) translate_percentage_to_dbm(ss);//dbm #else + #ifdef CONFIG_SKIP_SIGNAL_SCALE_MAPPING + { + /* Do signal scale mapping when using percentage as the unit of signal strength, since the scale mapping is skipped in odm */ + + HAL_DATA_TYPE *pHal = GET_HAL_DATA(padapter); + + iwe.u.qual.level = (u8)odm_SignalScaleMapping(&pHal->odmpriv, ss); + } + #else iwe.u.qual.level = (u8)ss;//% #endif + #endif iwe.u.qual.qual = (u8)sq; // signal quality #ifdef CONFIG_PLATFORM_ROCKCHIPS iwe.u.qual.noise = -100; // noise level suggest by zhf@rockchips #else + #if defined(CONFIG_SIGNAL_DISPLAY_DBM) && defined(CONFIG_BACKGROUND_NOISE_MONITOR) + { + s16 tmp_noise=0; + rtw_hal_get_odm_var(padapter, HAL_ODM_NOISE_MONITOR,&(pnetwork->network.Configuration.DSConfig), &(tmp_noise)); + iwe.u.qual.noise = tmp_noise ; + } + #else iwe.u.qual.noise = 0; // noise level + #endif #endif //CONFIG_PLATFORM_ROCKCHIPS //DBG_871X("iqual=%d, ilevel=%d, inoise=%d, iupdated=%d\n", iwe.u.qual.qual, iwe.u.qual.level , iwe.u.qual.noise, iwe.u.qual.updated); @@ -769,6 +1315,7 @@ static char *translate_scan(_adapter *padapter, return start; } +#endif static int wpa_set_auth_algs(struct net_device *dev, u32 value) { @@ -994,7 +1541,7 @@ _func_enter_; //DEBUG_ERR((" param->u.crypt.key_len=%d\n",param->u.crypt.key_len)); DBG_871X(" ~~~~set sta key:unicastkey\n"); - rtw_setstakey_cmd(padapter, (unsigned char *)psta, _TRUE, _TRUE); + rtw_setstakey_cmd(padapter, psta, _TRUE, _TRUE); } else//group key { @@ -1377,12 +1924,18 @@ static int rtw_wx_get_name(struct net_device *dev, { if(pcur_bss->Configuration.DSConfig > 14) { - if(vht_cap == _TRUE) + #ifdef CONFIG_80211AC_VHT + if(vht_cap == _TRUE){ snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11AC"); - else if(ht_cap == _TRUE) - snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11an"); + } else - snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11a"); + #endif + { + if(ht_cap == _TRUE) + snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11an"); + else + snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11a"); + } } else { @@ -5220,7 +5773,14 @@ static int rtw_p2p_connect(struct net_device *dev, DBG_871X( "[%s] WiFi Direct is disable!\n", __FUNCTION__ ); return ret; } - + +#ifdef CONFIG_INTEL_WIDI + if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == _TRUE) { + DBG_871X( "[%s] WiFi is under survey!\n", __FUNCTION__ ); + return ret; + } +#endif //CONFIG_INTEL_WIDI + if ( pwdinfo->ui_got_wps_info == P2P_NO_WPSINFO ) { return -1; @@ -5309,6 +5869,19 @@ static int rtw_p2p_connect(struct net_device *dev, else { DBG_871X( "[%s] Not Found in Scanning Queue~\n", __FUNCTION__ ); +#ifdef CONFIG_INTEL_WIDI + _cancel_timer_ex( &pwdinfo->restore_p2p_state_timer ); + rtw_p2p_set_state(pwdinfo, P2P_STATE_FIND_PHASE_SEARCH); + rtw_p2p_findphase_ex_set(pwdinfo, P2P_FINDPHASE_EX_NONE); + rtw_free_network_queue(padapter, _TRUE); + /** + * For WiDi, if we can't find candidate device in scanning queue, + * driver will do scanning itself + */ + _enter_critical_bh(&pmlmepriv->lock, &irqL); + rtw_sitesurvey_cmd(padapter, NULL, 0, NULL, 0); + _exit_critical_bh(&pmlmepriv->lock, &irqL); +#endif //CONFIG_INTEL_WIDI ret = -1; } exit: @@ -5988,7 +6561,7 @@ static int rtw_p2p_prov_disc(struct net_device *dev, else { #ifdef CONFIG_INTEL_WIDI - if(check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == _TRUE){ + if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == _TRUE) { DBG_871X( "[%s] WiFi is under survey!\n", __FUNCTION__ ); return ret; } @@ -6202,6 +6775,7 @@ static int rtw_p2p_prov_disc(struct net_device *dev, { DBG_871X( "[%s] NOT Found in the Scanning Queue!\n", __FUNCTION__ ); #ifdef CONFIG_INTEL_WIDI + _cancel_timer_ex( &pwdinfo->restore_p2p_state_timer ); rtw_p2p_set_state(pwdinfo, P2P_STATE_FIND_PHASE_SEARCH); rtw_p2p_findphase_ex_set(pwdinfo, P2P_FINDPHASE_EX_NONE); rtw_free_network_queue(padapter, _TRUE); @@ -6627,6 +7201,10 @@ exit: #ifdef CONFIG_IOL #include #endif + +#ifdef DBG_CMD_QUEUE +u8 dump_cmd_id=0; +#endif static int rtw_dbg_port(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) @@ -7074,6 +7652,26 @@ static int rtw_dbg_port(struct net_device *dev, printk("%s ==> max_mac_id = %d \n",__FUNCTION__,max_mac_id); } break; + case 0x0b: //Enable=1, Disable=0 driver control vrtl_carrier_sense. + { + //u8 driver_vcs_en; //Enable=1, Disable=0 driver control vrtl_carrier_sense. + //u8 driver_vcs_type;//force 0:disable VCS, 1:RTS-CTS, 2:CTS-to-self when vcs_en=1. + + if(arg == 0){ + DBG_871X("disable driver ctrl vcs\n"); + padapter->driver_vcs_en = 0; + } + else if(arg == 1){ + DBG_871X("enable driver ctrl vcs = %d\n", extra_arg); + padapter->driver_vcs_en = 1; + + if(extra_arg>2) + padapter->driver_vcs_type = 1; + else + padapter->driver_vcs_type = extra_arg; + } + } + break; case 0x0c://dump rx/tx packet { if(arg == 0){ @@ -7098,6 +7696,23 @@ static int rtw_dbg_port(struct net_device *dev, } break; #endif + case 0x0e: + { + if(arg == 0){ + DBG_871X("disable driver ctrl rx_ampdu_factor\n"); + padapter->driver_rx_ampdu_factor = 0xFF; + } + else if(arg == 1){ + + DBG_871X("enable driver ctrl rx_ampdu_factor = %d\n", extra_arg); + + if(extra_arg > 0x03) + padapter->driver_rx_ampdu_factor = 0xFF; + else + padapter->driver_rx_ampdu_factor = extra_arg; + } + } + break; #ifdef DBG_CONFIG_ERROR_DETECT case 0x0f: { @@ -7126,7 +7741,22 @@ static int rtw_dbg_port(struct net_device *dev, break; case 0x11://dump linked status { - linked_info_dump(padapter,extra_arg); + int pre_mode; + pre_mode=padapter->bLinkInfoDump; + // linked_info_dump(padapter,extra_arg); + if(extra_arg==1 || (extra_arg==0 && pre_mode==1) ) //not consider pwr_saving 0: + { + padapter->bLinkInfoDump = extra_arg; + + } + else if( (extra_arg==2 ) || (extra_arg==0 && pre_mode==2))//consider power_saving + { + //DBG_871X("linked_info_dump =%s \n", (padapter->bLinkInfoDump)?"enable":"disable") + linked_info_dump(padapter,extra_arg); + } + + + } break; #ifdef CONFIG_80211N_HT @@ -7194,6 +7824,120 @@ static int rtw_dbg_port(struct net_device *dev, rtw_hal_set_hwreg(padapter, HW_VAR_USB_MODE, (u8 *)&extra_arg); } break; +#ifdef CONFIG_80211N_HT + case 0x19: + { + struct registry_priv *pregistrypriv = &padapter->registrypriv; + // extra_arg : + // BIT0: Enable VHT LDPC Rx, BIT1: Enable VHT LDPC Tx, + // BIT4: Enable HT LDPC Rx, BIT5: Enable HT LDPC Tx + if(arg == 0){ + DBG_871X("driver disable LDPC\n"); + pregistrypriv->ldpc_cap = 0x00; + } + else if(arg == 1){ + DBG_871X("driver set LDPC cap = 0x%x\n", extra_arg); + pregistrypriv->ldpc_cap = (u8)(extra_arg&0x33); + } + } + break; + case 0x1a: + { + struct registry_priv *pregistrypriv = &padapter->registrypriv; + // extra_arg : + // BIT0: Enable VHT STBC Rx, BIT1: Enable VHT STBC Tx, + // BIT4: Enable HT STBC Rx, BIT5: Enable HT STBC Tx + if(arg == 0){ + DBG_871X("driver disable STBC\n"); + pregistrypriv->stbc_cap = 0x00; + } + else if(arg == 1){ + DBG_871X("driver set STBC cap = 0x%x\n", extra_arg); + pregistrypriv->stbc_cap = (u8)(extra_arg&0x33); + } + } + break; +#endif //CONFIG_80211N_HT + case 0x1b: + { + struct registry_priv *pregistrypriv = &padapter->registrypriv; + + if(arg == 0){ + DBG_871X("disable driver ctrl max_rx_rate, reset to default_rate_set\n"); + init_mlme_default_rate_set(padapter); +#ifdef CONFIG_80211N_HT + pregistrypriv->ht_enable = (u8)rtw_ht_enable; +#endif //CONFIG_80211N_HT + } + else if(arg == 1){ + + int i; + u8 max_rx_rate; + + DBG_871X("enable driver ctrl max_rx_rate = 0x%x\n", extra_arg); + + max_rx_rate = (u8)extra_arg; + + if(max_rx_rate < 0xc) // max_rx_rate < MSC0 -> B or G -> disable HT + { +#ifdef CONFIG_80211N_HT + pregistrypriv->ht_enable = 0; +#endif //CONFIG_80211N_HT + for(i=0; idatarate[i] > max_rx_rate) + pmlmeext->datarate[i] = 0xff; + } + + } +#ifdef CONFIG_80211N_HT + else if(max_rx_rate < 0x1c) // mcs0~mcs15 + { + u32 mcs_bitmap=0x0; + + for(i=0; i<((max_rx_rate+1)-0xc); i++) + mcs_bitmap |= BIT(i); + + set_mcs_rate_by_mask(pmlmeext->default_supported_mcs_set, mcs_bitmap); + } +#endif //CONFIG_80211N_HT + } + } + break; + case 0x1c: //enable/disable driver control AMPDU Density for peer sta's rx + { + if(arg == 0){ + DBG_871X("disable driver ctrl ampdu density\n"); + padapter->driver_ampdu_spacing = 0xFF; + } + else if(arg == 1){ + + DBG_871X("enable driver ctrl ampdu density = %d\n", extra_arg); + + if(extra_arg > 0x07) + padapter->driver_ampdu_spacing = 0xFF; + else + padapter->driver_ampdu_spacing = extra_arg; + } + } + break; +#ifdef CONFIG_BACKGROUND_NOISE_MONITOR + case 0x1e: + { + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); + PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + u8 chan = rtw_get_oper_ch(padapter); + DBG_871X("===========================================\n"); + ODM_InbandNoise_Monitor(pDM_Odm,_TRUE,0x1e,100); + DBG_871X("channel(%d),noise_a = %d, noise_b = %d , noise_all:%d \n", + chan,pDM_Odm->noise_level.noise[ODM_RF_PATH_A], + pDM_Odm->noise_level.noise[ODM_RF_PATH_B], + pDM_Odm->noise_level.noise_all); + DBG_871X("===========================================\n"); + + } + break; +#endif case 0x23: { DBG_871X("turn %s the bNotifyChannelChange Variable\n",(extra_arg==1)?"on":"off"); @@ -7208,6 +7952,54 @@ static int rtw_dbg_port(struct net_device *dev, #endif // CONFIG_P2P break; } +#ifdef CONFIG_GPIO_API + case 0x25: //Get GPIO register + { + /* + * dbg 0x7f250000 [gpio_num], Get gpio value, gpio_num:0~7 + */ + + u8 value; + DBG_871X("Read GPIO Value extra_arg = %d\n",extra_arg); + value = rtw_hal_get_gpio(padapter,extra_arg); + DBG_871X("Read GPIO Value = %d\n",value); + break; + } + case 0x26: //Set GPIO direction + { + + /* dbg 0x7f26000x [y], Set gpio direction, + * x: gpio_num,4~7 y: indicate direction, 0~1 + */ + + int value; + DBG_871X("Set GPIO Direction! arg = %d ,extra_arg=%d\n",arg ,extra_arg); + value = rtw_hal_config_gpio(padapter, arg, extra_arg); + DBG_871X("Set GPIO Direction %s \n",(value==-1)?"Fail!!!":"Success"); + break; + } + case 0x27: //Set GPIO output direction value + { + /* + * dbg 0x7f27000x [y], Set gpio output direction value, + * x: gpio_num,4~7 y: indicate direction, 0~1 + */ + + int value; + DBG_871X("Set GPIO Value! arg = %d ,extra_arg=%d\n",arg ,extra_arg); + value = rtw_hal_set_gpio_output_value(padapter,arg,extra_arg); + DBG_871X("Set GPIO Value %s \n",(value==-1)?"Fail!!!":"Success"); + break; + } +#endif +#ifdef DBG_CMD_QUEUE + case 0x28: + { + dump_cmd_id = extra_arg; + DBG_871X("dump_cmd_id:%d\n",dump_cmd_id); + } + break; +#endif //DBG_CMD_QUEUE case 0xaa: { if((extra_arg & 0x7F)> 0x3F) extra_arg = 0xFF; @@ -7926,9 +8718,9 @@ static int rtw_add_sta(struct net_device *dev, struct ieee_param *param) if(psta) { DBG_871X("rtw_add_sta(), free has been added psta=%p\n", psta); - _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + //_enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); rtw_free_stainfo(padapter, psta); - _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + //_exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); psta = NULL; } @@ -8744,6 +9536,79 @@ FREE_EXT: return ret; } +#ifdef CONFIG_WOWLAN +static int rtw_wowlan_ctrl(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); + struct wowlan_ioctl_param poidparam; + struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter); + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct net_device *pnetdev = padapter->pnetdev; +#ifdef CONFIG_CONCURRENT_MODE + struct net_device *pbuddy_netdev = padapter->pbuddy_adapter->pnetdev; +#endif + struct sta_info *psta = NULL; + int ret = 0; + u32 start_time = rtw_get_current_time(); + poidparam.subcode = 0; + + DBG_871X("+rtw_wowlan_ctrl: %s\n", extra); + + if(pwrctrlpriv->bSupportRemoteWakeup==_FALSE){ + ret = -EPERM; + DBG_871X("+rtw_wowlan_ctrl: Device didn't support the remote wakeup!!\n"); + goto _rtw_wowlan_ctrl_exit_free; + } + + if (!check_fwstate(pmlmepriv, _FW_LINKED) && + check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { + DBG_871X("[%s] WARNING: Please Connect With AP First!!\n", __func__); + goto _rtw_wowlan_ctrl_exit_free; + } + + if (_rtw_memcmp( extra, "enable", 6 )) { + + padapter->registrypriv.mp_mode = 1; + + while (pwrctrlpriv->bips_processing == _TRUE) + rtw_msleep_os(1); + + rtw_ps_deny(padapter, PS_DENY_SUSPEND); + + rtw_cancel_all_timer(padapter); + +#ifdef CONFIG_CONCURRENT_MODE + if (padapter->pbuddy_adapter){ + rtw_cancel_all_timer(padapter->pbuddy_adapter); + } +#endif // CONFIG_CONCURRENT_MODE + + LeaveAllPowerSaveModeDirect(padapter); + + rtw_stop_cmd_thread(padapter); + + rtw_ps_deny_cancel(padapter, PS_DENY_SUSPEND); + + rtw_suspend_wow(padapter); + + } else if (_rtw_memcmp( extra, "disable", 6 )) { + rtw_resume_process_wow(padapter); + padapter->registrypriv.mp_mode = 0; + } else { + DBG_871X("[%s] Invalid Parameter.\n", __func__); + goto _rtw_wowlan_ctrl_exit_free; + } + //mutex_lock(&ioctl_mutex); +_rtw_wowlan_ctrl_exit_free: + DBG_871X("-rtw_wowlan_ctrl( subcode = %d)\n", poidparam.subcode); + DBG_871X_LEVEL(_drv_always_, "%s in %d ms\n", __func__, + rtw_get_passing_time_ms(start_time)); +_rtw_wowlan_ctrl_exit: + return ret; +} +#endif //CONFIG_WOWLAN #ifdef CONFIG_AP_WOWLAN static int rtw_ap_wowlan_ctrl(struct net_device *dev, @@ -9532,7 +10397,7 @@ static int rtw_mp_efuse_set(struct net_device *dev, u8 *ShadowMapWiFi = NULL; u8 *setrawdata = NULL; char *pch, *ptmp, *token, *tmp[3]={0x00,0x00,0x00}; - u16 addr=0, cnts=0, BTStatus=0 , max_available_size=0; + u16 addr=0xFF, cnts=0, BTStatus=0 , max_available_size=0; int err; wrqu = (struct iw_point*)wdata; @@ -9787,7 +10652,20 @@ static int rtw_mp_efuse_set(struct net_device *dev, addr = EEPROM_MAC_ADDR_8723BU; #endif #endif // CONFIG_RTL8723B - + + #if defined(CONFIG_RTL8812A) || defined(CONFIG_RTL8821A) + #ifdef CONFIG_SDIO_HCI + addr = EEPROM_MAC_ADDR_8821AS; + #endif + #ifdef CONFIG_PCI_HCI + addr = EEPROM_MAC_ADDR_8821AE; + #endif + #ifdef CONFIG_USB_HCI + addr = EEPROM_MAC_ADDR_8821AU; + #endif + + #endif // CONFIG_RTL8812A/CONFIG_RTL8821A + cnts = strlen(tmp[1]); if (cnts%2) { @@ -10561,6 +11439,8 @@ static int rtw_mp_read_rf(struct net_device *dev, while( *pch != '\0' ) { pnext = strpbrk(pch, " "); + if (!pnext) + break; pnext++; if ( *pnext != '\0' ) { @@ -10587,23 +11467,21 @@ static int rtw_mp_start(struct net_device *dev, struct dm_priv *pdmpriv = &pHalData->dmpriv; struct hal_ops *pHalFunc = &padapter->HalFunc; + rtw_pm_set_ips(padapter,IPS_NONE); + LeaveAllPowerSaveMode(padapter); + if(padapter->registrypriv.mp_mode ==0) { - #if (defined(CONFIG_RTL8723A) || defined(CONFIG_RTL8723B)) - DBG_871X("_rtw_mp_xmit_priv for Download BT patch FW\n"); - _rtw_mp_xmit_priv(&padapter->xmitpriv); - #endif - rtw_pm_set_ips(padapter,IPS_NONE); - LeaveAllPowerSaveMode(padapter); + #ifdef CONFIG_BT_COEXIST pdmpriv->DMFlag &= ~DYNAMIC_FUNC_BT; #endif pHalFunc->hal_deinit(padapter); padapter->registrypriv.mp_mode =1; pHalFunc->hal_init(padapter); + rtw_pm_set_ips(padapter,IPS_NONE); LeaveAllPowerSaveMode(padapter); - } if (padapter->registrypriv.mp_mode == 0) @@ -10617,16 +11495,22 @@ static int rtw_mp_start(struct net_device *dev, } padapter->mppriv.bmac_filter = _FALSE; #ifdef CONFIG_RTL8723B +#ifdef CONFIG_USB_HCI + rtw_write32(padapter, 0x765, 0x0000); + rtw_write32(padapter, 0x948, 0x0280); +#else + rtw_write32(padapter, 0x765, 0x0000); + rtw_write32(padapter, 0x948, 0x0000); +#endif +#ifdef CONFIG_FOR_RTL8723BS_VQ0 + rtw_write32(padapter, 0x765, 0x0000); + rtw_write32(padapter, 0x948, 0x0280); +#endif rtw_write8(padapter, 0x66, 0x27); //Open BT uart Log rtw_write8(padapter, 0xc50, 0x20); //for RX init Gain #endif ODM_Write_DIG(&pHalData->odmpriv,0x20); - { - u8 thermal=0; - GetThermalMeter(padapter, &thermal); - printk("%s ### REG_C80:0x%08x,REG_C88:0x%08x ,thermal:0x%02x####\n",__FUNCTION__, - rtw_read32(padapter,0xc80),rtw_read32(padapter,0xc88),thermal); - } + return 0; } @@ -10639,10 +11523,6 @@ static int rtw_mp_stop(struct net_device *dev, if(padapter->registrypriv.mp_mode ==1) { - #if (defined(CONFIG_RTL8723A) || defined(CONFIG_RTL8723B)) - DBG_871X("_rtw_mp_xmit_priv reinit for normal mode\n"); - _rtw_mp_xmit_priv(&padapter->xmitpriv); - #endif MPT_DeInitAdapter(padapter); pHalFunc->hal_deinit(padapter); @@ -10671,19 +11551,24 @@ static int rtw_mp_rate(struct net_device *dev, if (copy_from_user(input, wrqu->pointer, wrqu->length)) return -EFAULT; - rate = rtw_atoi(input); - sprintf( extra, "Set data rate to %d" , rate ); - + rate = rtw_mpRateParseFunc(padapter,input); + + if (rate ==0 && strcmp(input,"1M")!=0) + { + rate = rtw_atoi(input); if(rate <= 0x7f) rate = wifirate2_ratetbl_inx( (u8)rate); - else if (rate < 0x90) - //HT rate 0x80(MCS0) ~ 0x8F(MCS15) 128~143 + else if (rate < 0xC8) rate =(rate - 0x80 + MPT_RATE_MCS0); - else + //HT rate 0x80(MCS0) ~ 0x8F(MCS15) ~ 0x9F(MCS31) 128~159 + //VHT1SS~2SS rate 0xA0 (VHT1SS_MCS0 44) ~ 0xB3 (VHT2SS_MCS9 #63) 160~179 + //VHT rate 0xB4 (VHT3SS_MCS0 64) ~ 0xC7 (VHT2SS_MCS9 #83) 180~199 + //else //VHT rate 0x90(VHT1SS_MCS0) ~ 0x99(VHT1SS_MCS9) 144~153 - rate =(rate - MPT_RATE_VHT1SS_MCS0); - - //DBG_871X("%s: rate=%d\n", __func__, rate); + // rate =(rate - MPT_RATE_VHT1SS_MCS0); + } + sprintf( extra, "Set data rate to %s index %d" , input,rate ); + DBG_871X("%s: %s rate index=%d \n", __func__,input,rate); if (rate >= MPT_RATE_LAST ) return -EINVAL; @@ -10691,7 +11576,7 @@ static int rtw_mp_rate(struct net_device *dev, padapter->mppriv.rateidx = rate; Hal_SetDataRate(padapter); - wrqu->length = strlen(extra) + 1; + wrqu->length = strlen(extra); return 0; } @@ -10713,12 +11598,10 @@ static int rtw_mp_channel(struct net_device *dev, //DBG_871X("%s: channel=%d\n", __func__, channel); sprintf( extra, "Change channel %d to channel %d", padapter->mppriv.channel , channel ); padapter->mppriv.channel = channel; - pHalData->CurrentChannel = channel; Hal_SetChannel(padapter); + pHalData->CurrentChannel = channel; - //cur_ch_offset = rtw_get_offset_by_ch(padapter->mppriv.channel); - //set_channel_bwmode(padapter, padapter->mppriv.channel, cur_ch_offset, padapter->mppriv.bandwidth); - wrqu->length = strlen(extra) + 1; + wrqu->length = strlen(extra); return 0; } @@ -10745,10 +11628,10 @@ static int rtw_mp_bandwidth(struct net_device *dev, DBG_871X("%s: bw=%d sg=%d \n", __func__, bandwidth , sg); padapter->mppriv.bandwidth = (u8)bandwidth; - pHalData->CurrentChannelBW = bandwidth; padapter->mppriv.preamble = sg; SetBandwidth(padapter); + pHalData->CurrentChannelBW = bandwidth; //cur_ch_offset = rtw_get_offset_by_ch(padapter->mppriv.channel); //set_channel_bwmode(padapter, padapter->mppriv.channel, cur_ch_offset, bandwidth); @@ -10774,7 +11657,7 @@ static int rtw_mp_txpower_index(struct net_device *dev, rfpath = rtw_atoi(input); txpower_inx = mpt_ProQueryCalTxPower(padapter, rfpath); sprintf(extra, " %d", txpower_inx); - wrqu->length = strlen(extra) + 1; + wrqu->length = strlen(extra); return 0; } @@ -10808,7 +11691,7 @@ static int rtw_mp_txpower(struct net_device *dev, padapter->mppriv.bSetTxPower = 1; Hal_SetAntennaPathPower(padapter); } - wrqu->length = strlen(extra) + 1; + wrqu->length = strlen(extra); return 0; } @@ -10826,7 +11709,7 @@ static int rtw_mp_ant_tx(struct net_device *dev, //DBG_871X("%s: input=%s\n", __func__, input); - sprintf( extra, "switch Tx antenna to %s", input ); + sprintf( extra, "switch Tx antenna to %s", input); for (i=0; i < strlen(input); i++) { @@ -10843,11 +11726,12 @@ static int rtw_mp_ant_tx(struct net_device *dev, //antenna |= BIT(extra[i]-'a'); //DBG_871X("%s: antenna=0x%x\n", __func__, antenna); padapter->mppriv.antenna_tx = antenna; + padapter->mppriv.antenna_rx = antenna; //DBG_871X("%s:mppriv.antenna_rx=%d\n", __func__, padapter->mppriv.antenna_tx); Hal_SetAntenna(padapter); - wrqu->length = strlen(extra) + 1; + wrqu->length = strlen(extra); return 0; } @@ -10883,6 +11767,7 @@ static int rtw_mp_ant_rx(struct net_device *dev, } //DBG_871X("%s: antenna=0x%x\n", __func__, antenna); + padapter->mppriv.antenna_tx = antenna; padapter->mppriv.antenna_rx = antenna; //DBG_871X("%s:mppriv.antenna_rx=%d\n", __func__, padapter->mppriv.antenna_rx); Hal_SetAntenna(padapter); @@ -11006,8 +11891,8 @@ static int rtw_mp_ctx(struct net_device *dev, //DBG_871X("%s: cotuTx %d\n", __func__, bStartTest); if (bStartTest != 0){ sprintf( extra, "Start continuous DA=ffffffffffff len=1500 \n infinite=yes."); - } - Hal_SetContinuousTx(padapter, (u8)bStartTest); + } + Hal_SetContinuousTx(padapter, (u8)bStartTest); break; case MP_CARRIER_SUPPRISSION_TX: @@ -11118,7 +12003,7 @@ static int rtw_mp_arx(struct net_device *dev, u32 mac_cck_err=0, mac_ofdm_err=0, mac_ht_err=0, mac_vht_err=0; u8 input[wrqu->length]; char *pch, *ptmp, *token, *tmp[2]={0x00,0x00}; - u32 i=0,ii=0,jj=0,kk=0,cnts=0; + u32 i=0,ii=0,jj=0,kk=0,cnts=0,bmon=0; PADAPTER padapter = rtw_netdev_priv(dev); struct mp_priv *pmppriv = &padapter->mppriv; @@ -11134,7 +12019,7 @@ static int rtw_mp_arx(struct net_device *dev, bSetBssid = (strncmp(input, "setbssid=", 8)==0)?1:0; // strncmp TRUE is 0 //bfilter_init = (strncmp(input, "filter_init",11)==0)?1:0; bmac_filter = (strncmp(input, "accept_mac",10)==0)?1:0; - + bmon = (strncmp(input, "mon=",4)==0)?1:0; if(bSetBssid==1){ pch = input; @@ -11199,8 +12084,7 @@ static int rtw_mp_arx(struct net_device *dev, else if(bQueryPhy) { - //if (IS_HARDWARE_TYPE_JAGUAR(padapter)) - #ifdef CONFIG_RTL8188A + if (IS_HARDWARE_TYPE_JAGUAR(padapter)) { cckok = PHY_QueryBBReg(padapter, 0xF04, 0x3FFF); // [13:0] ofdmok = PHY_QueryBBReg(padapter, 0xF14, 0x3FFF); // [13:0] @@ -11210,22 +12094,31 @@ static int rtw_mp_arx(struct net_device *dev, cckcrc = PHY_QueryBBReg(padapter, 0xF04, 0x3FFF0000); // [29:16] ofdmcrc = PHY_QueryBBReg(padapter, 0xF14, 0x3FFF0000); // [29:16] htcrc = PHY_QueryBBReg(padapter, 0xF10, 0x3FFF0000); // [29:16] - vht_err = PHY_QueryBBReg(padapter, 0xF0C, 0x3FFF0000); // [29:16] + vht_err = PHY_QueryBBReg(padapter, 0xF0C, 0x3FFF0000); // [29:16] + + CCK_FA = PHY_QueryBBReg(padapter, 0xa5c, bMaskLWord); + OFDM_FA = PHY_QueryBBReg(padapter, 0xF48, bMaskLWord); } - #else + else { cckok = PHY_QueryBBReg(padapter, 0xF88, bMaskDWord); ofdmok = PHY_QueryBBReg(padapter, 0xF94, bMaskLWord); - htok = PHY_QueryBBReg(padapter, 0xF90, bMaskLWord); + htok = PHY_QueryBBReg(padapter, 0xF90, bMaskLWord); vht_ok = 0; cckcrc = PHY_QueryBBReg(padapter, 0xF84, bMaskDWord); ofdmcrc = PHY_QueryBBReg(padapter, 0xF94, bMaskHWord); htcrc = PHY_QueryBBReg(padapter, 0xF90, bMaskHWord); vht_err = 0; - } - #endif + + OFDM_FA = PHY_QueryBBReg(padapter, 0xCF0, bMaskLWord) + PHY_QueryBBReg(padapter, 0xCF2, bMaskLWord) + + PHY_QueryBBReg(padapter, 0xDA2, bMaskLWord)+ PHY_QueryBBReg(padapter, 0xDA4, bMaskLWord) + + PHY_QueryBBReg(padapter, 0xDA6, bMaskLWord) + PHY_QueryBBReg(padapter, 0xDA8, bMaskLWord); + CCK_FA=(rtw_read8(padapter, 0xa5b )<<8 ) | (rtw_read8(padapter, 0xa5c)); + } + DBG_871X("%s: OFDM_FA =%d\n", __FUNCTION__, OFDM_FA); + DBG_871X("%s: CCK_FA =%d\n", __FUNCTION__, CCK_FA); sprintf( extra, "Phy Received packet OK:%d CRC error:%d FA Counter: %d",cckok+ofdmok+htok+vht_ok,cckcrc+ofdmcrc+htcrc+vht_err,OFDM_FA+CCK_FA); } else if(bQueryMac) @@ -11252,12 +12145,25 @@ static int rtw_mp_arx(struct net_device *dev, DropPacket = rtw_read32(padapter, 0x664)& 0x0000FFFF; } - sprintf( extra, "Mac Received packet OK: %d , CRC error: %d , FA Counter: %d , Drop Packets: %d\n", - mac_cck_ok+mac_ofdm_ok+mac_ht_ok+mac_vht_ok,mac_cck_err+mac_ofdm_err+mac_ht_err+mac_vht_err,OFDM_FA+CCK_FA,DropPacket); + sprintf( extra, "Mac Received packet OK: %d , CRC error: %d , Drop Packets: %d\n", + mac_cck_ok+mac_ofdm_ok+mac_ht_ok+mac_vht_ok,mac_cck_err+mac_ofdm_err+mac_ht_err+mac_vht_err,DropPacket); } + + if( bmon==1 ) { + sscanf(input, "mon=%d", &bmon); + + if(bmon==1) + { + pmppriv->rx_bindicatePkt= _TRUE; + sprintf( extra, "Indicating Receive Packet to network start\n"); + }else { + pmppriv->rx_bindicatePkt= _FALSE; + sprintf( extra, "Indicating Receive Packet to network Stop\n"); + } + } + wrqu->length = strlen(extra) + 1; - return 0; } @@ -11314,8 +12220,8 @@ static int rtw_mp_pwrtrk(struct net_device *dev, ret = Hal_SetThermalMeter(padapter, (u8)thermal); if (ret == _FAIL) return -EPERM; sprintf(extra, "mp tx power tracking start,target value=%d ok ",thermal); - }else { - return -EINVAL; + }else{ + return -EINVAL; } } @@ -11349,7 +12255,7 @@ static int rtw_mp_thermal(struct net_device *dev, struct iw_point *wrqu, char *extra) { u8 val; - u16 bwrite=1; + int bwrite=1; #ifdef CONFIG_RTL8192C u16 addr=EEPROM_THERMAL_METER_92C; @@ -11434,12 +12340,26 @@ static int rtw_mp_reset_stats(struct net_device *dev, { write_bbreg(padapter, 0xB58, BIT0, 0x1); write_bbreg(padapter, 0xB58, BIT0, 0x0); + + write_bbreg(padapter, 0x9A4, BIT17, 0x1);//reset OFDA FA counter + write_bbreg(padapter, 0x9A4, BIT17, 0x0); + + write_bbreg(padapter, 0xA5C, BIT15, 0x0);//reset CCK FA counter + write_bbreg(padapter, 0xA5C, BIT15, 0x1); } else { write_bbreg(padapter, 0xF14, BIT16, 0x1); rtw_msleep_os(10); write_bbreg(padapter, 0xF14, BIT16, 0x0); + + write_bbreg(padapter, 0xD00, BIT27, 0x1);//reset OFDA FA counter + write_bbreg(padapter, 0xC0C, BIT31, 0x1);//reset OFDA FA counter + write_bbreg(padapter, 0xD00, BIT27, 0x0); + write_bbreg(padapter, 0xC0C, BIT31, 0x0); + + write_bbreg(padapter, 0xA2C, BIT15, 0x0);//reset CCK FA counter + write_bbreg(padapter, 0xA2C, BIT15, 0x1); } //reset mac counter PHY_SetMacReg(padapter, 0x664, BIT27, 0x1); @@ -11576,7 +12496,7 @@ static int rtw_mp_PwrCtlDM(struct net_device *dev, { PADAPTER padapter = rtw_netdev_priv(dev); u8 input[wrqu->length]; - u8 bstart=1; + int bstart=1; if (copy_from_user(input, wrqu->pointer, wrqu->length)) return -EFAULT; @@ -11594,6 +12514,23 @@ static int rtw_mp_PwrCtlDM(struct net_device *dev, return 0; } +static int rtw_mp_getver(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + PADAPTER padapter = rtw_netdev_priv(dev); + struct mp_priv *pmp_priv; + + pmp_priv = &padapter->mppriv; + + if (copy_from_user(extra, wrqu->data.pointer, wrqu->data.length)) + return -EFAULT; + + sprintf(extra, "rtwpriv=%d\n",RTWPRIV_VER_INFO); + wrqu->data.length = strlen(extra); + return 0; +} + #if (defined(CONFIG_RTL8723A) || defined(CONFIG_RTL8723B)) /* update Tx AGC offset */ static int rtw_mp_SetBT(struct net_device *dev, @@ -11701,12 +12638,6 @@ static int rtw_mp_SetBT(struct net_device *dev, } if ( strncmp(extra, "dlfw", 4) == 0) { - #ifdef CONFIG_BT_COEXIST - rtw_btcoex_HaltNotify(padapter); - //DBG_871X("SetBT bt1ant !\n"); - //hal_btcoex1ant_SetAntPath(padapter); - rtw_btcoex_SetManualControl(padapter, _TRUE); - #endif pHalData->LastHMEBoxNum=0; padapter->bBTFWReady = _FALSE; rtw_write8(padapter, 0xa3, 0x05); @@ -11754,6 +12685,12 @@ static int rtw_mp_SetBT(struct net_device *dev, #endif DBG_871X("Wait for FirmwareDownloadBT fw boot!\n"); rtw_msleep_os(1000); +#ifdef CONFIG_BT_COEXIST + rtw_btcoex_HaltNotify(padapter); + DBG_871X("SetBT btcoex HaltNotify !\n"); + //hal_btcoex1ant_SetAntPath(padapter); + rtw_btcoex_SetManualControl(padapter, _TRUE); +#endif _rtw_memset(extra,'\0', wrqu->data.length); BtReq.opCodeVer = 1; BtReq.OpCode = 0; @@ -11783,9 +12720,15 @@ static int rtw_mp_SetBT(struct net_device *dev, if ( strncmp(extra, "down", 4) == 0){ DBG_871X("SetBT down for to hal_init !\n"); - mp_stop_test(padapter); +#ifdef CONFIG_BT_COEXIST + rtw_btcoex_SetManualControl(padapter, _FALSE); + rtw_btcoex_Initialize(padapter); +#endif + pHalFunc->read_adapter_info(padapter); + pHalFunc->hal_deinit(padapter); pHalFunc->hal_init(padapter); - mp_start_test(padapter); + rtw_pm_set_ips(padapter,IPS_NONE); + LeaveAllPowerSaveMode(padapter); MPT_PwrCtlDM(padapter,0); rtw_write32(padapter, 0xcc, (rtw_read32(padapter, 0xcc)| 0x00000004)); rtw_write32(padapter, 0x6b, (rtw_read32(padapter, 0x6b)& 0xFFFFFFEF)); @@ -11811,7 +12754,7 @@ static int rtw_mp_SetBT(struct net_device *dev, if ( strncmp(extra, "h2c", 3) == 0){ DBG_871X("SetBT h2c !\n"); padapter->bBTFWReady = _TRUE; - FillH2CCmd(padapter, 0x63, 1, u1H2CBtMpOperParm); + rtw_hal_fill_h2c_cmd(padapter, 0x63, 1, u1H2CBtMpOperParm); goto exit; } if ( strncmp(extra, "2ant", 4) == 0){ @@ -12031,6 +12974,12 @@ static int rtw_mp_set(struct net_device *dev, DBG_871X("set case MP_DISABLE_BT_COEXIST \n"); rtw_mp_disable_bt_coexist(dev, info, wdata, extra); break; +#ifdef CONFIG_WOWLAN + case MP_WOW_ENABLE: + DBG_871X("set case MP_WOW_ENABLE: %s \n", extra); + rtw_wowlan_ctrl(dev, info, wdata, extra); + break; +#endif #ifdef CONFIG_AP_WOWLAN case MP_AP_WOW_ENABLE: DBG_871X("set case MP_AP_WOW_ENABLE: %s \n", extra); @@ -12177,7 +13126,9 @@ static int rtw_mp_get(struct net_device *dev, DBG_871X("mp_get MP_GET_TXPOWER_INX \n"); rtw_mp_txpower_index(dev,info,wrqu,extra); break; - + case MP_GETVER: + DBG_871X("mp_get MP_GETVER \n"); + rtw_mp_getver(dev,info,wdata,extra); #if defined(CONFIG_RTL8723A) || defined(CONFIG_RTL8723B) case MP_SetBT: DBG_871X("set MP_SetBT \n"); @@ -13603,13 +14554,11 @@ static int rtw_test( { rtw_btcoex_SetManualControl(padapter, _FALSE); } - - if (strcmp(pch, "btoff") == 0) + else if (strcmp(pch, "btoff") == 0) { rtw_btcoex_SetManualControl(padapter, _TRUE); } - - if (strcmp(pch, "h2c") == 0) + else if (strcmp(pch, "h2c") == 0) { u8 param[8]; u8 count = 0; @@ -13646,6 +14595,20 @@ static int rtw_test( wrqu->data.length = strlen(extra) + 1; } + else if (strcmp(pch, "ba_rxbuf_sz") == 0) + { + u8 ba_rxbuf_bz; + + pch = strsep(&ptmp, delim); + if ((pch != NULL) && (strlen(pch) != 0)) { + sscanf(pch, "%hhu", &ba_rxbuf_bz); + DBG_871X("%s set ba_rxbuf_bz as %u\n", __func__, ba_rxbuf_bz); + padapter->fix_ba_rxbuf_bz = ba_rxbuf_bz; + rtw_btcoex_RejectApAggregatedPacket(padapter, _TRUE); + rtw_btcoex_RejectApAggregatedPacket(padapter, _FALSE); + } + } + #endif // CONFIG_BT_COEXIST rtw_mfree(pbuf, len); @@ -13712,64 +14675,6 @@ static iw_handler rtw_handlers[] = NULL, /*---hole---*/ }; -#if 0 -//defined(CONFIG_MP_INCLUDED) && defined(CONFIG_MP_IWPRIV_SUPPORT) -static const struct iw_priv_args rtw_private_args[] = -{ - { SIOCIWFIRSTPRIV + 0x00, IW_PRIV_TYPE_CHAR | 1024, 0 , ""}, //set - { SIOCIWFIRSTPRIV + 0x01, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK , ""},//get -/* --- sub-ioctls definitions --- */ - { MP_START , IW_PRIV_TYPE_CHAR | 1024, 0, "mp_start" }, //set - { MP_PHYPARA, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_phypara" },//get - { MP_STOP , IW_PRIV_TYPE_CHAR | 1024, 0, "mp_stop" }, //set - { MP_CHANNEL , IW_PRIV_TYPE_CHAR | 1024 , IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_channel" },//get - { MP_BANDWIDTH , IW_PRIV_TYPE_CHAR | 1024, 0, "mp_bandwidth"}, //set - { MP_RATE , IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_rate" },//get - { MP_RESET_STATS , IW_PRIV_TYPE_CHAR | 1024, 0, "mp_reset_stats"}, - { MP_QUERY , IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK , "mp_query"}, //get - { MP_NULL, IW_PRIV_TYPE_CHAR | 128, 0,"NULL"},//set - { READ_REG , IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "read_reg" }, - { MP_NULL, IW_PRIV_TYPE_CHAR | 128, 0,"NULL"},//set - { MP_RATE , IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_rate" }, - { MP_NULL, IW_PRIV_TYPE_CHAR | 128, 0,"NULL"},//set - { READ_RF , IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "read_rf" }, - { MP_NULL, IW_PRIV_TYPE_CHAR | 128, 0,"NULL"},//set - { MP_PSD , IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_psd"}, - { MP_NULL, IW_PRIV_TYPE_CHAR | 128, 0,"NULL"},//set - { MP_DUMP, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_dump" }, - { MP_NULL, IW_PRIV_TYPE_CHAR | 128, 0,"NULL"},//set - { MP_TXPOWER , IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_txpower"}, - { MP_NULL, IW_PRIV_TYPE_CHAR | 128, 0,"NULL"},//set - { MP_ANT_TX , IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_ant_tx"}, - { MP_NULL, IW_PRIV_TYPE_CHAR | 128, 0,"NULL"},//set - { MP_ANT_RX , IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_ant_rx"}, - { WRITE_REG, IW_PRIV_TYPE_CHAR | 1024, 0,"write_reg"},//set - { MP_NULL, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "NULL" }, - { WRITE_RF, IW_PRIV_TYPE_CHAR | 1024, 0,"write_rf"},//set - { MP_NULL, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "NULL" }, - { MP_NULL, IW_PRIV_TYPE_CHAR | 128, 0,"NULL"},//set - { MP_CTX , IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_ctx"}, - { MP_NULL, IW_PRIV_TYPE_CHAR | 128, 0,"NULL"},//set - { MP_ARX , IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_arx"}, - { MP_NULL, IW_PRIV_TYPE_CHAR | 128, 0,"NULL"},//set - { MP_THER , IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_ther"}, - { EFUSE_SET, IW_PRIV_TYPE_CHAR | 1024, 0, "efuse_set" }, - { EFUSE_GET, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "efuse_get" }, - { MP_PWRTRK , IW_PRIV_TYPE_CHAR | 1024, 0, "mp_pwrtrk"}, - { MP_QueryDrvStats, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_drvquery" }, - { MP_IOCTL, IW_PRIV_TYPE_CHAR | 1024, 0, "mp_ioctl"}, // mp_ioctl - { MP_SetRFPathSwh, IW_PRIV_TYPE_CHAR | 1024, 0, "mp_setrfpath" }, -#ifdef CONFIG_RTL8723A - { MP_SetBT, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_setbt" }, -#endif - { SIOCIWFIRSTPRIV + 0x02, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK , "test"},//set -}; -static iw_handler rtw_private_handler[] = -{ - rtw_mp_set, - rtw_mp_get, -}; -#else // not inlucde MP static const struct iw_priv_args rtw_private_args[] = { { @@ -13921,6 +14826,7 @@ static const struct iw_priv_args rtw_private_args[] = { { MP_SetRFPathSwh, IW_PRIV_TYPE_CHAR | 1024, 0, "mp_setrfpath" }, { MP_PwrCtlDM, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_pwrctldm" }, { MP_GET_TXPOWER_INX, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_get_txpower" }, + { MP_GETVER, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_priv_ver" }, #if defined(CONFIG_RTL8723A) || defined(CONFIG_RTL8723B) { MP_SetBT, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_setbt" }, @@ -13928,8 +14834,11 @@ static const struct iw_priv_args rtw_private_args[] = { #endif { CTA_TEST, IW_PRIV_TYPE_CHAR | 1024, 0, "cta_test"}, #endif +#ifdef CONFIG_WOWLAN + { MP_WOW_ENABLE , IW_PRIV_TYPE_CHAR | 1024, 0, "wow_mode" }, //set +#endif #ifdef CONFIG_AP_WOWLAN - { MP_AP_WOW_ENABLE , IW_PRIV_TYPE_CHAR | 1024, 0, "ap_wow_enable" }, //set + { MP_AP_WOW_ENABLE , IW_PRIV_TYPE_CHAR | 1024, 0, "ap_wow_mode" }, //set #endif }; @@ -13992,7 +14901,6 @@ static iw_handler rtw_private_handler[] = #endif // CONFIG_INTEL_WIDI }; -#endif // #if defined(CONFIG_MP_INCLUDED) && defined(CONFIG_MP_IWPRIV_SUPPORT) #if WIRELESS_EXT >= 17 static struct iw_statistics *rtw_get_wireless_stats(struct net_device *dev) @@ -14014,11 +14922,22 @@ static struct iw_statistics *rtw_get_wireless_stats(struct net_device *dev) #ifdef CONFIG_SIGNAL_DISPLAY_DBM tmp_level = translate_percentage_to_dbm(padapter->recvpriv.signal_strength); #else + #ifdef CONFIG_SKIP_SIGNAL_SCALE_MAPPING + { + /* Do signal scale mapping when using percentage as the unit of signal strength, since the scale mapping is skipped in odm */ + + HAL_DATA_TYPE *pHal = GET_HAL_DATA(padapter); + + tmp_level = (u8)odm_SignalScaleMapping(&pHal->odmpriv, padapter->recvpriv.signal_strength); + } + #else tmp_level = padapter->recvpriv.signal_strength; #endif + #endif tmp_qual = padapter->recvpriv.signal_qual; - tmp_noise =padapter->recvpriv.noise; + rtw_get_noise(padapter); + tmp_noise = padapter->recvpriv.noise; //DBG_871X("level:%d, qual:%d, noise:%d, rssi (%d)\n", tmp_level, tmp_qual, tmp_noise,padapter->recvpriv.rssi); piwstats->qual.level = tmp_level; @@ -14087,7 +15006,8 @@ static int get_priv_size(__u16 args) } // copy from net/wireless/wext.c end -static int rtw_ioctl_wext_private(struct net_device *dev, union iwreq_data *wrq_data) + +static int _rtw_ioctl_wext_private(struct net_device *dev, union iwreq_data *wrq_data) { int err = 0; u8 *input = NULL; @@ -14117,7 +15037,6 @@ static int rtw_ioctl_wext_private(struct net_device *dev, union iwreq_data *wrq_ union iwreq_data wdata; - _rtw_memcpy(&wdata, wrq_data, sizeof(wdata)); input_len = wdata.data.length; @@ -14130,17 +15049,16 @@ static int rtw_ioctl_wext_private(struct net_device *dev, union iwreq_data *wrq_ } ptr = input; len = input_len; - sscanf(ptr, "%16s", cmdname); cmdlen = strlen(cmdname); - DBG_8192C("%s: cmd=%s\n", __func__, cmdname); + DBG_871X("%s: cmd=%s\n", __func__, cmdname); // skip command string if (cmdlen > 0) cmdlen += 1; // skip one space ptr += cmdlen; len -= cmdlen; - DBG_8192C("%s: parameters=%s\n", __func__, ptr); + DBG_871X("%s: parameters=%s\n", __func__, ptr); priv = rtw_private_handler; priv_args = rtw_private_args; @@ -14426,6 +15344,61 @@ exit: return err; } +#ifdef CONFIG_COMPAT +static int rtw_ioctl_compat_wext_private(struct net_device *dev, struct ifreq *rq) +{ + struct compat_iw_point iwp_compat; + union iwreq_data wrq_data; + int err = 0; + DBG_871X("%s:...\n", __func__); + if (copy_from_user(&iwp_compat, rq->ifr_ifru.ifru_data, sizeof(struct compat_iw_point))) + return -EFAULT; + + wrq_data.data.pointer = compat_ptr(iwp_compat.pointer); + wrq_data.data.length = iwp_compat.length; + wrq_data.data.flags = iwp_compat.flags; + + err = _rtw_ioctl_wext_private(dev, &wrq_data); + + iwp_compat.pointer = ptr_to_compat(wrq_data.data.pointer); + iwp_compat.length = wrq_data.data.length; + iwp_compat.flags = wrq_data.data.flags; + if (copy_to_user(rq->ifr_ifru.ifru_data, &iwp_compat, sizeof(struct compat_iw_point))) + return -EFAULT; + + return err; +} +#endif // CONFIG_COMPAT + +static int rtw_ioctl_standard_wext_private(struct net_device *dev, struct ifreq *rq) +{ + struct iw_point *iwp; + struct ifreq ifrq; + union iwreq_data wrq_data; + int err = 0; + iwp = &wrq_data.data; + DBG_871X("%s:...\n", __func__); + if (copy_from_user(iwp, rq->ifr_ifru.ifru_data, sizeof(struct iw_point))) + return -EFAULT; + + err = _rtw_ioctl_wext_private(dev, &wrq_data); + + if (copy_to_user(rq->ifr_ifru.ifru_data, iwp, sizeof(struct iw_point))) + return -EFAULT; + + return err; +} + +static int rtw_ioctl_wext_private(struct net_device *dev, struct ifreq *rq) +{ +#ifdef CONFIG_COMPAT + if(is_compat_task()) + return rtw_ioctl_compat_wext_private( dev, rq ); + else +#endif // CONFIG_COMPAT + return rtw_ioctl_standard_wext_private( dev, rq ); +} + int rtw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct iwreq *wrq = (struct iwreq *)rq; @@ -14446,8 +15419,8 @@ int rtw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) break; #endif #endif // CONFIG_AP_MODE - case SIOCDEVPRIVATE: - ret = rtw_ioctl_wext_private(dev, &wrq->u); + case SIOCDEVPRIVATE: + ret = rtw_ioctl_wext_private(dev, rq); break; case (SIOCDEVPRIVATE+1): ret = rtw_android_priv_cmd(dev, rq, cmd); diff --git a/os_dep/linux/mlme_linux.c b/os_dep/linux/mlme_linux.c index 78ea101..c2cc56d 100644 --- a/os_dep/linux/mlme_linux.c +++ b/os_dep/linux/mlme_linux.c @@ -285,39 +285,41 @@ _func_enter_; if(authmode==_WPA_IE_ID_) { RT_TRACE(_module_mlme_osdep_c_,_drv_info_,("rtw_report_sec_ie, authmode=%d\n", authmode)); - - buff = rtw_malloc(IW_CUSTOM_MAX); - - _rtw_memset(buff,0,IW_CUSTOM_MAX); - - p=buff; - + + buff = rtw_zmalloc(IW_CUSTOM_MAX); + if (NULL == buff) { + DBG_871X(FUNC_ADPT_FMT ": alloc memory FAIL!!\n", + FUNC_ADPT_ARG(adapter)); + return; + } + p = buff; + p+=sprintf(p,"ASSOCINFO(ReqIEs="); len = sec_ie[1]+2; - len = (len < IW_CUSTOM_MAX) ? len:IW_CUSTOM_MAX; + len = (len < IW_CUSTOM_MAX) ? len:IW_CUSTOM_MAX; for(i=0;ipnetdev,IWEVCUSTOM,&wrqu,buff); #endif - if(buff) - rtw_mfree(buff, IW_CUSTOM_MAX); - + rtw_mfree(buff, IW_CUSTOM_MAX); } +exit: + _func_exit_; } diff --git a/os_dep/linux/os_intfs.c b/os_dep/linux/os_intfs.c index 8526303..813aa83 100644 --- a/os_dep/linux/os_intfs.c +++ b/os_dep/linux/os_intfs.c @@ -107,9 +107,9 @@ int rtw_ht_enable = 1; // 0x21 means enable 2.4G 40MHz & 5G 80MHz int rtw_bw_mode = 0x21; int rtw_cbw40_enable = 3; // 0 :diable, bit(0): enable 2.4g, bit(1): enable 5g -int rtw_ampdu_enable = 1;//for enable tx_ampdu +int rtw_ampdu_enable = 1;//for enable tx_ampdu ,// 0: disable, 0x1:enable (but wifi_spec should be 0), 0x2: force enable (don't care wifi_spec) int rtw_rx_stbc = 1;// 0: disable, bit(0):enable 2.4g, bit(1):enable 5g, default is set to enable 2.4GHZ for IOT issue with bufflao's AP at 5GHZ -int rtw_ampdu_amsdu = 0;// 0: disabled, 1:enabled, 2:auto +int rtw_ampdu_amsdu = 0;// 0: disabled, 1:enabled, 2:auto . There is an IOT issu with DLINK DIR-629 when the flag turn on // Short GI support Bit Map // BIT0 - 20MHz, 0: non-support, 1: support // BIT1 - 40MHz, 0: non-support, 1: support @@ -140,6 +140,9 @@ int rtw_wifi_spec = 1;//for wifi test #else int rtw_wifi_spec = 0; #endif + +int rtw_special_rf_path = 0; //0: 2T2R ,1: only turn on path A 1T1R + int rtw_channel_plan = RT_CHANNEL_DOMAIN_MAX; #ifdef CONFIG_BT_COEXIST @@ -223,6 +226,7 @@ module_param(rtw_ext_iface_num, int, 0644); module_param(rtw_initmac, charp, 0644); module_param(rtw_channel_plan, int, 0644); +module_param(rtw_special_rf_path, int, 0644); module_param(rtw_chip_version, int, 0644); module_param(rtw_rfintfs, int, 0644); module_param(rtw_lbkmode, int, 0644); @@ -316,6 +320,34 @@ uint rtw_notch_filter = RTW_NOTCH_FILTER; module_param(rtw_notch_filter, uint, 0644); MODULE_PARM_DESC(rtw_notch_filter, "0:Disable, 1:Enable, 2:Enable only for P2P"); +uint rtw_hiq_filter = CONFIG_RTW_HIQ_FILTER; +module_param(rtw_hiq_filter, uint, 0644); +MODULE_PARM_DESC(rtw_hiq_filter, "0:allow all, 1:allow special, 2:deny all"); + +uint rtw_adaptivity_en = CONFIG_RTW_ADAPTIVITY_EN; +module_param(rtw_adaptivity_en, uint, 0644); +MODULE_PARM_DESC(rtw_adaptivity_en, "0:disable, 1:enable, 2:auto"); + +uint rtw_adaptivity_mode = CONFIG_RTW_ADAPTIVITY_MODE; +module_param(rtw_adaptivity_mode, uint, 0644); +MODULE_PARM_DESC(rtw_adaptivity_mode, "0:normal, 1:carrier sense"); + +uint rtw_nhm_en = CONFIG_RTW_NHM_EN; +module_param(rtw_nhm_en, uint, 0644); +MODULE_PARM_DESC(rtw_nhm_en, "0:disable, 1:enable"); + +uint rtw_amplifier_type_2g = CONFIG_RTW_AMPLIFIER_TYPE_2G; +module_param(rtw_amplifier_type_2g, uint, 0644); +MODULE_PARM_DESC(rtw_amplifier_type_2g, "BIT3:2G ext-PA, BIT4:2G ext-LNA"); + +uint rtw_amplifier_type_5g = CONFIG_RTW_AMPLIFIER_TYPE_5G; +module_param(rtw_amplifier_type_5g, uint, 0644); +MODULE_PARM_DESC(rtw_amplifier_type_5g, "BIT6:5G ext-PA, BIT7:5G ext-LNA"); + +uint rtw_RFE_type = 64; +module_param(rtw_RFE_type, uint, 0644); +MODULE_PARM_DESC(rtw_RFE_type, "default init value:64"); + #if defined(CONFIG_CALIBRATE_TX_POWER_BY_REGULATORY) //eFuse: Regulatory selection=1 int rtw_tx_pwr_lmt_enable = 1; int rtw_tx_pwr_by_rate = 1; @@ -323,8 +355,13 @@ int rtw_tx_pwr_by_rate = 1; int rtw_tx_pwr_lmt_enable = 0; int rtw_tx_pwr_by_rate = 1; #else //eFuse: Regulatory selection=2 +#ifdef CONFIG_PCI_HCI +int rtw_tx_pwr_lmt_enable = 2; // 2- Depend on efuse +int rtw_tx_pwr_by_rate = 2;// 2- Depend on efuse +#else // USB & SDIO int rtw_tx_pwr_lmt_enable = 0; int rtw_tx_pwr_by_rate = 0; +#endif #endif module_param(rtw_tx_pwr_lmt_enable, int, 0644); @@ -334,7 +371,7 @@ module_param(rtw_tx_pwr_by_rate, int, 0644); MODULE_PARM_DESC(rtw_tx_pwr_by_rate,"0:Disable, 1:Enable, 2: Depend on efuse"); #ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE -char *rtw_phy_file_path = ""; +char *rtw_phy_file_path = REALTEK_CONFIG_PATH; module_param(rtw_phy_file_path, charp, 0644); MODULE_PARM_DESC(rtw_phy_file_path, "The path of phy parameter"); // PHY FILE Bit Map @@ -451,6 +488,7 @@ _func_enter_; registry_par->wifi_spec = (u8)rtw_wifi_spec; registry_par->channel_plan = (u8)rtw_channel_plan; + registry_par->special_rf_path = (u8)rtw_special_rf_path; #ifdef CONFIG_BT_COEXIST registry_par->btcoex = (u8)rtw_btcoex_enable; @@ -520,7 +558,9 @@ _func_enter_; registry_par->TxBBSwing_2G = 0xFF; registry_par->TxBBSwing_5G = 0xFF; registry_par->bEn_RFE = 1; - registry_par->RFE_Type = 64; + registry_par->RFE_Type = (u8)rtw_RFE_type; + registry_par->AmplifierType_2G = (u8)rtw_amplifier_type_2g; + registry_par->AmplifierType_5G = (u8)rtw_amplifier_type_5g; #ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE registry_par->load_phy_file = (u8)rtw_load_phy_file; @@ -528,6 +568,12 @@ _func_enter_; #endif registry_par->qos_opt_enable = (u8)rtw_qos_opt_enable; + registry_par->hiq_filter = (u8)rtw_hiq_filter; + + registry_par->adaptivity_en = (u8)rtw_adaptivity_en; + registry_par->adaptivity_mode = (u8)rtw_adaptivity_mode; + registry_par->nhm_en = (u8)rtw_nhm_en; + _func_exit_; return status; @@ -601,7 +647,16 @@ unsigned int rtw_classify8021d(struct sk_buff *skb) return dscp >> 5; } -static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb) + +static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0) + , void *accel_priv +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) + , select_queue_fallback_t fallback +#endif + +#endif +) { _adapter *padapter = rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; @@ -645,10 +700,13 @@ u16 rtw_recv_select_queue(struct sk_buff *skb) } #endif - -static int rtw_ndev_notifier_call(struct notifier_block * nb, unsigned long state, void *ndev) -{ - struct net_device *dev = ndev; +static int rtw_ndev_notifier_call(struct notifier_block * nb, unsigned long state, void *ptr) +{ +#if (LINUX_VERSION_CODE>=KERNEL_VERSION(3,11,0)) + struct net_device *dev = netdev_notifier_info_to_dev(ptr); +#else + struct net_device *dev = ptr; +#endif #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29)) if (dev->netdev_ops->ndo_do_ioctl != rtw_ioctl) @@ -1014,7 +1072,12 @@ u8 rtw_init_default_value(_adapter *padapter) padapter->bShowGetP2PState = 1; #endif + //for debug purpose padapter->fix_rate = 0xFF; + padapter->driver_ampdu_spacing = 0xFF; + padapter->driver_rx_ampdu_factor = 0xFF; + padapter->driver_rx_ampdu_spacing = 0xFF; + padapter->fix_ba_rxbuf_bz = 0xFF; return ret; } @@ -1033,14 +1096,13 @@ struct dvobj_priv *devobj_init(void) _rtw_mutex_init(&pdvobj->setch_mutex); _rtw_mutex_init(&pdvobj->setbw_mutex); - _rtw_spinlock_init(&pdvobj->lock); - - pdvobj->macid[1] = _TRUE; //macid=1 for bc/mc stainfo - pdvobj->processing_dev_remove = _FALSE; ATOMIC_SET(&pdvobj->disable_func, 0); + rtw_macid_ctl_init(&pdvobj->macid_ctl); + _rtw_spinlock_init(&pdvobj->cam_ctl.lock); + return pdvobj; } @@ -1050,13 +1112,14 @@ void devobj_deinit(struct dvobj_priv *pdvobj) if(!pdvobj) return; - _rtw_spinlock_free(&pdvobj->lock); - _rtw_mutex_free(&pdvobj->hw_init_mutex); _rtw_mutex_free(&pdvobj->h2c_fwcmd_mutex); _rtw_mutex_free(&pdvobj->setch_mutex); _rtw_mutex_free(&pdvobj->setbw_mutex); + rtw_macid_ctl_deinit(&pdvobj->macid_ctl); + _rtw_spinlock_free(&pdvobj->cam_ctl.lock); + rtw_mfree((u8*)pdvobj, sizeof(*pdvobj)); } @@ -1119,8 +1182,6 @@ _func_enter_; ret8 = rtw_init_default_value(padapter); - rtw_init_hal_com_default_value(padapter); - if ((rtw_init_cmd_priv(&padapter->cmdpriv)) == _FAIL) { RT_TRACE(_module_os_intfs_c_,_drv_err_,("\n Can't init cmd_priv\n")); @@ -1205,6 +1266,7 @@ _func_enter_; padapter->stapriv.padapter = padapter; padapter->setband = GHZ24_50; padapter->fix_rate = 0xFF; + padapter->fix_ba_rxbuf_bz = 0xFF; rtw_init_bcmc_stainfo(padapter); rtw_init_pwrctrl_priv(padapter); @@ -1824,6 +1886,13 @@ int netdev_if2_open(struct net_device *pnetdev) { int ret; _adapter *padapter = (_adapter *)rtw_netdev_priv(pnetdev); + struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter); + + if (pwrctrlpriv->bInSuspend == _TRUE) + { + DBG_871X("+871x_drv - netdev_if2_open, bInSuspend=%d\n", pwrctrlpriv->bInSuspend); + return 0; + } _enter_critical_mutex(&(adapter_to_dvobj(padapter)->hw_init_mutex), NULL); ret = _netdev_if2_open(pnetdev); @@ -2212,10 +2281,6 @@ int _netdev_open(struct net_device *pnetdev) DBG_871X("MAC Address = "MAC_FMT"\n", MAC_ARG(pnetdev->dev_addr)); -#ifdef CONFIG_RF_GAIN_OFFSET - rtw_bb_rf_gain_offset(padapter); -#endif //CONFIG_RF_GAIN_OFFSET - status=rtw_start_drv_threads(padapter); if(status ==_FAIL) { @@ -2292,6 +2357,13 @@ int netdev_open(struct net_device *pnetdev) { int ret; _adapter *padapter = (_adapter *)rtw_netdev_priv(pnetdev); + struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter); + + if (pwrctrlpriv->bInSuspend == _TRUE) + { + DBG_871X("+871x_drv - drv_open, bInSuspend=%d\n", pwrctrlpriv->bInSuspend); + return 0; + } _enter_critical_mutex(&(adapter_to_dvobj(padapter)->hw_init_mutex), NULL); ret = _netdev_open(pnetdev); @@ -2322,10 +2394,6 @@ int ips_netdrv_open(_adapter *padapter) goto netdev_open_error; } -#ifdef CONFIG_RF_GAIN_OFFSET - rtw_bb_rf_gain_offset(padapter); -#endif //CONFIG_RF_GAIN_OFFSET - if (padapter->intf_start) { padapter->intf_start(padapter); @@ -2417,120 +2485,22 @@ void rtw_ips_dev_unload(_adapter *padapter) } -#ifdef CONFIG_RF_GAIN_OFFSET -u32 Array_kfreemap[] = { -0xf8,0xe, -0xf6,0xc, -0xf4,0xa, -0xf2,0x8, -0xf0,0x6, -0xf3,0x4, -0xf5,0x2, -0xf7,0x0, -0xf9,0x0, -0xfc,0x0, -}; - -void rtw_bb_rf_gain_offset(_adapter *padapter) -{ - u8 value = padapter->eeprompriv.EEPROMRFGainOffset; - u8 tmp = 0x3e; - u32 res,i=0; - u4Byte ArrayLen = sizeof(Array_kfreemap)/sizeof(u32); - pu4Byte Array = Array_kfreemap; - u4Byte v1=0,v2=0,target=0; - //DBG_871X("+%s value: 0x%02x+\n", __func__, value); -#if defined(CONFIG_RTL8723A) - if (value & BIT0) { - DBG_871X("Offset RF Gain.\n"); - DBG_871X("Offset RF Gain. padapter->eeprompriv.EEPROMRFGainVal=0x%x\n",padapter->eeprompriv.EEPROMRFGainVal); - if(padapter->eeprompriv.EEPROMRFGainVal != 0xff){ - res = rtw_hal_read_rfreg(padapter, RF_PATH_A, 0xd, 0xffffffff); - DBG_871X("Offset RF Gain. reg 0xd=0x%x\n",res); - res &= 0xfff87fff; - - res |= (padapter->eeprompriv.EEPROMRFGainVal & 0x0f)<< 15; - DBG_871X("Offset RF Gain. reg 0xd=0x%x\n",res); - - rtw_hal_write_rfreg(padapter, RF_PATH_A, REG_RF_BB_GAIN_OFFSET_CCK, RF_GAIN_OFFSET_MASK, res); - - res = rtw_hal_read_rfreg(padapter, RF_PATH_A, 0xe, 0xffffffff); - DBG_871X("Offset RF Gain. reg 0xe=0x%x\n",res); - res &= 0xfffffff0; - - res |= (padapter->eeprompriv.EEPROMRFGainVal & 0x0f); - DBG_871X("Offset RF Gain. reg 0xe=0x%x\n",res); - - rtw_hal_write_rfreg(padapter, RF_PATH_A, REG_RF_BB_GAIN_OFFSET_OFDM, RF_GAIN_OFFSET_MASK, res); - } - else - { - DBG_871X("Offset RF Gain. padapter->eeprompriv.EEPROMRFGainVal=0x%x != 0xff, didn't run Kfree\n",padapter->eeprompriv.EEPROMRFGainVal); - } - } else { - DBG_871X("Using the default RF gain.\n"); - } -#elif defined(CONFIG_RTL8723B) - if (value & BIT4) { - DBG_871X("Offset RF Gain.\n"); - DBG_871X("Offset RF Gain. padapter->eeprompriv.EEPROMRFGainVal=0x%x\n",padapter->eeprompriv.EEPROMRFGainVal); - if(padapter->eeprompriv.EEPROMRFGainVal != 0xff){ - res = rtw_hal_read_rfreg(padapter, RF_PATH_A, 0x7f, 0xffffffff); - res &= 0xfff87fff; - DBG_871X("Offset RF Gain. before reg 0x7f=0x%08x\n",res); - //res &= 0xfff87fff; - for (i = 0; i < ArrayLen; i += 2 ) - { - v1 = Array[i]; - v2 = Array[i+1]; - if ( v1 == padapter->eeprompriv.EEPROMRFGainVal ) - { - DBG_871X("Offset RF Gain. got v1 =0x%x ,v2 =0x%x \n",v1,v2); - target=v2; - break; - } - } - DBG_871X("padapter->eeprompriv.EEPROMRFGainVal=0x%x ,Gain offset Target Value=0x%x\n",padapter->eeprompriv.EEPROMRFGainVal,target); - PHY_SetRFReg(padapter, RF_PATH_A, REG_RF_BB_GAIN_OFFSET, BIT18|BIT17|BIT16|BIT15, target); - - //res |= (padapter->eeprompriv.EEPROMRFGainVal & 0x0f)<< 15; - //rtw_hal_write_rfreg(padapter, RF_PATH_A, REG_RF_BB_GAIN_OFFSET, RF_GAIN_OFFSET_MASK, res); - res = rtw_hal_read_rfreg(padapter, RF_PATH_A, 0x7f, 0xffffffff); - DBG_871X("Offset RF Gain. After reg 0x7f=0x%08x\n",res); - } - else - { - DBG_871X("Offset RF Gain. padapter->eeprompriv.EEPROMRFGainVal=0x%x != 0xff, didn't run Kfree\n",padapter->eeprompriv.EEPROMRFGainVal); - } - } else { - DBG_871X("Using the default RF gain.\n"); - } -#else - if (!(value & 0x01)) { - //DBG_871X("Offset RF Gain.\n"); - res = rtw_hal_read_rfreg(padapter, RF_PATH_A, REG_RF_BB_GAIN_OFFSET, 0xffffffff); - value &= tmp; - res = value << 14; - rtw_hal_write_rfreg(padapter, RF_PATH_A, REG_RF_BB_GAIN_OFFSET, RF_GAIN_OFFSET_MASK, res); - } else { - DBG_871X("Using the default RF gain.\n"); - } -#endif - -} -#endif //CONFIG_RF_GAIN_OFFSET - int pm_netdev_open(struct net_device *pnetdev,u8 bnormal) { int status = 0; + _adapter *padapter = (_adapter *)rtw_netdev_priv(pnetdev); if (_TRUE == bnormal) - status = netdev_open(pnetdev); + { + _enter_critical_mutex(&(adapter_to_dvobj(padapter)->hw_init_mutex), NULL); + status = _netdev_open(pnetdev); + _exit_critical_mutex(&(adapter_to_dvobj(padapter)->hw_init_mutex), NULL); + } #ifdef CONFIG_IPS else - status = (_SUCCESS == ips_netdrv_open((_adapter *)rtw_netdev_priv(pnetdev)))?(0):(-1); + status = (_SUCCESS == ips_netdrv_open(padapter))?(0):(-1); #endif return status; @@ -2635,12 +2605,291 @@ void rtw_ndev_destructor(struct net_device *ndev) free_netdev(ndev); } +#ifdef CONFIG_ARP_KEEP_ALIVE +struct route_info { + struct in_addr dst_addr; + struct in_addr src_addr; + struct in_addr gateway; + unsigned int dev_index; +}; + +static void parse_routes(struct nlmsghdr *nl_hdr, struct route_info *rt_info) +{ + struct rtmsg *rt_msg; + struct rtattr *rt_attr; + int rt_len; + + rt_msg = (struct rtmsg *) NLMSG_DATA(nl_hdr); + if ((rt_msg->rtm_family != AF_INET) || (rt_msg->rtm_table != RT_TABLE_MAIN)) + return; + + rt_attr = (struct rtattr *) RTM_RTA(rt_msg); + rt_len = RTM_PAYLOAD(nl_hdr); + + for (; RTA_OK(rt_attr, rt_len); rt_attr = RTA_NEXT(rt_attr, rt_len)) + { + switch (rt_attr->rta_type) { + case RTA_OIF: + rt_info->dev_index = *(int *) RTA_DATA(rt_attr); + break; + case RTA_GATEWAY: + rt_info->gateway.s_addr = *(u_int *) RTA_DATA(rt_attr); + break; + case RTA_PREFSRC: + rt_info->src_addr.s_addr = *(u_int *) RTA_DATA(rt_attr); + break; + case RTA_DST: + rt_info->dst_addr.s_addr = *(u_int *) RTA_DATA(rt_attr); + break; + } + } +} + +static int route_dump(u32 *gw_addr ,int* gw_index) +{ + int err = 0; + struct socket *sock; + struct { + struct nlmsghdr nlh; + struct rtgenmsg g; + } req; + struct msghdr msg; + struct iovec iov; + struct sockaddr_nl nladdr; + mm_segment_t oldfs; + char *pg; + int size = 0; + + err = sock_create(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE, &sock); + if (err) + { + printk( ": Could not create a datagram socket, error = %d\n", -ENXIO); + return err; + } + + memset(&nladdr, 0, sizeof(nladdr)); + nladdr.nl_family = AF_NETLINK; + + req.nlh.nlmsg_len = sizeof(req); + req.nlh.nlmsg_type = RTM_GETROUTE; + req.nlh.nlmsg_flags = NLM_F_ROOT | NLM_F_MATCH | NLM_F_REQUEST; + req.nlh.nlmsg_pid = 0; + req.g.rtgen_family = AF_INET; + + iov.iov_base = &req; + iov.iov_len = sizeof(req); + + msg.msg_name = &nladdr; + msg.msg_namelen = sizeof(nladdr); + msg.msg_iov = &iov; + msg.msg_iovlen = 1; + msg.msg_control = NULL; + msg.msg_controllen = 0; + msg.msg_flags = MSG_DONTWAIT; + + oldfs = get_fs(); set_fs(KERNEL_DS); + err = sock_sendmsg(sock, &msg, sizeof(req)); + set_fs(oldfs); + + if (size < 0) + goto out_sock; + + pg = (char *) __get_free_page(GFP_KERNEL); + if (pg == NULL) { + err = -ENOMEM; + goto out_sock; + } + +#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) +restart: +#endif + + for (;;) + { + struct nlmsghdr *h; + + iov.iov_base = pg; + iov.iov_len = PAGE_SIZE; + + oldfs = get_fs(); set_fs(KERNEL_DS); + err = sock_recvmsg(sock, &msg, PAGE_SIZE, MSG_DONTWAIT); + set_fs(oldfs); + + if (err < 0) + goto out_sock_pg; + + if (msg.msg_flags & MSG_TRUNC) { + err = -ENOBUFS; + goto out_sock_pg; + } + + h = (struct nlmsghdr*) pg; + + while (NLMSG_OK(h, err)) + { + struct route_info rt_info; + if (h->nlmsg_type == NLMSG_DONE) { + err = 0; + goto done; + } + + if (h->nlmsg_type == NLMSG_ERROR) { + struct nlmsgerr *errm = (struct nlmsgerr*) NLMSG_DATA(h); + err = errm->error; + printk( "NLMSG error: %d\n", errm->error); + goto done; + } + + if (h->nlmsg_type == RTM_GETROUTE) + { + printk( "RTM_GETROUTE: NLMSG: %d\n", h->nlmsg_type); + } + if (h->nlmsg_type != RTM_NEWROUTE) { + printk( "NLMSG: %d\n", h->nlmsg_type); + err = -EINVAL; + goto done; + } + + memset(&rt_info, 0, sizeof(struct route_info)); + parse_routes(h, &rt_info); + if(!rt_info.dst_addr.s_addr && rt_info.gateway.s_addr && rt_info.dev_index) + { + *gw_addr = rt_info.gateway.s_addr; + *gw_index = rt_info.dev_index; + + } + h = NLMSG_NEXT(h, err); + } + + if (err) + { + printk( "!!!Remnant of size %d %d %d\n", err, h->nlmsg_len, h->nlmsg_type); + err = -EINVAL; + break; + } + } + +done: +#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) + if (!err && req.g.rtgen_family == AF_INET) { + req.g.rtgen_family = AF_INET6; + + iov.iov_base = &req; + iov.iov_len = sizeof(req); + + msg.msg_name = &nladdr; + msg.msg_namelen = sizeof(nladdr); + msg.msg_iov = &iov; + msg.msg_iovlen = 1; + msg.msg_control = NULL; + msg.msg_controllen = 0; + msg.msg_flags=MSG_DONTWAIT; + + oldfs = get_fs(); set_fs(KERNEL_DS); + err = sock_sendmsg(sock, &msg, sizeof(req)); + set_fs(oldfs); + + if (err > 0) + goto restart; + } +#endif + +out_sock_pg: + free_page((unsigned long) pg); + +out_sock: + sock_release(sock); + return err; +} + +static int arp_query(unsigned char *haddr, u32 paddr, + struct net_device *dev) +{ + struct neighbour *neighbor_entry; + int ret = 0; + + neighbor_entry = neigh_lookup(&arp_tbl, &paddr, dev); + + if (neighbor_entry != NULL) { + neighbor_entry->used = jiffies; + if (neighbor_entry->nud_state & NUD_VALID) { + _rtw_memcpy(haddr, neighbor_entry->ha, dev->addr_len); + ret = 1; + } + neigh_release(neighbor_entry); + } + return ret; +} + +static int get_defaultgw(u32 *ip_addr ,char mac[]) +{ + int gw_index = 0; // oif device index + struct net_device *gw_dev = NULL; //oif device + + route_dump(ip_addr, &gw_index); + + if( !(*ip_addr) || !gw_index ) + { + //DBG_871X("No default GW \n"); + return -1; + } + + gw_dev = dev_get_by_index(&init_net, gw_index); + + if(gw_dev == NULL) + { + //DBG_871X("get Oif Device Fail \n"); + return -1; + } + + if(!arp_query(mac, *ip_addr, gw_dev)) + { + //DBG_871X( "arp query failed\n"); + dev_put(gw_dev); + return -1; + + } + dev_put(gw_dev); + + return 0; +} + +int rtw_gw_addr_query(_adapter *padapter) +{ + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + u32 gw_addr = 0; // default gw address + unsigned char gw_mac[32] = {0}; // default gw mac + int i; + int res; + + res = get_defaultgw(&gw_addr, gw_mac); + if(!res) + { + pmlmepriv->gw_ip[0] = gw_addr&0xff; + pmlmepriv->gw_ip[1] = (gw_addr&0xff00)>>8; + pmlmepriv->gw_ip[2] = (gw_addr&0xff0000)>>16; + pmlmepriv->gw_ip[3] = (gw_addr&0xff000000)>>24; + _rtw_memcpy(pmlmepriv->gw_mac_addr, gw_mac, 6); + DBG_871X("%s Gateway Mac:\t" MAC_FMT "\n", __FUNCTION__, MAC_ARG(pmlmepriv->gw_mac_addr)); + DBG_871X("%s Gateway IP:\t" IP_FMT "\n", __FUNCTION__, IP_ARG(pmlmepriv->gw_ip)); + } + else + { + DBG_871X("Get Gateway IP/MAC fail!\n"); + } + + return res; +} +#endif + void rtw_dev_unload(PADAPTER padapter) { struct net_device *pnetdev = (struct net_device*)padapter->pnetdev; struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter); struct dvobj_priv *pobjpriv = padapter->dvobj; struct debug_priv *pdbgpriv = &pobjpriv->drv_dbg; + struct cmd_priv *pcmdpriv = &padapter->cmdpriv; + u8 cnt = 0; RT_TRACE(_module_hci_intfs_c_, _drv_notice_, ("+%s\n",__FUNCTION__)); @@ -2661,7 +2910,18 @@ void rtw_dev_unload(PADAPTER padapter) if (!pwrctl->bInternalAutoSuspend) rtw_stop_drv_threads(padapter); - + + while(ATOMIC_READ(&(pcmdpriv->cmdthd_running)) == _TRUE){ + if (cnt > 5) { + DBG_871X("stop cmdthd timeout\n"); + break; + } else { + cnt ++; + DBG_871X("cmdthd is running(%d)\n", cnt); + rtw_msleep_os(10); + } + } + RT_TRACE(_module_hci_intfs_c_, _drv_notice_, ("@ %s: stop thread complete!\n",__FUNCTION__)); //check the status of IPS @@ -2675,6 +2935,9 @@ void rtw_dev_unload(PADAPTER padapter) if (padapter->bSurpriseRemoved == _FALSE) { +#ifdef CONFIG_BT_COEXIST + rtw_btcoex_IpsNotify(padapter, pwrctl->ips_mode_req); +#endif #ifdef CONFIG_WOWLAN if (pwrctl->bSupportRemoteWakeup == _TRUE && pwrctl->wowlan_mode ==_TRUE) { @@ -2702,7 +2965,6 @@ void rtw_dev_unload(PADAPTER padapter) RT_TRACE(_module_hci_intfs_c_, _drv_notice_, ("-%s\n",__FUNCTION__)); } -#ifdef CONFIG_SUSPEND_REFINE int rtw_suspend_free_assoc_resource(_adapter *padapter) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; @@ -2777,12 +3039,7 @@ int rtw_suspend_wow(_adapter *padapter) int ret = _SUCCESS; DBG_871X("==> "FUNC_ADPT_FMT" entry....\n", FUNC_ADPT_ARG(padapter)); - - if (check_fwstate(pmlmepriv, _FW_LINKED)) { - pwrpriv->wowlan_mode = _TRUE; - } else if (pwrpriv->wowlan_pno_enable == _TRUE) { - pwrpriv->wowlan_mode |= pwrpriv->wowlan_pno_enable; - } + DBG_871X("wowlan_mode: %d\n", pwrpriv->wowlan_mode); DBG_871X("wowlan_pno_enable: %d\n", pwrpriv->wowlan_pno_enable); @@ -2809,11 +3066,11 @@ int rtw_suspend_wow(_adapter *padapter) } #endif // CONFIG_CONCURRENT_MODE - //#ifdef CONFIG_POWER_SAVING + //#ifdef CONFIG_LPS //rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, "WOWLAN"); //#endif -#ifdef CONFIG_SDIO_HCI +#if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) // 2. disable interrupt if (padapter->intf_stop) { padapter->intf_stop(padapter); @@ -2878,56 +3135,18 @@ int rtw_suspend_wow(_adapter *padapter) rtw_suspend_free_assoc_resource(padapter->pbuddy_adapter); } #endif - - #ifdef CONFIG_POWER_SAVING + if(pwrpriv->wowlan_pno_enable) DBG_871X_LEVEL(_drv_always_, "%s: pno: %d\n", __func__, pwrpriv->wowlan_pno_enable); + #ifdef CONFIG_LPS else rtw_set_ps_mode(padapter, PS_MODE_DTIM, 0, 0, "WOWLAN"); - #endif + #endif //#ifdef CONFIG_LPS } else { - if(pnetdev){ - netif_carrier_off(pnetdev); - rtw_netif_stop_queue(pnetdev); - } - #ifdef CONFIG_CONCURRENT_MODE - if(pbuddy_netdev){ - netif_carrier_off(pbuddy_netdev); - rtw_netif_stop_queue(pbuddy_netdev); - } - #endif//CONFIG_CONCURRENT_MODE - - rtw_suspend_free_assoc_resource(padapter); - - #ifdef CONFIG_CONCURRENT_MODE - if(rtw_buddy_adapter_up(padapter)){ - rtw_suspend_free_assoc_resource(padapter->pbuddy_adapter); - } - #endif//CONFIG_CONCURRENT_MODE - rtw_led_control(padapter, LED_CTL_POWER_OFF); - - - if ((rtw_hal_check_ips_status(padapter) == _TRUE) - || (adapter_to_pwrctl(padapter)->rf_pwrstate == rf_off)) - { - DBG_871X_LEVEL(_drv_always_, "%s: ### ERROR #### driver in IPS ####ERROR###!!!\n", __FUNCTION__); - - } - - - #ifdef CONFIG_CONCURRENT_MODE - if(rtw_buddy_adapter_up(padapter)){ - rtw_dev_unload(padapter->pbuddy_adapter); - } - #endif - rtw_dev_unload(padapter); - - //sdio_deinit(adapter_to_dvobj(padapter)); - if(padapter->intf_deinit) - padapter->intf_deinit(adapter_to_dvobj(padapter)); + DBG_871X_LEVEL(_drv_always_, "%s: ### ERROR ### wowlan_mode=%d\n", __FUNCTION__, pwrpriv->wowlan_mode); } DBG_871X("<== "FUNC_ADPT_FMT" exit....\n", FUNC_ADPT_ARG(padapter)); return ret; @@ -2942,9 +3161,9 @@ int rtw_suspend_ap_wow(_adapter *padapter) struct net_device *pnetdev = padapter->pnetdev; #ifdef CONFIG_CONCURRENT_MODE struct net_device *pbuddy_netdev; - #endif + #endif struct dvobj_priv *psdpriv = padapter->dvobj; - struct debug_priv *pdbgpriv = &psdpriv->drv_dbg; + struct debug_priv *pdbgpriv = &psdpriv->drv_dbg; struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); struct wowlan_ioctl_param poidparam; u8 ps_mode; @@ -2957,7 +3176,7 @@ int rtw_suspend_ap_wow(_adapter *padapter) DBG_871X("wowlan_ap_mode: %d\n", pwrpriv->wowlan_ap_mode); if(pnetdev) - rtw_netif_stop_queue(pnetdev); + rtw_netif_stop_queue(pnetdev); #ifdef CONFIG_CONCURRENT_MODE if (rtw_buddy_adapter_up(padapter)) { pbuddy_netdev = padapter->pbuddy_adapter->pnetdev; @@ -2977,10 +3196,11 @@ int rtw_suspend_ap_wow(_adapter *padapter) padapter->pbuddy_adapter->bDriverStopped = _FALSE; //for 32k command } #endif // CONFIG_CONCURRENT_MODE - - //#ifdef CONFIG_POWER_SAVING + + //#ifdef CONFIG_LPS //rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, "WOWLAN"); //#endif + #ifdef CONFIG_SDIO_HCI // 2. disable interrupt rtw_hal_disable_interrupt(padapter); // It need wait for leaving 32K. @@ -2994,7 +3214,8 @@ int rtw_suspend_ap_wow(_adapter *padapter) // 2.1 clean interupt if (padapter->HalFunc.clear_interrupt) padapter->HalFunc.clear_interrupt(padapter); -#endif +#endif //CONFIG_SDIO_HCI + // 2.2 free irq //sdio_free_irq(adapter_to_dvobj(padapter)); if(padapter->intf_free_irq) @@ -3005,14 +3226,14 @@ int rtw_suspend_ap_wow(_adapter *padapter) DBG_871X(" ### PORT SWITCH ### \n"); rtw_hal_set_hwreg(padapter, HW_VAR_PORT_SWITCH, NULL); } - #endif - + #endif + poidparam.subcode = WOWLAN_AP_ENABLE; padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_AP_WOWLAN,(u8 *)&poidparam); DBG_871X_LEVEL(_drv_always_, "%s: wowmode suspending\n", __func__); - + #ifdef CONFIG_CONCURRENT_MODE if (check_buddy_fwstate(padapter, WIFI_AP_STATE) == _TRUE) { if (rtw_get_ch_setting_union(padapter->pbuddy_adapter, &ch, &bw, &offset) != 0) { @@ -3037,11 +3258,11 @@ int rtw_suspend_ap_wow(_adapter *padapter) } #endif -#ifdef CONFIG_POWER_SAVING + #ifdef CONFIG_LPS rtw_set_ps_mode(padapter, PS_MODE_MIN, 0, 0, "AP-WOWLAN"); #endif - #endif + DBG_871X("<== "FUNC_ADPT_FMT" exit....\n", FUNC_ADPT_ARG(padapter)); return ret; @@ -3080,6 +3301,14 @@ int rtw_suspend_normal(_adapter *padapter) } #endif rtw_led_control(padapter, LED_CTL_POWER_OFF); + + if ((rtw_hal_check_ips_status(padapter) == _TRUE) + || (adapter_to_pwrctl(padapter)->rf_pwrstate == rf_off)) + { + DBG_871X_LEVEL(_drv_always_, "%s: ### ERROR #### driver in IPS ####ERROR###!!!\n", __FUNCTION__); + + } + #ifdef CONFIG_CONCURRENT_MODE if(rtw_buddy_adapter_up(padapter)){ rtw_dev_unload(padapter->pbuddy_adapter); @@ -3167,8 +3396,18 @@ int rtw_suspend_common(_adapter *padapter) #endif ) { #ifdef CONFIG_WOWLAN + if (check_fwstate(pmlmepriv, _FW_LINKED)) { + pwrpriv->wowlan_mode = _TRUE; + } else if (pwrpriv->wowlan_pno_enable == _TRUE) { + pwrpriv->wowlan_mode |= pwrpriv->wowlan_pno_enable; + } + + if (pwrpriv->wowlan_mode == _TRUE) rtw_suspend_wow(padapter); - #else + else + rtw_suspend_normal(padapter); + + #else //CONFIG_WOWLAN rtw_suspend_normal(padapter); #endif //CONFIG_WOWLAN } else if (check_fwstate(pmlmepriv,WIFI_AP_STATE) == _TRUE @@ -3233,16 +3472,22 @@ _func_enter_; goto exit; } + if (padapter->bDriverStopped || padapter->bSurpriseRemoved) { + DBG_871X("%s pdapter %p bDriverStopped %d bSurpriseRemoved %d\n", + __FUNCTION__, padapter, padapter->bDriverStopped, + padapter->bSurpriseRemoved); + goto exit; + } + #ifdef CONFIG_PNO_SUPPORT pwrpriv->pno_in_resume = _TRUE; #endif if (pwrpriv->wowlan_mode == _TRUE){ -#ifdef CONFIG_POWER_SAVING #ifdef CONFIG_LPS rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, "WOWLAN"); #endif //CONFIG_LPS -#endif + pwrpriv->bFwCurrentInPSMode = _FALSE; #ifdef CONFIG_SDIO_HCI @@ -3323,56 +3568,7 @@ _func_enter_; } else{ - // interface init - //if (sdio_init(adapter_to_dvobj(padapter)) != _SUCCESS) - if ((padapter->intf_init) &&(padapter->intf_init(adapter_to_dvobj(padapter)) != _SUCCESS)) - { - ret = -1; - RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("%s: initialize SDIO Failed!!\n", __FUNCTION__)); - goto exit; - } - - rtw_hal_disable_interrupt(padapter); - - if (padapter->HalFunc.clear_interrupt) - padapter->HalFunc.clear_interrupt(padapter); - - //if (sdio_alloc_irq(adapter_to_dvobj(padapter)) != _SUCCESS) - if ((padapter->intf_alloc_irq)&&(padapter->intf_alloc_irq(adapter_to_dvobj(padapter)) != _SUCCESS)) - { - ret = -1; - RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("%s: sdio_alloc_irq Failed!!\n", __FUNCTION__)); - goto exit; - } - - rtw_reset_drv_sw(padapter); - #ifdef CONFIG_CONCURRENT_MODE - rtw_reset_drv_sw(padapter->pbuddy_adapter); - #endif - pwrpriv->bkeepfwalive = _FALSE; - - DBG_871X("bkeepfwalive(%x)\n",pwrpriv->bkeepfwalive); - - if(pm_netdev_close(pnetdev, _TRUE) == 0) { - DBG_871X("netdev_close success\n"); - } - - if(pm_netdev_open(pnetdev,_TRUE) != 0) { - ret = -1; - pdbgpriv->dbg_resume_error_cnt++; - goto exit; - } - - netif_device_attach(pnetdev); - netif_carrier_on(pnetdev); - - #ifdef CONFIG_CONCURRENT_MODE - if(rtw_buddy_adapter_up(padapter)){ - pbuddy_netdev = padapter->pbuddy_adapter->pnetdev; - netif_device_attach(pbuddy_netdev); - netif_carrier_on(pbuddy_netdev); - } - #endif + DBG_871X_LEVEL(_drv_always_, "%s: ### ERROR ### wowlan_mode=%d\n", __FUNCTION__, pwrpriv->wowlan_mode); } if( padapter->pid[1]!=0) { @@ -3402,10 +3598,6 @@ _func_enter_; } } - #ifdef CONFIG_RESUME_IN_WORKQUEUE - rtw_unlock_suspend(); - #endif //CONFIG_RESUME_IN_WORKQUEUE - if (pwrpriv->wowlan_wake_reason == FWDecisionDisconnect) { rtw_lock_ext_suspend_timeout(2000); } @@ -3469,11 +3661,11 @@ _func_enter_; goto exit; } -#ifdef CONFIG_POWER_SAVING + #ifdef CONFIG_LPS rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, "AP-WOWLAN"); #endif //CONFIG_LPS -#endif + pwrpriv->bFwCurrentInPSMode = _FALSE; rtw_hal_disable_interrupt(padapter); @@ -3565,7 +3757,7 @@ _func_enter_; } #ifdef CONFIG_RESUME_IN_WORKQUEUE - rtw_unlock_suspend(); + //rtw_unlock_suspend(); #endif //CONFIG_RESUME_IN_WORKQUEUE if (pwrpriv->wowlan_wake_reason == AP_WakeUp) @@ -3699,7 +3891,7 @@ _func_enter_; #endif #ifdef CONFIG_RESUME_IN_WORKQUEUE - rtw_unlock_suspend(); + //rtw_unlock_suspend(); #endif //CONFIG_RESUME_IN_WORKQUEUE DBG_871X("<== "FUNC_ADPT_FMT" exit....\n", FUNC_ADPT_ARG(padapter)); @@ -3726,7 +3918,10 @@ int rtw_resume_common(_adapter *padapter) #endif ) { #ifdef CONFIG_WOWLAN - rtw_resume_process_wow(padapter); + if (pwrpriv->wowlan_mode == _TRUE) + rtw_resume_process_wow(padapter); + else + rtw_resume_process_normal(padapter); #else rtw_resume_process_normal(padapter); #endif @@ -3771,6 +3966,29 @@ int rtw_resume_common(_adapter *padapter) return ret; } -#endif +#ifdef CONFIG_GPIO_API +u8 rtw_get_gpio(struct net_device *netdev, u8 gpio_num) +{ + _adapter *adapter = (_adapter *)rtw_netdev_priv(netdev); + return rtw_hal_get_gpio(adapter, gpio_num); +} +EXPORT_SYMBOL(rtw_get_gpio); + +int rtw_set_gpio_output_value(struct net_device *netdev, u8 gpio_num, BOOLEAN isHigh) +{ + u8 direction = 0; + u8 res = -1; + _adapter *adapter = (_adapter *)rtw_netdev_priv(netdev); + return rtw_hal_set_gpio_output_value(adapter, gpio_num,isHigh); +} +EXPORT_SYMBOL(rtw_set_gpio_output_value); + +int rtw_config_gpio(struct net_device *netdev, u8 gpio_num, BOOLEAN isOutput) +{ + _adapter *adapter = (_adapter *)rtw_netdev_priv(netdev); + return rtw_hal_config_gpio(adapter,gpio_num,isOutput); +} +EXPORT_SYMBOL(rtw_config_gpio); +#endif //#ifdef CONFIG_GPIO_API diff --git a/os_dep/linux/recv_linux.c b/os_dep/linux/recv_linux.c index 2f965d2..5178095 100644 --- a/os_dep/linux/recv_linux.c +++ b/os_dep/linux/recv_linux.c @@ -233,9 +233,12 @@ int rtw_os_recvbuf_resource_free(_adapter *padapter, struct recv_buf *precvbuf) if(precvbuf->pskb) + { +#ifdef CONFIG_PREALLOC_RX_SKB_BUFFER + if(rtw_free_skb_premem(precvbuf->pskb)!=0) +#endif rtw_skb_free(precvbuf->pskb); - - + } return ret; } @@ -302,6 +305,7 @@ void rtw_os_recv_indicate_pkt(_adapter *padapter, _pkt *pkt, struct rx_pkt_attri #ifdef CONFIG_BR_EXT void *br_port = NULL; #endif + int ret; /* Indicat the packets to upper layer */ if (pkt) { @@ -342,7 +346,9 @@ void rtw_os_recv_indicate_pkt(_adapter *padapter, _pkt *pkt, struct rx_pkt_attri if(bmcast && (pskb2 != NULL) ) { pkt = pskb2; + DBG_COUNTER(padapter->rx_logs.os_indicate_ap_mcast); } else { + DBG_COUNTER(padapter->rx_logs.os_indicate_ap_forward); return; } } @@ -350,6 +356,7 @@ void rtw_os_recv_indicate_pkt(_adapter *padapter, _pkt *pkt, struct rx_pkt_attri else// to APself { //DBG_871X("to APSelf\n"); + DBG_COUNTER(padapter->rx_logs.os_indicate_ap_self); } } @@ -395,7 +402,11 @@ void rtw_os_recv_indicate_pkt(_adapter *padapter, _pkt *pkt, struct rx_pkt_attri pkt->ip_summed = CHECKSUM_NONE; #endif //CONFIG_TCP_CSUM_OFFLOAD_RX - rtw_netif_rx(padapter->pnetdev, pkt); + ret = rtw_netif_rx(padapter->pnetdev, pkt); + if (ret == NET_RX_SUCCESS) + DBG_COUNTER(padapter->rx_logs.os_netif_ok); + else + DBG_COUNTER(padapter->rx_logs.os_netif_err); } } @@ -558,10 +569,13 @@ int rtw_recv_indicatepkt(_adapter *padapter, union recv_frame *precv_frame) _queue *pfree_recv_queue; _pkt *skb; struct mlme_priv*pmlmepriv = &padapter->mlmepriv; - struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib; - -_func_enter_; + struct rx_pkt_attrib *pattrib; + + if(NULL == precv_frame) + goto _recv_indicatepkt_drop; + DBG_COUNTER(padapter->rx_logs.os_indicate); + pattrib = &precv_frame->u.hdr.attrib; precvpriv = &(padapter->recvpriv); pfree_recv_queue = &(precvpriv->free_recv_queue); @@ -629,7 +643,6 @@ _recv_indicatepkt_end: RT_TRACE(_module_recv_osdep_c_,_drv_info_,("\n rtw_recv_indicatepkt :after rtw_os_recv_indicate_pkt!!!!\n")); -_func_exit_; return _SUCCESS; @@ -639,9 +652,9 @@ _recv_indicatepkt_drop: if(precv_frame) rtw_free_recvframe(precv_frame, pfree_recv_queue); - return _FAIL; + DBG_COUNTER(padapter->rx_logs.os_indicate_err); -_func_exit_; + return _FAIL; } diff --git a/os_dep/linux/rtw_android.c b/os_dep/linux/rtw_android.c index e4f59cc..40ddf07 100644 --- a/os_dep/linux/rtw_android.c +++ b/os_dep/linux/rtw_android.c @@ -64,6 +64,9 @@ const char *android_wifi_cmd_str[ANDROID_WIFI_CMD_MAX] = { "P2P_GET_NOA", "P2P_SET_PS", "SET_AP_WPS_P2P_IE", + + "MIRACAST", + #ifdef CONFIG_PNO_SUPPORT "PNOSSIDCLR", "PNOSETUP", @@ -135,17 +138,19 @@ char pno_in_example[] = { #endif /* PNO_SUPPORT */ typedef struct android_wifi_priv_cmd { - -#ifdef CONFIG_COMPAT - compat_uptr_t buf; -#else char *buf; -#endif - int used_len; int total_len; } android_wifi_priv_cmd; +#ifdef CONFIG_COMPAT +typedef struct compat_android_wifi_priv_cmd { + compat_uptr_t buf; + int used_len; + int total_len; +} compat_android_wifi_priv_cmd; +#endif /* CONFIG_COMPAT */ + /** * Local (static) functions and variables */ @@ -438,6 +443,46 @@ int rtw_android_getband(struct net_device *net, char *command, int total_len) return bytes_written; } +enum { + MIRACAST_DISABLED = 0, + MIRACAST_SOURCE, + MIRACAST_SINK, + MIRACAST_INVALID, +}; + +static const char *miracast_mode_str[] = { + "DISABLED", + "SOURCE", + "SINK", + "INVALID", +}; + +static const char *get_miracast_mode_str(int mode) +{ + if (mode < MIRACAST_DISABLED || mode >= MIRACAST_INVALID) + mode = MIRACAST_INVALID; + + return miracast_mode_str[mode]; +} + +int rtw_android_set_miracast_mode(struct net_device *net, char *command, int total_len) +{ + _adapter *adapter = (_adapter *)rtw_netdev_priv(net); + char *arg = command + strlen(android_wifi_cmd_str[ANDROID_WIFI_CMD_MIRACAST]) + 1; + u8 mode; + int num; + int ret = _FAIL; + + num = sscanf(arg, "%hhu", &mode); + + if (num >= 1) { + DBG_871X("Miracast mode: %s(%u)\n", get_miracast_mode_str(mode), mode); + ret = _SUCCESS; + } + + return (ret==_SUCCESS)?0:-1; +} + int get_int_from_command( char* pcmd ) { int i = 0; @@ -517,12 +562,27 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd) #ifdef CONFIG_WFD struct wifi_display_info *pwfd_info; #endif + rtw_lock_suspend(); if (!ifr->ifr_data) { ret = -EINVAL; goto exit; } +#ifdef CONFIG_COMPAT + if (is_compat_task()) { + /* User space is 32-bit, use compat ioctl */ + compat_android_wifi_priv_cmd compat_priv_cmd; + + if (copy_from_user(&compat_priv_cmd, ifr->ifr_data, sizeof(compat_android_wifi_priv_cmd))) { + ret = -EFAULT; + goto exit; + } + priv_cmd.buf = compat_ptr(compat_priv_cmd.buf); + priv_cmd.used_len = compat_priv_cmd.used_len; + priv_cmd.total_len = compat_priv_cmd.total_len; + } else +#endif /* CONFIG_COMPAT */ if (copy_from_user(&priv_cmd, ifr->ifr_data, sizeof(android_wifi_priv_cmd))) { ret = -EFAULT; goto exit; @@ -545,11 +605,7 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd) ret = -EFAULT; goto exit; } -#ifdef CONFIG_COMPAT - if (copy_from_user(command, compat_ptr(priv_cmd.buf), (unsigned long) priv_cmd.total_len)) { -#else if (copy_from_user(command, (void *)priv_cmd.buf, priv_cmd.total_len)) { -#endif ret = -EFAULT; goto exit; } @@ -652,7 +708,11 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd) case ANDROID_WIFI_CMD_GETBAND: bytes_written = rtw_android_getband(net, command, priv_cmd.total_len); break; - + + case ANDROID_WIFI_CMD_MIRACAST: + bytes_written = rtw_android_set_miracast_mode(net, command, priv_cmd.total_len); + break; + case ANDROID_WIFI_CMD_COUNTRY: bytes_written = rtw_android_set_country(net, command, priv_cmd.total_len); break; @@ -728,12 +788,8 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd) pwfd_info = &padapter->wfd_info; if( padapter->wdinfo.driver_interface == DRIVER_CFG80211 ) { -#ifdef CONFIG_COMPAT - pwfd_info->rtsp_ctrlport = ( u16 ) get_int_from_command( compat_ptr(priv_cmd.buf) ); -#else pwfd_info->rtsp_ctrlport = ( u16 ) get_int_from_command( priv_cmd.buf ); -#endif - } + } break; } case ANDROID_WIFI_CMD_WFD_SET_MAX_TPUT: @@ -748,12 +804,7 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd) pwfd_info = &padapter->wfd_info; if( padapter->wdinfo.driver_interface == DRIVER_CFG80211 ) { -#ifdef CONFIG_COMPAT - pwfd_info->wfd_device_type = ( u8 ) get_int_from_command( compat_ptr(priv_cmd.buf) ); -#else pwfd_info->wfd_device_type = ( u8 ) get_int_from_command( priv_cmd.buf ); -#endif - pwfd_info->wfd_device_type &= WFD_DEVINFO_DUAL; } break; @@ -763,7 +814,7 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd) { #ifdef CONFIG_LPS u8 dtim; - u8 *ptr = priv_cmd.buf; + u8 *ptr =(u8 *) &priv_cmd.buf; ptr += 9;//string command length of "SET_DTIM"; @@ -797,7 +848,7 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd) } #ifdef CONFIG_GTK_OL case ANDROID_WIFI_CMD_GTK_REKEY_OFFLOAD: - rtw_gtk_offload(net, priv_cmd.buf); + rtw_gtk_offload(net, (u8*)command); break; #endif //CONFIG_GTK_OL case ANDROID_WIFI_CMD_P2P_DISABLE: @@ -827,11 +878,7 @@ response: bytes_written++; } priv_cmd.used_len = bytes_written; -#ifdef CONFIG_COMPAT - if (copy_to_user(compat_ptr(priv_cmd.buf), command, bytes_written)) { -#else if (copy_to_user((void *)priv_cmd.buf, command, bytes_written)) { -#endif DBG_871X("%s: failed to copy data to user buffer\n", __FUNCTION__); ret = -EFAULT; } diff --git a/os_dep/linux/rtw_proc.c b/os_dep/linux/rtw_proc.c index c55f637..ac66aec 100644 --- a/os_dep/linux/rtw_proc.c +++ b/os_dep/linux/rtw_proc.c @@ -261,14 +261,93 @@ static int proc_get_rf_reg_dump(struct seq_file *m, void *v) return 0; } + + +//gpio setting +#ifdef CONFIG_GPIO_API +static ssize_t proc_set_config_gpio(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) +{ + struct net_device *dev = data; + _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); + char tmp[32]={0}; + int num=0,gpio_pin=0,gpio_mode=0;//gpio_mode:0 input 1:output; + + if (count < 2) + return -EFAULT; + if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) + { + num =sscanf(tmp, "%d %d",&gpio_pin,&gpio_mode); + DBG_871X("num=%d gpio_pin=%d mode=%d\n",num,gpio_pin,gpio_mode); + padapter->pre_gpio_pin=gpio_pin; + + if(gpio_mode==0 || gpio_mode==1 ) + rtw_hal_config_gpio(padapter, gpio_pin,gpio_mode); + } + return count; + +} +static ssize_t proc_set_gpio_output_value(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) +{ + struct net_device *dev = data; + _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); + char tmp[32]={0}; + int num=0,gpio_pin=0,pin_mode=0;//pin_mode: 1 high 0:low + + if (count < 2) + return -EFAULT; + if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) + { + num =sscanf(tmp, "%d %d",&gpio_pin,&pin_mode); + DBG_871X("num=%d gpio_pin=%d pin_high=%d\n",num,gpio_pin,pin_mode); + padapter->pre_gpio_pin=gpio_pin; + + if(pin_mode==0 || pin_mode==1 ) + rtw_hal_set_gpio_output_value(padapter, gpio_pin,pin_mode); + } + return count; +} +static int proc_get_gpio(struct seq_file *m, void *v) +{ + u8 gpioreturnvalue=0; + struct net_device *dev = m->private; + + _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); + if(!padapter) + return -EFAULT; + gpioreturnvalue = rtw_hal_get_gpio(padapter, padapter->pre_gpio_pin); + DBG_871X_SEL_NL(m, "get_gpio %d:%d \n",padapter->pre_gpio_pin ,gpioreturnvalue); + + return 0; + +} +static ssize_t proc_set_gpio(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) +{ + struct net_device *dev = data; + _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); + char tmp[32]={0}; + int num=0,gpio_pin=0; + + if (count < 1) + return -EFAULT; + if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) + { + num =sscanf(tmp, "%d",&gpio_pin); + DBG_871X("num=%d gpio_pin=%d\n",num,gpio_pin); + padapter->pre_gpio_pin=gpio_pin; + + } + return count; +} +#endif + + static int proc_get_linked_info_dump(struct seq_file *m, void *v) { struct net_device *dev = m->private; _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); - - if(padapter) + if(padapter) DBG_871X_SEL_NL(m, "linked_info_dump :%s \n", (padapter->bLinkInfoDump)?"enable":"disable"); - + return 0; } @@ -276,28 +355,40 @@ static ssize_t proc_set_linked_info_dump(struct file *file, const char __user *b { struct net_device *dev = data; _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); - - char tmp[2]; - int mode=0; + + char tmp[32]={0}; + int mode=0,pre_mode=0; + int num=0; if (count < 1) return -EFAULT; - if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) { + pre_mode=padapter->bLinkInfoDump; + DBG_871X("pre_mode=%d \n",pre_mode); - int num = sscanf(tmp, "%d ", &mode); + if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) + { + num =sscanf(tmp, "%d ", &mode); + DBG_871X("num=%d mode=%d\n",num,mode); - if( padapter ) + if(num!=1) { - //padapter->bLinkInfoDump = mode; - //DBG_871X("linked_info_dump =%s \n", (padapter->bLinkInfoDump)?"enable":"disable"); - linked_info_dump(padapter,mode); + DBG_871X("argument number is wrong\n"); + return -EFAULT; + } + + if(mode==1 || (mode==0 && pre_mode==1) ) //not consider pwr_saving 0: + { + padapter->bLinkInfoDump = mode; + + } + else if( (mode==2 ) || (mode==0 && pre_mode==2))//consider power_saving + { + //DBG_871X("linked_info_dump =%s \n", (padapter->bLinkInfoDump)?"enable":"disable") + linked_info_dump(padapter,mode); } - } - return count; - } int proc_get_rx_info(struct seq_file *m, void *v) @@ -318,8 +409,17 @@ int proc_get_rx_info(struct seq_file *m, void *v) return 0; } +static int proc_get_mac_qinfo(struct seq_file *m, void *v) +{ + struct net_device *dev = m->private; + _adapter *adapter = (_adapter *)rtw_netdev_priv(dev); -int proc_reset_rx_info(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) + rtw_hal_get_hwreg(adapter, HW_VAR_DUMP_MAC_QUEUE_INFO, (u8 *)m); + + return 0; +} + +ssize_t proc_reset_rx_info(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) { struct net_device *dev = data; _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); @@ -339,6 +439,94 @@ int proc_reset_rx_info(struct file *file, const char __user *buffer, size_t coun return count; } +int proc_get_wifi_spec(struct seq_file *m, void *v) +{ + struct net_device *dev = m->private; + _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); + struct registry_priv *pregpriv = &padapter->registrypriv; + + DBG_871X_SEL_NL(m,"wifi_spec=%d\n",pregpriv->wifi_spec); + return 0; +} + +static int proc_get_chan_plan(struct seq_file *m, void *v) +{ + struct net_device *dev = m->private; + _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); + + DBG_871X_SEL_NL(m,"Channel plan=0x%02x\n",padapter->mlmepriv.ChannelPlan); + return 0; +} +static ssize_t proc_set_chan_plan(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) +{ + struct net_device *dev = data; + _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); + struct SetChannelPlan_param setChannelPlan_param; + + char tmp[32]; + u8 chan_plan = RT_CHANNEL_DOMAIN_REALTEK_DEFINE; + + if (!padapter) + return -EFAULT; + + if (count < 1) + { + DBG_871X("argument size is less than 1\n"); + return -EFAULT; + } + + if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) { + + int num = sscanf(tmp, "%hhx", &chan_plan); + + if (num != 1) { + DBG_871X("invalid read_reg parameter!\n"); + return count; + } + + } + setChannelPlan_param.channel_plan = chan_plan; + if( H2C_SUCCESS != set_chplan_hdl(padapter, (unsigned char *)&setChannelPlan_param) ) + return -EFAULT; + + return count; + +} + +static int proc_get_macid_info(struct seq_file *m, void *v) +{ + struct net_device *dev = m->private; + _adapter *adapter = (_adapter *)rtw_netdev_priv(dev); + struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); + struct macid_ctl_t *macid_ctl = dvobj_to_macidctl(dvobj); + u8 i; + + DBG_871X_SEL_NL(m, "max_num:%u\n", macid_ctl->num); + DBG_871X_SEL_NL(m, "\n"); + + DBG_871X_SEL_NL(m, "used:\n"); + dump_macid_map(m, &macid_ctl->used, macid_ctl->num); + DBG_871X_SEL_NL(m, "\n"); + + DBG_871X_SEL_NL(m, "%-3s %-3s %-4s %-4s" + "\n" + , "id", "bmc", "if_g", "ch_g" + ); + + for (i=0;inum;i++) { + if (rtw_macid_is_used(macid_ctl, i)) + DBG_871X_SEL_NL(m, "%3u %3u %4d %4d" + "\n" + , i + , rtw_macid_is_bmc(macid_ctl, i) + , rtw_macid_get_if_g(macid_ctl, i) + , rtw_macid_get_ch_g(macid_ctl, i) + ); + } + + return 0; +} + static int proc_get_cam(struct seq_file *m, void *v) { struct net_device *dev = m->private; @@ -389,31 +577,67 @@ static int proc_get_cam_cache(struct seq_file *m, void *v) struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); u8 i; - DBG_871X_SEL_NL(m, "%-2s %-6s %-17s %-32s %-7s %-3s" - //" %-2s %-2s" + DBG_871X_SEL_NL(m, "cam bitmap:0x%016llx\n", dvobj->cam_ctl.bitmap); + + DBG_871X_SEL_NL(m, "%-2s %-6s %-17s %-32s %-3s %-7s" + //" %-2s %-2s %-4s %-5s" "\n" - , "id", "ctrl", "mac", "key", "type", "kid" - //, "DK", "GK" + , "id", "ctrl", "addr", "key", "kid", "type" + //, "MK", "GK", "MFB", "valid" ); for (i=0;i<32;i++) { if (dvobj->cam_cache[i].ctrl != 0) - DBG_871X_SEL_NL(m, "%2u 0x%04x "MAC_FMT" "KEY_FMT" %-7s %3u" - //" %2u %2u" + DBG_871X_SEL_NL(m, "%2u 0x%04x "MAC_FMT" "KEY_FMT" %3u %-7s" + //" %2u %2u 0x%02x %5u" "\n", i , dvobj->cam_cache[i].ctrl , MAC_ARG(dvobj->cam_cache[i].mac) , KEY_ARG(dvobj->cam_cache[i].key) - , security_type_str(((dvobj->cam_cache[i].ctrl)>>2)&0x07) , (dvobj->cam_cache[i].ctrl)&0x03 + , security_type_str(((dvobj->cam_cache[i].ctrl)>>2)&0x07) //, ((dvobj->cam_cache[i].ctrl)>>5)&0x01 //, ((dvobj->cam_cache[i].ctrl)>>6)&0x01 + //, ((dvobj->cam_cache[i].ctrl)>>8)&0x7f + //, ((dvobj->cam_cache[i].ctrl)>>15)&0x01 ); } return 0; } +#ifdef CONFIG_BT_COEXIST +ssize_t proc_set_btinfo_evt(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) +{ + struct net_device *dev = data; + _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); + char tmp[32]; + u8 btinfo[8]; + + if (count < 6) + return -EFAULT; + + if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) { + int num = 0; + + _rtw_memset(btinfo, 0, 8); + + num = sscanf(tmp, "%hhx %hhx %hhx %hhx %hhx %hhx %hhx %hhx" + , &btinfo[0], &btinfo[1], &btinfo[2], &btinfo[3] + , &btinfo[4], &btinfo[5], &btinfo[6], &btinfo[7]); + + if (num < 6) + return -EINVAL; + + btinfo[1] = num-2; + + rtw_btinfo_cmd(padapter, btinfo, btinfo[1]+2); + } + + return count; +} +#endif + /* * rtw_adapter_proc: * init/deinit when register/unregister net_device @@ -432,11 +656,14 @@ const struct rtw_proc_hdl adapter_proc_hdls [] = { {"adapter_state", proc_get_adapter_state, NULL}, {"trx_info", proc_get_trx_info, NULL}, {"rate_ctl", proc_get_rate_ctl, proc_set_rate_ctl}, + {"dis_pwt_ctl", proc_get_dis_pwt, proc_set_dis_pwt}, + {"mac_qinfo", proc_get_mac_qinfo, NULL}, + {"macid_info", proc_get_macid_info, NULL}, {"cam", proc_get_cam, proc_set_cam}, {"cam_cache", proc_get_cam_cache, NULL}, {"suspend_info", proc_get_suspend_resume_info, NULL}, {"rx_info", proc_get_rx_info, proc_reset_rx_info}, - + {"wifi_spec",proc_get_wifi_spec,NULL}, #ifdef CONFIG_LAYER2_ROAMING {"roam_flags", proc_get_roam_flags, proc_set_roam_flags}, {"roam_param", proc_get_roam_param, proc_set_roam_param}, @@ -475,22 +702,45 @@ const struct rtw_proc_hdl adapter_proc_hdls [] = { {"ampdu_enable", proc_get_ampdu_enable, proc_set_ampdu_enable}, {"rx_stbc", proc_get_rx_stbc, proc_set_rx_stbc}, {"rx_ampdu", proc_get_rx_ampdu, proc_set_rx_ampdu}, + {"rx_ampdu_factor",proc_get_rx_ampdu_factor,proc_set_rx_ampdu_factor}, + {"rx_ampdu_density",proc_get_rx_ampdu_density,proc_set_rx_ampdu_density}, + {"tx_ampdu_density",proc_get_tx_ampdu_density,proc_set_tx_ampdu_density}, #endif /* CONFIG_80211N_HT */ {"en_fwps", proc_get_en_fwps, proc_set_en_fwps}, //{"path_rssi", proc_get_two_path_rssi, NULL}, - {"rssi_disp",proc_get_rssi_disp, proc_set_rssi_disp}, +// {"rssi_disp",proc_get_rssi_disp, proc_set_rssi_disp}, #ifdef CONFIG_BT_COEXIST {"btcoex_dbg", proc_get_btcoex_dbg, proc_set_btcoex_dbg}, {"btcoex", proc_get_btcoex_info, NULL}, + {"btinfo_evt", proc_get_dummy, proc_set_btinfo_evt}, #endif /* CONFIG_BT_COEXIST */ #if defined(DBG_CONFIG_ERROR_DETECT) {"sreset", proc_get_sreset, proc_set_sreset}, #endif /* DBG_CONFIG_ERROR_DETECT */ {"linked_info_dump",proc_get_linked_info_dump,proc_set_linked_info_dump}, + +#ifdef CONFIG_GPIO_API + {"get_gpio",proc_get_gpio,proc_set_gpio}, + {"set_gpio_output_value",proc_get_dummy,proc_set_gpio_output_value}, + {"config_gpio",proc_get_dummy,proc_set_config_gpio}, +#endif + +#ifdef CONFIG_DBG_COUNTER + {"rx_logs", proc_get_rx_logs, NULL}, + {"tx_logs", proc_get_tx_logs, NULL}, + {"int_logs", proc_get_int_logs, NULL}, +#endif + +#ifdef CONFIG_PCI_HCI + {"rx_ring", proc_get_rx_ring, NULL}, + {"tx_ring", proc_get_tx_ring, NULL}, +#endif + {"chan_plan",proc_get_chan_plan,proc_set_chan_plan}, + {"new_bcn_max", proc_get_new_bcn_max, proc_set_new_bcn_max}, }; const int adapter_proc_hdls_num = sizeof(adapter_proc_hdls) / sizeof(struct rtw_proc_hdl); diff --git a/os_dep/linux/rtw_proc.h b/os_dep/linux/rtw_proc.h index d45a28e..9aee7bf 100644 --- a/os_dep/linux/rtw_proc.h +++ b/os_dep/linux/rtw_proc.h @@ -40,12 +40,12 @@ void rtw_adapter_proc_replace(struct net_device *dev); #else //!CONFIG_PROC_DEBUG -struct proc_dir_entry *get_rtw_drv_proc(void) {return NULL;} -int rtw_drv_proc_init(void) {return 0;} -void rtw_drv_proc_deinit(void) {} -struct proc_dir_entry *rtw_adapter_proc_init(struct net_device *dev){return NULL;} -void rtw_adapter_proc_deinit(struct net_device *dev){} -void rtw_adapter_proc_replace(struct net_device *dev){} +#define get_rtw_drv_proc() NULL +#define rtw_drv_proc_init() 0 +#define rtw_drv_proc_deinit() do {} while (0) +#define rtw_adapter_proc_init(dev) NULL +#define rtw_adapter_proc_deinit(dev) do {} while (0) +#define rtw_adapter_proc_replace(dev) do {} while (0) #endif //!CONFIG_PROC_DEBUG diff --git a/os_dep/linux/usb_intf.c b/os_dep/linux/usb_intf.c index 3ddb6b3..f5b8249 100644 --- a/os_dep/linux/usb_intf.c +++ b/os_dep/linux/usb_intf.c @@ -44,7 +44,6 @@ int ui_pid[3] = {0, 0, 0}; extern int pm_netdev_open(struct net_device *pnetdev,u8 bnormal); static int rtw_suspend(struct usb_interface *intf, pm_message_t message); static int rtw_resume(struct usb_interface *intf); -int rtw_resume_process(_adapter *padapter); static int rtw_drv_init(struct usb_interface *pusb_intf,const struct usb_device_id *pdid); @@ -161,10 +160,75 @@ static struct usb_device_id rtw_usb_id_tbl[] ={ {USB_DEVICE(0x1058, 0x0631),.driver_info = RTL8188C_8192C},/* Alpha, 8192CU */ /*=== Customer ID ===*/ /****** 8188CUS Dongle ********/ + {USB_DEVICE(0x2019, 0xED17),.driver_info = RTL8188C_8192C},/* PCI - Edimax */ + {USB_DEVICE(0x0DF6, 0x0052),.driver_info = RTL8188C_8192C},/* Sitecom - Edimax */ + {USB_DEVICE(0x7392, 0x7811),.driver_info = RTL8188C_8192C},/* Edimax - Edimax */ + {USB_DEVICE(0x07B8, 0x8189),.driver_info = RTL8188C_8192C},/* Abocom - Abocom */ + {USB_DEVICE(0x0EB0, 0x9071),.driver_info = RTL8188C_8192C},/* NO Brand - Etop */ + {USB_DEVICE(0x06F8, 0xE033),.driver_info = RTL8188C_8192C},/* Hercules - Edimax */ + {USB_DEVICE(0x103C, 0x1629),.driver_info = RTL8188C_8192C},/* HP - Lite-On ,8188CUS Slim Combo */ {USB_DEVICE(0x2001, 0x3308),.driver_info = RTL8188C_8192C},/* D-Link - Alpha */ - /****** 8192CUS Dongle ********/ + {USB_DEVICE(0x050D, 0x1102),.driver_info = RTL8188C_8192C},/* Belkin - Edimax */ + {USB_DEVICE(0x2019, 0xAB2A),.driver_info = RTL8188C_8192C},/* Planex - Abocom */ + {USB_DEVICE(0x20F4, 0x648B),.driver_info = RTL8188C_8192C},/* TRENDnet - Cameo */ + {USB_DEVICE(0x4855, 0x0090),.driver_info = RTL8188C_8192C},/* - Feixun */ + {USB_DEVICE(0x13D3, 0x3357),.driver_info = RTL8188C_8192C},/* - AzureWave */ + {USB_DEVICE(0x0DF6, 0x005C),.driver_info = RTL8188C_8192C},/* Sitecom - Edimax */ + {USB_DEVICE(0x0BDA, 0x5088),.driver_info = RTL8188C_8192C},/* Thinkware - CC&C */ + {USB_DEVICE(0x4856, 0x0091),.driver_info = RTL8188C_8192C},/* NetweeN - Feixun */ + {USB_DEVICE(0x0846, 0x9041),.driver_info = RTL8188C_8192C}, /* Netgear - Cameo */ + {USB_DEVICE(0x2019, 0x4902),.driver_info = RTL8188C_8192C},/* Planex - Etop */ + {USB_DEVICE(0x2019, 0xAB2E),.driver_info = RTL8188C_8192C},/* SW-WF02-AD15 -Abocom */ + {USB_DEVICE(0x2001, 0x330B),.driver_info = RTL8188C_8192C}, /* D-LINK - T&W */ + {USB_DEVICE(0xCDAB, 0x8010),.driver_info = RTL8188C_8192C}, /* - - compare */ + {USB_DEVICE(0x0B05, 0x17BA),.driver_info = RTL8188C_8192C}, /* ASUS - Edimax */ + {USB_DEVICE(0x0BDA, 0x1E1E),.driver_info = RTL8188C_8192C}, /* Intel - - */ + {USB_DEVICE(0x04BB, 0x094c),.driver_info = RTL8188C_8192C}, /* I-O DATA - Edimax */ + /****** 8188CTV ********/ + {USB_DEVICE(0xCDAB, 0x8011),.driver_info = RTL8188C_8192C}, /* - - compare */ + {USB_DEVICE(0x0BDA, 0x0A8A),.driver_info = RTL8188C_8192C}, /* Sony - Foxconn */ + /****** 8188 RU ********/ + {USB_DEVICE(0x0BDA, 0x317F),.driver_info = RTL8188C_8192C},/* Netcore,Netcore */ + /****** 8188CE-VAU ********/ + {USB_DEVICE(0x13D3, 0x3359),.driver_info = RTL8188C_8192C},/* - Azwave */ + {USB_DEVICE(0x13D3, 0x3358),.driver_info = RTL8188C_8192C},/* - Azwave */ + /****** 8188CUS Slim Solo********/ + {USB_DEVICE(0x04F2, 0xAFF7),.driver_info = RTL8188C_8192C},/* XAVI - XAVI */ + {USB_DEVICE(0x04F2, 0xAFF9),.driver_info = RTL8188C_8192C},/* XAVI - XAVI */ + {USB_DEVICE(0x04F2, 0xAFFA),.driver_info = RTL8188C_8192C},/* XAVI - XAVI */ + /****** 8188CUS Slim Combo ********/ + {USB_DEVICE(0x04F2, 0xAFF8),.driver_info = RTL8188C_8192C},/* XAVI - XAVI */ + {USB_DEVICE(0x04F2, 0xAFFB),.driver_info = RTL8188C_8192C},/* XAVI - XAVI */ + {USB_DEVICE(0x04F2, 0xAFFC),.driver_info = RTL8188C_8192C},/* XAVI - XAVI */ + {USB_DEVICE(0x2019, 0x1201),.driver_info = RTL8188C_8192C},/* Planex - Vencer */ + /****** 8192CUS Dongle ********/ + {USB_DEVICE(0x2001, 0x3307),.driver_info = RTL8188C_8192C},/* D-Link - Cameo */ {USB_DEVICE(0x2001, 0x330A),.driver_info = RTL8188C_8192C},/* D-Link - Alpha */ {USB_DEVICE(0x2001, 0x3309),.driver_info = RTL8188C_8192C},/* D-Link - Alpha */ + {USB_DEVICE(0x0586, 0x341F),.driver_info = RTL8188C_8192C},/* Zyxel - Abocom */ + {USB_DEVICE(0x7392, 0x7822),.driver_info = RTL8188C_8192C},/* Edimax - Edimax */ + {USB_DEVICE(0x2019, 0xAB2B),.driver_info = RTL8188C_8192C},/* Planex - Abocom */ + {USB_DEVICE(0x07B8, 0x8178),.driver_info = RTL8188C_8192C},/* Abocom - Abocom */ + {USB_DEVICE(0x07AA, 0x0056),.driver_info = RTL8188C_8192C},/* ATKK - Gemtek */ + {USB_DEVICE(0x4855, 0x0091),.driver_info = RTL8188C_8192C},/* - Feixun */ + {USB_DEVICE(0x050D, 0x2102),.driver_info = RTL8188C_8192C},/* Belkin - Sercomm */ + {USB_DEVICE(0x050D, 0x2103),.driver_info = RTL8188C_8192C},/* Belkin - Edimax */ + {USB_DEVICE(0x20F4, 0x624D),.driver_info = RTL8188C_8192C},/* TRENDnet */ + {USB_DEVICE(0x0DF6, 0x0061),.driver_info = RTL8188C_8192C},/* Sitecom - Edimax */ + {USB_DEVICE(0x0B05, 0x17AB),.driver_info = RTL8188C_8192C},/* ASUS - Edimax */ + {USB_DEVICE(0x0846, 0x9021),.driver_info = RTL8188C_8192C},/* Netgear - Sercomm */ + {USB_DEVICE(0x0846, 0xF001),.driver_info = RTL8188C_8192C}, /* Netgear - Sercomm */ + {USB_DEVICE(0x0E66, 0x0019),.driver_info = RTL8188C_8192C},/* Hawking,Edimax */ + {USB_DEVICE(0x0E66, 0x0020),.driver_info = RTL8188C_8192C}, /* Hawking - Edimax */ + {USB_DEVICE(0x050D, 0x1004),.driver_info = RTL8188C_8192C}, /* Belkin - Edimax */ + {USB_DEVICE(0x0BDA, 0x2E2E),.driver_info = RTL8188C_8192C}, /* Intel - - */ + {USB_DEVICE(0x2357, 0x0100),.driver_info = RTL8188C_8192C}, /* TP-Link - TP-Link */ + {USB_DEVICE(0x06F8, 0xE035),.driver_info = RTL8188C_8192C}, /* Hercules - Edimax */ + {USB_DEVICE(0x04BB, 0x0950),.driver_info = RTL8188C_8192C}, /* IO-DATA - Edimax */ + {USB_DEVICE(0x0DF6, 0x0070),.driver_info = RTL8188C_8192C}, /* Sitecom - Edimax */ + {USB_DEVICE(0x0789, 0x016D),.driver_info = RTL8188C_8192C}, /* LOGITEC - Edimax */ + /****** 8192CE-VAU ********/ + {USB_DEVICE(USB_VENDER_ID_REALTEK, 0x8186),.driver_info = RTL8188C_8192C},/* Intel-Xavi( Azwave) */ #endif #ifdef CONFIG_RTL8192D @@ -175,6 +239,23 @@ static struct usb_device_id rtw_usb_id_tbl[] ={ {USB_DEVICE(USB_VENDER_ID_REALTEK, 0x8111),.driver_info = RTL8192D},/* Realtek 5G dongle for WiFi Display */ {USB_DEVICE(USB_VENDER_ID_REALTEK, 0x0193),.driver_info = RTL8192D},/* 8192DE-VAU */ {USB_DEVICE(USB_VENDER_ID_REALTEK, 0x8171),.driver_info = RTL8192D},/* 8192DU-VC */ + /*=== Customer ID ===*/ + /****** 8192DU-VC ********/ + {USB_DEVICE(0x2019, 0xAB2C),.driver_info = RTL8192D},/* PCI - Abocm */ + {USB_DEVICE(0x2019, 0x4903),.driver_info = RTL8192D},/* PCI - ETOP */ + {USB_DEVICE(0x2019, 0x4904),.driver_info = RTL8192D},/* PCI - ETOP */ + {USB_DEVICE(0x07B8, 0x8193),.driver_info = RTL8192D},/* Abocom - Abocom */ + /****** 8192DU-VS ********/ + {USB_DEVICE(0x20F4, 0x664B),.driver_info = RTL8192D},/* TRENDnet */ + {USB_DEVICE(0x04DD, 0x954F),.driver_info = RTL8192D}, /* Sharp */ + {USB_DEVICE(0x04DD, 0x96A6),.driver_info = RTL8192D}, /* Sharp */ + {USB_DEVICE(0x050D, 0x110A),.driver_info = RTL8192D}, /* Belkin - Edimax */ + {USB_DEVICE(0x050D, 0x1105),.driver_info = RTL8192D}, /* Belkin - Edimax */ + {USB_DEVICE(0x050D, 0x120A),.driver_info = RTL8192D}, /* Belkin - Edimax */ + {USB_DEVICE(0x1668, 0x8102),.driver_info = RTL8192D}, /* - */ + {USB_DEVICE(0x0BDA, 0xE194),.driver_info = RTL8192D}, /* - Edimax */ + /****** 8192DU-WiFi Display Dongle ********/ + {USB_DEVICE(0x2019, 0xAB2D),.driver_info = RTL8192D},/* Planex - Abocom ,5G dongle for WiFi Display */ #endif #ifdef CONFIG_RTL8723A @@ -187,6 +268,9 @@ static struct usb_device_id rtw_usb_id_tbl[] ={ /*=== Realtek demoboard ===*/ {USB_DEVICE(USB_VENDER_ID_REALTEK, 0x8179),.driver_info = RTL8188E}, /* 8188EUS */ {USB_DEVICE(USB_VENDER_ID_REALTEK, 0x0179),.driver_info = RTL8188E}, /* 8188ETV */ + /*=== Customer ID ===*/ + /****** 8188EUS ********/ + {USB_DEVICE(0x07B8, 0x8179),.driver_info = RTL8188E}, /* Abocom - Abocom */ #endif #ifdef CONFIG_RTL8812A @@ -196,8 +280,23 @@ static struct usb_device_id rtw_usb_id_tbl[] ={ {USB_DEVICE(USB_VENDER_ID_REALTEK, 0x881B),.driver_info = RTL8812},/* Default ID */ {USB_DEVICE(USB_VENDER_ID_REALTEK, 0x881C),.driver_info = RTL8812},/* Default ID */ /*=== Customer ID ===*/ + {USB_DEVICE(0x050D, 0x1106),.driver_info = RTL8812}, /* Belkin - sercomm */ {USB_DEVICE(0x2001, 0x330E),.driver_info = RTL8812}, /* D-Link - ALPHA */ + {USB_DEVICE(0x7392, 0xA822),.driver_info = RTL8812}, /* Edimax - Edimax */ + {USB_DEVICE(0x0DF6, 0x0074),.driver_info = RTL8812}, /* Sitecom - Edimax */ + {USB_DEVICE(0x04BB, 0x0952),.driver_info = RTL8812}, /* I-O DATA - Edimax */ + {USB_DEVICE(0x0789, 0x016E),.driver_info = RTL8812}, /* Logitec - Edimax */ + {USB_DEVICE(0x0409, 0x0408),.driver_info = RTL8812}, /* NEC - */ + {USB_DEVICE(0x0B05, 0x17D2),.driver_info = RTL8812}, /* ASUS - Edimax */ + {USB_DEVICE(0x0E66, 0x0022),.driver_info = RTL8812}, /* HAWKING - Edimax */ + {USB_DEVICE(0x0586, 0x3426),.driver_info = RTL8812}, /* ZyXEL - */ {USB_DEVICE(0x2001, 0x3313),.driver_info = RTL8812}, /* D-Link - ALPHA */ + {USB_DEVICE(0x1058, 0x0632),.driver_info = RTL8812}, /* WD - Cybertan*/ + {USB_DEVICE(0x1740, 0x0100),.driver_info = RTL8812}, /* EnGenius - EnGenius */ + {USB_DEVICE(0x2019, 0xAB30),.driver_info = RTL8812}, /* Planex - Abocom */ + {USB_DEVICE(0x07B8, 0x8812),.driver_info = RTL8812}, /* Abocom - Abocom */ + {USB_DEVICE(0x2001, 0x3315),.driver_info = RTL8812}, /* D-Link - Cameo */ + {USB_DEVICE(0x2001, 0x3316),.driver_info = RTL8812}, /* D-Link - Cameo */ #endif #ifdef CONFIG_RTL8821A @@ -205,15 +304,19 @@ static struct usb_device_id rtw_usb_id_tbl[] ={ {USB_DEVICE(USB_VENDER_ID_REALTEK, 0x0811),.driver_info = RTL8821},/* Default ID */ {USB_DEVICE(USB_VENDER_ID_REALTEK, 0x0821),.driver_info = RTL8821},/* Default ID */ {USB_DEVICE(USB_VENDER_ID_REALTEK, 0x8822),.driver_info = RTL8821},/* Default ID */ - {USB_DEVICE(USB_VENDER_ID_REALTEK, 0x0820),.driver_info = RTL8821},/* Default ID */ + {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDER_ID_REALTEK, 0x0820,0xff,0xff,0xff),.driver_info = RTL8821}, /* 8821AU */ + /*=== Customer ID ===*/ + {USB_DEVICE(0x7392, 0xA811),.driver_info = RTL8821}, /* Edimax - Edimax */ + {USB_DEVICE(0x04BB, 0x0953),.driver_info = RTL8821}, /* I-O DATA - Edimax */ + {USB_DEVICE(0x2001, 0x3314),.driver_info = RTL8821}, /* D-Link - Cameo */ + {USB_DEVICE(0x2001, 0x3318),.driver_info = RTL8821}, /* D-Link - Cameo */ + {USB_DEVICE(0x0E66, 0x0023),.driver_info = RTL8821}, /* HAWKING - Edimax */ #endif #ifdef CONFIG_RTL8192E /*=== Realtek demoboard ===*/ {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDER_ID_REALTEK, 0x818B,0xff,0xff,0xff),.driver_info = RTL8192E},/* Default ID */ {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDER_ID_REALTEK, 0x818C,0xff,0xff,0xff),.driver_info = RTL8192E},/* Default ID */ - /*=== Customer ID ===*/ - {USB_DEVICE(0x2001, 0x3319),.driver_info = RTL8192E}, /* D-Link - DWA-131 */ #endif #ifdef CONFIG_RTL8723B @@ -610,6 +713,9 @@ static void rtw_decide_chip_type_by_usb_info(_adapter *padapter, const struct us } void rtw_set_hal_ops(_adapter *padapter) { + //alloc memory for HAL DATA + rtw_hal_data_init(padapter); + #ifdef CONFIG_RTL8192C if(padapter->chip_type == RTL8188C_8192C) rtl8192cu_set_hal_ops(padapter); @@ -874,13 +980,26 @@ error_exit: } #endif -#ifdef CONFIG_SUSPEND_REFINE static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message) { + struct dvobj_priv *dvobj; + struct pwrctrl_priv *pwrpriv; + struct debug_priv *pdbgpriv; + PADAPTER padapter; int ret = 0; - struct dvobj_priv *dvobj = usb_get_intfdata(pusb_intf); - _adapter *padapter = dvobj->if1; - struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); + + + dvobj = usb_get_intfdata(pusb_intf); + pwrpriv = dvobj_to_pwrctl(dvobj); + pdbgpriv = &dvobj->drv_dbg; + padapter = dvobj->if1; + + if (pwrpriv->bInSuspend == _TRUE) { + DBG_871X("%s bInSuspend = %d\n", __FUNCTION__, pwrpriv->bInSuspend); + pdbgpriv->dbg_suspend_error_cnt++; + goto exit; + } + if((padapter->bup) || (padapter->bDriverStopped == _FALSE)||(padapter->bSurpriseRemoved == _FALSE)) { #ifdef CONFIG_AUTOSUSPEND @@ -898,23 +1017,37 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message) } #endif//CONFIG_AUTOSUSPEND } + ret = rtw_suspend_common(padapter); +exit: return ret; } + int rtw_resume_process(_adapter *padapter) { int ret,pm_cnt = 0; struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); - - #if defined(CONFIG_BT_COEXIST) && defined(CONFIG_AUTOSUSPEND) //add by amy for 8723as-vau - #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,32)) + struct dvobj_priv *pdvobj = padapter->dvobj; + struct debug_priv *pdbgpriv = &pdvobj->drv_dbg; + + + if (pwrpriv->bInSuspend == _FALSE) + { + pdbgpriv->dbg_resume_error_cnt++; + DBG_871X("%s bInSuspend = %d\n", __FUNCTION__, pwrpriv->bInSuspend); + return -1; + } + +#if defined(CONFIG_BT_COEXIST) && defined(CONFIG_AUTOSUSPEND) //add by amy for 8723as-vau +#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,32)) DBG_871X("%s...pm_usage_cnt(%d) pwrpriv->bAutoResume=%x. ....\n",__func__,atomic_read(&(adapter_to_dvobj(padapter)->pusbintf->pm_usage_cnt)),pwrpriv->bAutoResume); pm_cnt=atomic_read(&(adapter_to_dvobj(padapter)->pusbintf->pm_usage_cnt)); - #else +#else // kernel < 2.6.32 DBG_871X("...pm_usage_cnt(%d).....\n", adapter_to_dvobj(padapter)->pusbintf->pm_usage_cnt); pm_cnt = adapter_to_dvobj(padapter)->pusbintf->pm_usage_cnt; - #endif +#endif // kernel < 2.6.32 + DBG_871X("pwrpriv->bAutoResume (%x)\n",pwrpriv->bAutoResume ); if( _TRUE == pwrpriv->bAutoResume ){ pwrpriv->bInternalAutoSuspend = _FALSE; @@ -922,7 +1055,7 @@ int rtw_resume_process(_adapter *padapter) DBG_871X("pwrpriv->bAutoResume (%x) pwrpriv->bInternalAutoSuspend(%x)\n",pwrpriv->bAutoResume,pwrpriv->bInternalAutoSuspend ); } - #endif //#ifdef CONFIG_BT_COEXIST &CONFIG_AUTOSUSPEND& +#endif //#ifdef CONFIG_BT_COEXIST &CONFIG_AUTOSUSPEND& #if defined (CONFIG_WOWLAN) || defined (CONFIG_AP_WOWLAN) /* @@ -967,277 +1100,62 @@ int rtw_resume_process(_adapter *padapter) return ret; } -#else -static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message) -{ - struct dvobj_priv *dvobj = usb_get_intfdata(pusb_intf); - _adapter *padapter = dvobj->if1; - struct net_device *pnetdev = padapter->pnetdev; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct pwrctrl_priv *pwrpriv = dvobj_to_pwrctl(dvobj); - struct usb_device *usb_dev = interface_to_usbdev(pusb_intf); - -#ifdef CONFIG_WOWLAN - struct wowlan_ioctl_param poidparam; -#endif // CONFIG_WOWLAN - int ret = 0; - u32 start_time = rtw_get_current_time(); - - _func_enter_; - - DBG_871X("==> %s (%s:%d)\n",__FUNCTION__, current->comm, current->pid); - -#ifdef CONFIG_WOWLAN - if (check_fwstate(pmlmepriv, _FW_LINKED)) - pwrpriv->wowlan_mode = _TRUE; - else - pwrpriv->wowlan_mode = _FALSE; -#endif - -#ifdef CONFIG_IOL_READ_EFUSE_MAP - if(!padapter->bup){ - u8 bMacPwrCtrlOn = _FALSE; - rtw_hal_get_hwreg(padapter, HW_VAR_APFM_ON_MAC, &bMacPwrCtrlOn); - if(bMacPwrCtrlOn) - rtw_hal_power_off(padapter); - } -#endif - - if((!padapter->bup) || (padapter->bDriverStopped)||(padapter->bSurpriseRemoved)) - { - DBG_871X("padapter->bup=%d bDriverStopped=%d bSurpriseRemoved = %d\n", - padapter->bup, padapter->bDriverStopped,padapter->bSurpriseRemoved); - goto exit; - } - - if(pwrpriv->bInternalAutoSuspend ) - { - #ifdef CONFIG_AUTOSUSPEND - #ifdef SUPPORT_HW_RFOFF_DETECTED - // The FW command register update must after MAC and FW init ready. - if((padapter->bFWReady) && (pwrpriv->bHWPwrPindetect ) && (padapter->registrypriv.usbss_enable )) - { - u8 bOpen = _TRUE; - rtw_interface_ps_func(padapter,HAL_USB_SELECT_SUSPEND,&bOpen); - //rtl8192c_set_FwSelectSuspend_cmd(padapter,_TRUE ,500);//note fw to support hw power down ping detect - } - #endif - #endif - } - pwrpriv->bInSuspend = _TRUE; - rtw_cancel_all_timer(padapter); - LeaveAllPowerSaveMode(padapter); - - rtw_stop_cmd_thread(padapter); - - _enter_pwrlock(&pwrpriv->lock); - //padapter->net_closed = _TRUE; - //s1. - if(pnetdev) - { - netif_carrier_off(pnetdev); - rtw_netif_stop_queue(pnetdev); - } - -#ifdef CONFIG_WOWLAN - if(pwrpriv->bSupportRemoteWakeup==_TRUE && pwrpriv->wowlan_mode==_TRUE){ - if (rtw_port_switch_chk(padapter)) - rtw_hal_set_hwreg(padapter, HW_VAR_PORT_SWITCH, NULL); - - //set H2C command - poidparam.subcode=WOWLAN_ENABLE; - padapter->HalFunc.SetHwRegHandler(padapter,HW_VAR_WOWLAN,(u8 *)&poidparam); - } - else -#else - { - //s2. - rtw_disassoc_cmd(padapter, 0, _FALSE); - } -#endif //CONFIG_WOWLAN - - if (rtw_chk_roam_flags(padapter, RTW_ROAM_ON_RESUME)) { - if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) - && check_fwstate(pmlmepriv, _FW_LINKED)) - { - //DBG_871X("%s:%d assoc_ssid:%s\n", __FUNCTION__, __LINE__, pmlmepriv->assoc_ssid.Ssid); - DBG_871X("%s:%d %s(" MAC_FMT "), length:%d assoc_ssid.length:%d\n",__FUNCTION__, __LINE__, - pmlmepriv->cur_network.network.Ssid.Ssid, - MAC_ARG(pmlmepriv->cur_network.network.MacAddress), - pmlmepriv->cur_network.network.Ssid.SsidLength, - pmlmepriv->assoc_ssid.SsidLength); - - rtw_set_to_roam(padapter, 1); - } - } - - //s2-2. indicate disconnect to os - rtw_indicate_disconnect(padapter); - //s2-3. - rtw_free_assoc_resources(padapter, 1); -#ifdef CONFIG_AUTOSUSPEND - if(!pwrpriv->bInternalAutoSuspend ) -#endif - //s2-4. - rtw_free_network_queue(padapter, _TRUE); - - rtw_dev_unload(padapter); -#ifdef CONFIG_AUTOSUSPEND - pwrpriv->rf_pwrstate = rf_off; - pwrpriv->bips_processing = _FALSE; -#endif - _exit_pwrlock(&pwrpriv->lock); - - if(check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) - rtw_indicate_scan_done(padapter, 1); - - if(check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) - rtw_indicate_disconnect(padapter); - -exit: - DBG_871X("<=== %s return %d.............. in %dms\n", __FUNCTION__ - , ret, rtw_get_passing_time_ms(start_time)); - - _func_exit_; - return ret; -} - - -int rtw_resume_process(_adapter *padapter) -{ - struct net_device *pnetdev; - struct pwrctrl_priv *pwrpriv = NULL; - int ret = -1; - u32 start_time = rtw_get_current_time(); -#ifdef CONFIG_BT_COEXIST - u8 pm_cnt; -#endif //#ifdef CONFIG_BT_COEXIST - _func_enter_; - - DBG_871X("==> %s (%s:%d)\n",__FUNCTION__, current->comm, current->pid); - - if(padapter) { - pnetdev= padapter->pnetdev; - pwrpriv = adapter_to_pwrctl(padapter); - } else { - goto exit; - } - - _enter_pwrlock(&pwrpriv->lock); -#ifdef CONFIG_BT_COEXIST -#ifdef CONFIG_AUTOSUSPEND - #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,32)) - DBG_871X("%s...pm_usage_cnt(%d) pwrpriv->bAutoResume=%x. ....\n",__func__,atomic_read(&(adapter_to_dvobj(padapter)->pusbintf->pm_usage_cnt)),pwrpriv->bAutoResume); - pm_cnt=atomic_read(&(adapter_to_dvobj(padapter)->pusbintf->pm_usage_cnt)); - #else - DBG_871X("...pm_usage_cnt(%d).....\n", adapter_to_dvobj(padapter)->pusbintf->pm_usage_cnt); - pm_cnt = adapter_to_dvobj(padapter)->pusbintf->pm_usage_cnt; - #endif - - DBG_871X("pwrpriv->bAutoResume (%x)\n",pwrpriv->bAutoResume ); - if( _TRUE == pwrpriv->bAutoResume ){ - pwrpriv->bInternalAutoSuspend = _FALSE; - pwrpriv->bAutoResume=_FALSE; - DBG_871X("pwrpriv->bAutoResume (%x) pwrpriv->bInternalAutoSuspend(%x)\n",pwrpriv->bAutoResume,pwrpriv->bInternalAutoSuspend ); - - } -#endif //#ifdef CONFIG_AUTOSUSPEND -#endif //#ifdef CONFIG_BT_COEXIST - rtw_reset_drv_sw(padapter); - pwrpriv->bkeepfwalive = _FALSE; - - DBG_871X("bkeepfwalive(%x)\n",pwrpriv->bkeepfwalive); - if(pm_netdev_open(pnetdev,_TRUE) != 0){ - _exit_pwrlock(&pwrpriv->lock); - goto exit; - } - - netif_device_attach(pnetdev); - netif_carrier_on(pnetdev); - -#ifdef CONFIG_AUTOSUSPEND - if(pwrpriv->bInternalAutoSuspend ) - { - #ifdef CONFIG_AUTOSUSPEND - #ifdef SUPPORT_HW_RFOFF_DETECTED - // The FW command register update must after MAC and FW init ready. - if((padapter->bFWReady) && (pwrpriv->bHWPwrPindetect) && (padapter->registrypriv.usbss_enable )) - { - //rtl8192c_set_FwSelectSuspend_cmd(padapter,_FALSE ,500);//note fw to support hw power down ping detect - u8 bOpen = _FALSE; - rtw_interface_ps_func(padapter,HAL_USB_SELECT_SUSPEND,&bOpen); - } - #endif - #endif -#ifdef CONFIG_BT_COEXIST - DBG_871X("pwrpriv->bAutoResume (%x)\n",pwrpriv->bAutoResume ); - if( _TRUE == pwrpriv->bAutoResume ){ - pwrpriv->bInternalAutoSuspend = _FALSE; - pwrpriv->bAutoResume=_FALSE; - DBG_871X("pwrpriv->bAutoResume (%x) pwrpriv->bInternalAutoSuspend(%x)\n",pwrpriv->bAutoResume,pwrpriv->bInternalAutoSuspend ); - } - -#else //#ifdef CONFIG_BT_COEXIST - pwrpriv->bInternalAutoSuspend = _FALSE; -#endif //#ifdef CONFIG_BT_COEXIST - pwrpriv->brfoffbyhw = _FALSE; - } -#endif - _exit_pwrlock(&pwrpriv->lock); - - if( padapter->pid[1]!=0) { - DBG_871X("pid[1]:%d\n",padapter->pid[1]); - rtw_signal_process(padapter->pid[1], SIGUSR2); - } - - if (rtw_chk_roam_flags(padapter, RTW_ROAM_ON_RESUME)) - rtw_roaming(padapter, NULL); - - ret = 0; -exit: - #ifdef CONFIG_RESUME_IN_WORKQUEUE - rtw_unlock_suspend(); - #endif //CONFIG_RESUME_IN_WORKQUEUE - - pwrpriv->bInSuspend = _FALSE; - DBG_871X("<=== %s return %d.............. in %dms\n", __FUNCTION__ - , ret, rtw_get_passing_time_ms(start_time)); - - _func_exit_; - - return ret; -} -#endif static int rtw_resume(struct usb_interface *pusb_intf) { - struct dvobj_priv *dvobj = usb_get_intfdata(pusb_intf); - _adapter *padapter = dvobj->if1; - struct net_device *pnetdev = padapter->pnetdev; - struct pwrctrl_priv *pwrpriv = dvobj_to_pwrctl(dvobj); - int ret = 0; + struct dvobj_priv *dvobj; + struct pwrctrl_priv *pwrpriv; + struct debug_priv *pdbgpriv; + PADAPTER padapter; + struct mlme_ext_priv *pmlmeext; + int ret = 0; - if(pwrpriv->bInternalAutoSuspend ){ + + dvobj = usb_get_intfdata(pusb_intf); + pwrpriv = dvobj_to_pwrctl(dvobj); + pdbgpriv = &dvobj->drv_dbg; + padapter = dvobj->if1; + pmlmeext = &padapter->mlmeextpriv; + + DBG_871X("==> %s (%s:%d)\n", __FUNCTION__, current->comm, current->pid); + pdbgpriv->dbg_resume_cnt++; + + if(pwrpriv->bInternalAutoSuspend) + { ret = rtw_resume_process(padapter); - } else { -#ifdef CONFIG_RESUME_IN_WORKQUEUE - rtw_resume_in_workqueue(pwrpriv); -#else - if (rtw_is_earlysuspend_registered(pwrpriv) - #ifdef CONFIG_WOWLAN - && !pwrpriv->wowlan_mode - #endif /* CONFIG_WOWLAN */ - ) { - /* jeff: bypass resume here, do in late_resume */ - rtw_set_do_late_resume(pwrpriv, _TRUE); - } else { + } + else + { + if(pwrpriv->wowlan_mode || pwrpriv->wowlan_ap_mode) + { + rtw_resume_lock_suspend(); ret = rtw_resume_process(padapter); + rtw_resume_unlock_suspend(); + } + else + { +#ifdef CONFIG_RESUME_IN_WORKQUEUE + rtw_resume_in_workqueue(pwrpriv); +#else + if (rtw_is_earlysuspend_registered(pwrpriv)) + { + /* jeff: bypass resume here, do in late_resume */ + rtw_set_do_late_resume(pwrpriv, _TRUE); + } + else + { + rtw_resume_lock_suspend(); + ret = rtw_resume_process(padapter); + rtw_resume_unlock_suspend(); + } +#endif } -#endif /* CONFIG_RESUME_IN_WORKQUEUE */ } - return ret; + pmlmeext->last_scan_time = rtw_get_current_time(); + DBG_871X("<======== %s return %d\n", __FUNCTION__, ret); + return ret; } @@ -1298,6 +1216,7 @@ void autosuspend_enter(_adapter* padapter) #endif } + int autoresume_enter(_adapter* padapter) { int result = _SUCCESS; diff --git a/os_dep/linux/usb_ops_linux.c b/os_dep/linux/usb_ops_linux.c index b76cfc0..d854d76 100644 --- a/os_dep/linux/usb_ops_linux.c +++ b/os_dep/linux/usb_ops_linux.c @@ -486,11 +486,6 @@ _func_enter_; case BK_QUEUE_INX: pxmitpriv->bkq_cnt--; break; - case HIGH_QUEUE_INX: -#ifdef CONFIG_AP_MODE - rtw_chk_hi_queue_cmd(padapter); -#endif - break; default: break; } @@ -598,7 +593,7 @@ _func_enter_; check_completion: _enter_critical(&pxmitpriv->lock_sctx, &irqL); rtw_sctx_done_err(&pxmitbuf->sctx, - purb->status ? RTW_SCTX_DONE_WRITE_PORT_ERR : RTW_SCTX_DONE_SUCCESS); + purb->status ? RTW_SCTX_DONE_WRITE_PORT_ERR : RTW_SCTX_DONE_SUCCESS); _exit_critical(&pxmitpriv->lock_sctx, &irqL); rtw_free_xmitbuf(pxmitpriv, pxmitbuf); @@ -776,7 +771,7 @@ void usb_write_port_cancel(struct intf_hdl *pintfhdl) } pxmitbuf = (struct xmit_buf*)padapter->xmitpriv.pxmit_extbuf; - for (i = 0; i < NR_XMIT_EXTBUFF; i++) { + for (i = 0; i < NR_XMIT_EXTBUFF ; i++) { for (j=0; j<8; j++) { if(pxmitbuf->pxmit_urb[j]) { usb_kill_urb(pxmitbuf->pxmit_urb[j]); diff --git a/os_dep/linux/wifi_regd.c b/os_dep/linux/wifi_regd.c index 74895ea..04ffe78 100644 --- a/os_dep/linux/wifi_regd.c +++ b/os_dep/linux/wifi_regd.c @@ -268,10 +268,15 @@ static void _rtw_reg_apply_radar_flags(struct wiphy *wiphy) if (!_rtw_is_radar_freq(ch->center_freq)) continue; #ifdef CONFIG_DFS - if (!(ch->flags & IEEE80211_CHAN_DISABLED)) - ch->flags |= IEEE80211_CHAN_RADAR | - IEEE80211_CHAN_NO_IBSS; -#endif + if (!(ch->flags & IEEE80211_CHAN_DISABLED)) { + ch->flags |= IEEE80211_CHAN_RADAR; + #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0)) + ch->flags |= (IEEE80211_CHAN_NO_IBSS|IEEE80211_CHAN_PASSIVE_SCAN); + #else + ch->flags |= IEEE80211_CHAN_NO_IR; + #endif + } +#endif //CONFIG_DFS #if 0 /* @@ -354,12 +359,19 @@ static void _rtw_reg_apply_flags(struct wiphy *wiphy) rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); + ch = ieee80211_get_channel(wiphy, freq); if (ch) { - if (channel_set[i].ScanType == SCAN_PASSIVE) - ch->flags = IEEE80211_CHAN_PASSIVE_SCAN; - else + if (channel_set[i].ScanType == SCAN_PASSIVE) { + #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0)) + ch->flags = (IEEE80211_CHAN_NO_IBSS|IEEE80211_CHAN_PASSIVE_SCAN); + #else + ch->flags = IEEE80211_CHAN_NO_IR; + #endif + } + else { ch->flags = 0; + } } } @@ -474,20 +486,52 @@ static const struct ieee80211_regdomain *_rtw_regdomain_select(struct #endif } -static int _rtw_regd_init_wiphy(struct rtw_regulatory *reg, - struct wiphy *wiphy, - int (*reg_notifier) (struct wiphy * wiphy, - struct regulatory_request * - request)) +void _rtw_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request) +{ + struct rtw_regulatory *reg = NULL; + + DBG_8192C("%s\n", __func__); + + _rtw_reg_notifier_apply(wiphy, request, reg); +} + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)) +int rtw_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request) +#else +void rtw_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request) +#endif +{ + _rtw_reg_notifier(wiphy, request); + #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)) + return 0; + #endif +} + +void rtw_reg_notify_by_driver(_adapter *adapter) +{ + if ((adapter->rtw_wdev != NULL) && (adapter->rtw_wdev->wiphy)) { + struct regulatory_request request; + request.initiator = NL80211_REGDOM_SET_BY_DRIVER; + rtw_reg_notifier(adapter->rtw_wdev->wiphy, &request); + } +} + +static void _rtw_regd_init_wiphy(struct rtw_regulatory *reg, struct wiphy *wiphy) { const struct ieee80211_regdomain *regd; - wiphy->reg_notifier = reg_notifier; + wiphy->reg_notifier = rtw_reg_notifier; + #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0)) wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY; wiphy->flags &= ~WIPHY_FLAG_STRICT_REGULATORY; wiphy->flags &= ~WIPHY_FLAG_DISABLE_BEACON_HINTS; - + #else + wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG; + wiphy->regulatory_flags &= ~REGULATORY_STRICT_REG; + wiphy->regulatory_flags &= ~REGULATORY_DISABLE_BEACON_HINTS; + #endif + regd = _rtw_regdomain_select(reg); wiphy_apply_custom_regulatory(wiphy, regd); @@ -495,7 +539,6 @@ static int _rtw_regd_init_wiphy(struct rtw_regulatory *reg, _rtw_reg_apply_flags(wiphy); _rtw_reg_apply_radar_flags(wiphy); _rtw_reg_apply_world_flags(wiphy, NL80211_REGDOM_SET_BY_DRIVER, reg); - return 0; } static struct country_code_to_enum_rd *_rtw_regd_find_country(u16 countrycode) @@ -509,11 +552,8 @@ static struct country_code_to_enum_rd *_rtw_regd_find_country(u16 countrycode) return NULL; } -int rtw_regd_init(_adapter * padapter, - int (*reg_notifier) (struct wiphy * wiphy, - struct regulatory_request * request)) +int rtw_regd_init(_adapter * padapter) { - //struct registry_priv *registrypriv = &padapter->registrypriv; struct wiphy *wiphy = padapter->rtw_wdev->wiphy; #if 0 @@ -531,17 +571,9 @@ int rtw_regd_init(_adapter * padapter, __func__, rtw_regd->alpha2[0], rtw_regd->alpha2[1]); #endif - _rtw_regd_init_wiphy(NULL, wiphy, reg_notifier); + _rtw_regd_init_wiphy(NULL, wiphy); return 0; } +#endif //CONFIG_IOCTL_CFG80211 -int rtw_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request) -{ - struct rtw_regulatory *reg = NULL; - - DBG_8192C("%s\n", __func__); - - return _rtw_reg_notifier_apply(wiphy, request, reg); -} -#endif //CONFIG_IOCTL_CFG80211 \ No newline at end of file diff --git a/os_dep/linux/xmit_linux.c b/os_dep/linux/xmit_linux.c index 0539e65..db9b311 100644 --- a/os_dep/linux/xmit_linux.c +++ b/os_dep/linux/xmit_linux.c @@ -21,6 +21,7 @@ #include +#define DBG_DUMP_OS_QUEUE_CTL 0 uint rtw_remainder_len(struct pkt_file *pfile) { @@ -143,11 +144,11 @@ int rtw_os_xmit_resource_alloc(_adapter *padapter, struct xmit_buf *pxmitbuf, u3 for(i=0; i<8; i++) { pxmitbuf->pxmit_urb[i] = usb_alloc_urb(0, GFP_KERNEL); - if(pxmitbuf->pxmit_urb[i] == NULL) - { - DBG_871X("pxmitbuf->pxmit_urb[i]==NULL"); - return _FAIL; - } + if(pxmitbuf->pxmit_urb[i] == NULL) + { + DBG_871X("pxmitbuf->pxmit_urb[i]==NULL"); + return _FAIL; + } } #endif } @@ -187,28 +188,78 @@ void rtw_os_xmit_resource_free(_adapter *padapter, struct xmit_buf *pxmitbuf,u32 } } +void dump_os_queue(void *sel, _adapter *padapter) +{ + struct net_device *ndev = padapter->pnetdev; + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) + int i; + + for (i=0;i<4;i++) { + DBG_871X_SEL_NL(sel, "os_queue[%d]:%s\n" + , i, __netif_subqueue_stopped(ndev, i)?"stopped":"waked"); + } +#else + DBG_871X_SEL_NL(sel, "os_queue:%s\n" + , netif_queue_stopped(ndev)?"stopped":"waked"); +#endif +} + #define WMM_XMIT_THRESHOLD (NR_XMITFRAME*2/5) +inline static bool rtw_os_need_wake_queue(_adapter *padapter, u16 qidx) +{ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) + struct xmit_priv *pxmitpriv = &padapter->xmitpriv; + + if (padapter->registrypriv.wifi_spec) { + if (pxmitpriv->hwxmits[qidx].accnt < WMM_XMIT_THRESHOLD) + return _TRUE; + } else { + return _TRUE; + } + return _FALSE; +#else + return _TRUE; +#endif +} + +inline static bool rtw_os_need_stop_queue(_adapter *padapter, u16 qidx) +{ + struct xmit_priv *pxmitpriv = &padapter->xmitpriv; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) + if (padapter->registrypriv.wifi_spec) { + /* No free space for Tx, tx_worker is too slow */ + if (pxmitpriv->hwxmits[qidx].accnt > WMM_XMIT_THRESHOLD) + return _TRUE; + } else { + if(pxmitpriv->free_xmitframe_cnt<=4) + return _TRUE; + } +#else + if(pxmitpriv->free_xmitframe_cnt<=4) + return _TRUE; +#endif + return _FALSE; +} + void rtw_os_pkt_complete(_adapter *padapter, _pkt *pkt) { #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) - u16 queue; - struct xmit_priv *pxmitpriv = &padapter->xmitpriv; + u16 qidx; - queue = skb_get_queue_mapping(pkt); - if (padapter->registrypriv.wifi_spec) { - if(__netif_subqueue_stopped(padapter->pnetdev, queue) && - (pxmitpriv->hwxmits[queue].accnt < WMM_XMIT_THRESHOLD)) - { - netif_wake_subqueue(padapter->pnetdev, queue); - } - } else { - if(__netif_subqueue_stopped(padapter->pnetdev, queue)) - netif_wake_subqueue(padapter->pnetdev, queue); + qidx = skb_get_queue_mapping(pkt); + if (rtw_os_need_wake_queue(padapter, qidx)) { + if (DBG_DUMP_OS_QUEUE_CTL) + DBG_871X(FUNC_ADPT_FMT": netif_wake_subqueue[%d]\n", FUNC_ADPT_ARG(padapter), qidx); + netif_wake_subqueue(padapter->pnetdev, qidx); } #else - if (netif_queue_stopped(padapter->pnetdev)) + if (rtw_os_need_wake_queue(padapter, 0)) { + if (DBG_DUMP_OS_QUEUE_CTL) + DBG_871X(FUNC_ADPT_FMT": netif_wake_queue\n", FUNC_ADPT_ARG(padapter)); netif_wake_queue(padapter->pnetdev); + } #endif rtw_skb_free(pkt); @@ -259,30 +310,53 @@ void rtw_os_xmit_schedule(_adapter *padapter) #endif } -static void rtw_check_xmit_resource(_adapter *padapter, _pkt *pkt) +static bool rtw_check_xmit_resource(_adapter *padapter, _pkt *pkt) { + bool busy = _FALSE; struct xmit_priv *pxmitpriv = &padapter->xmitpriv; #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35)) - u16 queue; + u16 qidx; - queue = skb_get_queue_mapping(pkt); - if (padapter->registrypriv.wifi_spec) { - /* No free space for Tx, tx_worker is too slow */ - if (pxmitpriv->hwxmits[queue].accnt > WMM_XMIT_THRESHOLD) { - //DBG_871X("%s(): stop netif_subqueue[%d]\n", __FUNCTION__, queue); - netif_stop_subqueue(padapter->pnetdev, queue); - } - } else { - if(pxmitpriv->free_xmitframe_cnt<=4) { - if (!netif_tx_queue_stopped(netdev_get_tx_queue(padapter->pnetdev, queue))) - netif_stop_subqueue(padapter->pnetdev, queue); + qidx = skb_get_queue_mapping(pkt); + if (rtw_os_need_stop_queue(padapter, qidx)) { + if (DBG_DUMP_OS_QUEUE_CTL) + DBG_871X(FUNC_ADPT_FMT": netif_stop_subqueue[%d]\n", FUNC_ADPT_ARG(padapter), qidx); + netif_stop_subqueue(padapter->pnetdev, qidx); + busy = _TRUE; + } +#else + if (rtw_os_need_stop_queue(padapter, 0)) { + if (DBG_DUMP_OS_QUEUE_CTL) + DBG_871X(FUNC_ADPT_FMT": netif_stop_queue\n", FUNC_ADPT_ARG(padapter)); + rtw_netif_stop_queue(padapter->pnetdev); + busy = _TRUE; + } +#endif + return busy; +} + +void rtw_os_wake_queue_at_free_stainfo(_adapter *padapter, int *qcnt_freed) +{ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) + int i; + + for (i=0;i<4;i++) { + if (qcnt_freed[i] == 0) + continue; + + if(rtw_os_need_wake_queue(padapter, i)) { + if (DBG_DUMP_OS_QUEUE_CTL) + DBG_871X(FUNC_ADPT_FMT": netif_wake_subqueue[%d]\n", FUNC_ADPT_ARG(padapter), i); + netif_wake_subqueue(padapter->pnetdev, i); } } #else - if(pxmitpriv->free_xmitframe_cnt<=4) - { - if (!rtw_netif_queue_stopped(padapter->pnetdev)) - rtw_netif_stop_queue(padapter->pnetdev); + if (qcnt_freed[0] || qcnt_freed[1] || qcnt_freed[2] || qcnt_freed[3]) { + if(rtw_os_need_wake_queue(padapter, 0)) { + if (DBG_DUMP_OS_QUEUE_CTL) + DBG_871X(FUNC_ADPT_FMT": netif_wake_queue\n", FUNC_ADPT_ARG(padapter)); + netif_wake_queue(padapter->pnetdev); + } } #endif } @@ -304,6 +378,8 @@ int rtw_mlcst2unicst(_adapter *padapter, struct sk_buff *skb) int i; s32 res; + DBG_COUNTER(padapter->tx_logs.os_tx_m2u); + _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); phead = &pstapriv->asoc_list; plist = get_next(phead); @@ -324,14 +400,22 @@ int rtw_mlcst2unicst(_adapter *padapter, struct sk_buff *skb) for (i = 0; i < chk_alive_num; i++) { psta = rtw_get_stainfo_by_offset(pstapriv, chk_alive_list[i]); if(!(psta->state &_FW_LINKED)) + { + DBG_COUNTER(padapter->tx_logs.os_tx_m2u_ignore_fw_linked); continue; + } /* avoid come from STA1 and send back STA1 */ if (_rtw_memcmp(psta->hwaddr, &skb->data[6], 6) == _TRUE || _rtw_memcmp(psta->hwaddr, null_addr, 6) == _TRUE || _rtw_memcmp(psta->hwaddr, bc_addr, 6) == _TRUE ) + { + DBG_COUNTER(padapter->tx_logs.os_tx_m2u_ignore_self); continue; + } + + DBG_COUNTER(padapter->tx_logs.os_tx_m2u_entry); newskb = rtw_skb_copy(skb); @@ -339,11 +423,13 @@ int rtw_mlcst2unicst(_adapter *padapter, struct sk_buff *skb) _rtw_memcpy(newskb->data, psta->hwaddr, 6); res = rtw_xmit(padapter, &newskb); if (res < 0) { + DBG_COUNTER(padapter->tx_logs.os_tx_m2u_entry_err_xmit); DBG_871X("%s()-%d: rtw_xmit() return error!\n", __FUNCTION__, __LINE__); pxmitpriv->tx_drop++; rtw_skb_free(newskb); } } else { + DBG_COUNTER(padapter->tx_logs.os_tx_m2u_entry_err_skb); DBG_871X("%s-%d: rtw_skb_copy() failed!\n", __FUNCTION__, __LINE__); pxmitpriv->tx_drop++; //rtw_skb_free(skb); @@ -372,9 +458,16 @@ int _rtw_xmit_entry(_pkt *pkt, _nic_hdl pnetdev) _func_enter_; + if(padapter->registrypriv.mp_mode) + { + DBG_871X("MP_TX_DROP_OS_FRAME\n"); + goto drop_packet; + } + DBG_COUNTER(padapter->tx_logs.os_tx); RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("+xmit_enry\n")); if (rtw_if_up(padapter) == _FALSE) { + DBG_COUNTER(padapter->tx_logs.os_tx_err_up); RT_TRACE(_module_xmit_osdep_c_, _drv_err_, ("rtw_xmit_entry: rtw_if_up fail\n")); #ifdef DBG_TX_DROP_FRAME DBG_871X("DBG_TX_DROP_FRAME %s if_up fail\n", __FUNCTION__); @@ -388,7 +481,11 @@ _func_enter_; if ( !rtw_mc2u_disable && check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE && ( IP_MCAST_MAC(pkt->data) - || ICMPV6_MCAST_MAC(pkt->data) ) + || ICMPV6_MCAST_MAC(pkt->data) + #ifdef CONFIG_TX_BCAST2UNI + || is_broadcast_mac_addr(pkt->data) + #endif + ) && (padapter->registrypriv.wifi_spec == 0) ) { @@ -400,6 +497,7 @@ _func_enter_; } else { //DBG_871X("Stop M2U(%d, %d)! ", pxmitpriv->free_xmitframe_cnt, pxmitpriv->free_xmitbuf_cnt); //DBG_871X("!m2u ); + DBG_COUNTER(padapter->tx_logs.os_tx_m2u_stop); } } #endif // CONFIG_TX_MCAST2UNI @@ -417,7 +515,7 @@ _func_enter_; drop_packet: pxmitpriv->tx_drop++; - rtw_skb_free(pkt); + rtw_os_pkt_complete(padapter, pkt); RT_TRACE(_module_xmit_osdep_c_, _drv_notice_, ("rtw_xmit_entry: drop, tx_drop=%d\n", (u32)pxmitpriv->tx_drop)); exit: diff --git a/os_dep/osdep_service.c b/os_dep/osdep_service.c index 97a904b..dcef0e7 100644 --- a/os_dep/osdep_service.c +++ b/os_dep/osdep_service.c @@ -751,7 +751,7 @@ inline void *dbg_rtw_usb_buffer_alloc(struct usb_device *dev, size_t size, dma_a void *p; if(match_mstat_sniff_rules(flags, size)) - DBG_871X("DBG_MEM_ALLOC %s:%d %s(%d)\n", func, line, __FUNCTION__, size); + DBG_871X("DBG_MEM_ALLOC %s:%d %s(%zu)\n", func, line, __FUNCTION__, size); p = _rtw_usb_buffer_alloc(dev, size, dma); @@ -768,7 +768,7 @@ inline void dbg_rtw_usb_buffer_free(struct usb_device *dev, size_t size, void *a { if(match_mstat_sniff_rules(flags, size)) - DBG_871X("DBG_MEM_ALLOC %s:%d %s(%d)\n", func, line, __FUNCTION__, size); + DBG_871X("DBG_MEM_ALLOC %s:%d %s(%zu)\n", func, line, __FUNCTION__, size); _rtw_usb_buffer_free(dev, size, addr, dma); @@ -782,7 +782,7 @@ inline void dbg_rtw_usb_buffer_free(struct usb_device *dev, size_t size, void *a #endif /* defined(DBG_MEM_ALLOC) */ -void* rtw_malloc2d(int h, int w, int size) +void* rtw_malloc2d(int h, int w, size_t size) { int j; @@ -1404,7 +1404,12 @@ void rtw_msleep_os(int ms) { #ifdef PLATFORM_LINUX - + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)) + if (ms < 20) { + unsigned long us = ms * 1000UL; + usleep_range(us, us + 1000UL); + } else + #endif msleep((unsigned int)ms); #endif @@ -1423,16 +1428,19 @@ void rtw_msleep_os(int ms) } void rtw_usleep_os(int us) { - #ifdef PLATFORM_LINUX - - // msleep((unsigned int)us); - if ( 1 < (us/1000) ) - msleep(1); + + // msleep((unsigned int)us); + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)) + usleep_range(us, us + 1); + #else + if ( 1 < (us/1000) ) + msleep(1); else msleep( (us/1000) + 1); + #endif +#endif -#endif #ifdef PLATFORM_FREEBSD //Delay for delay microseconds DELAY(us); @@ -2310,6 +2318,10 @@ inline u32 rtw_random32(void) #ifdef PLATFORM_LINUX #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) return prandom_u32(); + #elif (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,18)) + u32 random_int; + get_random_bytes( &random_int , 4 ); + return random_int; #else return random32(); #endif diff --git a/platform/platform_ARM_SUNnI_sdio.c b/platform/platform_ARM_SUNnI_sdio.c index 4806526..d384141 100644 --- a/platform/platform_ARM_SUNnI_sdio.c +++ b/platform/platform_ARM_SUNnI_sdio.c @@ -69,20 +69,27 @@ int platform_wifi_power_on(void) } else { sdc_id = val.val; DBG_871X("----- %s sdc_id: %d, mod_sel: %d\n", __FUNCTION__, sdc_id, mod_sel); - wifi_pm_power(1); - mdelay(10); + #if defined(CONFIG_PLATFORM_ARM_SUN6I) || defined(CONFIG_PLATFORM_ARM_SUN7I) sw_mci_rescan_card(sdc_id, 1); #elif defined(CONFIG_PLATFORM_ARM_SUN8I) sunxi_mci_rescan_card(sdc_id, 1); #endif + mdelay(100); + wifi_pm_power(1); + DBG_871X("%s: power up, rescan card.\n", __FUNCTION__); } #ifdef CONFIG_GPIO_WAKEUP +#ifdef CONFIG_RTL8723B type = script_get_item("wifi_para", "rtl8723bs_wl_host_wake", &val); +#endif +#ifdef CONFIG_RTL8188E + type = script_get_item("wifi_para", "rtl8189es_host_wake", &val); +#endif if (SCIRPT_ITEM_VALUE_TYPE_PIO != type) { - DBG_871X("has no rtl8723bs_wl_wake_host\n"); + DBG_871X("No definition of wake up host PIN\n"); ret = -1; } else { gpio_eint_wlan = val.gpio.gpio; @@ -100,12 +107,14 @@ int platform_wifi_power_on(void) void platform_wifi_power_off(void) { #ifdef CONFIG_MMC - wifi_pm_power(0); #if defined(CONFIG_PLATFORM_ARM_SUN6I) ||defined(CONFIG_PLATFORM_ARM_SUN7I) sw_mci_rescan_card(sdc_id, 0); #elif defined(CONFIG_PLATFORM_ARM_SUN8I) sunxi_mci_rescan_card(sdc_id, 0); #endif + mdelay(100); + wifi_pm_power(0); + DBG_871X("%s: remove card, power off.\n", __FUNCTION__); #endif // CONFIG_MMC } diff --git a/platform/platform_ARM_WMT_sdio.c b/platform/platform_ARM_WMT_sdio.c new file mode 100644 index 0000000..62e5825 --- /dev/null +++ b/platform/platform_ARM_WMT_sdio.c @@ -0,0 +1,51 @@ +/****************************************************************************** + * + * 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 +#include +#include + +extern void wmt_detect_sdio2(void); +extern void force_remove_sdio2(void); + +int platform_wifi_power_on(void) +{ + int err = 0; + err = gpio_request(WMT_PIN_GP62_SUSGPIO1, "wifi_chip_en"); + if (err < 0){ + printk("request gpio for rtl8188eu failed!\n"); + return err; + } + gpio_direction_output(WMT_PIN_GP62_SUSGPIO1, 0);//pull sus_gpio1 to 0 to open vcc_wifi. + printk("power on rtl8189.\n"); + msleep(500); + wmt_detect_sdio2(); + printk("[rtl8189es] %s: new card, power on.\n", __FUNCTION__); + return err; +} + +void platform_wifi_power_off(void) +{ + force_remove_sdio2(); + + gpio_direction_output(WMT_PIN_GP62_SUSGPIO1, 1);//pull sus_gpio1 to 1 to close vcc_wifi. + printk("power off rtl8189.\n"); + gpio_free(WMT_PIN_GP62_SUSGPIO1); + printk("[rtl8189es] %s: remove card, power off.\n", __FUNCTION__); +}